-
Notifications
You must be signed in to change notification settings - Fork 132
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
Roasbeef
wants to merge
8
commits into
lightninglabs:universe-supply-trees
Choose a base branch
from
Roasbeef:supply-commit-machine
base: universe-supply-trees
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
tapdb: add implementation of supplycommit.CommitmentTracker and supplycommit.StateMachineStore #1508
Roasbeef
wants to merge
8
commits into
lightninglabs:universe-supply-trees
from
Roasbeef:supply-commit-machine
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4778c90
to
d718094
Compare
522c3ee
to
d786104
Compare
d718094
to
1db2104
Compare
d786104
to
af5f8f5
Compare
e67b58f
to
6b99f70
Compare
af5f8f5
to
64516c9
Compare
6b99f70
to
5056daa
Compare
64516c9
to
6e0b6a4
Compare
… 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.
… new spent_by field
…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.
5056daa
to
5c20025
Compare
6e0b6a4
to
aa782c8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.