Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- validateTx :: MonadError TxValidationError m => Environment -> UTxO -> Annotated Tx ByteString -> m ()
- validateTxAux :: MonadError TxValidationError m => Environment -> UTxO -> ATxAux ByteString -> m ()
- updateUTxO :: ( MonadError UTxOValidationError m, MonadReader ValidationMode m) => Environment -> UTxO -> [ ATxAux ByteString ] -> m UTxO
- updateUTxOTxWitness :: ( MonadError UTxOValidationError m, MonadReader ValidationMode m) => Environment -> UTxO -> ATxAux ByteString -> m UTxO
- updateUTxOTx :: ( MonadError UTxOValidationError m, MonadReader ValidationMode m) => Environment -> UTxO -> Annotated Tx ByteString -> m UTxO
-
data
TxValidationError
- = TxValidationLovelaceError Text LovelaceError
- | TxValidationFeeTooSmall Tx Lovelace Lovelace
- | TxValidationWitnessWrongSignature TxInWitness ProtocolMagicId TxSigData
- | TxValidationWitnessWrongKey TxInWitness Address
- | TxValidationMissingInput TxIn
- | TxValidationNetworkMagicMismatch NetworkMagic NetworkMagic
- | TxValidationTxTooLarge Natural Natural
- | TxValidationUnknownAddressAttributes
- | TxValidationUnknownAttributes
- data Environment = Environment { }
- data UTxOValidationError
Documentation
validateTx :: MonadError TxValidationError m => Environment -> UTxO -> Annotated Tx ByteString -> m () Source #
Validate that:
-
All
TxIn
s are in domain ofUtxo
These are the conditions of the UTxO inference rule in the spec.
validateTxAux :: MonadError TxValidationError m => Environment -> UTxO -> ATxAux ByteString -> m () Source #
Validate that:
- The fee for a transaction is not less than the minimum fee.
- The size of the transaction is below the maximum size.
- Output balance + fee = input balance
The transaction size must be calculated _including the witnesses_. As such
this cannot be part of
validateTx
. We actually assume 3 by calculating
the fee as output balance - input balance.
updateUTxO :: ( MonadError UTxOValidationError m, MonadReader ValidationMode m) => Environment -> UTxO -> [ ATxAux ByteString ] -> m UTxO Source #
Update UTxO with a list of transactions
updateUTxOTxWitness :: ( MonadError UTxOValidationError m, MonadReader ValidationMode m) => Environment -> UTxO -> ATxAux ByteString -> m UTxO Source #
Validate a transaction with a witness and use it to update the
UTxO
updateUTxOTx :: ( MonadError UTxOValidationError m, MonadReader ValidationMode m) => Environment -> UTxO -> Annotated Tx ByteString -> m UTxO Source #
Validate a transaction and use it to update the
UTxO
data TxValidationError Source #
A representation of all the ways a transaction might be invalid
Instances
Eq TxValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation (==) :: TxValidationError -> TxValidationError -> Bool Source # (/=) :: TxValidationError -> TxValidationError -> Bool Source # |
|
Show TxValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation |
|
ToCBOR TxValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation toCBOR :: TxValidationError -> Encoding Source # encodedSizeExpr :: ( forall t. ToCBOR t => Proxy t -> Size ) -> Proxy TxValidationError -> Size Source # encodedListSizeExpr :: ( forall t. ToCBOR t => Proxy t -> Size ) -> Proxy [ TxValidationError ] -> Size Source # |
|
FromCBOR TxValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation |
data Environment Source #
Instances
Eq Environment Source # | |
Defined in Cardano.Chain.UTxO.Validation (==) :: Environment -> Environment -> Bool Source # (/=) :: Environment -> Environment -> Bool Source # |
|
Show Environment Source # | |
Defined in Cardano.Chain.UTxO.Validation |
data UTxOValidationError Source #
Instances
Eq UTxOValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation (==) :: UTxOValidationError -> UTxOValidationError -> Bool Source # (/=) :: UTxOValidationError -> UTxOValidationError -> Bool Source # |
|
Show UTxOValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation |
|
ToCBOR UTxOValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation toCBOR :: UTxOValidationError -> Encoding Source # encodedSizeExpr :: ( forall t. ToCBOR t => Proxy t -> Size ) -> Proxy UTxOValidationError -> Size Source # encodedListSizeExpr :: ( forall t. ToCBOR t => Proxy t -> Size ) -> Proxy [ UTxOValidationError ] -> Size Source # |
|
FromCBOR UTxOValidationError Source # | |
Defined in Cardano.Chain.UTxO.Validation |