Skip to content

universe/supplycommit: create new state machine responsible for maintaining the supply commitment for an asset #1464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Apr 9, 2025

In this commit, we add a new sub-package to the universe package which adds a new state machine responsible for managing the supply commitment for a given grouped asset.

A supply commitment is a special MS-SMT tree that tracks the total supply of a grouped asset. A supply can be modified by: minting new assets, doing an official burn of some assets, or adding some assets to the ignore proof cache.

To create a supply commitment (for an asset that opts into this), we'll spend the pre-commitment from all past minting batches that have been confirmed on chain. We'll then stage all the pending updates, to create new sub-trees (ignore, burn mint) for the grouped asset. With those trees created, we'll create the new root supply commitment.

With the root supply commitment created, we'll make a new transaction and commit to that using the non spendable script leaf that we use elsewhere to commit to asset IDs for a group key.

During this process, we'll continue to serve the old supply commitments. Only once the supply commitments have been confirmed on disk will we apply all the state transitions on disk. After we apply these state transitions, we'll start to serve the new commitments, and go back to our default state.

See the last commit's readme for more details.

Roasbeef added 7 commits May 2, 2025 19:16
This makes the generator more consistent and useful.
…achine

In this commit, we add the initial set of states for the SupplyCommit
state machine. This will be the primary state machine that'll be used to
stage, then apply updates to the root supply tree as well as the sub
supply trees associated with the root tree.
In this commit, we populate the environment that the state machine will
use. This includes the set of fundamental interfaces (related to
persistence and the new supply trees).
…state machine

In this commit, we build on the two prior commits and add defined state
transitions for the supply commit state machine. We start in a default
state, until we hear about a new update. We'll continue in that state
untli we get a commit tick, at which point we'll enter the main logic of
the state machine.

After a tick, we'll construct the final tree, make a commit transaction
from that, sign it, then write everything to disk. We'll then resume by
broadcasting the commit tx. Once we reecive a confirmation, we'll apply
the state tranition which will update all the relevant state on disk.
These were from a much earlier draft, well before the current design of
the commit state machine.
@Roasbeef Roasbeef force-pushed the asset-commitment-creator branch from 90b04f6 to aaeddf4 Compare May 3, 2025 02:18
@Roasbeef Roasbeef changed the base branch from burn-tree to main May 3, 2025 02:18
@Roasbeef Roasbeef marked this pull request as ready for review May 3, 2025 02:18
@Roasbeef
Copy link
Member Author

Roasbeef commented May 3, 2025

Removed from draft for now. Have unit tests, and additional documentation to commit.

@Roasbeef Roasbeef changed the title Asset commitment creator universe/supplycommit: create new state machine responsible for maintaining the supply commitment for an aseset May 3, 2025
@Roasbeef Roasbeef changed the title universe/supplycommit: create new state machine responsible for maintaining the supply commitment for an aseset universe/supplycommit: create new state machine responsible for maintaining the supply commitment for an asset May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

1 participant