{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeData #-}
{-# LANGUAGE TypeFamilies #-}
module Ouroboros.Consensus.Ledger.SupportsMempool
( ApplyTxErr
, ByteSize32 (..)
, WhatToDoWithTxDiffs (..)
, InputTxDiffs
, ConvertRawTxId (..)
, GenTx
, GenTxId
, HasByteSize (..)
, HasTxId (..)
, HasTxs (..)
, IgnoringOverflow (..)
, Invalidated (..)
, LedgerSupportsMempool (..)
, ReapplyTxsResult (..)
, TxId
, TxLimits (..)
, TxMeasureMetrics (..)
, Validated
, WhetherToIntervene (..)
, nothingMkMempoolApplyTxError
) where
import Codec.Serialise (Serialise)
import Control.DeepSeq (NFData)
import Control.Monad.Except
import Data.ByteString.Short (ShortByteString)
import Data.Coerce (coerce)
import Data.DerivingVia (InstantiatedAt (..))
import qualified Data.Foldable as Foldable
import Data.Kind (Type)
import Data.Measure (Measure)
import qualified Data.Measure
import Data.Text (Text)
import Data.Word (Word32)
import GHC.Stack (HasCallStack)
import NoThunks.Class
import Numeric.Natural
import Ouroboros.Consensus.Block.Abstract
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Tables.Utils
import Ouroboros.Network.SizeInBytes as Network
type GenTx :: Type -> Type
data family GenTx blk
type ApplyTxErr :: Type -> Type
type family ApplyTxErr blk
data WhetherToIntervene
=
DoNotIntervene
|
Intervene
deriving Int -> WhetherToIntervene -> ShowS
[WhetherToIntervene] -> ShowS
WhetherToIntervene -> String
(Int -> WhetherToIntervene -> ShowS)
-> (WhetherToIntervene -> String)
-> ([WhetherToIntervene] -> ShowS)
-> Show WhetherToIntervene
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WhetherToIntervene -> ShowS
showsPrec :: Int -> WhetherToIntervene -> ShowS
$cshow :: WhetherToIntervene -> String
show :: WhetherToIntervene -> String
$cshowList :: [WhetherToIntervene] -> ShowS
showList :: [WhetherToIntervene] -> ShowS
Show
type data WhatToDoWithTxDiffs = Collect | Discard
type family InputTxDiffs blk wtd where
InputTxDiffs blk Discard = ()
InputTxDiffs blk Collect = LedgerTables (TickedLedgerState blk) DiffMK
class
( UpdateLedger blk
, TxLimits blk
, NoThunks (GenTx blk)
, NoThunks (Validated (GenTx blk))
, Show (GenTx blk)
, Show (Validated (GenTx blk))
, Show (ApplyTxErr blk)
) =>
LedgerSupportsMempool blk
where
txInvariant :: GenTx blk -> Bool
txInvariant = Bool -> GenTx blk -> Bool
forall a b. a -> b -> a
const Bool
True
applyTx ::
LedgerConfig blk ->
WhetherToIntervene ->
SlotNo ->
GenTx blk ->
TickedLedgerState blk ValuesMK ->
Except (ApplyTxErr blk) (TickedLedgerState blk DiffMK, Validated (GenTx blk))
reapplyTx ::
HasCallStack =>
LedgerConfig blk ->
SlotNo ->
Validated (GenTx blk) ->
TickedLedgerState blk ValuesMK ->
Except (ApplyTxErr blk) (TickedLedgerState blk ValuesMK)
reapplyTxs ::
LedgerConfig blk ->
SlotNo ->
[(Validated (GenTx blk), InputTxDiffs blk wtd, extra)] ->
TickedLedgerState blk ValuesMK ->
ReapplyTxsResult extra blk wtd
reapplyTxs LedgerConfig blk
cfg SlotNo
slot [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
txs TickedLedgerState blk ValuesMK
st =
(\([Invalidated blk]
err, [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
val, TickedLedgerState blk ValuesMK
st') -> [Invalidated blk]
-> [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
-> TickedLedgerState blk EmptyMK
-> ReapplyTxsResult extra blk wtd
forall extra blk (wtd :: WhatToDoWithTxDiffs).
[Invalidated blk]
-> [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
-> TickedLedgerState blk EmptyMK
-> ReapplyTxsResult extra blk wtd
ReapplyTxsResult [Invalidated blk]
err ([(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
-> [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
forall a. [a] -> [a]
reverse [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
val) (TickedLedgerState blk ValuesMK -> TickedLedgerState blk EmptyMK
forall (l :: MapKind -> *) (mk :: MapKind).
HasLedgerTables l =>
l mk -> l EmptyMK
forgetLedgerTables TickedLedgerState blk ValuesMK
st')) (([Invalidated blk],
[(Validated (GenTx blk), InputTxDiffs blk wtd, extra)],
TickedLedgerState blk ValuesMK)
-> ReapplyTxsResult extra blk wtd)
-> ([Invalidated blk],
[(Validated (GenTx blk), InputTxDiffs blk wtd, extra)],
TickedLedgerState blk ValuesMK)
-> ReapplyTxsResult extra blk wtd
forall a b. (a -> b) -> a -> b
$
((Validated (GenTx blk), InputTxDiffs blk wtd, extra)
-> Validated (GenTx blk))
-> [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
-> ([Invalidated blk],
[(Validated (GenTx blk), InputTxDiffs blk wtd, extra)],
TickedLedgerState blk ValuesMK)
forall a.
(a -> Validated (GenTx blk))
-> [a] -> ([Invalidated blk], [a], TickedLedgerState blk ValuesMK)
foldReapplyTxs (Validated (GenTx blk), InputTxDiffs blk wtd, extra)
-> Validated (GenTx blk)
forall {a} {b} {c}. (a, b, c) -> a
fst3 [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
txs
where
fst3 :: (a, b, c) -> a
fst3 (a
a, b
_, c
_) = a
a
foldReapplyTxs ::
(a -> Validated (GenTx blk)) ->
[a] ->
([Invalidated blk], [a], TickedLedgerState blk ValuesMK)
foldReapplyTxs :: forall a.
(a -> Validated (GenTx blk))
-> [a] -> ([Invalidated blk], [a], TickedLedgerState blk ValuesMK)
foldReapplyTxs a -> Validated (GenTx blk)
projectTx =
(([Invalidated blk], [a], TickedLedgerState blk ValuesMK)
-> a -> ([Invalidated blk], [a], TickedLedgerState blk ValuesMK))
-> ([Invalidated blk], [a], TickedLedgerState blk ValuesMK)
-> [a]
-> ([Invalidated blk], [a], TickedLedgerState blk ValuesMK)
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
Foldable.foldl'
( \([Invalidated blk]
accE, [a]
accV, TickedLedgerState blk ValuesMK
st') a
a ->
case Except (ApplyTxErr blk) (TickedLedgerState blk ValuesMK)
-> Either (ApplyTxErr blk) (TickedLedgerState blk ValuesMK)
forall e a. Except e a -> Either e a
runExcept (LedgerConfig blk
-> SlotNo
-> Validated (GenTx blk)
-> TickedLedgerState blk ValuesMK
-> Except (ApplyTxErr blk) (TickedLedgerState blk ValuesMK)
forall blk.
(LedgerSupportsMempool blk, HasCallStack) =>
LedgerConfig blk
-> SlotNo
-> Validated (GenTx blk)
-> TickedLedgerState blk ValuesMK
-> Except (ApplyTxErr blk) (TickedLedgerState blk ValuesMK)
reapplyTx LedgerConfig blk
cfg SlotNo
slot (a -> Validated (GenTx blk)
projectTx a
a) TickedLedgerState blk ValuesMK
st') of
Left ApplyTxErr blk
err -> (Validated (GenTx blk) -> ApplyTxErr blk -> Invalidated blk
forall blk.
Validated (GenTx blk) -> ApplyTxErr blk -> Invalidated blk
Invalidated (a -> Validated (GenTx blk)
projectTx a
a) ApplyTxErr blk
err Invalidated blk -> [Invalidated blk] -> [Invalidated blk]
forall a. a -> [a] -> [a]
: [Invalidated blk]
accE, [a]
accV, TickedLedgerState blk ValuesMK
st')
Right TickedLedgerState blk ValuesMK
st'' -> ([Invalidated blk]
accE, a
a a -> [a] -> [a]
forall a. a -> [a] -> [a]
: [a]
accV, TickedLedgerState blk ValuesMK
st'')
)
([], [], TickedLedgerState blk ValuesMK
st)
txForgetValidated :: Validated (GenTx blk) -> GenTx blk
getTransactionKeySets :: GenTx blk -> LedgerTables (LedgerState blk) KeysMK
prependMempoolDiffs ::
TickedLedgerState blk DiffMK ->
TickedLedgerState blk DiffMK ->
TickedLedgerState blk DiffMK
prependMempoolDiffs = TickedLedgerState blk DiffMK
-> TickedLedgerState blk DiffMK -> TickedLedgerState blk DiffMK
forall (l :: MapKind -> *) (l' :: MapKind -> *).
(SameUtxoTypes l l', HasLedgerTables l, HasLedgerTables l') =>
l DiffMK -> l' DiffMK -> l' DiffMK
prependDiffs
applyMempoolDiffs ::
LedgerTables (LedgerState blk) ValuesMK ->
LedgerTables (LedgerState blk) KeysMK ->
TickedLedgerState blk DiffMK ->
TickedLedgerState blk ValuesMK
applyMempoolDiffs = LedgerTables (LedgerState blk) ValuesMK
-> LedgerTables (LedgerState blk) KeysMK
-> TickedLedgerState blk DiffMK
-> TickedLedgerState blk ValuesMK
forall (l :: MapKind -> *) (l' :: MapKind -> *).
(SameUtxoTypes l l', HasLedgerTables l, HasLedgerTables l') =>
LedgerTables l ValuesMK
-> LedgerTables l KeysMK -> l' DiffMK -> l' ValuesMK
applyDiffForKeysOnTables
mkMempoolApplyTxError ::
TickedLedgerState blk mk ->
Text ->
Maybe (ApplyTxErr blk)
nothingMkMempoolApplyTxError :: TickedLedgerState blk mk -> Text -> Maybe (ApplyTxErr blk)
nothingMkMempoolApplyTxError :: forall blk (mk :: MapKind).
TickedLedgerState blk mk -> Text -> Maybe (ApplyTxErr blk)
nothingMkMempoolApplyTxError TickedLedgerState blk mk
_ Text
_ = Maybe (ApplyTxErr blk)
forall a. Maybe a
Nothing
data ReapplyTxsResult extra blk wtd
= ReapplyTxsResult
{ forall extra blk (wtd :: WhatToDoWithTxDiffs).
ReapplyTxsResult extra blk wtd -> [Invalidated blk]
invalidatedTxs :: ![Invalidated blk]
, forall extra blk (wtd :: WhatToDoWithTxDiffs).
ReapplyTxsResult extra blk wtd
-> [(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
validatedTxs :: ![(Validated (GenTx blk), InputTxDiffs blk wtd, extra)]
, forall extra blk (wtd :: WhatToDoWithTxDiffs).
ReapplyTxsResult extra blk wtd -> TickedLedgerState blk EmptyMK
resultingState :: !(TickedLedgerState blk EmptyMK)
}
type TxId :: Type -> Type
data family TxId blk
class
( Show (TxId tx)
, Ord (TxId tx)
, NoThunks (TxId tx)
) =>
HasTxId tx
where
txId :: tx -> TxId tx
class HasTxId tx => ConvertRawTxId tx where
toRawTxIdHash :: TxId tx -> ShortByteString
type GenTxId blk = TxId (GenTx blk)
class HasTxs blk where
:: blk -> [GenTx blk]
class
( Measure (TxMeasure blk)
, HasByteSize (TxMeasure blk)
, NoThunks (TxMeasure blk)
, TxMeasureMetrics (TxMeasure blk)
, Show (TxMeasure blk)
) =>
TxLimits blk
where
type TxMeasure blk
txWireSize :: GenTx blk -> Network.SizeInBytes
txMeasure ::
LedgerConfig blk ->
TickedLedgerState blk ValuesMK ->
GenTx blk ->
Except (ApplyTxErr blk) (TxMeasure blk)
blockCapacityTxMeasure ::
LedgerConfig blk ->
TickedLedgerState blk mk ->
TxMeasure blk
newtype ByteSize32 = ByteSize32 {ByteSize32 -> Word32
unByteSize32 :: Word32}
deriving stock Int -> ByteSize32 -> ShowS
[ByteSize32] -> ShowS
ByteSize32 -> String
(Int -> ByteSize32 -> ShowS)
-> (ByteSize32 -> String)
-> ([ByteSize32] -> ShowS)
-> Show ByteSize32
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ByteSize32 -> ShowS
showsPrec :: Int -> ByteSize32 -> ShowS
$cshow :: ByteSize32 -> String
show :: ByteSize32 -> String
$cshowList :: [ByteSize32] -> ShowS
showList :: [ByteSize32] -> ShowS
Show
deriving newtype (ByteSize32 -> ByteSize32 -> Bool
(ByteSize32 -> ByteSize32 -> Bool)
-> (ByteSize32 -> ByteSize32 -> Bool) -> Eq ByteSize32
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ByteSize32 -> ByteSize32 -> Bool
== :: ByteSize32 -> ByteSize32 -> Bool
$c/= :: ByteSize32 -> ByteSize32 -> Bool
/= :: ByteSize32 -> ByteSize32 -> Bool
Eq, Eq ByteSize32
Eq ByteSize32 =>
(ByteSize32 -> ByteSize32 -> Ordering)
-> (ByteSize32 -> ByteSize32 -> Bool)
-> (ByteSize32 -> ByteSize32 -> Bool)
-> (ByteSize32 -> ByteSize32 -> Bool)
-> (ByteSize32 -> ByteSize32 -> Bool)
-> (ByteSize32 -> ByteSize32 -> ByteSize32)
-> (ByteSize32 -> ByteSize32 -> ByteSize32)
-> Ord ByteSize32
ByteSize32 -> ByteSize32 -> Bool
ByteSize32 -> ByteSize32 -> Ordering
ByteSize32 -> ByteSize32 -> ByteSize32
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ByteSize32 -> ByteSize32 -> Ordering
compare :: ByteSize32 -> ByteSize32 -> Ordering
$c< :: ByteSize32 -> ByteSize32 -> Bool
< :: ByteSize32 -> ByteSize32 -> Bool
$c<= :: ByteSize32 -> ByteSize32 -> Bool
<= :: ByteSize32 -> ByteSize32 -> Bool
$c> :: ByteSize32 -> ByteSize32 -> Bool
> :: ByteSize32 -> ByteSize32 -> Bool
$c>= :: ByteSize32 -> ByteSize32 -> Bool
>= :: ByteSize32 -> ByteSize32 -> Bool
$cmax :: ByteSize32 -> ByteSize32 -> ByteSize32
max :: ByteSize32 -> ByteSize32 -> ByteSize32
$cmin :: ByteSize32 -> ByteSize32 -> ByteSize32
min :: ByteSize32 -> ByteSize32 -> ByteSize32
Ord)
deriving newtype ByteSize32 -> ()
(ByteSize32 -> ()) -> NFData ByteSize32
forall a. (a -> ()) -> NFData a
$crnf :: ByteSize32 -> ()
rnf :: ByteSize32 -> ()
NFData
deriving newtype [ByteSize32] -> Encoding
ByteSize32 -> Encoding
(ByteSize32 -> Encoding)
-> (forall s. Decoder s ByteSize32)
-> ([ByteSize32] -> Encoding)
-> (forall s. Decoder s [ByteSize32])
-> Serialise ByteSize32
forall s. Decoder s [ByteSize32]
forall s. Decoder s ByteSize32
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
$cencode :: ByteSize32 -> Encoding
encode :: ByteSize32 -> Encoding
$cdecode :: forall s. Decoder s ByteSize32
decode :: forall s. Decoder s ByteSize32
$cencodeList :: [ByteSize32] -> Encoding
encodeList :: [ByteSize32] -> Encoding
$cdecodeList :: forall s. Decoder s [ByteSize32]
decodeList :: forall s. Decoder s [ByteSize32]
Serialise
deriving
(Semigroup ByteSize32
ByteSize32
Semigroup ByteSize32 =>
ByteSize32
-> (ByteSize32 -> ByteSize32 -> ByteSize32)
-> ([ByteSize32] -> ByteSize32)
-> Monoid ByteSize32
[ByteSize32] -> ByteSize32
ByteSize32 -> ByteSize32 -> ByteSize32
forall a.
Semigroup a =>
a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
$cmempty :: ByteSize32
mempty :: ByteSize32
$cmappend :: ByteSize32 -> ByteSize32 -> ByteSize32
mappend :: ByteSize32 -> ByteSize32 -> ByteSize32
$cmconcat :: [ByteSize32] -> ByteSize32
mconcat :: [ByteSize32] -> ByteSize32
Monoid, NonEmpty ByteSize32 -> ByteSize32
ByteSize32 -> ByteSize32 -> ByteSize32
(ByteSize32 -> ByteSize32 -> ByteSize32)
-> (NonEmpty ByteSize32 -> ByteSize32)
-> (forall b. Integral b => b -> ByteSize32 -> ByteSize32)
-> Semigroup ByteSize32
forall b. Integral b => b -> ByteSize32 -> ByteSize32
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: ByteSize32 -> ByteSize32 -> ByteSize32
<> :: ByteSize32 -> ByteSize32 -> ByteSize32
$csconcat :: NonEmpty ByteSize32 -> ByteSize32
sconcat :: NonEmpty ByteSize32 -> ByteSize32
$cstimes :: forall b. Integral b => b -> ByteSize32 -> ByteSize32
stimes :: forall b. Integral b => b -> ByteSize32 -> ByteSize32
Semigroup)
via (InstantiatedAt Measure (IgnoringOverflow ByteSize32))
deriving
Context -> ByteSize32 -> IO (Maybe ThunkInfo)
Proxy ByteSize32 -> String
(Context -> ByteSize32 -> IO (Maybe ThunkInfo))
-> (Context -> ByteSize32 -> IO (Maybe ThunkInfo))
-> (Proxy ByteSize32 -> String)
-> NoThunks ByteSize32
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
$cnoThunks :: Context -> ByteSize32 -> IO (Maybe ThunkInfo)
noThunks :: Context -> ByteSize32 -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> ByteSize32 -> IO (Maybe ThunkInfo)
wNoThunks :: Context -> ByteSize32 -> IO (Maybe ThunkInfo)
$cshowTypeOf :: Proxy ByteSize32 -> String
showTypeOf :: Proxy ByteSize32 -> String
NoThunks
via OnlyCheckWhnfNamed "ByteSize" ByteSize32
newtype IgnoringOverflow a = IgnoringOverflow {forall a. IgnoringOverflow a -> a
unIgnoringOverflow :: a}
deriving stock Int -> IgnoringOverflow a -> ShowS
[IgnoringOverflow a] -> ShowS
IgnoringOverflow a -> String
(Int -> IgnoringOverflow a -> ShowS)
-> (IgnoringOverflow a -> String)
-> ([IgnoringOverflow a] -> ShowS)
-> Show (IgnoringOverflow a)
forall a. Show a => Int -> IgnoringOverflow a -> ShowS
forall a. Show a => [IgnoringOverflow a] -> ShowS
forall a. Show a => IgnoringOverflow a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> IgnoringOverflow a -> ShowS
showsPrec :: Int -> IgnoringOverflow a -> ShowS
$cshow :: forall a. Show a => IgnoringOverflow a -> String
show :: IgnoringOverflow a -> String
$cshowList :: forall a. Show a => [IgnoringOverflow a] -> ShowS
showList :: [IgnoringOverflow a] -> ShowS
Show
deriving newtype (IgnoringOverflow a -> IgnoringOverflow a -> Bool
(IgnoringOverflow a -> IgnoringOverflow a -> Bool)
-> (IgnoringOverflow a -> IgnoringOverflow a -> Bool)
-> Eq (IgnoringOverflow a)
forall a. Eq a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
== :: IgnoringOverflow a -> IgnoringOverflow a -> Bool
$c/= :: forall a. Eq a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
/= :: IgnoringOverflow a -> IgnoringOverflow a -> Bool
Eq, Eq (IgnoringOverflow a)
Eq (IgnoringOverflow a) =>
(IgnoringOverflow a -> IgnoringOverflow a -> Ordering)
-> (IgnoringOverflow a -> IgnoringOverflow a -> Bool)
-> (IgnoringOverflow a -> IgnoringOverflow a -> Bool)
-> (IgnoringOverflow a -> IgnoringOverflow a -> Bool)
-> (IgnoringOverflow a -> IgnoringOverflow a -> Bool)
-> (IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a)
-> (IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a)
-> Ord (IgnoringOverflow a)
IgnoringOverflow a -> IgnoringOverflow a -> Bool
IgnoringOverflow a -> IgnoringOverflow a -> Ordering
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (IgnoringOverflow a)
forall a. Ord a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
forall a.
Ord a =>
IgnoringOverflow a -> IgnoringOverflow a -> Ordering
forall a.
Ord a =>
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
$ccompare :: forall a.
Ord a =>
IgnoringOverflow a -> IgnoringOverflow a -> Ordering
compare :: IgnoringOverflow a -> IgnoringOverflow a -> Ordering
$c< :: forall a. Ord a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
< :: IgnoringOverflow a -> IgnoringOverflow a -> Bool
$c<= :: forall a. Ord a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
<= :: IgnoringOverflow a -> IgnoringOverflow a -> Bool
$c> :: forall a. Ord a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
> :: IgnoringOverflow a -> IgnoringOverflow a -> Bool
$c>= :: forall a. Ord a => IgnoringOverflow a -> IgnoringOverflow a -> Bool
>= :: IgnoringOverflow a -> IgnoringOverflow a -> Bool
$cmax :: forall a.
Ord a =>
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
max :: IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
$cmin :: forall a.
Ord a =>
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
min :: IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
Ord)
deriving newtype IgnoringOverflow a -> ()
(IgnoringOverflow a -> ()) -> NFData (IgnoringOverflow a)
forall a. NFData a => IgnoringOverflow a -> ()
forall a. (a -> ()) -> NFData a
$crnf :: forall a. NFData a => IgnoringOverflow a -> ()
rnf :: IgnoringOverflow a -> ()
NFData
deriving newtype (Semigroup (IgnoringOverflow a)
IgnoringOverflow a
Semigroup (IgnoringOverflow a) =>
IgnoringOverflow a
-> (IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a)
-> ([IgnoringOverflow a] -> IgnoringOverflow a)
-> Monoid (IgnoringOverflow a)
[IgnoringOverflow a] -> IgnoringOverflow a
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
forall a.
Semigroup a =>
a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall a. Monoid a => Semigroup (IgnoringOverflow a)
forall a. Monoid a => IgnoringOverflow a
forall a. Monoid a => [IgnoringOverflow a] -> IgnoringOverflow a
forall a.
Monoid a =>
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
$cmempty :: forall a. Monoid a => IgnoringOverflow a
mempty :: IgnoringOverflow a
$cmappend :: forall a.
Monoid a =>
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
mappend :: IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
$cmconcat :: forall a. Monoid a => [IgnoringOverflow a] -> IgnoringOverflow a
mconcat :: [IgnoringOverflow a] -> IgnoringOverflow a
Monoid, NonEmpty (IgnoringOverflow a) -> IgnoringOverflow a
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
(IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a)
-> (NonEmpty (IgnoringOverflow a) -> IgnoringOverflow a)
-> (forall b.
Integral b =>
b -> IgnoringOverflow a -> IgnoringOverflow a)
-> Semigroup (IgnoringOverflow a)
forall b.
Integral b =>
b -> IgnoringOverflow a -> IgnoringOverflow a
forall a.
Semigroup a =>
NonEmpty (IgnoringOverflow a) -> IgnoringOverflow a
forall a.
Semigroup a =>
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
forall a b.
(Semigroup a, Integral b) =>
b -> IgnoringOverflow a -> IgnoringOverflow a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: forall a.
Semigroup a =>
IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
<> :: IgnoringOverflow a -> IgnoringOverflow a -> IgnoringOverflow a
$csconcat :: forall a.
Semigroup a =>
NonEmpty (IgnoringOverflow a) -> IgnoringOverflow a
sconcat :: NonEmpty (IgnoringOverflow a) -> IgnoringOverflow a
$cstimes :: forall a b.
(Semigroup a, Integral b) =>
b -> IgnoringOverflow a -> IgnoringOverflow a
stimes :: forall b.
Integral b =>
b -> IgnoringOverflow a -> IgnoringOverflow a
Semigroup)
deriving newtype Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo)
Proxy (IgnoringOverflow a) -> String
(Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo))
-> (Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo))
-> (Proxy (IgnoringOverflow a) -> String)
-> NoThunks (IgnoringOverflow a)
forall a.
NoThunks a =>
Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo)
forall a. NoThunks a => Proxy (IgnoringOverflow a) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
$cnoThunks :: forall a.
NoThunks a =>
Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo)
noThunks :: Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall a.
NoThunks a =>
Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo)
wNoThunks :: Context -> IgnoringOverflow a -> IO (Maybe ThunkInfo)
$cshowTypeOf :: forall a. NoThunks a => Proxy (IgnoringOverflow a) -> String
showTypeOf :: Proxy (IgnoringOverflow a) -> String
NoThunks
deriving newtype IgnoringOverflow a -> ByteSize32
(IgnoringOverflow a -> ByteSize32)
-> HasByteSize (IgnoringOverflow a)
forall a. HasByteSize a => IgnoringOverflow a -> ByteSize32
forall a. (a -> ByteSize32) -> HasByteSize a
$ctxMeasureByteSize :: forall a. HasByteSize a => IgnoringOverflow a -> ByteSize32
txMeasureByteSize :: IgnoringOverflow a -> ByteSize32
HasByteSize
deriving newtype IgnoringOverflow a -> Natural
IgnoringOverflow a -> ByteSize32
(IgnoringOverflow a -> ByteSize32)
-> (IgnoringOverflow a -> Natural)
-> (IgnoringOverflow a -> Natural)
-> (IgnoringOverflow a -> ByteSize32)
-> TxMeasureMetrics (IgnoringOverflow a)
forall a. TxMeasureMetrics a => IgnoringOverflow a -> Natural
forall a. TxMeasureMetrics a => IgnoringOverflow a -> ByteSize32
forall msr.
(msr -> ByteSize32)
-> (msr -> Natural)
-> (msr -> Natural)
-> (msr -> ByteSize32)
-> TxMeasureMetrics msr
$ctxMeasureMetricTxSizeBytes :: forall a. TxMeasureMetrics a => IgnoringOverflow a -> ByteSize32
txMeasureMetricTxSizeBytes :: IgnoringOverflow a -> ByteSize32
$ctxMeasureMetricExUnitsMemory :: forall a. TxMeasureMetrics a => IgnoringOverflow a -> Natural
txMeasureMetricExUnitsMemory :: IgnoringOverflow a -> Natural
$ctxMeasureMetricExUnitsSteps :: forall a. TxMeasureMetrics a => IgnoringOverflow a -> Natural
txMeasureMetricExUnitsSteps :: IgnoringOverflow a -> Natural
$ctxMeasureMetricRefScriptsSizeBytes :: forall a. TxMeasureMetrics a => IgnoringOverflow a -> ByteSize32
txMeasureMetricRefScriptsSizeBytes :: IgnoringOverflow a -> ByteSize32
TxMeasureMetrics
instance Measure (IgnoringOverflow ByteSize32) where
zero :: IgnoringOverflow ByteSize32
zero = Word32 -> IgnoringOverflow ByteSize32
forall a b. Coercible a b => a -> b
coerce (Word32
0 :: Word32)
plus :: IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32 -> IgnoringOverflow ByteSize32
plus = (Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
forall a b. Coercible a b => a -> b
coerce ((Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32)
-> (Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
forall a b. (a -> b) -> a -> b
$ forall a. Num a => a -> a -> a
(+) @Word32
min :: IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32 -> IgnoringOverflow ByteSize32
min = (Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
forall a b. Coercible a b => a -> b
coerce ((Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32)
-> (Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
forall a b. (a -> b) -> a -> b
$ forall a. Ord a => a -> a -> a
min @Word32
max :: IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32 -> IgnoringOverflow ByteSize32
max = (Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
forall a b. Coercible a b => a -> b
coerce ((Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32)
-> (Word32 -> Word32 -> Word32)
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
-> IgnoringOverflow ByteSize32
forall a b. (a -> b) -> a -> b
$ forall a. Ord a => a -> a -> a
max @Word32
class HasByteSize a where
txMeasureByteSize :: a -> ByteSize32
instance HasByteSize ByteSize32 where
txMeasureByteSize :: ByteSize32 -> ByteSize32
txMeasureByteSize = ByteSize32 -> ByteSize32
forall a. a -> a
id
class TxMeasureMetrics msr where
txMeasureMetricTxSizeBytes :: msr -> ByteSize32
txMeasureMetricExUnitsMemory :: msr -> Natural
txMeasureMetricExUnitsSteps :: msr -> Natural
txMeasureMetricRefScriptsSizeBytes :: msr -> ByteSize32
instance TxMeasureMetrics ByteSize32 where
txMeasureMetricTxSizeBytes :: ByteSize32 -> ByteSize32
txMeasureMetricTxSizeBytes = ByteSize32 -> ByteSize32
forall a. a -> a
id
txMeasureMetricExUnitsMemory :: ByteSize32 -> Natural
txMeasureMetricExUnitsMemory ByteSize32
_ = Natural
0
txMeasureMetricExUnitsSteps :: ByteSize32 -> Natural
txMeasureMetricExUnitsSteps ByteSize32
_ = Natural
0
txMeasureMetricRefScriptsSizeBytes :: ByteSize32 -> ByteSize32
txMeasureMetricRefScriptsSizeBytes ByteSize32
_ = ByteSize32
forall a. Monoid a => a
mempty
data Invalidated blk = Invalidated
{ forall blk. Invalidated blk -> Validated (GenTx blk)
getInvalidated :: !(Validated (GenTx blk))
, forall blk. Invalidated blk -> ApplyTxErr blk
getReason :: !(ApplyTxErr blk)
}