Skip to content

Commit 3577c5b

Browse files
authored
fix(anvil): properly execute Tempo tx requests (#15857)
* fix(anvil): properly execute Tempo tx requests Route parsed transaction requests through network-specific call environments so Tempo AA requests retain their complete call batches across eth_call, estimation, access-list generation, tracing, eth_simulateV1, and node-signed transaction flows. Preserve Tempo nonce, fee-payer, signature, and transaction identity semantics during probing and sequential simulation. Construct synthetic simulation envelopes from the original request while applying gas limits and other execution-only changes to the prepared environment. Keep Ethereum and Optimism request classification intact and build simulated receipts with the appropriate network-specific fields. * fix(anvil): preserve keychain gas estimates Avoid charging Tempo keychain protocol fees while probing candidate gas limits so the block gas limit cannot invalidate an otherwise valid estimate. Keep call-level spending checks active and cover inline and provisioned access keys. Update the stale Optimism executor rustdoc link. * fix(anvil): preserve canonical simulation logs Build simulated receipt roots and blooms only from logs produced by transaction execution, while keeping synthetic transfer logs in the RPC response. Align the Cast keychain assertions with successful session cleanup. * fix(anvil): discard reverted simulation logs Only reconcile canonical simulation logs after successful execution. Clear response logs after a top-level revert while preserving attempted log indices for subsequent calls.
1 parent d03f184 commit 3577c5b

16 files changed

Lines changed: 2243 additions & 331 deletions

File tree

.changelog/pr-15857.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
anvil: patch
3+
---
4+
5+
Fixed Anvil RPC methods to properly execute Tempo transaction requests.

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/anvil/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ foundry-config.workspace = true
2929
foundry-evm.workspace = true
3030
foundry-evm-networks.workspace = true
3131
foundry-primitives = { workspace = true, default-features = false }
32-
tempo-alloy = { workspace = true, features = ["revm"] }
3332
tempo-hardfork.workspace = true
3433
tempo-primitives.workspace = true
3534
tempo-precompiles.workspace = true
@@ -124,6 +123,8 @@ reqwest.workspace = true
124123
foundry-test-utils.workspace = true
125124
tokio = { workspace = true, features = ["full"] }
126125

126+
tempo-alloy.workspace = true
127+
127128
[features]
128129
default = ["cli", "jemalloc", "asm-keccak", "optimism", "js-tracer"]
129130
optimism = [

crates/anvil/core/src/eth/mod.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,10 @@ pub enum EthRequest {
231231
EthCallBundle(EthCallBundle),
232232

233233
#[serde(rename = "eth_simulateV1")]
234-
EthSimulateV1(SimulatePayload, #[serde(default)] Option<BlockId>),
234+
EthSimulateV1(
235+
SimulatePayload<WithOtherFields<TransactionRequest>>,
236+
#[serde(default)] Option<BlockId>,
237+
),
235238

236239
#[serde(rename = "eth_createAccessList")]
237240
EthCreateAccessList(
@@ -1378,6 +1381,27 @@ mod tests {
13781381
let _req = serde_json::from_value::<EthRequest>(value).unwrap();
13791382
}
13801383

1384+
#[test]
1385+
fn test_simulate_preserves_transaction_extension_fields() {
1386+
let value = serde_json::json!({
1387+
"method": "eth_simulateV1",
1388+
"params": [{
1389+
"blockStateCalls": [{
1390+
"calls": [{
1391+
"to": "0x0000000000000000000000000000000000000001",
1392+
"tempoExtension": "preserved"
1393+
}]
1394+
}]
1395+
}]
1396+
});
1397+
1398+
let request = serde_json::from_value::<EthRequest>(value).unwrap();
1399+
let EthRequest::EthSimulateV1(payload, _) = request else { panic!() };
1400+
let transaction = &payload.block_state_calls[0].calls[0];
1401+
1402+
assert_eq!(transaction.other["tempoExtension"], serde_json::json!("preserved"));
1403+
}
1404+
13811405
#[test]
13821406
fn test_custom_set_code() {
13831407
let s = r#"{"method": "anvil_setCode", "params":

0 commit comments

Comments
 (0)