| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Naming.Request
Description
The insert-request commitment codec and the refund comparison for
the initial request, transcribed exactly from the accepted epic-15
contract's simulator/naming-wire.mjs, core.mjs and
lifecycle-corpus.json vector WR01-insert-request-refund-roundtrip
(v0.2.0, commit 13231f58833b8feb57f4b0f9b1117bfcfba0c07d, asset
sha256 acbabdf54a271251bd73bf9d84ab2c901107045a7dd77d28a391f22cdd53b0e5).
The commitment is constr(0,[constr(0,[registry, key,
applicationPolicy, refundAddress, initial output, scope])]) — six
proposal fields, no seventh. Every constr index here is 0 and every
number a non-negative integer, exactly as the reference decoders
require. Where this module and the reference disagree, the reference
is right and this module is wrong.
Synopsis
- data Representative = Representative {
- representativeRegistry :: Integer
- representativeKey :: Integer
- representativePolicy :: Integer
- representativeAssetScope :: Integer
- data InitialOutput = InitialOutput {
- initialRepresentative :: Representative
- initialQuantity :: Integer
- initialDestination :: Integer
- initialDatum :: Integer
- initialValue :: Integer
- data InsertProposal = InsertProposal {
- registry :: Integer
- key :: Integer
- applicationPolicy :: Integer
- refundAddress :: Integer
- initial :: InitialOutput
- scope :: [Integer]
- data InsertRequestShape = InsertRequestShape {
- commitmentIndex :: Int
- commitmentArity :: Int
- proposalIndex :: Int
- proposalArity :: Int
- newtype RefundReason = RefundReason {
- refundReasonText :: String
- data RefundComparison
- withdrawRefundAddress :: RefundReason
- encodeInsertCommitment :: InsertProposal -> WireData
- decodeInsertCommitment :: WireData -> Maybe InsertProposal
- insertRequestShape :: WireData -> Maybe InsertRequestShape
- serialiseInsertCommitment :: InsertProposal -> Maybe ByteString
- deserialiseInsertCommitment :: ByteString -> Maybe InsertProposal
- matchingInsertCommitment :: InsertProposal -> ByteString -> Maybe InsertProposal
- compareRefund :: Integer -> Integer -> RefundComparison
Documentation
data Representative Source #
The representative asset identity inside the initial output.
Constructors
| Representative | |
Fields
| |
Instances
| Show Representative Source # | |
Defined in Naming.Request Methods showsPrec :: Int -> Representative -> ShowS Source # show :: Representative -> String Source # showList :: [Representative] -> ShowS Source # | |
| Eq Representative Source # | |
Defined in Naming.Request Methods (==) :: Representative -> Representative -> Bool Source # (/=) :: Representative -> Representative -> Bool Source # | |
data InitialOutput Source #
The initial output of a proposal.
Constructors
| InitialOutput | |
Fields
| |
Instances
| Show InitialOutput Source # | |
Defined in Naming.Request Methods showsPrec :: Int -> InitialOutput -> ShowS Source # show :: InitialOutput -> String Source # showList :: [InitialOutput] -> ShowS Source # | |
| Eq InitialOutput Source # | |
Defined in Naming.Request Methods (==) :: InitialOutput -> InitialOutput -> Bool Source # (/=) :: InitialOutput -> InitialOutput -> Bool Source # | |
data InsertProposal Source #
The insert proposal carried in the request commitment.
Constructors
| InsertProposal | |
Fields
| |
Instances
| Show InsertProposal Source # | |
Defined in Naming.Request Methods showsPrec :: Int -> InsertProposal -> ShowS Source # show :: InsertProposal -> String Source # showList :: [InsertProposal] -> ShowS Source # | |
| Eq InsertProposal Source # | |
Defined in Naming.Request Methods (==) :: InsertProposal -> InsertProposal -> Bool Source # (/=) :: InsertProposal -> InsertProposal -> Bool Source # | |
data InsertRequestShape Source #
The structural shape the vector records for the request commitment:
{commitmentIndex: 0, commitmentArity: 1, proposalIndex: 0,
proposalArity: 6}.
Constructors
| InsertRequestShape | |
Fields
| |
Instances
| Show InsertRequestShape Source # | |
Defined in Naming.Request Methods showsPrec :: Int -> InsertRequestShape -> ShowS Source # show :: InsertRequestShape -> String Source # showList :: [InsertRequestShape] -> ShowS Source # | |
| Eq InsertRequestShape Source # | |
Defined in Naming.Request Methods (==) :: InsertRequestShape -> InsertRequestShape -> Bool Source # (/=) :: InsertRequestShape -> InsertRequestShape -> Bool Source # | |
newtype RefundReason Source #
Refusal reason, recorded in the vector's comparisonResult.
Constructors
| RefundReason | |
Fields
| |
Instances
| Show RefundReason Source # | |
Defined in Naming.Request Methods showsPrec :: Int -> RefundReason -> ShowS Source # show :: RefundReason -> String Source # showList :: [RefundReason] -> ShowS Source # | |
| Eq RefundReason Source # | |
Defined in Naming.Request Methods (==) :: RefundReason -> RefundReason -> Bool Source # (/=) :: RefundReason -> RefundReason -> Bool Source # | |
data RefundComparison Source #
Outcome of comparing a presented refund against the stored one.
Constructors
| RefundAccepted | |
| RefundRefused RefundReason |
Instances
| Show RefundComparison Source # | |
Defined in Naming.Request Methods showsPrec :: Int -> RefundComparison -> ShowS Source # show :: RefundComparison -> String Source # showList :: [RefundComparison] -> ShowS Source # | |
| Eq RefundComparison Source # | |
Defined in Naming.Request Methods (==) :: RefundComparison -> RefundComparison -> Bool Source # (/=) :: RefundComparison -> RefundComparison -> Bool Source # | |
withdrawRefundAddress :: RefundReason Source #
The reason the contract records when a withdrawal presents a refund address other than the stored one.
encodeInsertCommitment :: InsertProposal -> WireData Source #
Exact mirror of the contract's encodeProposal wrapped in its
single-field constr(0) commitment constructor.
decodeInsertCommitment :: WireData -> Maybe InsertProposal Source #
Exact mirror of the contract's decodeInsertCommitment composed
with decodeProposal: constr(0,[proposal]).
insertRequestShape :: WireData -> Maybe InsertRequestShape Source #
Exact mirror of the contract's insertRequestShape.
serialiseInsertCommitment :: InsertProposal -> Maybe ByteString Source #
Exact mirror of the contract's serialiseInsertRequest at the
commitment level.
deserialiseInsertCommitment :: ByteString -> Maybe InsertProposal Source #
Exact mirror of the contract's deserialiseInsertCommitment.
matchingInsertCommitment :: InsertProposal -> ByteString -> Maybe InsertProposal Source #
Exact mirror of the contract's decodeInsertRequestCommitment: the
bytes decode to a proposal only if that proposal equals the expected
one — a redirected refund decodes fine but never matches the request.
compareRefund :: Integer -> Integer -> RefundComparison Source #
The contract's withdraw-step refund check
(core.mjs: if (d.refund.destination !==
pending.proposal.refundAddress) fail('withdraw-refund-address')),
which vector WR01 records as comparisonResult.