singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.Registry.Types

Description

The caller-importable surface of the registry wire: every datum, redeemer, domain type, edge constant and helper that used to live in this module, re-exported unchanged from the five focused owners of the Singular.Registry.Wire family that now hold each definition beside its encoding instances. The constructors, selectors, strictness and ToData/FromData/UnsafeFromData encodings are byte-identical to the single-module era; existing callers keep importing this facade and should continue to. See the wire guide (Singular.Registry.Wire.Primitive and its siblings) for who owns what and the dependency direction between the owners.

Synopsis

On-chain datum/redeemer types

data CageDatum Source #

Cage datum: either a pending request or a token state. Matches Aiken types/CageDatum.

Constructors

RequestDatum !OnChainRequest

A pending operation request (Constr 0)

StateDatum !OnChainTokenState

Current token state (Constr 1)

AbsentCustody !ByteString

The cage's own custody of an absent token (Constr 2, #157 absent-custody-datum; appended, so 0 and 1 never move): the address the inserter named for the refund. The registry key is the sole non-ADA asset carried by the output.

Instances

Instances details
Show CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

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

show :: CageDatum -> String Source #

showList :: [CageDatum] -> ShowS Source #

Eq CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

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

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

FromData CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

fromBuiltinData :: BuiltinData -> Maybe CageDatum

ToData CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

toBuiltinData :: CageDatum -> BuiltinData

UnsafeFromData CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

unsafeFromBuiltinData :: BuiltinData -> CageDatum

data MintRedeemer Source #

Minting redeemer. Matches Aiken types/MintRedeemer.

The seed OutputReference that authorizes a fresh mint and derives the asset name is carried by the redeemer because the state validator is global and unparameterized.

Constructors

Minting !OnChainTxOutRef

Mint a new cage token (Constr 0)

Migrating !Migration

Migrate from old validator (Constr 1)

Burning !OnChainTokenId

Burn a cage token (Constr 2)

Instances

Instances details
Show MintRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

show :: MintRedeemer -> String Source #

showList :: [MintRedeemer] -> ShowS Source #

Eq MintRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

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

FromData MintRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

fromBuiltinData :: BuiltinData -> Maybe MintRedeemer

ToData MintRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

toBuiltinData :: MintRedeemer -> BuiltinData

UnsafeFromData MintRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

unsafeFromBuiltinData :: BuiltinData -> MintRedeemer

data Migration Source #

Migration parameters. Matches Aiken types/Migration.

Constructors

Migration 

Fields

Instances

Instances details
Show Migration Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

show :: Migration -> String Source #

showList :: [Migration] -> ShowS Source #

Eq Migration Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

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

FromData Migration Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

fromBuiltinData :: BuiltinData -> Maybe Migration

ToData Migration Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

toBuiltinData :: Migration -> BuiltinData

UnsafeFromData Migration Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

unsafeFromBuiltinData :: BuiltinData -> Migration

data UpdateRedeemer Source #

Spending redeemer. Matches Aiken types/UpdateRedeemer.

Sweep stateRef is refused for every party (operator ruling NOTE-028/A-003); the constructor stays for the wire shape.

Constructors

End

End the token (Constr 0)

Contribute !OnChainTxOutRef

Link a request to a state UTxO (Constr 1)

Modify ![RequestAction]

Process requests with mixed actions (Constr 2)

Retract !OnChainTxOutRef

Reclaim a pending request (Constr 3)

Sweep !OnChainTxOutRef

Reclaim a non-legitimate UTxO at the cage's address (Constr 4). Owner-signed.

Instances

Instances details
Show UpdateRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

show :: UpdateRedeemer -> String Source #

showList :: [UpdateRedeemer] -> ShowS Source #

Eq UpdateRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

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

FromData UpdateRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

fromBuiltinData :: BuiltinData -> Maybe UpdateRedeemer

ToData UpdateRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

toBuiltinData :: UpdateRedeemer -> BuiltinData

UnsafeFromData UpdateRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

unsafeFromBuiltinData :: BuiltinData -> UpdateRedeemer

data RequestAction Source #

Per-request action in a Modify redeemer. Matches Aiken types/RequestAction.

Constructors

Update ![ProofStep]

Update with Merkle proof (Constr 0)

