hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Ledger

Synopsis

Documentation

data Ledger tx Source #

An abstract interface for a Ledger. Allows to define mock / simpler implementation for testing as well as limiting feature-envy from the business logic by forcing a closed interface.

Constructors

Ledger 

Fields

  • applyTransactions :: ChainSlot -> UTxOType tx -> [tx] -> Either (tx, ValidationError) (UTxOType tx)

    Apply a set of transaction to a given UTxO set. Returns the new UTxO or validation failures returned from the ledger. TODO: ValidationError should also include the UTxO, which is not necessarily the same as the given UTxO after some transactions

  • reapplyTransactions :: ChainSlot -> UTxOType tx -> [tx] -> Either (tx, ValidationError) (UTxOType tx)

    Like $sel:applyTransactions:Ledger, but only for transactions that were already accepted by $sel:applyTransactions:Ledger earlier (possibly against a different UTxO). It skips the expensive *static* checks — Plutus script evaluation and witness cryptography — while still running the state-dependent checks (inputs present, value preserved), so it fails exactly like $sel:applyTransactions:Ledger when a transaction no longer applies.

    Callers MUST only pass previously-validated transactions; passing an unvalidated transaction is unsound (its scripts/signatures are not checked).

data ValidationResult Source #

Either valid or an error which we get from the ledger-specs tx validation.

Instances

Instances details
Generic ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

Associated Types

type Rep ValidationResult :: Type -> Type Source #

Show ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

Eq ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationResult = D1 ('MetaData "ValidationResult" "Hydra.Ledger" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "Valid" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Invalid" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ValidationError)))

newtype ValidationError Source #

Constructors

ValidationError 

Fields

Instances

Instances details
FromJSON ValidationError Source # 
Instance details

Defined in Hydra.Ledger

ToJSON ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Generic ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Associated Types

type Rep ValidationError :: Type -> Type Source #

Show ValidationError Source # 
Instance details

Defined in Hydra.Ledger

FromCBOR ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Methods

fromCBOR :: Decoder s ValidationError

label :: Proxy ValidationError -> Text

ToCBOR ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Methods

toCBOR :: ValidationError -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy ValidationError -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [ValidationError] -> Size

Eq ValidationError Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationError Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationError = D1 ('MetaData "ValidationError" "Hydra.Ledger" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'True) (C1 ('MetaCons "ValidationError" 'PrefixI 'True) (S1 ('MetaSel ('Just "reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))