singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.State.Lineage

Description

The chain commits a registry's trie by its root only. This module rebuilds the trie itself from the transactions that moved the registry's state token since its genesis, so a folder needs nothing from the person who booked.

The lineage is read in the order the history gives it, creator before spender. The genesis mints the token under the state policy with the seed in its redeemer, spends that seed and writes the empty root; each fold spends the current state output with the redeemer of a fold and writes the root of the trie with its keys. A transaction whose bytes say it failed its scripts spent only its collateral and is never in the lineage. After every fold the rebuilt root must equal the root in the new state output, wherever in the transaction that output sits.

Synopsis

Documentation

data Replayed Source #

A replay that reached the selected state output from the genesis.

Constructors

Replayed 

Fields

Instances

Instances details
Show Replayed Source # 
Instance details

Defined in Singular.State.Lineage

Methods

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

show :: Replayed -> String Source #

showList :: [Replayed] -> ShowS Source #

Eq Replayed Source # 
Instance details

Defined in Singular.State.Lineage

Methods

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

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

replayRegistry :: Monad m => Session w m -> TrieSelection -> m (Either TrieFailure (Replayed, MPFInMemoryDB)) Source #

Rebuild the registry's trie from the history of its state token up to the selected state output, and check every root on the way against the root the chain recorded.

registryTrieState :: forall (m :: Type -> Type) w. Monad m => Session w m -> TrieState m Source #

The registry's trie as a capability, for the registries of this line.

registryAsset :: RegistryIdentity -> Maybe (PolicyID, AssetName) Source #

The state token of a registry as a ledger asset, when its policy is a script hash.