cardano-ledger-shelley-0.1.0.0
Safe Haskell None
Language Haskell2010

Cardano.Ledger.Shelley.Rules.Utxo

Contents

Synopsis

Documentation

data UTXO era Source #

Instances

Instances details
( UsesTxOut era, TxOut era ~ TxOut era, UsesValue era, UsesScript era, UsesAuxiliary era, UsesPParams era, Show ( Witnesses era), TxBody era ~ TxBody era, PParams era ~ PParams era, Tx era ~ Tx era, Value era ~ Coin , Eq ( PredicateFailure ( EraRule "PPUP" era)), Embed ( EraRule "PPUP" era) ( UTXO era), Environment ( EraRule "PPUP" era) ~ PPUPEnv era, State ( EraRule "PPUP" era) ~ PPUPState era, Signal ( EraRule "PPUP" era) ~ Maybe ( Update era)) => STS ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

( Era era, STS ( PPUP era), PredicateFailure ( EraRule "PPUP" era) ~ PpupPredicateFailure era, Event ( EraRule "PPUP" era) ~ PpupEvent era) => Embed ( PPUP era) ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

( Era era, STS ( UTXO era), PredicateFailure ( EraRule "UTXO" era) ~ UtxoPredicateFailure era, Event ( EraRule "UTXO" era) ~ UtxoEvent era) => Embed ( UTXO era) ( UTXOW era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxow

type PredicateFailure ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Event ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Event ( UTXO era) = UtxoEvent era
type BaseM ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Environment ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Signal ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Signal ( UTXO era) = Tx era
type State ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type State ( UTXO era) = UTxOState era

data UtxoPredicateFailure era Source #

Instances

Instances details
( Eq ( Value era), Eq ( TxOut era), Eq ( PredicateFailure ( EraRule "PPUP" era))) => Eq ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

( UsesValue era, Show ( TxOut era), Show ( PredicateFailure ( EraRule "PPUP" era))) => Show ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Generic ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

( Typeable era, Crypto ( Crypto era), ToCBOR ( Value era), ToCBOR ( TxOut era), ToCBOR ( PredicateFailure ( EraRule "PPUP" era))) => ToCBOR ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

( TransValue FromCBOR era, TransUTxO FromCBOR era, DecodeNonNegative ( Value era), Show ( Value era), FromCBOR ( PredicateFailure ( EraRule "PPUP" era))) => FromCBOR ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

( NoThunks ( Value era), NoThunks ( TxOut era), NoThunks ( PredicateFailure ( EraRule "PPUP" era))) => NoThunks ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

PredicateFailure ( EraRule "PPUP" era) ~ PpupPredicateFailure era => Inject ( PpupPredicateFailure era) ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Inject ( UtxoPredicateFailure era) ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

PredicateFailure ( EraRule "UTXO" era) ~ UtxoPredicateFailure era => Inject ( UtxoPredicateFailure era) ( UtxowPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxow

type Rep ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Rep ( UtxoPredicateFailure era) = D1 (' MetaData "UtxoPredicateFailure" "Cardano.Ledger.Shelley.Rules.Utxo" "cardano-ledger-shelley-0.1.0.0-4LNBTpyKcsy6EW18a3tTt2" ' False ) ((( C1 (' MetaCons "BadInputsUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Set ( TxIn ( Crypto era))))) :+: C1 (' MetaCons "ExpiredUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SlotNo ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SlotNo ))) :+: ( C1 (' MetaCons "MaxTxSizeUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Integer ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Integer )) :+: ( C1 (' MetaCons "InputSetEmptyUTxO" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "FeeTooSmallUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin ))))) :+: (( C1 (' MetaCons "ValueNotConservedUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Value era)) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Value era))) :+: ( C1 (' MetaCons "WrongNetwork" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Network ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Set ( Addr ( Crypto era))))) :+: C1 (' MetaCons "WrongNetworkWithdrawal" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Network ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Set ( RewardAcnt ( Crypto era))))))) :+: ( C1 (' MetaCons "OutputTooSmallUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [ TxOut era])) :+: ( C1 (' MetaCons "UpdateFailure" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( PredicateFailure ( EraRule "PPUP" era)))) :+: C1 (' MetaCons "OutputBootAddrAttrsTooBig" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [ TxOut era]))))))