Rejected

Reject expired request (Constr 1)

Instances

Instances details
Show RequestAction Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

show :: RequestAction -> String Source #

showList :: [RequestAction] -> ShowS Source #

Eq RequestAction Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

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

FromData RequestAction Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

fromBuiltinData :: BuiltinData -> Maybe RequestAction

ToData RequestAction Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

toBuiltinData :: RequestAction -> BuiltinData

UnsafeFromData RequestAction Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

unsafeFromBuiltinData :: BuiltinData -> RequestAction

On-chain domain types

newtype OnChainTokenId Source #

On-chain token identifier (asset name as raw bytes). Matches Aiken lib/TokenId.

Constructors

OnChainTokenId 

Fields

Instances

Instances details
Show OnChainTokenId Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

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

show :: OnChainTokenId -> String Source #

showList :: [OnChainTokenId] -> ShowS Source #

Eq OnChainTokenId Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

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

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

FromData OnChainTokenId Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

fromBuiltinData :: BuiltinData -> Maybe OnChainTokenId

ToData OnChainTokenId Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

toBuiltinData :: OnChainTokenId -> BuiltinData

UnsafeFromData OnChainTokenId Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

unsafeFromBuiltinData :: BuiltinData -> OnChainTokenId

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 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.

newtype OnChainRoot Source #

On-chain MPF root hash (raw bytes).

Constructors

OnChainRoot 

Fields

Instances

Instances details
Show OnChainRoot Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

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

show :: OnChainRoot -> String Source #

showList :: [OnChainRoot] -> ShowS Source #

Eq OnChainRoot Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

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

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

FromData OnChainRoot Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

fromBuiltinData :: BuiltinData -> Maybe OnChainRoot

ToData OnChainRoot Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

toBuiltinData :: OnChainRoot -> BuiltinData

UnsafeFromData OnChainRoot Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

unsafeFromBuiltinData :: BuiltinData -> OnChainRoot

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.

data OnChainTokenState Source #

