Skip to content

tapdb: add implementation of supplycommit.CommitmentTracker and supplycommit.StateMachineStore #1508

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: universe-supply-trees
Choose a base branch
from

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented May 3, 2025

In this PR, we add a concrete implementation of the two fundamental interfaces that will drive the state machine implemented in #1464.

We start with a state machine on disk for a given group key that also points to the latest supply commitment. When we want to add new elements to the supply tree, we create a new state transition, and then queue pending updates associated with this state transition. Once we've signed and broadcasted the commitment transaction, we then apply the state transition: insert all the updates into the tree, update the state machine to point to that new tree, and finalize the state transition.

See the readme for more details.

@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board May 5, 2025
@Roasbeef Roasbeef force-pushed the supply-commit-machine branch from 4778c90 to d718094 Compare May 5, 2025 22:46
@Roasbeef Roasbeef force-pushed the universe-supply-trees branch 2 times, most recently from 522c3ee to d786104 Compare May 5, 2025 23:04
@Roasbeef Roasbeef force-pushed the supply-commit-machine branch from d718094 to 1db2104 Compare May 5, 2025 23:08
@Roasbeef Roasbeef force-pushed the universe-supply-trees branch from d786104 to af5f8f5 Compare May 5, 2025 23:13
@Roasbeef Roasbeef force-pushed the supply-commit-machine branch 3 times, most recently from e67b58f to 6b99f70 Compare May 5, 2025 23:54
@Roasbeef Roasbeef force-pushed the universe-supply-trees branch from af5f8f5 to 64516c9 Compare May 5, 2025 23:54
@Roasbeef Roasbeef force-pushed the supply-commit-machine branch from 6b99f70 to 5056daa Compare May 6, 2025 01:19
@Roasbeef Roasbeef force-pushed the universe-supply-trees branch from 64516c9 to 6e0b6a4 Compare May 6, 2025 01:19
Roasbeef added 8 commits May 5, 2025 18:27
… tree state machine

In this commit, we add a new migration for the persistence layer of the
supply tree state machine. We track a state machine that points to the
latest supply commitment. We update the supply commit via a new state
transition, which refrerences a series of updates. Once we're ready to
apply, we'll apply the updates, mark the transition as finalized, and
finally update the relevant pointers.

We also make a change to modify mint_anchor_uni_commitments to point to
a supply commitment. This lets us keep track of the set of pre
commitments that aren't yet spent.
…and supplycommit.StateMachineStore

In this commit, we add concrete implementation of both CommitmentTracker and StateMachineStore. This implements the persistence layer for the supply commit state machine. The main method to understand is ApplyStateTransition, as it implements the atomic update of all the various components (tree, state transition, etc) on disk.
@Roasbeef Roasbeef force-pushed the supply-commit-machine branch from 5056daa to 5c20025 Compare May 6, 2025 01:27
@Roasbeef Roasbeef force-pushed the universe-supply-trees branch from 6e0b6a4 to aa782c8 Compare May 6, 2025 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

1 participant