type family PredicateFailure a Source #

Descriptive type for the possible failures which might cause a transition to fail.

As a convention, PredicateFailure s which are "structural" (meaning that they are not "throwable" in practice, and are used to pass control from one transition rule to another) are prefixed with S_ .

Structural PredicateFailure s represent conditions between rules where the disjunction of all rules' preconditions is equal to True . That is, either one rule will throw a structural PredicateFailure and the other will succeed, or vice-versa.

Instances

Instances details
type PredicateFailure ( SNAP era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Snap

type PredicateFailure ( RUPD era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Rupd

type PredicateFailure ( PPUP era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ppup

type PredicateFailure ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type PredicateFailure ( UTXOW era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxow

type PredicateFailure ( POOLREAP era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.PoolReap

type PredicateFailure ( POOL era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Pool

type PredicateFailure ( NEWPP era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Newpp

type PredicateFailure ( UPEC era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Upec

type PredicateFailure ( MIR era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Mir

type PredicateFailure ( EPOCH era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Epoch

type PredicateFailure ( DELEG era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Deleg

type PredicateFailure ( DELPL era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Delpl

type PredicateFailure ( DELEGS era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Delegs

type PredicateFailure ( LEDGER era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ledger

type PredicateFailure ( LEDGERS era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ledgers

type PredicateFailure ( BBODY era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Bbody

type PredicateFailure ( NEWEPOCH era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.NewEpoch

type PredicateFailure ( TICKF era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Tick

type PredicateFailure ( TICK era) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Tick

type PredicateFailure ( STUB e st si f m)
Instance details

Defined in Control.State.Transition.Extended

type PredicateFailure ( STUB e st si f m) = f

Validations

validateInputSetEmptyUTxO :: HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))) => TxBody era -> Test ( UtxoPredicateFailure era) Source #

Ensure that there is at least one input in the TxBody

txins txb ≠ ∅

validateFeeTooSmallUTxO :: ( HasField "body" ( Tx era) ( TxBody era), HasField "txfee" ( TxBody era) Coin , HasField "_minfeeA" ( PParams era) Natural , HasField "_minfeeB" ( PParams era) Natural , HasField "txsize" ( Tx era) Integer ) => PParams era -> Tx era -> Test ( UtxoPredicateFailure era) Source #

Ensure that the fee is at least the amount specified by the minfee

minfee pp tx ≤ txfee txb

validateBadInputsUTxO :: UTxO era -> Set ( TxIn ( Crypto era)) -> Test ( UtxoPredicateFailure era) Source #

Ensure all transaction inputs are present in UTxO

inputs ⊆ dom utxo

validateWrongNetwork :: Era era => Network -> [ TxOut era] -> Test ( UtxoPredicateFailure era) Source #

Make sure all addresses match the supplied NetworkId

∀(_ → (a, _)) ∈ txouts txb, netId a = NetworkId

validateWrongNetworkWithdrawal :: HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)) => Network -> TxBody era -> Test ( UtxoPredicateFailure era) Source #

Make sure all addresses match the supplied NetworkId

∀(a → ) ∈ txwdrls txb, netId a = NetworkId

validateOutputBootAddrAttrsTooBig :: Era era => UTxO era -> Test ( UtxoPredicateFailure era) Source #

Bootstrap (i.e. Byron) addresses have variable sized attributes in them. It is important to limit their overall size.

∀ ( _ ↦ (a,_)) ∈ txoutstxb,  a ∈ Addrbootstrap → bootstrapAttrsSize a ≤ 64

validateMaxTxSizeUTxO :: ( HasField "_maxTxSize" ( PParams era) Natural , HasField "txsize" ( Tx era) Integer ) => PParams era -> Tx era -> Test ( UtxoPredicateFailure era) Source #

Ensure that the size of the transaction does not exceed the maxTxSize protocol parameter

txsize tx ≤ maxTxSize pp