cardano-ledger-shelley-1.12.2.1: Shelley Ledger Executable Model
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Shelley.Rules.Utxo

Synopsis

Documentation

data ShelleyUTXO era Source #

Instances

Instances details
(EraTx era, EraUTxO era, ShelleyEraTxBody era, EraGov era, GovState era ~ ShelleyGovState era, ExactEra ShelleyEra era, Embed (EraRule "PPUP" era) (ShelleyUTXO era), Environment (EraRule "PPUP" era) ~ PpupEnv era, Signal (EraRule "PPUP" era) ~ StrictMaybe (Update era), State (EraRule "PPUP" era) ~ ShelleyGovState era, Eq (EraRuleFailure "PPUP" era), Show (EraRuleFailure "PPUP" era), EraRule "UTXO" era ~ ShelleyUTXO era, InjectRuleFailure "UTXO" ShelleyUtxoPredFailure era) ⇒ STS (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Associated Types

type State (ShelleyUTXO era) Source #

type Signal (ShelleyUTXO era) Source #

type Environment (ShelleyUTXO era) Source #

type BaseM (ShelleyUTXO era) ∷ TypeType Source #

type Event (ShelleyUTXO era) Source #

type PredicateFailure (ShelleyUTXO era) Source #

(Era era, STS (ShelleyPPUP era), EraRuleFailure "PPUP" era ~ ShelleyPpupPredFailure era, Event (EraRule "PPUP" era) ~ PpupEvent era) ⇒ Embed (ShelleyPPUP era) (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

(Era era, STS (ShelleyUTXO era), PredicateFailure (EraRule "UTXO" era) ~ ShelleyUtxoPredFailure era, Event (EraRule "UTXO" era) ~ UtxoEvent era) ⇒ Embed (ShelleyUTXO era) (ShelleyUTXOW era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxow

type BaseM (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Environment (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Event (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Event (ShelleyUTXO era) = UtxoEvent era
type PredicateFailure (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Signal (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

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

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type State (ShelleyUTXO era) = UTxOState era

data UtxoEnv era Source #

Constructors

UtxoEnv 

Fields

Instances

Instances details
Generic (UtxoEnv era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Associated Types

type Rep (UtxoEnv era) ∷ TypeType Source #

Methods

fromUtxoEnv era → Rep (UtxoEnv era) x Source #

toRep (UtxoEnv era) x → UtxoEnv era Source #

Show (PParams era) ⇒ Show (UtxoEnv era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Methods

showsPrecIntUtxoEnv era → ShowS Source #

showUtxoEnv era → String Source #

showList ∷ [UtxoEnv era] → ShowS Source #

(Era era, NFData (PParams era)) ⇒ NFData (UtxoEnv era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Methods

rnfUtxoEnv era → () Source #

Eq (PParams era) ⇒ Eq (UtxoEnv era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Methods

(==)UtxoEnv era → UtxoEnv era → Bool Source #

(/=)UtxoEnv era → UtxoEnv era → Bool Source #

type Rep (UtxoEnv era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Rep (UtxoEnv era) = D1 ('MetaData "UtxoEnv" "Cardano.Ledger.Shelley.Rules.Utxo" "cardano-ledger-shelley-1.12.2.1-inplace" 'False) (C1 ('MetaCons "UtxoEnv" 'PrefixI 'True) (S1 ('MetaSel ('Just "ueSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo) :*: (S1 ('MetaSel ('Just "uePParams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PParams era)) :*: S1 ('MetaSel ('Just "ueCertState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertState era)))))

data ShelleyUtxoPredFailure era Source #

Instances

Instances details
InjectRuleFailure "BBODY" ShelleyUtxoPredFailure (ShelleyEra c) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Bbody

InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure (ShelleyEra c) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ledger

InjectRuleFailure "LEDGERS" ShelleyUtxoPredFailure (ShelleyEra c) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ledgers

InjectRuleFailure "UTXO" ShelleyUtxoPredFailure (ShelleyEra c) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

InjectRuleFailure "UTXOW" ShelleyUtxoPredFailure (ShelleyEra c) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxow

Generic (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Associated Types

type Rep (ShelleyUtxoPredFailure era) ∷ TypeType Source #

(Show (Value era), Show (TxOut era), Show (EraRuleFailure "PPUP" era)) ⇒ Show (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

(EraTxOut era, DecCBOR (EraRuleFailure "PPUP" era)) ⇒ DecCBOR (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

(Era era, EncCBOR (Value era), EncCBOR (TxOut era), EncCBOR (EraRuleFailure "PPUP" era)) ⇒ EncCBOR (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

(Era era, NFData (Value era), NFData (TxOut era), NFData (EraRuleFailure "PPUP" era)) ⇒ NFData (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Methods

rnfShelleyUtxoPredFailure era → () Source #

(Eq (Value era), Eq (TxOut era), Eq (EraRuleFailure "PPUP" era)) ⇒ Eq (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

(NoThunks (Value era), NoThunks (TxOut era), NoThunks (EraRuleFailure "PPUP" era)) ⇒ NoThunks (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Rep (ShelleyUtxoPredFailure era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type Rep (ShelleyUtxoPredFailure era) = D1 ('MetaData "ShelleyUtxoPredFailure" "Cardano.Ledger.Shelley.Rules.Utxo" "cardano-ledger-shelley-1.12.2.1-inplace" 'False) (((C1 ('MetaCons "BadInputsUTxO" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set (TxIn (EraCrypto era))))) :+: C1 ('MetaCons "ExpiredUTxO" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo))) :+: (C1 ('MetaCons "MaxTxSizeUTxO" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer)) :+: (C1 ('MetaCons "InputSetEmptyUTxO" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "FeeTooSmallUTxO" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin))))) :+: ((C1 ('MetaCons "ValueNotConservedUTxO" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Value era)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Value era))) :+: (C1 ('MetaCons "WrongNetwork" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Network) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set (Addr (EraCrypto era))))) :+: C1 ('MetaCons "WrongNetworkWithdrawal" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Network) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set (RewardAccount (EraCrypto era))))))) :+: (C1 ('MetaCons "OutputTooSmallUTxO" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [TxOut era])) :+: (C1 ('MetaCons "UpdateFailure" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (EraRuleFailure "PPUP" era))) :+: C1 ('MetaCons "OutputBootAddrAttrsTooBig" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [TxOut era]))))))

data UtxoEvent era Source #

Constructors

TotalDeposits (SafeHash (EraCrypto era) EraIndependentTxBody) Coin 
UpdateEvent (Event (EraRule "PPUP" era)) 
TxUTxODiff

The UTxOs consumed and created by a signal tx

Fields

  • (UTxO era)

    UTxO consumed

  • (UTxO era)

    UTxO created

Instances

Instances details
Generic (UtxoEvent era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Associated Types

type Rep (UtxoEvent era) ∷ TypeType Source #

Methods

fromUtxoEvent era → Rep (UtxoEvent era) x Source #

toRep (UtxoEvent era) x → UtxoEvent era Source #

(Era era, NFData (Event (EraRule "PPUP" era)), NFData (TxOut era)) ⇒ NFData (UtxoEvent era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Methods

rnfUtxoEvent era → () Source #

(Era era, Eq (TxOut era), Eq (Event (EraRule "PPUP" era))) ⇒ Eq (UtxoEvent era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

Methods

(==)UtxoEvent era → UtxoEvent era → Bool Source #

(/=)UtxoEvent era → UtxoEvent era → Bool Source #

type Rep (UtxoEvent era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type family PredicateFailure a Source #

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

As a convention, PredicateFailures 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 PredicateFailures 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 (ShelleyBBODY era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Bbody

type PredicateFailure (ShelleyDELEG era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Deleg

type PredicateFailure (ShelleyDELEGS era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Delegs

type PredicateFailure (ShelleyDELPL era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Delpl

type PredicateFailure (ShelleyEPOCH era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Epoch

type PredicateFailure (ShelleyLEDGER era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ledger

type PredicateFailure (ShelleyLEDGERS era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ledgers

type PredicateFailure (ShelleyMIR era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Mir

type PredicateFailure (ShelleyNEWEPOCH era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.NewEpoch

type PredicateFailure (ShelleyNEWPP era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Newpp

type PredicateFailure (ShelleyPOOL era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Pool

type PredicateFailure (ShelleyPOOLREAP era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.PoolReap

type PredicateFailure (ShelleyPPUP era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Ppup

type PredicateFailure (ShelleyRUPD era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Rupd

type PredicateFailure (ShelleySNAP era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Snap

type PredicateFailure (ShelleyTICK era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Tick

type PredicateFailure (ShelleyTICKF era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Tick

type PredicateFailure (ShelleyUPEC era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Upec

type PredicateFailure (ShelleyUTXO era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxo

type PredicateFailure (ShelleyUTXOW era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.Rules.Utxow

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

updateUTxOState ∷ (EraTxBody era, Monad m) ⇒ PParams era → UTxOState era → TxBody era → CertState era → GovState era → (Coin → m ()) → (UTxO era → UTxO era → m ()) → m (UTxOState era) Source #

This monadic action captures the final stages of the UTXO(S) rule. In particular it applies all of the UTxO related aditions and removals, gathers all of the fees into the fee pot utxosFees and updates the utxosDeposited field. Continuation supplied will be called on the deposit - refund change, which is normally used to emit the TotalDeposits event.

Validations

validateInputSetEmptyUTxOEraTxBody era ⇒ TxBody era → Test (ShelleyUtxoPredFailure era) Source #

Ensure that there is at least one input in the TxBody

txins txb ≠ ∅

validateFeeTooSmallUTxOEraUTxO era ⇒ PParams era → Tx era → UTxO era → Test (ShelleyUtxoPredFailure era) Source #

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

minfee pp tx ≤ txfee txb

validateBadInputsUTxOUTxO era → Set (TxIn (EraCrypto era)) → Test (ShelleyUtxoPredFailure era) Source #

Ensure all transaction inputs are present in UTxO

inputs ⊆ dom utxo

validateWrongNetwork ∷ (EraTxOut era, Foldable f) ⇒ Network → f (TxOut era) → Test (ShelleyUtxoPredFailure era) Source #

Make sure all addresses match the supplied NetworkId

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

validateWrongNetworkWithdrawalEraTxBody era ⇒ NetworkTxBody era → Test (ShelleyUtxoPredFailure era) Source #

Make sure all addresses match the supplied NetworkId

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

validateOutputBootAddrAttrsTooBig ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Test (ShelleyUtxoPredFailure 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

validateMaxTxSizeUTxOEraTx era ⇒ PParams era → Tx era → Test (ShelleyUtxoPredFailure era) Source #

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

txsize tx ≤ maxTxSize pp

validateValueNotConservedUTxOEraUTxO era ⇒ PParams era → UTxO era → CertState era → TxBody era → Test (ShelleyUtxoPredFailure era) Source #

Ensure that value consumed and produced matches up exactly

consumed pp utxo txb = produced pp poolParams txb

Orphan instances

InjectRuleFailure "UTXO" ShelleyPpupPredFailure (ShelleyEra c) Source # 
Instance details

(EraTx era, EraUTxO era, ShelleyEraTxBody era, EraGov era, GovState era ~ ShelleyGovState era, ExactEra ShelleyEra era, Embed (EraRule "PPUP" era) (ShelleyUTXO era), Environment (EraRule "PPUP" era) ~ PpupEnv era, Signal (EraRule "PPUP" era) ~ StrictMaybe (Update era), State (EraRule "PPUP" era) ~ ShelleyGovState era, Eq (EraRuleFailure "PPUP" era), Show (EraRuleFailure "PPUP" era), EraRule "UTXO" era ~ ShelleyUTXO era, InjectRuleFailure "UTXO" ShelleyUtxoPredFailure era) ⇒ STS (ShelleyUTXO era) Source # 
Instance details

Associated Types

type State (ShelleyUTXO era) Source #

type Signal (ShelleyUTXO era) Source #

type Environment (ShelleyUTXO era) Source #

type BaseM (ShelleyUTXO era) ∷ TypeType Source #

type Event (ShelleyUTXO era) Source #

type PredicateFailure (ShelleyUTXO era) Source #

(Era era, STS (ShelleyPPUP era), EraRuleFailure "PPUP" era ~ ShelleyPpupPredFailure era, Event (EraRule "PPUP" era) ~ PpupEvent era) ⇒ Embed (ShelleyPPUP era) (ShelleyUTXO era) Source # 
Instance details