singular-registry
Safe HaskellNone
LanguageGHC2021

Singular.Registry.TrieState

Description

Application proofs for one registry's independently selected state. Unbound selections record observations without promising an atomic ledger snapshot. Coverage is checked from create and reproduced trie-changing roots.

Synopsis

Documentation

newtype StatePolicyId Source #

Constructors

StatePolicyId ByteString 

Instances

Instances details
Show StatePolicyId Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: StatePolicyId -> String Source #

showList :: [StatePolicyId] -> ShowS Source #

Eq StatePolicyId Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

Ord StatePolicyId Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

compare :: StatePolicyId -> StatePolicyId -> Ordering Source #

(<) :: StatePolicyId -> StatePolicyId -> Bool Source #

(<=) :: StatePolicyId -> StatePolicyId -> Bool Source #

(>) :: StatePolicyId -> StatePolicyId -> Bool Source #

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

max :: StatePolicyId -> StatePolicyId -> StatePolicyId Source #

min :: StatePolicyId -> StatePolicyId -> StatePolicyId Source #

data RegistryIdentity Source #

Constructors

RegistryIdentity StatePolicyId AssetName 

Instances

Instances details
Show RegistryIdentity Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: RegistryIdentity -> String Source #

showList :: [RegistryIdentity] -> ShowS Source #

Eq RegistryIdentity Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

Ord RegistryIdentity Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

compare :: RegistryIdentity -> RegistryIdentity -> Ordering Source #

(<) :: RegistryIdentity -> RegistryIdentity -> Bool Source #

(<=) :: RegistryIdentity -> RegistryIdentity -> Bool Source #

(>) :: RegistryIdentity -> RegistryIdentity -> Bool Source #

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

max :: RegistryIdentity -> RegistryIdentity -> RegistryIdentity Source #

min :: RegistryIdentity -> RegistryIdentity -> RegistryIdentity Source #

newtype SessionId #

Constructors

SessionId Text 

Instances

Instances details
Show SessionId # 
Instance details

Defined in Singular.Registry.Evidence

Methods

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

show :: SessionId -> String Source #

showList :: [SessionId] -> ShowS Source #

Eq SessionId # 
Instance details

Defined in Singular.Registry.Evidence

Methods

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

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

Ord SessionId # 
Instance details

Defined in Singular.Registry.Evidence

Methods

compare :: SessionId -> SessionId -> Ordering Source #

(<) :: SessionId -> SessionId -> Bool Source #

(<=) :: SessionId -> SessionId -> Bool Source #

(>) :: SessionId -> SessionId -> Bool Source #

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

max :: SessionId -> SessionId -> SessionId Source #

min :: SessionId -> SessionId -> SessionId Source #

data SessionBinding #

Constructors

Unbound 
Bound Integer ByteString 

Instances

Instances details
Show SessionBinding # 
Instance details

Defined in Singular.Registry.Evidence

Methods

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

show :: SessionBinding -> String Source #

showList :: [SessionBinding] -> ShowS Source #

Eq SessionBinding # 
Instance details

Defined in Singular.Registry.Evidence

Methods

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

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

data StatePoint Source #

Instances

Instances details
Show StatePoint Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: StatePoint -> String Source #

showList :: [StatePoint] -> ShowS Source #

Eq StatePoint Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data TrieSelection Source #

Instances

Instances details
Show TrieSelection Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: TrieSelection -> String Source #

showList :: [TrieSelection] -> ShowS Source #

Eq TrieSelection Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data TrieState (m :: Type -> Type) Source #

Constructors

TrieState 

Fields

data TrieSnapshot (m :: Type -> Type) Source #

trieIdentity :: forall (m :: Type -> Type). TrieSnapshot m -> RegistryIdentity Source #

triePoint :: forall (m :: Type -> Type). TrieSnapshot m -> StatePoint Source #

trieRoot :: forall (m :: Type -> Type). TrieSnapshot m -> Root Source #

trieCoverage :: forall (m :: Type -> Type). TrieSnapshot m -> CompleteFromCreate Source #

trieLineage :: forall (m :: Type -> Type). TrieSnapshot m -> Maybe PublicLineage Source #

