hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.HeadLogic.Error

Description

Error types used in the Hydra.HeadLogic module.

Documentation

data LogicError tx Source #

Instances

Instances details
(ToJSON (HeadState tx), ToJSON (Input tx), ToJSON (RequirementFailure tx), ToJSON (SideLoadRequirementFailure tx)) => ToJSON (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

toJSON :: LogicError tx -> Value

toEncoding :: LogicError tx -> Encoding

toJSONList :: [LogicError tx] -> Value

toEncodingList :: [LogicError tx] -> Encoding

omitField :: LogicError tx -> Bool

Generic (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Associated Types

type Rep (LogicError tx) :: Type -> Type Source #

Methods

from :: LogicError tx -> Rep (LogicError tx) x Source #

to :: Rep (LogicError tx) x -> LogicError tx Source #

(Show (HeadState tx), Show (Input tx), Show (RequirementFailure tx), Show (SideLoadRequirementFailure tx)) => Show (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

(Eq (HeadState tx), Eq (Input tx), Eq (RequirementFailure tx), Eq (SideLoadRequirementFailure tx)) => Eq (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

(==) :: LogicError tx -> LogicError tx -> Bool Source #

(/=) :: LogicError tx -> LogicError tx -> Bool Source #

type Rep (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (LogicError tx) = D1 ('MetaData "LogicError" "Hydra.HeadLogic.Error" "hydra-node-2.4.1-Ld6araFLy8R3VgBqKXvTkN" 'False) ((C1 ('MetaCons "UnhandledInput" 'PrefixI 'True) (S1 ('MetaSel ('Just "input") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Input tx)) :*: S1 ('MetaSel ('Just "currentHeadState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (HeadState tx))) :+: C1 ('MetaCons "RequireFailed" 'PrefixI 'True) (S1 ('MetaSel ('Just "requirementFailure") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (RequirementFailure tx)))) :+: (C1 ('MetaCons "AssertionFailed" 'PrefixI 'True) (S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "NotOurHead" 'PrefixI 'True) (S1 ('MetaSel ('Just "ourHeadId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "otherHeadId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)) :+: C1 ('MetaCons "SideLoadSnapshotFailed" 'PrefixI 'True) (S1 ('MetaSel ('Just "sideLoadRequirementFailure") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (SideLoadRequirementFailure tx))))))

data RequirementFailure tx Source #

Constructors

ReqSnNumberInvalid 

Fields

ReqSvNumberInvalid 

Fields

ReqSnNotLeader 

Fields

ReqSnDecommitNotSettled 
ReqSnCommitNotSettled 
ReqSnBothCommitAndDecommit

A snapshot may settle a commit or a decommit, never both: close and fanout carry a single incremental action, so a snapshot with both would leave the head unclosable.

Fields

ReqSnDecommitNoOutputs

A decommit that materializes no output cannot be settled: the decrement validator requires at least one decommit output.

Fields

InvalidMultisignature 

Fields

SnapshotAlreadySigned 

Fields

AckSnNumberInvalid 

Fields

SnapshotDoesNotApply 

Fields

NoMatchingDeposit 
RecoverBlockedByFinalizedCommit

The deposit is claimed by a signed snapshot whose increment settled on-chain but was rolled back: its funds are already accounted for in the head, so recovering them on-chain would corrupt the L2 ledger. The increment is re-posted instead, see #2741.

Fields

ReqSnDepositBlockedByFinalizedCommit

The requested deposit is claimed by an already signed snapshot whose increment settled on-chain but was rolled back (which is the only way it resurfaces in the pending deposits): signing a second snapshot claiming it would double claim the deposit. Only re-posting the increment settles it, see #2741.

Fields

RequestedDepositExpired 

Fields

RequestedDepositNotFoundLocally 

Fields

ReqSnUTxOSetTooLarge 

Fields

Instances

Instances details
ToJSON (TxIdType tx) => ToJSON (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Generic (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Associated Types

type Rep (RequirementFailure tx) :: Type -> Type Source #

Show (TxIdType tx) => Show (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

IsTx tx => FromCBOR (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

fromCBOR :: Decoder s (RequirementFailure tx)

label :: Proxy (RequirementFailure tx) -> Text

IsTx tx => ToCBOR (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

toCBOR :: RequirementFailure tx -> Encoding

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

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

Eq (TxIdType tx) => Eq (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (RequirementFailure tx) = D1 ('MetaData "RequirementFailure" "Hydra.HeadLogic.Error" "hydra-node-2.4.1-Ld6araFLy8R3VgBqKXvTkN" 'False) ((((C1 ('MetaCons "ReqSnNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "lastSeenSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :+: C1 ('MetaCons "ReqSvNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "lastSeenSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion))) :+: (C1 ('MetaCons "ReqSnNotLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "leader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Party)) :+: C1 ('MetaCons "ReqSnDecommitNotSettled" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ReqSnCommitNotSettled" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ReqSnBothCommitAndDecommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: S1 ('MetaSel ('Just "decommitTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)))) :+: (C1 ('MetaCons "ReqSnDecommitNoOutputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "decommitTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: C1 ('MetaCons "InvalidMultisignature" 'PrefixI 'True) (S1 ('MetaSel ('Just "multisig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "vkeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [VerificationKey HydraKey]))))) :+: (((C1 ('MetaCons "SnapshotAlreadySigned" 'PrefixI 'True) (S1 ('MetaSel ('Just "knownSignatures") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Party]) :*: S1 ('MetaSel ('Just "receivedSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Party)) :+: C1 ('MetaCons "AckSnNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "lastSeenSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber))) :+: (C1 ('MetaCons "SnapshotDoesNotApply" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: (S1 ('MetaSel ('Just "txid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: S1 ('MetaSel ('Just "error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ValidationError))) :+: C1 ('MetaCons "NoMatchingDeposit" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "RecoverBlockedByFinalizedCommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: C1 ('MetaCons "ReqSnDepositBlockedByFinalizedCommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)))) :+: (C1 ('MetaCons "RequestedDepositExpired" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: (C1 ('MetaCons "RequestedDepositNotFoundLocally" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: C1 ('MetaCons "ReqSnUTxOSetTooLarge" 'PrefixI 'True) (S1 ('MetaSel ('Just "utxoCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "maxAllowed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))))))

data SideLoadRequirementFailure tx Source #

Constructors

SideLoadInitialSnapshotMismatch 
SideLoadSnNumberInvalid 

Fields

SideLoadSvNumberInvalid 

Fields

SideLoadUTxOToCommitInvalid 

Fields

SideLoadDepositTxIdInvalid

The side-loaded snapshot commits the same UTxO as the confirmed one, but from a different deposit. Since the deposit is what identifies a pending commit, this is a distinct disagreement from SideLoadUTxOToCommitInvalid, whose payload would show two identical UTxO sets here.

Fields

SideLoadUTxOToDecommitInvalid 

Fields

SideLoadInvalidMultisignature 

Fields

SideLoadUTxOSetTooLarge

The snapshot commits to more outputs than the accumulator's trusted setup supports, so its commitment could never be computed.

SECURITY: unlike its siblings, this one is raised at the client API boundary rather than by the head logic, and it has to be: forcing an over-capacity accumulator calls RequirementFailure (see checkAccumulatorSize), and by the time the head logic sees an input the node has already traced it, which forces it. See validateClientInput.

update keeps an independent check for any future producer that skips the boundary, reported as SideLoadSnapshotFailed. That route deliberately does not go through sideLoadFailed: a SideLoadSnapshotRejected client message echoes the offending ClientInput back, and encoding that echo would force the very accumulator that cannot be computed. This constructor carries only the two counts, so it is safe to report either way.

Fields

Instances

Instances details
(FromJSON (UTxOType tx), FromJSON (TxIdType tx)) => FromJSON (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

(ToJSON (UTxOType tx), ToJSON (TxIdType tx)) => ToJSON (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Generic (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Associated Types

type Rep (SideLoadRequirementFailure tx) :: Type -> Type Source #

(Show (UTxOType tx), Show (TxIdType tx)) => Show (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

IsTx tx => FromCBOR (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

IsTx tx => ToCBOR (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

toCBOR :: SideLoadRequirementFailure tx -> Encoding

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

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

(Eq (UTxOType tx), Eq (TxIdType tx)) => Eq (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (SideLoadRequirementFailure tx) = D1 ('MetaData "SideLoadRequirementFailure" "Hydra.HeadLogic.Error" "hydra-node-2.4.1-Ld6araFLy8R3VgBqKXvTkN" 'False) (((C1 ('MetaCons "SideLoadInitialSnapshotMismatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SideLoadSnNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "lastSeenSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber))) :+: (C1 ('MetaCons "SideLoadSvNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "lastSeenSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion)) :+: C1 ('MetaCons "SideLoadUTxOToCommitInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx))) :*: S1 ('MetaSel ('Just "lastSeenSc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx)))))) :+: ((C1 ('MetaCons "SideLoadDepositTxIdInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedDeposit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (TxIdType tx))) :*: S1 ('MetaSel ('Just "lastSeenDeposit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (TxIdType tx)))) :+: C1 ('MetaCons "SideLoadUTxOToDecommitInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx))) :*: S1 ('MetaSel ('Just "lastSeenSd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx))))) :+: (C1 ('MetaCons "SideLoadInvalidMultisignature" 'PrefixI 'True) (S1 ('MetaSel ('Just "multisig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "vkeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [VerificationKey HydraKey])) :+: C1 ('MetaCons "SideLoadUTxOSetTooLarge" 'PrefixI 'True) (S1 ('MetaSel ('Just "utxoCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "maxAllowed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))))