conformance
Safe HaskellNone
LanguageGHC2021

Conformance.Compare.Registration

Description

The registration comparison, as one named thing.

This is the comparison the registration chapter has always run, moved out of the runner so that what it covers can be stated and checked rather than inferred by reading it. The semantics are unchanged: the delivery observation and the holder's quantity are each compared with the model's expected observation, and the registration fails if either differs.

What is new is that the result says which of the model's declared observations it accounted for, and which names the model cannot observe it carried. Both are derived from the comparison that actually ran — the compared objects' own fields, intersected with the declared surface — so a comparison that covers a projection cannot report otherwise.

Synopsis

Documentation

data Declared Source #

What the model says it can see, read off the driver surface.

Constructors

Declared 

Fields

Instances

Instances details
Show Declared Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

show :: Declared -> String Source #

showList :: [Declared] -> ShowS Source #

Eq Declared Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

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

data Delivery Source #

The delivery the registration chapter presents to the model, in model ids.

Constructors

Delivery 

Fields

Instances

Instances details
Show Delivery Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

show :: Delivery -> String Source #

showList :: [Delivery] -> ShowS Source #

Eq Delivery Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

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

data Difference Source #

One disagreement, named by the model field it is about.

Constructors

Difference 

Fields

Instances

Instances details
Show Difference Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

show :: Difference -> String Source #

showList :: [Difference] -> ShowS Source #

Eq Difference Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

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

data Agreement Source #

What a comparison established, and what it deliberately did not.

Constructors

Agreement 

Fields

Instances

Instances details
Show Agreement Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

show :: Agreement -> String Source #

showList :: [Agreement] -> ShowS Source #

Eq Agreement Source # 
Instance details

Defined in Conformance.Compare.Registration

Methods

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

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

declaredSurface :: Value -> Either String Declared Source #

Read the declared surface out of a driver corpus value.

deliveryObservation :: Delivery -> Value Source #

Exactly the object this chapter has always compared.

compareRegistration :: Declared -> Value -> Value -> Either [Difference] Agreement Source #

Compare an observed registration with the model's declared boundary.

Both sides are an observations object in the model's vocabulary: the expected one from the driver corpus row, the observed one translated from the chain.

Every declared observation must be present on both sides and must agree. A name the model cannot observe must not appear at all: an observed object that carried one would be claiming to have seen what the model has no vocabulary for, so it is reported rather than passed over. Those names are carried in the result, never compared. The model states lovelace as floors: every observed output's lovelace in tx, and every payment's value in paid and in `tx.refunds`, must be at least the corresponding model value. Surplus is allowed while every other field, and the number and order of outputs and payments, is compared for equality.

outputFloorAgrees :: Value -> Value -> Bool Source #

The shared acceptance rule for one lovelace floor the model states: an output's lovelace or a payment's value.

rootOf :: [(Integer, Word8)] -> [Word8] Source #

Singular.rootOf: FNV-1a over the sorted (key, leaf byte) pairs.

A second site computing a model function, so it is not trusted on sight: a control requires it to reproduce every accepted corpus row's root from that row's own trie.

approvalAssetName :: Text -> Integer -> Integer -> Integer -> Maybe Integer Source #

Singular.approvalAssetName, which datumHash also is.

FNV-1a over the scoping tuple, masked to 32 bits: the model's stand-in for blake2b_256(edge ‖ key ‖ owner ‖ destination). A second site computing a model function, so like rootOf it is not trusted on sight — a control requires it to reproduce every approval asset name and destination commitment in the committed corpus, from that row's own request.

edgeOrdinal :: Text -> Maybe Word8 Source #

Singular.edgeOrdinal: the byte each edge commits under.