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

Merged
merged 18 commits into from
Jul 29, 2025

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Jun 18, 2025

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 added enhancement New feature or request supply commit Work on the supply commitment feature, enabling issuers to attest to total asset supply on-chain. supply tree labels Jun 18, 2025
@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 marked this pull request as ready for review July 23, 2025 19:50
@Roasbeef Roasbeef force-pushed the updates-mempool branch 2 times, most recently from 5db6108 to da300cf Compare July 23, 2025 20:43
@Roasbeef Roasbeef requested a review from guggero July 23, 2025 20:43
@Roasbeef
Copy link
Member Author

Removed from draft.

Roasbeef added 14 commits July 23, 2025 15:57
…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.
@guggero guggero changed the base branch from supply-leaf-height-query to main July 25, 2025 04:56
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, LGTM 🎉

@github-project-automation github-project-automation bot moved this from 🏗 In progress to 👀 In review in Taproot-Assets Project Board Jul 29, 2025
@ffranr ffranr added this pull request to the merge queue Jul 29, 2025
Merged via the queue into main with commit 22642c3 Jul 29, 2025
33 of 36 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Taproot-Assets Project Board Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request supply commit Work on the supply commitment feature, enabling issuers to attest to total asset supply on-chain. supply tree
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants