-
Notifications
You must be signed in to change notification settings - Fork 110
feat(metering): use pending flashblocks state for bundle metering #387
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
da51cc3 to
75e8eaf
Compare
994978c to
13ef63c
Compare
13ef63c to
6817f24
Compare
75e8eaf to
0cba54d
Compare
6817f24 to
8dadef0
Compare
0cba54d to
8bca81f
Compare
724a0c9 to
be1c7a5
Compare
8bca81f to
25c0260
Compare
danyalprout
reviewed
Jan 13, 2026
Collaborator
✅ Heimdall Review Status
|
be1c7a5 to
f1a198a
Compare
Add support for metering bundles against the current flashblocks pending state instead of just the canonical block state. This ensures that bundle simulations see the same state that will be used when the bundle is actually included. Key changes: - Add FlashblocksState struct containing Cache and BundleState - Update meter_bundle to accept optional FlashblocksState parameter - Implement three-layer database architecture in metering - Add integration tests for flashblock state visibility
f1a198a to
3e17305
Compare
refcell
approved these changes
Jan 13, 2026
Contributor
refcell
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 looks good to me pending @danyalprout
danyalprout
approved these changes
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.
thank you! this looks great
niran
added a commit
that referenced
this pull request
Jan 13, 2026
…ration Add new metering tests to verify the metering state root PR stack features: - meter_bundle_with_transaction: Meters a real signed transaction and verifies gas usage, execution time, and result fields - meter_bundle_flashblock_index: Verifies that state_flashblock_index is returned when metering uses flashblocks state - meter_bundle_state_root_timing: Verifies state root timing with ETH transfer - meter_bundle_state_root_timing_simulator: Verifies state root timing with Simulator contract for more meaningful results Adds Simulator contract integration for controlled resource usage testing: - Configurable storage creation (gas pressure) - Configurable account creation (state root time pressure) New CLI argument: - --simulator: Address of deployed Simulator contract These tests exercise the new MeterBundleResponse fields added in the metering state root PR stack: - state_flashblock_index (from PR #387) - state_root_time_us (from PR #349)
niran
added a commit
that referenced
this pull request
Jan 13, 2026
…ration Add new metering tests to verify the metering state root PR stack features: - meter_bundle_with_transaction: Meters a real signed transaction and verifies gas usage, execution time, and result fields - meter_bundle_flashblock_index: Verifies that state_flashblock_index is returned when metering uses flashblocks state - meter_bundle_state_root_timing: Verifies state root timing with ETH transfer - meter_bundle_state_root_timing_simulator: Verifies state root timing with Simulator contract for more meaningful results Adds Simulator contract integration for controlled resource usage testing: - Configurable storage creation (gas pressure) - Configurable account creation (state root time pressure) New CLI argument: - --simulator: Address of deployed Simulator contract These tests exercise the new MeterBundleResponse fields added in the metering state root PR stack: - state_flashblock_index (from PR #387) - state_root_time_us (from PR #349)
niran
added a commit
that referenced
this pull request
Jan 13, 2026
…ration Add new metering tests to verify the metering state root PR stack features: - meter_bundle_with_transaction: Meters a real signed transaction and verifies gas usage, execution time, and result fields - meter_bundle_flashblock_index: Verifies that state_flashblock_index is returned when metering uses flashblocks state - meter_bundle_state_root_timing: Verifies state root timing with ETH transfer - meter_bundle_state_root_timing_simulator: Verifies state root timing with Simulator contract for more meaningful results Adds Simulator contract integration for controlled resource usage testing: - Configurable storage creation (gas pressure) - Configurable account creation (state root time pressure) New CLI argument: - --simulator: Address of deployed Simulator contract These tests exercise the new MeterBundleResponse fields added in the metering state root PR stack: - state_flashblock_index (from PR #387) - state_root_time_us (from PR #349)
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
Enable bundle metering to use the current pending flashblocks state instead of just the canonical block state. This ensures that bundle simulations see the same state that will be used when the bundle is actually included in a flashblock.
Changes
Metering Crate
PendingStatestruct containingBundleStateand optionalPendingTrieInput. Updatemeter_bundleto accept an optionalPendingStateparameter. Usewith_bundle_prestate()to layer pending flashblock state on top of canonical state.MeteringApiImplto integrate with flashblocks API. Get pending blocks state and pass it tometer_bundle. Includestate_flashblock_indexin response.MeteringExtensionto acceptFlashblocksConfigfor state access.PendingStateandPendingTrieInput.Flashblocks Crate
Defaultimpl forFlashblocksState.Clonederive toFlashblocksConfig.Architecture
Test Plan
cargo +nightly clippypassescargo +nightly fmtpasses