Skip to content

multi: allow supply commit state machine to accept pending updates during state transition #1609

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

Draft
wants to merge 17 commits into
base: supply-leaf-height-query
Choose a base branch
from

Conversation

Roasbeef
Copy link
Member

In this PR, we update the state machine to accept pending updates during a state transition. This takes a burden off of callers, as they can just continue to send in new events at will without needing to handle the error case.

To achieve this, we add a stage where we explicitly freeze a pending state transition. Once frozen, any other updates will be added as a dangling update (not pointing to a state transition). We then update the state machine to do a new transition where we'll query for dangling updates and bind them to a new state transition in an atomic step. We'll then create a new state transition with these dangling updates.

TODO

  • Update docs and state machine diagram.
  • Additional tests for bind in db, and loop back in state machine

@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from bd5d0b4 to 37f23fa Compare June 18, 2025 23:02
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from 37f23fa to be0a52c Compare June 18, 2025 23:25
@Roasbeef Roasbeef force-pushed the updates-mempool branch 2 times, most recently from cf3e3d5 to 407e826 Compare June 18, 2025 23:57
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from be0a52c to f2a69aa Compare June 18, 2025 23:57
@levmi levmi requested review from ffranr and guggero June 19, 2025 14:51
@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Jun 19, 2025
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from f2a69aa to 93ed469 Compare June 20, 2025 23:49
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from 93ed469 to 633373a Compare June 21, 2025 00:08
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from 633373a to 3ca1517 Compare June 21, 2025 00:12
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from 3ca1517 to 988837b Compare June 21, 2025 00:20
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from 988837b to a9ef139 Compare June 21, 2025 01:22
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from a9ef139 to ca7db9a Compare June 25, 2025 00:27
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from ca7db9a to ec56941 Compare June 25, 2025 01:59
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from ec56941 to 16f9f9a Compare June 26, 2025 22:30
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch from 16f9f9a to 059ed3f Compare June 27, 2025 00:08
Roasbeef added 17 commits July 2, 2025 18:38
In this commit, we add a new method to the SupplyTreeStore that is able
to read out the leaves of a supply tree based on a start and end height.
This will be useful for writing the new syncing state machine and the
sub-system that serves the supply tree syncer.
…sitions

In this commit, we allow dangling updates, as we want to be able to
insert updates not associated with a state transition, then bind them
later. We do this by allowing the transition_id to be NULL, and also
adding a new frozen bool. This bool will be used later on to mark the
point at whicih we'll create danging updates vs adding to the existing
state transition.
This'll allow us to query for all the dangling updates for a given
asset. Without this, if transition_id is NULL, then we can't do a join
to query based on the group key.
We'll use these to properly freze a batch, query for the set of dangling
updates, and also bind the set of dangling updates as well.
…pdates

In this commit, we update the supply update insertion logic to support
dangling updates. To do this, we modify the main routine to:
  * Use an upfront query to determine if a transition exists or not:
     * If not, then we'll just make a new one and add the update.
     * Otherwise we check if it's frozen, if so, then we'll insert a
dangling update.

We also now allow insertions at any state, as we'll also update the main
state machine to allow inserting updates at any state.

With this change, we can always call insert supply updates, and know
that they'll either be added to the current transition, or added as a
dangling update.
After this point, any inserted updates will now be dangling.
… updates

We'll now automatically loop back to the updates pending state if we
have any dangling updates. After the next tick we'll then re run the
main loop to create a new on-chain commitment.
@Roasbeef Roasbeef force-pushed the supply-leaf-height-query branch 2 times, most recently from 5025c8c to acafde1 Compare July 3, 2025 02:20
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