conformance
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Conformance.Replay

Description

A live phase-2 refusal carries no reason: the deployed validators are built without traces. The runner replays the refused transaction's failing script twice on the arguments the ledger built for it — the deployed bytes under the transaction's declared units, then the traced bytes of the same source with the same parameters under the protocol maximum — and this module decides what those two runs establish.

A reason is admitted only when both runs fail as a validator and the traced run leaves exactly one user-defined trace; that line, verbatim, is the reason. Every other result is an unobserved reason with its cause, and every cause is its own value. A reason is compared with the model's only once admitted.

Pure: the runs arrive as data. Capturing and evaluating belong to the runner's replay module, Conformance.Run.Replay.

Synopsis

Runs

data RunOutcome Source #

How one evaluation of one script on one purpose's arguments ended.

Constructors

Succeeded

the script returned

ValidatorFailure

the script failed: an error, a failed builtin, a non-unit result

BudgetExhausted

the budget ran out before the script finished

EvaluationError Text

the evaluator could not run the script at all

Instances

Instances details
ToJSON RunOutcome Source # 
Instance details

Defined in Conformance.Replay

Methods

toJSON :: RunOutcome -> Value

toEncoding :: RunOutcome -> Encoding

toJSONList :: [RunOutcome] -> Value

toEncodingList :: [RunOutcome] -> Encoding

omitField :: RunOutcome -> Bool

Show RunOutcome Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> RunOutcome -> ShowS Source #

show :: RunOutcome -> String Source #

showList :: [RunOutcome] -> ShowS Source #

Eq RunOutcome Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: RunOutcome -> RunOutcome -> Bool Source #

(/=) :: RunOutcome -> RunOutcome -> Bool Source #

data ReplayRun Source #

One evaluation: which bytes, under which limit, using what, how it ended.

Constructors

ReplayRun 

Fields

Instances

Instances details
ToJSON ReplayRun Source # 
Instance details

Defined in Conformance.Replay

Methods

toJSON :: ReplayRun -> Value

toEncoding :: ReplayRun -> Encoding

toJSONList :: [ReplayRun] -> Value

toEncodingList :: [ReplayRun] -> Encoding

omitField :: ReplayRun -> Bool

Show ReplayRun Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> ReplayRun -> ShowS Source #

show :: ReplayRun -> String Source #

showList :: [ReplayRun] -> ShowS Source #

Eq ReplayRun Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: ReplayRun -> ReplayRun -> Bool Source #

(/=) :: ReplayRun -> ReplayRun -> Bool Source #

Classes

data UnobservedCause Source #

Why a replay admits no reason. Each is distinct; none stands for another.

Constructors

CaptureIncomplete

the capture does not resolve every output the transaction names

ContextUnavailable

the ledger's arguments for the failing purpose could not be built

ToolchainMismatch

the deployed blueprint is not the one the traced build corresponds to

NoReplayRoute

the failing script's family is identified, but the replay traces none of it

ParametersMismatch

the family is identified by the capture; its applications do not reproduce the hash

UnidentifiedScript

no family is identified and no application is claimed

DeployedSucceeds 
DeployedBudget 
TracedSucceeds 
TracedBudget 
NoUserTrace

the traced run failed without a user-defined trace

SeveralUserTraces

the traced run failed with more than one user-defined trace

Phase1

the node rejected the transaction before any script ran

SetupFailure

the run could not reach the evaluation

Timeout 
ClientException 
EvaluatorFailed

the evaluator itself failed, on either run

Instances

Instances details
Bounded UnobservedCause Source # 
Instance details

Defined in Conformance.Replay

Methods

minBound :: UnobservedCause Source #

maxBound :: UnobservedCause Source #

Enum UnobservedCause Source # 
Instance details

Defined in Conformance.Replay

Methods

succ :: UnobservedCause -> UnobservedCause Source #

pred :: UnobservedCause -> UnobservedCause Source #

toEnum :: Int -> UnobservedCause Source #

fromEnum :: UnobservedCause -> Int Source #

enumFrom :: UnobservedCause -> [UnobservedCause] Source #

enumFromThen :: UnobservedCause -> UnobservedCause -> [UnobservedCause] Source #

enumFromTo :: UnobservedCause -> UnobservedCause -> [UnobservedCause] Source #

enumFromThenTo :: UnobservedCause -> UnobservedCause -> UnobservedCause -> [UnobservedCause] Source #

Show UnobservedCause Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> UnobservedCause -> ShowS Source #

show :: UnobservedCause -> String Source #

showList :: [UnobservedCause] -> ShowS Source #

Eq UnobservedCause Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: UnobservedCause -> UnobservedCause -> Bool Source #

(/=) :: UnobservedCause -> UnobservedCause -> Bool Source #

Ord UnobservedCause Source # 
Instance details

Defined in Conformance.Replay

Methods

compare :: UnobservedCause -> UnobservedCause -> Ordering Source #

