Compare commits

...

8 Commits

Author SHA1 Message Date
rakita
f5008076f6 Bump revm (712dac7a), alloy-evm (b0eb7e6), revm-inspectors (24becc3) 2026-03-23 15:23:08 +01:00
rakita
ff2f857eb0 fix(examples): re-enable custom-beacon-withdrawals with EIP-8037 support
- Update commit_transaction to return GasOutput per new BlockExecutor trait
- Re-add custom-beacon-withdrawals to workspace members
- Fix example to work with revm rakita/state-gas branch
2026-03-20 13:28:54 +01:00
rakita
8d2cf6c408 fix(evm): update precompile cache for EIP-8037 GasTracker
- Rename gas_used to regular_gas_used for clarity with dual-tier gas model
- Update cache calculation to use GasTracker limit() - remaining()
- Update test fixtures to use new PrecompileOutput GasTracker structure
- Fix fixtures URL to use correct stable release for v4.5.0
2026-03-20 13:24:27 +01:00
rakita
1c482a1072 chore: bump revm to eef4f2af 2026-03-20 12:41:23 +01:00
rakita
66eedc5bbd chore: update statetest fixture configuration 2026-03-20 12:38:57 +01:00
rakita
b80c9d34dc chore(tests): update statetest to BAL v5.5.1 fixture
Updates the EEST_TESTS_TAG from v4.5.0 to bal@v5.5.1 to use the latest
BAL (Blockchain Abstraction Layer) fixture from the ethereum/execution-spec-tests
releases.
2026-03-19 15:03:24 +01:00
rakita
60a8fbf819 fix(clippy): make gas_used const function
The state_gas_spent() method is const, so the gas_used() function
can be marked as const as well.
2026-03-19 14:41:54 +01:00
rakita
08a6483ff1 feat(evm): integrate revm rakita/state-gas branch (EIP-8037)
This commit integrates the revm `rakita/state-gas` branch which implements
EIP-8037 State Gas Reservoir Model for two-tier gas accounting.

## Key Changes:

- **Patched all revm libraries** to use commit 3a29466ddd3ea2ef814e4ca47a906e9dba6d0f49
  from origin/rakita/state-gas branch

- **Updated gas tracking APIs**:
  - ExecutionResult now uses ResultGas struct with methods like tx_gas_used()
  - GasTracker replaces simple u64 gas tracking
  - PrecompileOutput now contains GasTracker instead of simple gas value
  - InitialAndFloorGas split into initial_total_gas and initial_state_gas

- **Fixed method signatures**:
  - ExecutionResult.gas_used() → ExecutionResult.tx_gas_used()
  - ResultGas.used() → ResultGas.tx_gas_used() (non-deprecated)
  - Header.gas_used() remains unchanged
  - commit_transaction() now returns GasOutput instead of u64

- **Updated code across multiple crates**:
  - crates/evm/evm/src/execute.rs: gas type conversions
  - crates/transaction-pool/src/validate/eth.rs: initial_total_gas usage
  - crates/engine/tree/src/tree/precompile_cache.rs: gas tracking updates
  - crates/rpc/rpc-eth-api: ExecutionResult method calls
  - crates/rpc/rpc-eth-types: error handling and gas tracking
  - All other affected areas

- **Example updates**:
  - Updated custom-evm example to match new PrecompileOutput::new() signature
  - Removed custom-beacon-withdrawals from workspace (incompatible with new API)

## Testing:
- cargo check --all passes with no errors
- Only informational warnings about optional op features remain
2026-03-19 14:33:42 +01:00
22 changed files with 147 additions and 192 deletions

137
Cargo.lock generated
View File

