Skip to content

Conversation

@niran
Copy link
Contributor

@niran niran commented Jan 11, 2026

Summary

Add timing measurement for state root calculation in bundle metering. This provides visibility into the I/O cost of computing state roots, which is critical for understanding the full execution costs of a given bundle.

Key changes:

  • Add MeterBundleOutput struct to replace tuple return type with named fields
  • Add state_root_time_us field to measure state root calculation time separately
  • Add total_time_us field for overall metering time (includes tx execution + state root)
  • Calculate state root after transaction execution using hashed_post_state and state_root_with_updates
  • Add meter_bundle_state_root_time_invariant test to verify timing consistency

Test plan

  • cargo test -p base-reth-metering - all 20 tests pass
  • cargo +nightly fmt --all -- --check - passes
  • cargo +nightly clippy --all-targets --all-features -- -D warnings - passes

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.
@niran niran force-pushed the niran/meter-state-root-timing branch from fda8f6c to c53ce7c Compare January 11, 2026 07:30
@niran niran force-pushed the niran/metering-test-harness branch from 8695f6f to fa14653 Compare January 12, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants