{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
module Ouroboros.Consensus.Ledger.SupportsMempool
( ApplyTxErr
, ByteSize32 (..)
, ComputeDiffs (..)
, ConvertRawTxId (..)
, GenTx
, GenTxId
, HasByteSize (..)
, HasTxId (..)
, HasTxs (..)
, IgnoringOverflow (..)
, Invalidated (..)
, LedgerSupportsMempool (..)
, ReapplyTxsResult (..)
, TxId
, TxLimits (..)
, TxMeasureMetrics (..)
, Validated
, WhetherToIntervene (..)
) 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.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
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
data ComputeDiffs
=
ComputeDiffs
|
IgnoreDiffs
deriving Int -> ComputeDiffs -> ShowS
[ComputeDiffs] -> ShowS
ComputeDiffs -> String
(Int -> ComputeDiffs -> ShowS)
-> (ComputeDiffs -> String)
-> ([ComputeDiffs] -> ShowS)
-> Show ComputeDiffs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ComputeDiffs -> ShowS
showsPrec :: Int -> ComputeDiffs -> ShowS
$cshow :: ComputeDiffs -> String
show :: ComputeDiffs -> String
$cshowList :: [ComputeDiffs] -> ShowS
showList :: [ComputeDiffs] -> ShowS
Show
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 =>
ComputeDiffs ->
LedgerConfig blk ->
SlotNo ->
Validated (GenTx blk) ->
TickedLedgerState blk ValuesMK ->
Except (ApplyTxErr blk) (TickedLedgerState blk TrackingMK)
reapplyTxs ::
ComputeDiffs ->
LedgerConfig blk ->
SlotNo ->
[(Validated (GenTx blk), extra)] ->
TickedLedgerState blk ValuesMK ->
ReapplyTxsResult extra blk
reapplyTxs ComputeDiffs
doDiffs LedgerConfig blk
cfg SlotNo
slot [(Validated (GenTx blk), extra)]
txs TickedLedgerState blk ValuesMK
st =
( \([Invalidated blk]
err, [(Validated (GenTx blk), extra)]
val, TickedLedgerState blk TrackingMK
st') ->
[Invalidated blk]
-> [(Validated (GenTx blk), extra)]
-> TickedLedgerState blk TrackingMK
-> ReapplyTxsResult extra blk
forall extra blk.
[Invalidated blk]
-> [(Validated (GenTx blk), extra)]
-> TickedLedgerState blk TrackingMK
-> ReapplyTxsResult extra blk
ReapplyTxsResult
[Invalidated blk]
err
([(Validated (GenTx blk), extra)]
-> [(Validated (GenTx blk), extra)]
forall a. [a] -> [a]
reverse [(Validated (GenTx blk), extra)]
val)
TickedLedgerState blk TrackingMK
st'
)
(([Invalidated blk], [(Validated (GenTx blk), extra)],
TickedLedgerState blk TrackingMK)
-> ReapplyTxsResult extra blk)
-> ([Invalidated blk], [(Validated (GenTx blk), extra)],
TickedLedgerState blk TrackingMK)
-> ReapplyTxsResult extra blk
forall a b. (a -> b) -> a -> b
$ (([Invalidated blk], [(Validated (GenTx blk), extra)],
TickedLedgerState blk TrackingMK)
-> (Validated (GenTx blk), extra)
-> ([Invalidated blk], [(Validated (GenTx blk), extra)],
TickedLedgerState blk TrackingMK))
-> ([Invalidated blk], [(Validated (GenTx blk), extra)],
TickedLedgerState blk TrackingMK)
-> [(Validated (GenTx blk), extra)]
-> ([Invalidated blk], [(Validated (GenTx blk), extra)],
TickedLedgerState blk TrackingMK)
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, [(Validated (GenTx blk), extra)]
accV, TickedLedgerState blk TrackingMK
st') (Validated (GenTx blk)
tx, extra
extra) ->
case Except (ApplyTxErr blk) (TickedLedgerState blk TrackingMK)
-> Either (ApplyTxErr blk) (TickedLedgerState blk TrackingMK)
forall e a. Except e a -> Either e a
runExcept (ComputeDiffs
-> LedgerConfig blk
-> SlotNo
-> Validated (GenTx blk)
-> TickedLedgerState blk ValuesMK
-> Except (ApplyTxErr blk) (TickedLedgerState blk TrackingMK)
forall blk.
(LedgerSupportsMempool blk, HasCallStack) =>
ComputeDiffs
-> LedgerConfig blk
-> SlotNo
-> Validated (GenTx blk)
-> TickedLedgerState blk ValuesMK
-> Except (ApplyTxErr blk) (TickedLedgerState blk TrackingMK)
reapplyTx ComputeDiffs
doDiffs LedgerConfig blk
cfg SlotNo
slot Validated (GenTx blk)
tx (TickedLedgerState blk ValuesMK
-> Except (ApplyTxErr blk) (TickedLedgerState blk TrackingMK))
-> TickedLedgerState blk ValuesMK
-> Except (ApplyTxErr blk) (TickedLedgerState blk TrackingMK)
forall a b. (a -> b) -> a -> b
$ TickedLedgerState blk TrackingMK -> TickedLedgerState blk ValuesMK
forall (l :: MapKind -> *).
(LedgerTableConstraints l, HasLedgerTables l) =>
l TrackingMK -> l ValuesMK
trackingToValues TickedLedgerState blk TrackingMK
st') of
Left ApplyTxErr blk
err -> (Validated (GenTx blk) -> ApplyTxErr blk -> Invalidated blk
forall blk.
Validated (GenTx blk) -> ApplyTxErr blk -> Invalidated blk
Invalidated Validated (GenTx blk)
tx ApplyTxErr blk
err Invalidated blk -> [Invalidated blk] -> [Invalidated blk]
forall a. a -> [a] -> [a]
: [Invalidated blk]
accE, [(Validated (GenTx blk), extra)]
accV, TickedLedgerState blk TrackingMK
st')
Right TickedLedgerState blk TrackingMK
st'' ->
( [Invalidated blk]
accE
, (Validated (GenTx blk)
tx, extra
extra) (Validated (GenTx blk), extra)
-> [(Validated (GenTx blk), extra)]
-> [(Validated (GenTx blk), extra)]
forall a. a -> [a] -> [a]
: [(Validated (GenTx blk), extra)]
accV
, case ComputeDiffs
doDiffs of
ComputeDiffs
ComputeDiffs -> TickedLedgerState blk TrackingMK
-> TickedLedgerState blk TrackingMK
-> TickedLedgerState blk TrackingMK
forall (l :: MapKind -> *) (l' :: MapKind -> *).
(SameUtxoTypes l l', HasLedgerTables l, HasLedgerTables l') =>
l TrackingMK -> l' TrackingMK -> l' TrackingMK
prependTrackingDiffs TickedLedgerState blk TrackingMK
st' TickedLedgerState blk TrackingMK
st''
ComputeDiffs
IgnoreDiffs -> TickedLedgerState blk TrackingMK
st''
)
)
([], [], TickedLedgerState blk ValuesMK -> TickedLedgerState blk TrackingMK
forall (l :: MapKind -> *).
HasLedgerTables l =>
l ValuesMK -> l TrackingMK
attachEmptyDiffs TickedLedgerState blk ValuesMK
st)
[(Validated (GenTx blk), extra)]
txs
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
data ReapplyTxsResult extra blk
= ReapplyTxsResult
{ forall extra blk. ReapplyTxsResult extra blk -> [Invalidated blk]
invalidatedTxs :: ![Invalidated blk]
, forall extra blk.
ReapplyTxsResult extra blk -> [(Validated (GenTx blk), extra)]
validatedTxs :: ![(Validated (GenTx blk), extra)]
, forall extra blk.
ReapplyTxsResult extra blk -> TickedLedgerState blk TrackingMK
resultingState :: !(TickedLedgerState blk TrackingMK)
}
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
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)
}