| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data Declared = Declared {
- declaredObservations :: [Text]
- declaredUnobservable :: [Text]
- data Delivery = Delivery {
- deliveryAddress :: Integer
- deliveryPolicy :: Integer
- deliveryKey :: Integer
- deliveryQuantity :: Integer
- data Difference = Difference {
- differenceObservation :: Text
- differenceExpected :: Value
- differenceObserved :: Value
- data Agreement = Agreement {
- agreementCompared :: [Text]
- agreementUnobserved :: [Text]
- declaredSurface :: Value -> Either String Declared
- deliveryObservation :: Delivery -> Value
- compareRegistration :: Declared -> Value -> Value -> Either [Difference] Agreement
- outputFloorAgrees :: Value -> Value -> Bool
- rootOf :: [(Integer, Word8)] -> [Word8]
- approvalAssetName :: Text -> Integer -> Integer -> Integer -> Maybe Integer
- edgeOrdinal :: Text -> Maybe Word8
Documentation
What the model says it can see, read off the driver surface.
Constructors
| Declared | |
Fields
| |
Instances
| Show Declared Source # | |
Defined in Conformance.Compare.Registration | |
| Eq Declared Source # | |
Defined in Conformance.Compare.Registration | |
The delivery the registration chapter presents to the model, in model ids.
Constructors
| Delivery | |
Fields
| |
Instances
| Show Delivery Source # | |
Defined in Conformance.Compare.Registration | |
| Eq Delivery Source # | |
Defined in Conformance.Compare.Registration | |
data Difference Source #
One disagreement, named by the model field it is about.
Constructors
| Difference | |
Fields
| |
Instances
| Show Difference Source # | |
Defined in Conformance.Compare.Registration Methods showsPrec :: Int -> Difference -> ShowS Source # show :: Difference -> String Source # showList :: [Difference] -> ShowS Source # | |
| Eq Difference Source # | |
Defined in Conformance.Compare.Registration Methods (==) :: Difference -> Difference -> Bool Source # (/=) :: Difference -> Difference -> Bool Source # | |
What a comparison established, and what it deliberately did not.
Constructors
| Agreement | |
Fields
| |
Instances
| Show Agreement Source # | |
Defined in Conformance.Compare.Registration | |
| Eq Agreement Source # | |
Defined in Conformance.Compare.Registration | |
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.