singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.Registry.Wire.Request

Description

What a registry request names and when its age allows acting on it: the seven-admitted-edges row-index edge vocabulary, the request datum with its codec, and the accept/retract/reject phase classification. Reads only Singular.Registry.Wire.Primitive; nothing here is importable by a caller — the public surface is the Singular.Registry.Types facade.

Synopsis

On-chain domain types

type Edge = Integer Source #

The seven-admitted-edges row index a request names (#183, Lean Request.edge, Aiken lib/edgeInsertAbsent … edgeWitnessTerminal).

An edge names its own leaf bytes, so no value bytes travel with a request and an illegal value-byte shape is not expressible:

0  insertAbsent     insert 0x00
1  insertActive     insert 0x01
2  updateActive     update 0x00 -> 0x01
3  updateTerminal   update 0x01 -> 0x02
4  deleteAbsent     delete 0x00
5  deleteActive     delete 0x01
6  witnessTerminal  read   0x02

It is a plain Integer, exactly as it is a plain Int on chain, so a tag outside 0..6 can still be encoded and sent — which is what the cage's edge-inadmissible refusal is there to answer, and what a row that exercises that refusal needs to be able to build.

edgeName :: Edge -> String Source #

The name of an admitted edge, for diagnostics and receipts.

data OnChainRequest Source #

On-chain request to modify a token's trie. Matches Aiken types/Request.

Constructors

OnChainRequest 

Fields

  • requestToken :: !OnChainTokenId

    Token whose trie is being modified

  • requestOwner :: !BuiltinByteString

    Payment key hash of the requester (28 bytes)

  • requestKey :: !ByteString

    Trie key to operate on

  • requestEdge :: !Edge

    The seven-admitted-edges row index this request names (#183). The edge names the trie move and its leaf bytes; no value bytes travel here.

  • requestDeposit :: !Integer

    The deposit (lovelace) the request rides with, over and above the tip. Must equal the request output's lovelace less state.tip at fold time; the fold returns it to the destination.

  • requestSubmittedAt :: !Integer

    POSIX time (ms) when the request was submitted

  • requestDestination :: !RequestDestination

    Where this request's minted token goes, and the inline datum the receiving output must carry, or none for a datum-less output (#157 request-destination-binding, appended last; #419: the request carries the datum itself, so any party can build the fold from the chain). Encoded as a two-element list, exactly as Aiken encodes a tuple, the datum as Aiken's Option. For edge 0 the address component is the refund address.

Instances

Instances details
Show OnChainRequest Source # 
Instance details

Defined in Singular.Registry.Wire.Request

Methods

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

show :: OnChainRequest -> String Source #

showList :: [OnChainRequest] -> ShowS Source #

Eq OnChainRequest Source # 
Instance details

Defined in Singular.Registry.Wire.Request

Methods

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

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

FromData OnChainRequest Source # 
Instance details

Defined in Singular.Registry.Wire.Request

Methods

fromBuiltinData :: BuiltinData -> Maybe OnChainRequest

ToData OnChainRequest Source # 
Instance details

Defined in Singular.Registry.Wire.Request

Methods

toBuiltinData :: OnChainRequest -> BuiltinData

UnsafeFromData OnChainRequest Source # 
Instance details

Defined in Singular.Registry.Wire.Request

Methods

unsafeFromBuiltinData :: BuiltinData -> OnChainRequest

type RequestDestination = (ByteString, Maybe Data) Source #

Where a request's minted token goes, and the datum the receiving output must carry, or none (#419): what the request carries on the chain.

Request phase

data RequestPhase Source #

The exit a resuming client chooses for one of its pending requests at a chain tip.

It follows the windows of onchainvalidatorsshared.ak: an update is folded only while the tip is before submitted_at + process_time (phase 1), and the owner may retract only before submitted_at + process_time + retract_time (phase 2). After both the client rejects (phase 3). This is the client's choice, not the validator's rule for a reject: a reject carries no admission and is accepted in every window (#320).

Instances

Instances details
Show RequestPhase Source # 
Instance details

Defined in Singular.Registry.Wire.Request

Methods

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

show :: RequestPhase -> String Source #

showList :: [RequestPhase] -> ShowS Source #

Eq RequestPhase Source # 
Instance details

Defined in Singular.Registry.Wire.Request

Methods

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

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

requestPhase Source #

Arguments

:: SlotNo

Last slot an accept fold can carry (process deadline).

-> SlotNo

Last slot a retract can carry (retract deadline).

-> SlotNo

The live tip.

-> RequestPhase 

Classify a request from its two boundary slots and the live tip.

The boundaries are the slots the builders can express: the accept fold's validity upper bound is the process deadline slot, the retract's is the retract deadline slot. The comparison is strict, so a phase is chosen only while the tip is inside what that phase's builder can still build — a window already behind the tip never classifies into the phase that would build it.