The public lineage the snapshot was replayed from, or nothing for a fixture snapshot.

leafAt :: TrieSnapshot m -> ByteString -> m (Either TrieFailure Leaf) Source #

membership :: TrieSnapshot m -> ByteString -> Leaf -> m (Either TrieFailure MembershipProof) Source #

speculateEdges :: TrieSnapshot m -> NonEmpty (ByteString, Integer) -> m (Either TrieFailure SpeculativeWalk) Source #

data Leaf Source #

Constructors

Unknown 
Absent 
Active 
Terminal 

Instances

Instances details
Bounded Leaf Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

minBound :: Leaf Source #

maxBound :: Leaf Source #

Enum Leaf Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

succ :: Leaf -> Leaf Source #

pred :: Leaf -> Leaf Source #

toEnum :: Int -> Leaf Source #

fromEnum :: Leaf -> Int Source #

enumFrom :: Leaf -> [Leaf] Source #

enumFromThen :: Leaf -> Leaf -> [Leaf] Source #

enumFromTo :: Leaf -> Leaf -> [Leaf] Source #

enumFromThenTo :: Leaf -> Leaf -> Leaf -> [Leaf] Source #

Show Leaf Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: Leaf -> String Source #

showList :: [Leaf] -> ShowS Source #

Eq Leaf Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

leafName :: Leaf -> Text Source #

data TrieFailure Source #

Why a registry's trie cannot be served, naming what a person needs to act on it: the registry, the transaction where one is known, and the reason. A backend passes what it knows and never invents the rest.

Constructors

HistoryIncomplete RegistryIdentity (Maybe TxId) Incomplete

The history does not reach the selection from create.

RootDoesNotChain RegistryIdentity (Maybe TxId) Parting

A rebuilt root is not the recorded one, or a recorded root cannot be read.

UndecodableRequest RegistryIdentity (Maybe TxId) Undecodable

A fold's redeemer, actions, state output or edges cannot be read.

WrongRegistry RegistryIdentity (Maybe TxId) Mismatch

The material is another registry's, or not this registry's state.

StaleState RegistryIdentity (Maybe TxId) Staleness

The selection is not the state the trie is served at.

MissingProof RegistryIdentity Missing

No proof can be given.

Instances

Instances details
Show TrieFailure Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: TrieFailure -> String Source #

showList :: [TrieFailure] -> ShowS Source #

Eq TrieFailure Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data Parting Source #

How a rebuilt root parts from the recorded one.

Constructors

RootsPart Root Root

The rebuilt root is not the recorded root: rebuilt, recorded.

UnreadableRoot Text

A recorded root cannot be read; the text says which.

Instances

Instances details
Show Parting Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: Parting -> String Source #

showList :: [Parting] -> ShowS Source #

Eq Parting Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data Incomplete Source #

How a history falls short of the lineage.

Constructors

MissingTransaction

A transaction the lineage spends through is not in the history.

ProviderHistoryFailure HistoryFailure

The acquired provider refused reconstruction; every datum is retained.

UnresolvedInput TxIn

A spent input is resolved neither by the history nor by the map.

ConflictingResolution TxIn

The map resolves an input differently from the transaction that made it.

ConflictingCopies

Two different transactions share one identifier.

NoStateInput

A transaction holds the token but spends no state output and mints none.

ForkedStateOutput TxIn

A state output is spent by two different transactions.

OutsideLineage

A transaction touches the token outside the lineage.

Instances

Instances details
Show Incomplete Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: Incomplete -> String Source #

showList :: [Incomplete] -> ShowS Source #

Eq Incomplete Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data Undecodable Source #

What of a fold cannot be read.

Constructors

UndecodableStateOutput

The state output carries no inline state datum, or is not first.

MissingRedeemer

The state input's spend carries no redeemer.

NotModify

The state input's redeemer is not Modify.

ActionCount Int Int

Actions given and matching requests found differ in number.

EdgeOutOfRange Integer

An edge outside the seven the registry defines.

UnreadableRecord Text

A local record the history is read from cannot be read; the text says what.

Instances

Instances details
Show Undecodable Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: Undecodable -> String Source #

showList :: [Undecodable] -> ShowS Source #

