singular-registry
Safe HaskellNone
LanguageGHC2021

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

Documentation

data Representative Source #

The representative asset identity inside the initial output.

Constructors

Representative 

Fields

Instances

Instances details
Show Representative Source # 
Instance details

Defined in Naming.Request

Methods

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

show :: Representative -> String Source #

showList :: [Representative] -> ShowS Source #

Eq Representative Source # 
Instance details

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

Instances details
Show InitialOutput Source # 
Instance details

Defined in Naming.Request

Methods

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

show :: InitialOutput -> String Source #

showList :: [InitialOutput] -> ShowS Source #

Eq InitialOutput Source # 
Instance details

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

Instances details
Show InsertProposal Source # 
Instance details

Defined in Naming.Request

Methods

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

show :: InsertProposal -> String Source #

showList :: [InsertProposal] -> ShowS Source #

Eq InsertProposal Source # 
Instance details

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

Instances details
Show InsertRequestShape Source # 
Instance details

Defined in Naming.Request

Methods

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

show :: InsertRequestShape -> String Source #

showList :: [InsertRequestShape] -> ShowS Source #

Eq InsertRequestShape Source # 
Instance details

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

Instances details
Show RefundReason Source # 
Instance details

Defined in Naming.Request

Methods

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

show :: RefundReason -> String Source #

showList :: [RefundReason] -> ShowS Source #

Eq RefundReason Source # 
Instance details

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.

Instances

Instances details
Show RefundComparison Source # 
Instance details

Defined in Naming.Request

Methods

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

show :: RefundComparison -> String Source #

showList :: [RefundComparison] -> ShowS Source #

Eq RefundComparison Source # 
Instance details

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.