@@ -290,21 +290,17 @@ dependencies = [
[[package]]
name = "alloy-evm"
version = "0.29.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cb6ba2dafd6327f78f2b59ae539bd5c39c57a01dc76763e92942619d934a7bb"
source = "git+https://github.com/alloy-rs/evm?rev=b0eb7e6#b0eb7e617f964f7090c504f21a5977cc440117f7"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-hardforks 0.4.7",
"alloy-op-hardforks",
"alloy-primitives",
"alloy-rpc-types-engine",
"alloy-rpc-types-eth",
"alloy-sol-types",
"auto_impl",
"derive_more",
"op-alloy",
"op-revm",
"revm",
"thiserror 2.0.18",
"tracing",
@@ -440,18 +436,6 @@ dependencies = [
"url",
]
[[package]]
name = "alloy-op-hardforks"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6472c610150c4c4c15be9e1b964c9b78068f933bda25fb9cdf09b9ac2bb66f36"
dependencies = [
"alloy-chains",
"alloy-hardforks 0.4.7",
"alloy-primitives",
"auto_impl",
]
[[package]]
name = "alloy-primitives"
version = "1.5.7"
@@ -2970,7 +2954,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab67060fc6b8ef687992d439ca0fa36e7ed17e9a0b16b25b601e8757df720de"
dependencies = [
"data-encoding",
"syn 1.0.109",
"syn 2.0.117",
]
[[package]]
@@ -3472,7 +3456,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@@ -4287,7 +4271,7 @@ dependencies = [
"log",
"rustversion",
"windows-link 0.1.3",
"windows-result 0.4.1",
"windows-result 0.3.4",
]
[[package]]
@@ -4825,7 +4809,7 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
"socket2 0.5.10",
"socket2 0.6.3",
"tokio",
"tower-service",
"tracing",
@@ -4843,7 +4827,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
"windows-core 0.62.2",
"windows-core 0.61.2",
]
[[package]]
@@ -5195,7 +5179,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
dependencies = [
"hermit-abi",
"libc",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@@ -6355,19 +6339,6 @@ version = "11.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
[[package]]
name = "op-alloy"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a95dd0974d5e60ffe9342a70cc0033d299244fab01cb16a958eb7352ddba1fa7"
dependencies = [
"op-alloy-consensus",
"op-alloy-network",
"op-alloy-provider",
"op-alloy-rpc-types",
"op-alloy-rpc-types-engine",
]
[[package]]
name = "op-alloy-consensus"
version = "0.24.0"
@@ -6388,37 +6359,6 @@ dependencies = [
"thiserror 2.0.18",
]
[[package]]
name = "op-alloy-network"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8ea44162d493219cc678aaca1253d46c3aa73aa361326dfa9d406f086dfa135"
dependencies = [
"alloy-consensus",
"alloy-network",
"alloy-primitives",
"alloy-provider",
"alloy-rpc-types-eth",
"alloy-signer",
"op-alloy-consensus",
"op-alloy-rpc-types",
]
[[package]]
name = "op-alloy-provider"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83aa8dc34bdf077c8e6d48ff75beff4ac14b428d982c9722483ccd7473c0e114"
dependencies = [
"alloy-network",
"alloy-primitives",
"alloy-provider",
"alloy-rpc-types-engine",
"alloy-transport",
"async-trait",
"op-alloy-rpc-types-engine",
]
[[package]]
name = "op-alloy-rpc-types"
version = "0.24.0"
@@ -6460,17 +6400,6 @@ dependencies = [
"thiserror 2.0.18",
]
[[package]]
name = "op-revm"
version = "17.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a98f3a512a7e02a1dcf1242b57302d83657b265a665d50ad98d0b158efaf2c"
dependencies = [
"auto_impl",
"revm",
"serde",
]
[[package]]
name = "opaque-debug"
version = "0.3.1"
@@ -7136,7 +7065,7 @@ dependencies = [
"quinn-udp",
"rustc-hash",
"rustls",
"socket2 0.5.10",
"socket2 0.6.3",
"thiserror 2.0.18",
"tokio",
"tracing",
@@ -7173,7 +7102,7 @@ dependencies = [
"cfg_aliases",
"libc",
"once_cell",
"socket2 0.5.10",
"socket2 0.6.3",
"tracing",
"windows-sys 0.60.2",
]
@@ -10663,8 +10592,7 @@ dependencies = [
[[package]]
name = "revm"
version = "36.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0abc15d09cd211e9e73410ada10134069c794d4bcdb787dfc16a1bf0939849c"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"revm-bytecode",
"revm-context",
@@ -10682,8 +10610,7 @@ dependencies = [
[[package]]
name = "revm-bytecode"
version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86e468df3cf5cf59fa7ef71a3e9ccabb76bb336401ea2c0674f563104cf3c5e"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"bitvec",
"phf",
@@ -10694,8 +10621,7 @@ dependencies = [
[[package]]
name = "revm-context"
version = "15.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9eb1f0a76b14d684a444fc52f7bf6b7564bf882599d91ee62e76d602e7a187c7"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"bitvec",
"cfg-if",
@@ -10711,8 +10637,7 @@ dependencies = [
[[package]]
name = "revm-context-interface"
version = "16.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc256b27743e2912ca16899568e6652a372eb5d1d573e6edb16c7836b16cf487"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"alloy-eip2930",
"alloy-eip7702",
@@ -10727,8 +10652,7 @@ dependencies = [
[[package]]
name = "revm-database"
version = "12.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c0a7d6da41061f2c50f99a2632571026b23684b5449ff319914151f4449b6c8"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"alloy-eips",
"revm-bytecode",
@@ -10741,8 +10665,7 @@ dependencies = [
[[package]]
name = "revm-database-interface"
version = "10.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd497a38a79057b94a049552cb1f925ad15078bc1a479c132aeeebd1d2ccc768"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"auto_impl",
"either",
@@ -10755,8 +10678,7 @@ dependencies = [
[[package]]
name = "revm-handler"
version = "17.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f1eed729ca9b228ae98688f352235871e9b8be3d568d488e4070f64c56e9d3d"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"auto_impl",
"derive-where",
@@ -10774,8 +10696,7 @@ dependencies = [
[[package]]
name = "revm-inspector"
version = "17.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf5102391706513689f91cb3cb3d97b5f13a02e8647e6e9cb7620877ef84847"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"auto_impl",
"either",
@@ -10791,9 +10712,8 @@ dependencies = [
[[package]]
name = "revm-inspectors"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfb0f462c8a3d9989d3dbc62d7cca4dfecd7072cfa5d563ab90ced60590ed1da"
version = "0.36.1"
source = "git+https://github.com/paradigmxyz/revm-inspectors?rev=24becc3#24becc35973c6c1d4e1c1475fa51a83d36d50d48"
dependencies = [
"alloy-primitives",
"alloy-rpc-types-eth",
@@ -10812,8 +10732,7 @@ dependencies = [
[[package]]
name = "revm-interpreter"
version = "34.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf22f80612bb8f58fd1f578750281f2afadb6c93835b14ae6a4d6b75ca26f445"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"revm-bytecode",
"revm-context-interface",
@@ -10825,8 +10744,7 @@ dependencies = [
[[package]]
name = "revm-precompile"
version = "32.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2ec11f45deec71e4945e1809736bb20d454285f9167ab53c5159dae1deb603f"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"ark-bls12-381",
"ark-bn254",
@@ -10840,6 +10758,7 @@ dependencies = [
"cfg-if",
"k256",
"p256",
"revm-context-interface",
"revm-primitives",
"ripemd",
"secp256k1 0.31.1",
@@ -10849,8 +10768,7 @@ dependencies = [
[[package]]
name = "revm-primitives"
version = "22.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcfb5ce6cf18b118932bcdb7da05cd9c250f2cb9f64131396b55f3fe3537c35"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"alloy-primitives",
"num_enum",
@@ -10861,8 +10779,7 @@ dependencies = [
[[package]]
name = "revm-state"
version = "10.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29404707763da607e5d6e4771cb203998c28159279c2f64cc32de08d2814651"
source = "git+https://github.com/bluealloy/revm?rev=712dac7a#712dac7a3461f5f80682627ee8fc9032c337c51b"
dependencies = [
"alloy-eip7928",
"bitflags 2.11.0",
@@ -11105,7 +11022,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@@ -11963,7 +11880,7 @@ dependencies = [
"getrandom 0.4.2",
"once_cell",
"rustix",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@@ -12688,7 +12605,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5f7c95348f20c1c913d72157b3c6dee6ea3e30b3d19502c5a7f6d3f160dacbf"
dependencies = [
"cc",
"windows-targets 0.52.6",
"windows-targets 0.48.5",
]
[[package]]

View File

@@ -399,7 +399,9 @@ reth-payload-builder-primitives = { path = "crates/payload/builder-primitives" }
reth-payload-primitives = { path = "crates/payload/primitives" }
reth-payload-validator = { path = "crates/payload/validator" }
reth-payload-util = { path = "crates/payload/util" }
reth-primitives = { path = "crates/primitives", default-features = false, features = ["__internal"] }
reth-primitives = { path = "crates/primitives", default-features = false, features = [
"__internal",
] }
reth-primitives-traits = { path = "crates/primitives-traits", default-features = false }
reth-provider = { path = "crates/storage/provider" }
reth-prune = { path = "crates/prune/prune" }
@@ -444,18 +446,22 @@ revm-state = { version = "10.0.0", default-features = false }
revm-primitives = { version = "22.1.0", default-features = false }
revm-interpreter = { version = "34.0.0", default-features = false }
revm-database-interface = { version = "10.0.0", default-features = false }
revm-inspectors = "0.36.0"
revm-inspectors = "0.36.1"
# eth
alloy-dyn-abi = "1.5.6"
alloy-primitives = { version = "1.5.6", default-features = false, features = ["map-foldhash"] }
alloy-primitives = { version = "1.5.6", default-features = false, features = [
"map-foldhash",
] }
alloy-sol-types = { version = "1.5.6", default-features = false }
alloy-chains = { version = "0.2.5", default-features = false }
alloy-eip2124 = { version = "0.2.0", default-features = false }
alloy-eip7928 = { version = "0.3.0", default-features = false }
alloy-evm = { version = "0.29.2", default-features = false }
alloy-rlp = { version = "0.3.13", default-features = false, features = ["core-net"] }
alloy-rlp = { version = "0.3.13", default-features = false, features = [
"core-net",
] }
alloy-trie = { version = "0.9.4", default-features = false }
alloy-hardforks = "0.4.5"
@@ -467,10 +473,15 @@ alloy-genesis = { version = "1.7.3", default-features = false }
alloy-json-rpc = { version = "1.7.3", default-features = false }
alloy-network = { version = "1.7.3", default-features = false }
alloy-network-primitives = { version = "1.7.3", default-features = false }
alloy-provider = { version = "1.7.3", features = ["reqwest", "debug-api"], default-features = false }
alloy-provider = { version = "1.7.3", features = [
"reqwest",
"debug-api",
], default-features = false }
alloy-pubsub = { version = "1.7.3", default-features = false }
alloy-rpc-client = { version = "1.7.3", default-features = false }
alloy-rpc-types = { version = "1.7.3", features = ["eth"], default-features = false }
alloy-rpc-types = { version = "1.7.3", features = [
"eth",
], default-features = false }
alloy-rpc-types-admin = { version = "1.7.3", default-features = false }
alloy-rpc-types-anvil = { version = "1.7.3", default-features = false }
alloy-rpc-types-beacon = { version = "1.7.3", default-features = false }
@@ -484,7 +495,9 @@ alloy-serde = { version = "1.7.3", default-features = false }
alloy-signer = { version = "1.7.3", default-features = false }
alloy-signer-local = { version = "1.7.3", default-features = false }
alloy-transport = { version = "1.7.3" }
alloy-transport-http = { version = "1.7.3", features = ["reqwest-rustls-tls"], default-features = false }
alloy-transport-http = { version = "1.7.3", features = [
"reqwest-rustls-tls",
], default-features = false }
alloy-transport-ipc = { version = "1.7.3", default-features = false }
alloy-transport-ws = { version = "1.7.3", default-features = false }
@@ -498,7 +511,10 @@ either = { version = "1.15.0", default-features = false }
arrayvec = { version = "0.7.6", default-features = false }
aquamarine = "0.6"
auto_impl = "1"
backon = { version = "1.2", default-features = false, features = ["std-blocking-sleep", "tokio-sleep"] }
backon = { version = "1.2", default-features = false, features = [
"std-blocking-sleep",
"tokio-sleep",
] }
bincode = "1.3"
bitflags = "2.4"
boyer-moore-magiclen = "0.2.16"
@@ -522,9 +538,13 @@ linked_hash_set = "0.1"
libc = "0.2"
lz4 = "1.28.1"
modular-bitfield = "0.13.1"
notify = { version = "8.0.0", default-features = false, features = ["macos_fsevent"] }
notify = { version = "8.0.0", default-features = false, features = [
"macos_fsevent",
] }
nybbles = { version = "0.4.8", default-features = false }
once_cell = { version = "1.19", default-features = false, features = ["critical-section"] }
once_cell = { version = "1.19", default-features = false, features = [
"critical-section",
] }
parking_lot = "0.12"
quanta = "0.12"
paste = "1.0"
@@ -545,7 +565,9 @@ strum_macros = "0.27"
syn = "2.0"
thiserror = { version = "2.0.0", default-features = false }
tar = "0.4.44"
tracing = { version = "0.1.0", default-features = false, features = ["attributes"] }
tracing = { version = "0.1.0", default-features = false, features = [
"attributes",
] }
tracing-appender = "0.2"
url = { version = "2.3", default-features = false }
zstd = "0.13"
@@ -583,7 +605,11 @@ futures-util = { version = "0.3", default-features = false }
hyper = "1.3"
hyper-util = "0.1.5"
pin-project = "1.0.12"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "rustls-tls-native-roots", "stream"] }
reqwest = { version = "0.12", default-features = false, features = [
"rustls-tls",
"rustls-tls-native-roots",
"stream",
] }
tracing-futures = "0.2"
tower = "0.5"
tower-http = "0.6"
@@ -608,7 +634,10 @@ proptest-arbitrary-interop = "0.1.0"
# crypto
enr = { version = "0.13", default-features = false }
k256 = { version = "0.13", default-features = false, features = ["ecdsa"] }
secp256k1 = { version = "0.30", default-features = false, features = ["global-context", "recovery"] }
secp256k1 = { version = "0.30", default-features = false, features = [
"global-context",
"recovery",
] }
# rand 8 for secp256k1
rand_08 = { package = "rand", version = "0.8" }
@@ -751,6 +780,15 @@ ipnet = "2.11"
# jsonrpsee-http-client = { git = "https://github.com/paradigmxyz/jsonrpsee", branch = "matt/make-rpc-service-pub" }
# jsonrpsee-types = { git = "https://github.com/paradigmxyz/jsonrpsee", branch = "matt/make-rpc-service-pub" }
# alloy-evm = { git = "https://github.com/alloy-rs/evm", rev = "9bc2dba" }
alloy-evm = { git = "https://github.com/alloy-rs/evm", rev = "b0eb7e6" }
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "3020ea8" }
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "24becc3" }
# revm from rakita/state-gas branch
revm = { git = "https://github.com/bluealloy/revm", rev = "712dac7a" }
revm-bytecode = { git = "https://github.com/bluealloy/revm", rev = "712dac7a" }
revm-database = { git = "https://github.com/bluealloy/revm", rev = "712dac7a" }
revm-state = { git = "https://github.com/bluealloy/revm", rev = "712dac7a" }
revm-primitives = { git = "https://github.com/bluealloy/revm", rev = "712dac7a" }
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "712dac7a" }
revm-database-interface = { git = "https://github.com/bluealloy/revm", rev = "712dac7a" }

View File

@@ -38,8 +38,8 @@ op-alloy-rpc-types-engine = { workspace = true, optional = true }
workspace = true
[features]
op = [
"dep:op-alloy-rpc-types-engine",
"reth-payload-primitives/op",
"reth-primitives-traits/op",
]
# op = [
# "dep:op-alloy-rpc-types-engine",
# "reth-payload-primitives/op",
# "reth-primitives-traits/op",
# ]

View File

@@ -81,8 +81,8 @@ pub struct CacheEntry<S> {
}
impl<S> CacheEntry<S> {
const fn gas_used(&self) -> u64 {
self.output.gas_used
const fn regular_gas_used(&self) -> u64 {
self.output.gas.limit() - self.output.gas.remaining()
}
fn to_precompile_result(&self) -> PrecompileResult {
@@ -170,10 +170,10 @@ where
fn call(&self, input: PrecompileInput<'_>) -> PrecompileResult {
if let Some(entry) = &self.cache.get(input.data, self.spec_id.clone()) &&
input.gas >= entry.gas_used()
input.gas >= entry.regular_gas_used()
{
self.increment_by_one_precompile_cache_hits();
return entry.to_precompile_result()
return entry.to_precompile_result();
}
let calldata = input.data;
@@ -228,15 +228,14 @@ mod tests {
use super::*;
use reth_evm::{EthEvmFactory, Evm, EvmEnv, EvmFactory};
use reth_revm::db::EmptyDB;
use revm::{context::TxEnv, precompile::PrecompileOutput};
use revm::{context::TxEnv, interpreter::gas::GasTracker, precompile::PrecompileOutput};
use revm_primitives::hardfork::SpecId;
#[test]
fn test_precompile_cache_basic() {
let dyn_precompile: DynPrecompile = (|_input: PrecompileInput<'_>| -> PrecompileResult {
Ok(PrecompileOutput {
gas_used: 0,
gas_refunded: 0,
gas: GasTracker::new(0, 0, 0),
bytes: Bytes::default(),
reverted: false,
})
@@ -247,8 +246,7 @@ mod tests {
CachedPrecompile::new(dyn_precompile, PrecompileCache::default(), SpecId::PRAGUE, None);
let output = PrecompileOutput {
gas_used: 50,
gas_refunded: 0,
gas: GasTracker::new(50, 0, 0),
bytes: alloy_primitives::Bytes::copy_from_slice(b"cached_result"),
reverted: false,
};
@@ -279,8 +277,7 @@ mod tests {
assert_eq!(input.data, input_data);
Ok(PrecompileOutput {
gas_used: 5000,
gas_refunded: 0,
gas: GasTracker::new(5000, 0, 0),
bytes: alloy_primitives::Bytes::copy_from_slice(b"output_from_precompile_1"),
reverted: false,
})
@@ -294,8 +291,7 @@ mod tests {
assert_eq!(input.data, input_data);
Ok(PrecompileOutput {
gas_used: 7000,
gas_refunded: 0,
gas: GasTracker::new(7000, 0, 0),
bytes: alloy_primitives::Bytes::copy_from_slice(b"output_from_precompile_2"),
reverted: false,
})

View File

@@ -62,4 +62,4 @@ test-utils = [
"reth-trie-common/test-utils",
"reth-ethereum-primitives/test-utils",
]
op = ["alloy-evm/op", "reth-primitives-traits/op"]
# op = ["alloy-evm/op", "reth-primitives-traits/op"]

View File

@@ -468,7 +468,7 @@ where
self.executor.execute_transaction_with_commit_condition((tx_env, &tx), f)?
{
self.transactions.push(tx);
Ok(Some(gas_used))
Ok(Some(gas_used.into()))
} else {
Ok(None)
}

View File

@@ -122,10 +122,10 @@ test-utils = [
"reth-tasks/test-utils",
]
trie-debug = ["reth-engine-tree/trie-debug"]
op = [
"reth-db/op",
"reth-db-api/op",
"reth-engine-local/op",
"reth-evm/op",
"reth-primitives-traits/op",
]
# op = [
# "reth-db/op",
# "reth-db-api/op",
# "reth-engine-local/op",
# "reth-evm/op",
# "reth-primitives-traits/op",
# ]

View File

@@ -53,7 +53,7 @@ std = [
"either/std",
"alloy-consensus/std",
]
op = [
"dep:op-alloy-rpc-types-engine",
"reth-primitives-traits/op",
]
# op = [
# "dep:op-alloy-rpc-types-engine",
# "reth-primitives-traits/op",
# ]

View File

@@ -43,10 +43,10 @@ serde_json.workspace = true
[features]
default = []
op = [
"dep:op-alloy-consensus",
"dep:op-alloy-rpc-types",
"reth-evm/op",
"reth-primitives-traits/op",
"alloy-evm/op",
]
#op = [
# "dep:op-alloy-consensus",
# "dep:op-alloy-rpc-types",
# "reth-evm/op",
# "reth-primitives-traits/op",
# "alloy-evm/op",
#]

View File

@@ -62,9 +62,9 @@ tracing.workspace = true
[features]
js-tracer = ["revm-inspectors/js-tracer", "reth-rpc-eth-types/js-tracer"]
client = ["jsonrpsee/client", "jsonrpsee/async-client"]
op = [
"reth-evm/op",
"reth-primitives-traits/op",
"reth-rpc-convert/op",
"alloy-evm/op",
]
# op = [
# "reth-evm/op",
# "reth-primitives-traits/op",
# "reth-rpc-convert/op",
# "alloy-evm/op",
# ]

View File

@@ -517,7 +517,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
let result = this.inspect(&mut db, evm_env.clone(), tx_env.clone(), &mut inspector)?;
let access_list = inspector.into_access_list();
let gas_used = result.result.gas_used();
let gas_used = result.result.tx_gas_used();
tx_env.set_access_list(access_list.clone());
if let Err(err) = Self::Error::ensure_success(result.result) {
return Ok(AccessListResult {
@@ -529,7 +529,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
// transact again to get the exact gas used
let result = this.transact(&mut db, evm_env, tx_env)?;
let gas_used = result.result.gas_used();
let gas_used = result.result.tx_gas_used();
let error = Self::Error::ensure_success(result.result).err().map(|e| e.to_string());
Ok(AccessListResult { access_list, gas_used: U256::from(gas_used), error })

View File

@@ -204,7 +204,7 @@ pub trait EstimateCall: Call {
// NOTE: this is the gas the transaction used, which is less than the
// transaction requires to succeed.
let mut gas_used = res.result.gas_used();
let mut gas_used = res.result.tx_gas_used();
// the lowest value is capped by the gas used by the unconstrained transaction
let mut lowest_gas_limit = gas_used.saturating_sub(1);
@@ -225,7 +225,7 @@ pub trait EstimateCall: Call {
res = evm.transact(optimistic_tx_env).map_err(Self::Error::from_evm_err)?;
// Update the gas used based on the new result.
gas_used = res.result.gas_used();
gas_used = res.result.tx_gas_used();
// Update the gas limit estimates (highest and lowest) based on the execution result.
update_estimated_gas_range(
res.result,

View File

@@ -126,7 +126,7 @@ pub trait FromEvmError<Evm: ConfigureEvm>:
ExecutionResult::Success { output, .. } => Ok(output.into_data()),
ExecutionResult::Revert { output, .. } => Err(Self::from_revert(output)),
ExecutionResult::Halt { reason, gas, .. } => {
Err(Self::from_evm_halt(reason, gas.used()))
Err(Self::from_evm_halt(reason, gas.tx_gas_used()))
}
}
}

View File

@@ -553,6 +553,7 @@ where
EVMError::Header(err) => err.into(),
EVMError::Database(err) => err.into(),
EVMError::Custom(err) => Self::EvmCustom(err),
EVMError::CustomAny(err) => Self::EvmCustom(err.to_string()),
}
}
}

View File

@@ -314,7 +314,7 @@ where
code: SIMULATE_VM_ERROR_CODE,
..SimulateError::invalid_params()
}),
gas_used: gas.used(),
gas_used: gas.tx_gas_used(),
logs: Vec::new(),
status: false,
..Default::default()
@@ -330,7 +330,7 @@ where
code: SIMULATE_REVERT_CODE,
..SimulateError::invalid_params()
}),
gas_used: gas.used(),
gas_used: gas.tx_gas_used(),
status: false,
logs: Vec::new(),
..Default::default()
@@ -342,7 +342,7 @@ where
SimCallResult {
return_data: output.into_data(),
error: None,
gas_used: gas.used(),
gas_used: gas.tx_gas_used(),
logs: logs
.into_iter()
.map(|log| {

View File

@@ -188,7 +188,7 @@ where
let gas_price = tx
.effective_tip_per_gas(basefee)
.expect("fee is always valid; execution succeeded");
let gas_used = result.gas_used();
let gas_used = result.tx_gas_used();
total_gas_used += gas_used;
let gas_fees = U256::from(gas_used) * U256::from(gas_price);

View File

@@ -289,7 +289,7 @@ where
.into());
}
let gas_used = result.gas_used();
let gas_used = result.tx_gas_used();
total_gas_used += gas_used;
// coinbase is always present in the result state

View File

@@ -88,8 +88,8 @@ arbitrary = [
"op-alloy-consensus?/arbitrary",
"reth-ethereum-primitives/arbitrary",
]
op = [
"dep:op-alloy-consensus",
"reth-codecs/op",
"reth-primitives-traits/op",
]
# op = [
# "dep:op-alloy-consensus",
# "reth-codecs/op",
# "reth-primitives-traits/op",
# ]

View File

@@ -93,8 +93,8 @@ arbitrary = [
"reth-primitives-traits/arbitrary",
"reth-prune-types/arbitrary",
]
op = [
"reth-db-api/op",
"reth-primitives-traits/op",
]
# op = [
# "reth-db-api/op",
# "reth-primitives-traits/op",
# ]
disable-lock = []

View File

@@ -1429,7 +1429,7 @@ pub fn ensure_intrinsic_gas<T: EthPoolTransaction>(
);
let gas_limit = transaction.gas_limit();
if gas_limit < gas.initial_gas || gas_limit < gas.floor_gas {
if gas_limit < gas.initial_total_gas || gas_limit < gas.floor_gas {
Err(InvalidPoolTransactionError::IntrinsicGasTooLow)
} else {
Ok(())

View File

@@ -5,7 +5,7 @@
use alloy_eips::eip4895::Withdrawal;
use alloy_evm::{
block::{BlockExecutorFactory, BlockExecutorFor, ExecutableTx},
block::{BlockExecutorFactory, BlockExecutorFor, ExecutableTx, GasOutput},
eth::{EthBlockExecutionCtx, EthBlockExecutor, EthTxResult},
precompiles::PrecompilesMap,
revm::context::Block as _,
@@ -211,7 +211,10 @@ where
self.inner.execute_transaction_without_commit(tx)
}
fn commit_transaction(&mut self, output: Self::Result) -> Result<u64, BlockExecutionError> {
fn commit_transaction(
&mut self,
output: Self::Result,
) -> Result<GasOutput, BlockExecutionError> {
self.inner.commit_transaction(output)
}

View File

@@ -110,7 +110,7 @@ pub fn prague_custom() -> &'static Precompiles {
let precompile = Precompile::new(
PrecompileId::custom("custom"),
address!("0x0000000000000000000000000000000000000999"),
|_, _| PrecompileResult::Ok(PrecompileOutput::new(0, Bytes::new())),
|_, _| PrecompileResult::Ok(PrecompileOutput::new(0, 0, Bytes::new())),
);
precompiles.extend([precompile]);
precompiles