Eq Undecodable Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data Mismatch Source #

How the material differs from the selected registry.

Constructors

SelectionNotState

The output read as the state does not hold exactly the registry's token.

CreateMint

create does not mint exactly one token under Minting(seed).

SeedNotSpent

create does not spend its seed.

SeedName

The token's name is not assetName(seed).

CreateOutput

create's first output is not the state address holding the token.

OtherRegistry RegistryIdentity

The material names this other registry.

UnknownRegistry

Nothing is held for the registry.

Instances

Instances details
Show Mismatch Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: Mismatch -> String Source #

showList :: [Mismatch] -> ShowS Source #

Eq Mismatch Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data Staleness Source #

How the selection differs from the state the trie is served at.

Constructors

StaleRoot Root Root

The selection's root is not the root at its output: selected, at the output.

StaleSelection TrieSelection TrieSelection

The selection is not the one held: selected, held.

StaleOutput TxIn TxIn

The selected output is not the output the history makes: selected, made.

NoSelection

No selection has been made, or the live state could not be read.

Instances

Instances details
Show Staleness Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: Staleness -> String Source #

showList :: [Staleness] -> ShowS Source #

Eq Staleness Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data Missing Source #

What no proof can be given for.

Constructors

NoProofFor ByteString

The key no proof binds under the selected root.

NoLocalTrie

No local trie is held for the registry.

Instances

Instances details
Show Missing Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: Missing -> String Source #

showList :: [Missing] -> ShowS Source #

Eq Missing Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

failureRegistry :: TrieFailure -> RegistryIdentity Source #

The registry a refusal is about.

failureTransaction :: TrieFailure -> Maybe TxId Source #

The transaction a refusal is about, where one is known.

trieFailureName :: TrieFailure -> Text Source #

The refusal's name, as a command prints it.

trieFailureFields :: TrieFailure -> [(Text, Value)] Source #

The receipt field a command prints beside the refusal's name: one trieRefusal object holding the registry, the transaction where one is known, and the cause. Held under one key, it never overwrites a field the command's receipt already carries.

data CompleteFromCreate Source #

Instances

Instances details
Show CompleteFromCreate Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: CompleteFromCreate -> String Source #

showList :: [CompleteFromCreate] -> ShowS Source #

Eq CompleteFromCreate Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data MembershipProof Source #

Instances

Instances details
Show MembershipProof Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: MembershipProof -> String Source #

showList :: [MembershipProof] -> ShowS Source #

Eq MembershipProof Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

verifyNonMembership :: NonMembershipProof -> Root -> ByteString -> Bool Source #

The proof's key is the one the backend actually queried. Its constructor is private; changing either the requested key or selected root fails.

data PublicLineage Source #

A replayed registry's public lineage: the transaction that minted its state token, every fold from create to the selection in chain order, and the distinct keys the applied updates named, ascending.

Constructors

PublicLineage 

Fields

Instances

Instances details
Show PublicLineage Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: PublicLineage -> String Source #

showList :: [PublicLineage] -> ShowS Source #

Eq PublicLineage Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data SpeculativeWalk Source #

Instances

Instances details
Show SpeculativeWalk Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: SpeculativeWalk -> String Source #

showList :: [SpeculativeWalk] -> ShowS Source #

Eq SpeculativeWalk Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data CreateRecord Source #

Constructors

CreateRecord RegistryIdentity TxIn 

Instances

Instances details
Show CreateRecord Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: CreateRecord -> String Source #

showList :: [CreateRecord] -> ShowS Source #

Eq CreateRecord Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data ObservedFold Source #

Constructors

ObservedFold TrieSelection TrieSelection (NonEmpty (ByteString, Integer)) 

Instances

Instances details
Show ObservedFold Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: ObservedFold -> String Source #

showList :: [ObservedFold] -> ShowS Source #

Eq ObservedFold Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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

data TrieObservation Source #

Completed operations, emitted by the same engine that returned their values or persisted their accepted nodes.

Instances

Instances details
Show TrieObservation Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

show :: TrieObservation -> String Source #

showList :: [TrieObservation] -> ShowS Source #

Eq TrieObservation Source # 
Instance details

Defined in Singular.Registry.TrieState.Types

Methods

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

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