(<) :: UnobservedCause -> UnobservedCause -> Bool Source #

(<=) :: UnobservedCause -> UnobservedCause -> Bool Source #

(>) :: UnobservedCause -> UnobservedCause -> Bool Source #

(>=) :: UnobservedCause -> UnobservedCause -> Bool Source #

max :: UnobservedCause -> UnobservedCause -> UnobservedCause Source #

min :: UnobservedCause -> UnobservedCause -> UnobservedCause Source #

causeName :: UnobservedCause -> Text Source #

The cause as the replay evidence spells it.

data ReplayClass Source #

What a replay establishes about the chain-side reason.

Constructors

Admitted Text 
Unobserved UnobservedCause 

Instances

Instances details
ToJSON ReplayClass Source # 
Instance details

Defined in Conformance.Replay

Methods

toJSON :: ReplayClass -> Value

toEncoding :: ReplayClass -> Encoding

toJSONList :: [ReplayClass] -> Value

toEncodingList :: [ReplayClass] -> Encoding

omitField :: ReplayClass -> Bool

Show ReplayClass Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> ReplayClass -> ShowS Source #

show :: ReplayClass -> String Source #

showList :: [ReplayClass] -> ShowS Source #

Eq ReplayClass Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: ReplayClass -> ReplayClass -> Bool Source #

(/=) :: ReplayClass -> ReplayClass -> Bool Source #

admitReason :: ReplayRun -> ReplayRun -> Maybe UnobservedCause -> ReplayClass Source #

Decide what the deployed run and the traced run admit. An earlier cause (capture, toolchain, parameters, or the run never reaching evaluation) wins.

userTraces :: [Text] -> [Text] Source #

The user-defined lines of an evaluation log. The traced build keeps only user-defined traces, so every non-blank line is one.

data ScriptFamily Source #

A validator family the replay can recognise a failing hash by.

Constructors

ScriptFamily 

Fields

  • sfTitle :: Text
     
  • sfRouted :: Bool

    whether the replay has a traced counterpart for it

  • sfCandidates :: [Text]

    hashes of its untraced applications built from the capture

Instances

Instances details
Show ScriptFamily Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> ScriptFamily -> ShowS Source #

show :: ScriptFamily -> String Source #

showList :: [ScriptFamily] -> ShowS Source #

Eq ScriptFamily Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: ScriptFamily -> ScriptFamily -> Bool Source #

(/=) :: ScriptFamily -> ScriptFamily -> Bool Source #

identifyScript :: [ScriptFamily] -> Maybe Text -> Text -> Either UnobservedCause Text Source #

Which family a failing hash belongs to: a routed family whose candidate reproduces it is replayed; an unrouted one is NoReplayRoute; a family the capture records for the script (its role), none of whose candidates reproduce it, is ParametersMismatch; otherwise UnidentifiedScript.

Comparison

data ReasonComparison Source #

A refused step's chain-side reason against the model's.

Constructors

Agrees 
Differs 

Fields

Uncompared UnobservedCause 

Instances

Instances details
Show ReasonComparison Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> ReasonComparison -> ShowS Source #

show :: ReasonComparison -> String Source #

showList :: [ReasonComparison] -> ShowS Source #

Eq ReasonComparison Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: ReasonComparison -> ReasonComparison -> Bool Source #

(/=) :: ReasonComparison -> ReasonComparison -> Bool Source #

compareReason :: Text -> ReplayClass -> ReasonComparison Source #

Compare an admitted reason with Lean's; an unobserved one is not compared.

stepComparison :: Text -> Text -> [(Text, ReplayClass)] -> ReasonComparison Source #

A refused step's comparison: the purposes of the script the step is judged by (its marker hash) against Lean's reason. It agrees only when every such purpose agrees; any purpose that differs makes it differ; otherwise it is uncompared, with the first cause — or ContextUnavailable when the marker's script is not among the failing purposes at all.

comparisonName :: ReasonComparison -> Text Source #

The comparison as the replay index spells it.

admittedFor :: Text -> [(Text, ReplayClass)] -> Maybe Text Source #

The reason the marker's script admitted, when every purpose of it admits the same one.

Evidence

data PurposeReplay Source #

One failing purpose of one rejected transaction, and its two runs.

Constructors

PurposeReplay 

Fields

Instances

Instances details
ToJSON PurposeReplay Source # 
Instance details

Defined in Conformance.Replay

Methods

toJSON :: PurposeReplay -> Value

toEncoding :: PurposeReplay -> Encoding

toJSONList :: [PurposeReplay] -> Value

toEncodingList :: [PurposeReplay] -> Encoding

omitField :: PurposeReplay -> Bool

Show PurposeReplay Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> PurposeReplay -> ShowS Source #

show :: PurposeReplay -> String Source #

showList :: [PurposeReplay] -> ShowS Source #

Eq PurposeReplay Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: PurposeReplay -> PurposeReplay -> Bool Source #

