Skip to content

Commit 1c80299

Browse files
committed
Use pending flashblocks state for bundle metering
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.
1 parent a2ca31d commit 1c80299

File tree

13 files changed

+227
-103
lines changed

13 files changed

+227
-103
lines changed

Cargo.lock

Lines changed: 37 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ base-reth-transaction-tracing = { path = "crates/transaction-tracing" }
4747

4848
# base/tips
4949
# Note: default-features = false avoids version conflicts with reth's alloy/op-alloy dependencies
50-
tips-core = { git = "https://github.com/base/tips", rev = "e59327bec565808e0505d3fb3a64749dfc61a41a", default-features = false }
50+
tips-core = { git = "https://github.com/base/tips", rev = "86b275c0fd63226c3fb85ac5512033f99b67d0f5", default-features = false }
5151

5252
# reth
5353
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
@@ -79,6 +79,7 @@ reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
7979
# revm
8080
revm = { version = "29.0.0", default-features = false }
8181
revm-bytecode = { version = "6.2.2", default-features = false }
82+
revm-database = { version = "7.0.5", default-features = false }
8283

8384
# alloy
8485
alloy-primitives = { version = "1.3.1", default-features = false, features = [

crates/flashblocks-rpc/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ reth-primitives.workspace = true
2929
reth-primitives-traits.workspace = true
3030
reth-exex.workspace = true
3131

32+
# revm
33+
revm-database.workspace = true
34+
3235
# alloy
3336
alloy-primitives.workspace = true
3437
alloy-eips.workspace = true

0 commit comments

Comments
 (0)