registry/genesis
Genesis: minting a registry’s state token (#157 state-datum-fields).
Responsibility
validateMint is the rule behind the state validator’s Minting mint
redeemer: a registry is booted by minting its one state token, named
after the seed output it consumes, into a state UTxO at the validator’s
own script address whose datum holds the empty trie’s root.
Dependencies
Imports lib (the seed-derived asset name, exact quantity), types and
the Merkle Patricia Forestry library (the empty root). Imported by
state, whose mint handler dispatches Minting here. It imports no
other registry owner: genesis runs no fold.
Assumptions
- The ledger guarantees an input is spent at most once, so consuming the seed makes the minted token name unique to this registry.
- The seven non-root state fields are chosen freely at boot; a fold, not genesis, keeps them fixed afterwards.
Invariants
- Minting succeeds only when the seed is an input, exactly one token of that name is minted under this policy, and the first output is at this script’s address, with an inline state datum whose root is the empty trie’s, and holds that token at quantity exactly one.
- Every failing condition is an
expect: genesis crashes rather than tracing a user-defined reason.
Functions
Genesis (#157 state-datum-fields): the four policies are set here and preserved by
every fold. Boot is permissionless — there is no owner — so the mint
authorizes no particular choice of them; preservation is what gives
them their force, not mint-time approval. The consumer pin and its
width check are gone with consumer.ak.