(/=) :: PurposeReplay -> PurposeReplay -> Bool Source #

acceptingControlGaps :: [Value] -> [Text] Source #

What the replay index lacks for FR-13: every script role a refusal names (a validator title — a bare hash names no family a control could replay) needs an accepting-control entry in which that role's deployed and traced runs both succeeded. One line per missing or failing role; none when complete.

data TracedProvenance Source #

The traced build's provenance, as the flake writes it beside it.

Constructors

TracedProvenance 

Fields

Instances

Instances details
FromJSON TracedProvenance Source # 
Instance details

Defined in Conformance.Replay

Methods

parseJSON :: Value -> Parser TracedProvenance

parseJSONList :: Value -> Parser [TracedProvenance]

omittedField :: Maybe TracedProvenance

Show TracedProvenance Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> TracedProvenance -> ShowS Source #

show :: TracedProvenance -> String Source #

showList :: [TracedProvenance] -> ShowS Source #

Eq TracedProvenance Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: TracedProvenance -> TracedProvenance -> Bool Source #

(/=) :: TracedProvenance -> TracedProvenance -> Bool Source #

toolchainCause :: TracedProvenance -> Map Text Text -> Maybe UnobservedCause Source #

ToolchainMismatch unless the deployed blueprint's validators are exactly the ones the traced build's untraced twin produced, hash for hash.

captureIdOf :: [(FilePath, ByteString)] -> Text Source #

The identity of a capture: SHA-256 over each file's canonical name and content hash, in name order, so the order the files were written in does not move it.

Receipt evidence

data ReplayEvidence Source #

One failing purpose's replay as a receipt carries it: the hash the node reported, the traced hash of the same parameters once the replay applied one, the reason it admitted or the cause it admits none — never both — and the capture it was replayed from.

Constructors

ReplayEvidence 

Fields

Instances

Instances details
FromJSON ReplayEvidence Source # 
Instance details

Defined in Conformance.Replay

Methods

parseJSON :: Value -> Parser ReplayEvidence

parseJSONList :: Value -> Parser [ReplayEvidence]

omittedField :: Maybe ReplayEvidence

ToJSON ReplayEvidence Source # 
Instance details

Defined in Conformance.Replay

Methods

toJSON :: ReplayEvidence -> Value

toEncoding :: ReplayEvidence -> Encoding

toJSONList :: [ReplayEvidence] -> Value

toEncodingList :: [ReplayEvidence] -> Encoding

omitField :: ReplayEvidence -> Bool

Show ReplayEvidence Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> ReplayEvidence -> ShowS Source #

show :: ReplayEvidence -> String Source #

showList :: [ReplayEvidence] -> ShowS Source #

Eq ReplayEvidence Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: ReplayEvidence -> ReplayEvidence -> Bool Source #

(/=) :: ReplayEvidence -> ReplayEvidence -> Bool Source #

rejectionEvidence Source #

Arguments

:: Maybe Text

the capture's identity

-> [Text]

the failing hashes the node reported

-> [PurposeReplay] 
-> [ReplayClass]

what the replay established, in the index's order

-> [ReplayEvidence] 

A rejection's evidence, one entry per failing purpose the replay met; a replay that ended before reaching any purpose gives each failing hash the cause it ended with.

data ReplayCorrespondence Source #

The traced build a receipt's replay reasons rely on: its source, compiler and trace flags, and a digest of the untraced hashes it was held to.

Constructors

ReplayCorrespondence 

Fields

Instances

Instances details
FromJSON ReplayCorrespondence Source # 
Instance details

Defined in Conformance.Replay

Methods

parseJSON :: Value -> Parser ReplayCorrespondence

parseJSONList :: Value -> Parser [ReplayCorrespondence]

omittedField :: Maybe ReplayCorrespondence

ToJSON ReplayCorrespondence Source # 
Instance details

Defined in Conformance.Replay

Methods

toJSON :: ReplayCorrespondence -> Value

toEncoding :: ReplayCorrespondence -> Encoding

toJSONList :: [ReplayCorrespondence] -> Value

toEncodingList :: [ReplayCorrespondence] -> Encoding

omitField :: ReplayCorrespondence -> Bool

Show ReplayCorrespondence Source # 
Instance details

Defined in Conformance.Replay

Methods

showsPrec :: Int -> ReplayCorrespondence -> ShowS Source #

show :: ReplayCorrespondence -> String Source #

showList :: [ReplayCorrespondence] -> ShowS Source #

Eq ReplayCorrespondence Source # 
Instance details

Defined in Conformance.Replay

Methods

(==) :: ReplayCorrespondence -> ReplayCorrespondence -> Bool Source #

(/=) :: ReplayCorrespondence -> ReplayCorrespondence -> Bool Source #

correspondenceOf :: TracedProvenance -> ReplayCorrespondence Source #

The correspondence a traced build's provenance states.