Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Ledger.Shelley.Rules.Utxo
Contents
Synopsis
- data UTXO era
- data UtxoEnv era = UtxoEnv SlotNo ( PParams era) ( Map ( KeyHash ' StakePool ( Crypto era)) ( PoolParams ( Crypto era))) ( GenDelegs ( Crypto era))
-
data
UtxoPredicateFailure
era
- = BadInputsUTxO !( Set ( TxIn ( Crypto era)))
- | ExpiredUTxO ! SlotNo ! SlotNo
- | MaxTxSizeUTxO ! Integer ! Integer
- | InputSetEmptyUTxO
- | FeeTooSmallUTxO ! Coin ! Coin
- | ValueNotConservedUTxO !( Value era) !( Value era)
- | WrongNetwork ! Network !( Set ( Addr ( Crypto era)))
- | WrongNetworkWithdrawal ! Network !( Set ( RewardAcnt ( Crypto era)))
- | OutputTooSmallUTxO ![ TxOut era]
- | UpdateFailure ( PredicateFailure ( EraRule "PPUP" era))
- | OutputBootAddrAttrsTooBig ![ TxOut era]
-
data
UtxoEvent
era
- = TotalDeposits Coin
- | UpdateEvent ( Event ( EraRule "PPUP" era))
- type family PredicateFailure a
- updateUTxOState :: ( Era era, HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era)))) => UTxOState era -> TxBody era -> Coin -> State ( EraRule "PPUP" era) -> UTxOState era
- validateInputSetEmptyUTxO :: HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))) => TxBody era -> Test ( UtxoPredicateFailure era)
- 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)
- validateBadInputsUTxO :: UTxO era -> Set ( TxIn ( Crypto era)) -> Test ( UtxoPredicateFailure era)
- validateWrongNetwork :: Era era => Network -> [ TxOut era] -> Test ( UtxoPredicateFailure era)
- validateWrongNetworkWithdrawal :: HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)) => Network -> TxBody era -> Test ( UtxoPredicateFailure era)
- validateOutputBootAddrAttrsTooBig :: Era era => UTxO era -> Test ( UtxoPredicateFailure era)
- validateMaxTxSizeUTxO :: ( HasField "_maxTxSize" ( PParams era) Natural , HasField "txsize" ( Tx era) Integer ) => PParams era -> Tx era -> Test ( UtxoPredicateFailure era)
Documentation
Instances
data UtxoPredicateFailure era Source #
Constructors
BadInputsUTxO !( Set ( TxIn ( Crypto era))) | |
ExpiredUTxO ! SlotNo ! SlotNo | |
MaxTxSizeUTxO ! Integer ! Integer | |
InputSetEmptyUTxO | |
FeeTooSmallUTxO ! Coin ! Coin | |
ValueNotConservedUTxO !( Value era) !( Value era) | |
WrongNetwork ! Network !( Set ( Addr ( Crypto era))) | |
WrongNetworkWithdrawal ! Network !( Set ( RewardAcnt ( Crypto era))) | |
OutputTooSmallUTxO ![ TxOut era] | |
UpdateFailure ( PredicateFailure ( EraRule "PPUP" era)) | |
OutputBootAddrAttrsTooBig ![ TxOut era] |
Instances
Constructors
TotalDeposits Coin | |
UpdateEvent ( Event ( EraRule "PPUP" 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
updateUTxOState :: ( Era era, HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era)))) => UTxOState era -> TxBody era -> Coin -> State ( EraRule "PPUP" era) -> UTxOState era Source #
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