On-chain token state. Matches Aiken types/State (#157 state-datum-fields: eight fields, replacing the six). consumer_pin is deleted with the pinned consumer; representative_policy is renamed active_policy; the application, absent and terminal policies are new. All four policies are set at genesis and preserved by every Modify.

Constructors

OnChainTokenState 

Fields

  • stateRoot :: !OnChainRoot

    Current Merkle root of the token's trie

  • stateMaxFee :: !Integer

    Oracle tip (lovelace) charged per request

  • stateProcessTime :: !Integer

    Oracle processing window duration (ms)

  • stateRetractTime :: !Integer

    Requester retract window duration (ms)

  • stateAppPolicy :: !BuiltinByteString

    The application policy that certifies requests (#157 tree-edge-admission-by-approval): a request whose operation changes the trie is folded only if its UTxO carries one asset under this policy whose name is the request's approval binding.

  • stateActivePolicy :: !BuiltinByteString

    The policy that mints the ACTIVE token (renamed from the representative policy). Under it the asset name is the registry key itself (#157 token-name-is-registry-key).

  • stateAbsentPolicy :: !BuiltinByteString

    The policy that mints the ABSENT token, held in the cage's own custody beside the inserter's refund address.

  • stateTerminalPolicy :: !BuiltinByteString

    The policy that mints the TERMINAL token: a name is over, forever.

Instances

Instances details
Show OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

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

show :: OnChainTokenState -> String Source #

showList :: [OnChainTokenState] -> ShowS Source #

Eq OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

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

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

FromData OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

fromBuiltinData :: BuiltinData -> Maybe OnChainTokenState

ToData OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

toBuiltinData :: OnChainTokenState -> BuiltinData

UnsafeFromData OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

unsafeFromBuiltinData :: BuiltinData -> OnChainTokenState

data OnChainTxOutRef Source #

On-chain output reference. Matches Aiken cardano/transaction/OutputReference.

Constructors

OnChainTxOutRef 

Fields

  • txOutRefId :: !BuiltinByteString

    Transaction hash (32 bytes)

  • txOutRefIdx :: !Integer

    Output index within the transaction

Instances

Instances details
Show OnChainTxOutRef Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

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

show :: OnChainTxOutRef -> String Source #

showList :: [OnChainTxOutRef] -> ShowS Source #

Eq OnChainTxOutRef Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

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

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

FromData OnChainTxOutRef Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

fromBuiltinData :: BuiltinData -> Maybe OnChainTxOutRef

ToData OnChainTxOutRef Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

toBuiltinData :: OnChainTxOutRef -> BuiltinData

UnsafeFromData OnChainTxOutRef Source # 
Instance details

Defined in Singular.Registry.Wire.Primitive

Methods

unsafeFromBuiltinData :: BuiltinData -> OnChainTxOutRef

Proof steps (Aiken MPF proof encoding)

data ProofStep Source #

A single step in an MPF Merkle proof, matching the Aiken ProofStep type from aiken-lang/merkle-patricia-forestry.

Constructors

Branch

Branch step (Constr 0)

Fields

  • branchSkip :: !Integer

    Number of shared nibbles to skip

  • branchNeighbors :: !ByteString

    Concatenated neighbor hashes (4 x 32 bytes)

Fork

Fork step (Constr 1)

Fields

Leaf

Leaf step (Constr 2)

Fields

  • leafSkip :: !Integer

    Number of shared nibbles to skip

  • leafKey :: !ByteString

    Remaining key suffix at the leaf

  • leafValue :: !ByteString

    Value hash stored at the leaf

Instances

Instances details
Show ProofStep Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

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

show :: ProofStep -> String Source #

showList :: [ProofStep] -> ShowS Source #

Eq ProofStep Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

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

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

FromData ProofStep Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

fromBuiltinData :: BuiltinData -> Maybe ProofStep

ToData ProofStep Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

toBuiltinData :: ProofStep -> BuiltinData

UnsafeFromData ProofStep Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

unsafeFromBuiltinData :: BuiltinData -> ProofStep

data Neighbor Source #

Neighbor node in a fork proof step.

Constructors

Neighbor 

Fields

  • neighborNibble :: !Integer

    Hex digit (0-15) identifying the fork branch

  • neighborPrefix :: !ByteString

    Common prefix nibbles of the neighbor subtree

  • neighborRoot :: !ByteString

    Merkle root hash of the neighbor subtree

Instances

Instances details
Show Neighbor Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

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

show :: Neighbor -> String Source #

showList :: [Neighbor] -> ShowS Source #

Eq Neighbor Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

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

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

FromData Neighbor Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

fromBuiltinData :: BuiltinData -> Maybe Neighbor

ToData Neighbor Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

toBuiltinData :: Neighbor -> BuiltinData

UnsafeFromData Neighbor Source # 
Instance details

Defined in Singular.Registry.Wire.Proof

Methods

unsafeFromBuiltinData :: BuiltinData -> Neighbor

State helpers

stateActivePolicyBytes :: OnChainTokenState -> ByteString Source #

The active-token policy as plain bytes (issue #77 E-001, renamed by #157 state-datum-fields): unwraps the BuiltinByteString for hex comparison in verifiers. Named for the field it reads — no alias of the representative policy survives.

stateAppPolicyBytes :: OnChainTokenState -> ByteString Source #

The application policy as plain bytes (#157 tree-edge-admission-by-approval).

stateAbsentPolicyBytes :: OnChainTokenState -> ByteString Source #

The absent-token policy as plain bytes (#157 mint-matches-edge-deltas).

stateTerminalPolicyBytes :: OnChainTokenState -> ByteString Source #

The terminal-token policy as plain bytes (#157 mint-matches-edge-deltas).

Pinned-hook consumer redeemer (NOTE-021)

data ConsumerRedeemer Source #

Pinned-hook consumer redeemer (NOTE-021): a nullary hook. The consumer authenticates the batch from the transaction's own evidence (spent state, request datums, naming claims, mint field) — the redeemer carries nothing because nothing caller-supplied is trusted. Encodes as Constr 0 [].

Constructors

Hook 

Instances

Instances details
Show ConsumerRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

show :: ConsumerRedeemer -> String Source #

showList :: [ConsumerRedeemer] -> ShowS Source #

Eq ConsumerRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

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

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

ToData ConsumerRedeemer Source # 
Instance details

Defined in Singular.Registry.Wire.Redeemer

Methods

toBuiltinData :: ConsumerRedeemer -> BuiltinData