Skip to content
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

cnidarium: implement deferred commits via StagedWriteBatch #4122

Merged
merged 9 commits into from
Apr 3, 2024

Conversation

noot
Copy link
Collaborator

@noot noot commented Mar 27, 2024

refactor commit into prepare_commit and commit_batch. this allows a StagedWriteBatch to be prepared via prepare_commit and the actual writing the StagedWriteBatch to disk to occur in commit_batch. this allows us to get the root hash of the changes without requiring the data to be fully committed.

closes #4095

@erwanor erwanor self-requested a review March 28, 2024 00:42
@erwanor erwanor added A-node Area: System design and implementation for node software C-enhancement Category: an enhancement to the codebase labels Mar 28, 2024
Copy link
Member

@erwanor erwanor left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on, this is great work and it unlocks a lot of cool things besides 0.38 support. There are a couple things we want to change before merging but overall ACK. I have put together a couple unit tests that I will add before merging, once we're done with review

crates/cnidarium/src/storage.rs Outdated Show resolved Hide resolved
crates/cnidarium/src/storage.rs Outdated Show resolved Hide resolved
crates/cnidarium/src/storage.rs Outdated Show resolved Hide resolved
crates/cnidarium/src/storage.rs Outdated Show resolved Hide resolved
@noot
Copy link
Collaborator Author

noot commented Apr 3, 2024

@erwanor thanks for the review, comments addressed!

@noot noot requested a review from erwanor April 3, 2024 01:58
@erwanor erwanor changed the title refactor(cnidarium): split commit into prepare_commit and commit_batch cnidarium: implement deferred commits via StagedWriteBatch Apr 3, 2024
@erwanor
Copy link
Member

erwanor commented Apr 3, 2024

Added some simple tests scenarios, will merge on green CI. This is really exciting! Thanks again for your work on this.

@erwanor erwanor merged commit 46489d3 into main Apr 3, 2024
7 checks passed
@erwanor erwanor deleted the noot/update-commit branch April 3, 2024 15:14
github-merge-queue bot pushed a commit to astriaorg/astria that referenced this pull request Apr 17, 2024
## Summary

updates the sequencer app to use ABCI v0.38, which replaces
`begin_block`/`deliver_tx`/`end_block` with one call, `finalize_block`.

relevant penumbra PRs:

- update penumbra-tower-trace to re-add instrumentation to the ABCI
methods (done in penumbra-zone/penumbra#4160)
- update cnidarium to be able to get the root hash of the state without
calling `commit` (done in
penumbra-zone/penumbra#4122)

## Background
this was inevitable, also it cleans up the block execution flow inside
the sequencer application. (removed `processed_txs` and
`current_sequencer_block_builder` from the app)

## Changes
- implement `finalize_block`; for the most part, I left the
`begin_block`/`deliver_tx`/`end_block` as they are but called them
inside `finalize_block`
- however the block execution flow is cleaned up as we no longer need to
track how many txs have been delivered (for the commitments) and we can
construct the `SequencerBlock` at the end of `finalize_block` without
needing to track things between calls

## Testing
unit tests 

ran it with cometbft release
[v0.38.6](https://github.com/cometbft/cometbft/releases/tag/v0.38.6)

## Breaking Changelist
- the sequencer app will now only work with a cometbft version that
supports ABCI v0.38

## Related Issues

closes #679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-node Area: System design and implementation for node software C-enhancement Category: an enhancement to the codebase
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

cnidarium: implement deferred commit
2 participants