-
Notifications
You must be signed in to change notification settings - Fork 110
fix(flashblocks): use correct database layering for state tracking #386
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
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
51db7aa to
c9302b7
Compare
da51cc3 to
75e8eaf
Compare
75e8eaf to
0cba54d
Compare
Measure and report time spent calculating state root separately from transaction execution, enabling better performance analysis: - Add MeterBundleOutput struct with state_root_time_us field - Calculate state root after transaction execution using merge_transitions - Track state root calculation time separately from total execution time - Update RPC to log state_root_time_us in metering response - Add meter_bundle_state_root_time_invariant test The state root is computed by calling hashed_post_state on the bundle and then state_root_with_updates on the state provider.
0cba54d to
8bca81f
Compare
c9302b7 to
8319f27
Compare
danyalprout
reviewed
Jan 13, 2026
Collaborator
danyalprout
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good to me, I would like @meyer9 to take a look too
Fix the database layering in flashblocks processor to use State<CacheDB<...>> instead of the incorrect CacheDB<State<...>>. The correct layering ensures that State's bundle tracking captures all writes properly. Key changes: - Add bundle_state to PendingBlocks for tracking accumulated state changes - Change processor to wrap CacheDB with State (not vice versa) - Add with_bundle_prestate() to accumulate state across flashblocks - Add layering verification tests
meyer9
previously approved these changes
Jan 13, 2026
Contributor
meyer9
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG! nice simplification
8bca81f to
25c0260
Compare
Contributor
Author
|
Moved a renaming to the next PR that it was intended for |
Collaborator
✅ Heimdall Review Status
|
danyalprout
approved these changes
Jan 13, 2026
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.
Summary
Fix the database layering in flashblocks processor to use
State<CacheDB<...>>instead of the incorrectCacheDB<State<...>>. The correct layering ensures that State's bundle tracking captures all writes properly.This is a prerequisite for using pending flashblock state in bundle metering.
Changes
bundle_state: BundleStatefield to track accumulated state changes across flashblocks. Addget_bundle_state()andget_db_cache()methods to expose this state.CacheDB<State<...>>toState<CacheDB<...>>. Addwith_bundle_prestate()to accumulate state across flashblocks. Extract bundle state viamerge_transitions()andtake_bundle().bundle_state_clone_durationandbundle_state_clone_sizemetrics for observability.Why This Matters
With the previous layering (
CacheDB<State<...>>), writes go toCacheDB.cachefirst and State's bundle tracker never sees them. With the correct layering (State<CacheDB<...>>), State intercepts all writes and properly tracks them in its bundle, which is essential for:Test Plan
cargo clippypasses