You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integrate flashblocks state into metering to execute bundles on top of
pending flashblock state rather than canonical block state. This ensures
metered gas usage and execution time accurately reflect the effects of
pending transactions (nonces, balances, storage, code changes).
Implementation:
- Add flashblocks-rpc dependency to metering crate
- Update meter_bundle() to accept optional db_cache parameter
- Implement three-layer state architecture:
1. StateProviderDatabase (canonical block base state)
2. CacheDB (applies flashblock pending changes via cache)
3. State wrapper (for EVM builder compatibility)
- Update MeteringApiImpl to accept FlashblocksState
- Get pending blocks and db_cache from flashblocks when available
- Fall back to canonical block state when no flashblocks available
- Update response to include flashblock_index in logs
- Require flashblocks to be enabled for metering RPC
- Update all tests to pass FlashblocksState parameter
The metering RPC now uses the same state as flashblocks eth_call,
ensuring consistent simulation results.
Copy file name to clipboardExpand all lines: crates/metering/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Simulates a bundle of transactions, providing gas usage and execution time metri
11
11
The method accepts a Bundle object with the following fields:
12
12
13
13
-`txs`: Array of signed, RLP-encoded transactions (hex strings with 0x prefix)
14
-
-`block_number`: Target block number for bundle validity (note: simulation always uses the latest available block state)
14
+
-`block_number`: Target block number for bundle validity (note: simulation uses pending flashblocks state when available, otherwise latest canonical block)
15
15
-`min_timestamp` (optional): Minimum timestamp for bundle validity (also used as simulation timestamp if provided)
16
16
-`max_timestamp` (optional): Maximum timestamp for bundle validity
17
17
-`reverting_tx_hashes` (optional): Array of transaction hashes allowed to revert
@@ -26,7 +26,7 @@ The method accepts a Bundle object with the following fields:
26
26
-`coinbaseDiff`: Total gas fees paid
27
27
-`ethSentToCoinbase`: ETH sent directly to coinbase
28
28
-`gasFees`: Total gas fees
29
-
-`stateBlockNumber`: Block number used for state (always the latest available block)
29
+
-`stateBlockNumber`: Block number used for state (latest flashblock if pending flashblocks exist, otherwise latest canonical block)
30
30
-`totalGasUsed`: Total gas consumed
31
31
-`totalExecutionTimeUs`: Total execution time (μs)
0 commit comments