foundry: bug(`anvil`): inconsistent simulation behaviour

Component

Anvil

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (b174c3a 2024-02-09T00:16:22.953958126Z)

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

Hi! I am experiencing inconsistent behaviour from anvil when simulating a transaction on an old block. There are 2 commands: First set up anvil:

anvil --chain-id 1 --port 8545 --base-fee 1000 --fork-block-number 14684306 -f "<NODE_URL>"

Then run eth_sendUnsignedTransaction:

curl -X POST -H "Content-Type: application/json" --data \
'{
  "jsonrpc":"2.0",
  "method":"eth_sendUnsignedTransaction",
  "params":[{
    "from": "0x63341ba917de90498f3903b199df5699b4a55ac0",
    "to": "0x7336F819775B1D31Ea472681D70cE7A903482191",
    "data": "0xaf8271f7",
    "gas": "0x20EF3F",
    "gasPrice": "0x34257"
  }],
  "id":1
}' "http://127.0.0.1:8545"

You might need to run it several times but sometimes it succeeds (as it should) and sometimes it fails. To rerun it, re-run both commands again (to ensure anvil is at the right block level + so it’s the same state):

Listening on 127.0.0.1:8545
eth_sendUnsignedTransaction

    Transaction: 0x83b8909a89584001b122eba49310f13a8c7dc690acbc8c7d90350494a1cf7537
    Gas used: 1815058

    Block Number: 14684307
    Block Hash: 0x3f59e4fa81cc720c5d0d7df38ac08fa650cd72c046fe665d428a0e3965595cb9
    Block Time: "Sat, 30 Apr 2022 07:40:14 +0000"

Other times it fails:

Listening on 127.0.0.1:8545
eth_sendUnsignedTransaction

    Transaction: 0x83b8909a89584001b122eba49310f13a8c7dc690acbc8c7d90350494a1cf7537
    Gas used: 2158038
    Error: reverted with: EvmError: Revert

    Block Number: 14684307
    Block Hash: 0x667ea63188956e7fe25fa2806d76651afb745b0c102cf3606c33eb398942c712
    Block Time: "Sat, 30 Apr 2022 07:40:07 +0000"

In general, I’m getting a lot of inconsistent behaviour from anvil VS simulating using trace_call using Erigon:

curl -X POST -H "Content-Type: application/json" --data \
'{
  "jsonrpc":"2.0",
  "method":"trace_call",            
  "params":[{
    "from": "0x63341ba917de90498f3903b199df5699b4a55ac0",
    "to": "0x7336F819775B1D31Ea472681D70cE7A903482191",
    "data": "0xaf8271f7",
    "gas": "0x20EF3F",
    "gasPrice": "0x34257"
  }, ["trace"], "0xE01092"], 
  "id":1
}' "<NODE_URL>"

This succeeds every single time I run it.

(Also the txn I’m replicating in this instance is: “0x2b023d65485c4bb68d781960c2196588d03b871dc9eb1c054f596b7ca6f7da56”)

Anvil isn’t just failing on this txn, it’s failing on many txns across the entire history of the chain.

Thank you in advance!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 16 (1 by maintainers)

Most upvoted comments

Nice finding. Cool, please open new issues if you find unexpected anvil behaviour. Thank you!

Very interesting, thank you both! I did not consider that system clock time would affect this, because the contract doesn’t use the TIMESTAMP opcode Etherscan contract source. For now it’s simple enough for me to call evm_setTime before I mine a block, but I will continue poking at this to see where the trace begins to differ between known good/bad block timestamps.

Sounds good 👍 So even if the contract doesn’t use the opcode itself, could it just try to determine if any swap slippage or something and just revert if so?

It’s not my contract but I’m actively working on understanding how it operates. It certainly performs some safety checks, and the timestamp failure mechanism is very interesting to me.

I added a line cast rpc --rpc-url=$FORK_URL "anvil_setBlockTimestampInterval" 12 --silent after the coinbase setter that matches the block interval for mainnet. Interestingly, the TX only succeeds if the value is 12.

There are two DELEGATECALL opcodes in there, so perhaps the contract relies on safety checks via another contract.

Either way I’ll keep looking, but I think this bug can be closed — the TX should revert if it includes this obfuscated timestamp check, so Anvil is working as expected.

Ah sorry I forgot to report back on some findings that I had. I was able to isolate the root cause of my inconsistencies down to anvil’s unexpected state differences when forking the previous block and simulating to the next.

For example in BTD’s example above we fork the block at 19922506, at thus have a time of May-22-2024 02:39:23 AM UTC. But what time will the transactions land when we simulate it? It depends on the wall clock time. So in the example above it’ll be simulating the transactions at timestamp May-22-2024 02:39:24 AM UTC (since we slept 1 second).

Some transactions are sensitive to time, thus will revert. Perhaps the mev bot has that logic built in.

Workaround = use evm_setTime and those transactions will succeed

I’ve also found some transactions which were sensitive to block gas limit (evm_setBlockGasLimit) and base gas price anvil_setNextBlockBaseFeePerGas so those are also things you need to set ahead of time prior to propagating the block

Hopefully this helps!

The two-TX failure I shared in https://github.com/foundry-rs/foundry/issues/7068#issuecomment-2412141772 is still present on the latest nightly (commit 9f11e6df38)

Here is a minimal repro using cast/anvil only, written in bash:

#!/usr/bin/env bash

export FOUNDRY_DISABLE_NIGHTLY_WARNING=1

RPC_URL=http://localhost:8545
ANVIL_PORT=6969
FORK_URL=http://localhost:$ANVIL_PORT
FORK_BLOCK=19922506
FORK_BLOCK_COINBASE="0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5"

TX_0_HASH="0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5"
TX_1_HASH="0x6c9ec85db14f593dd2290c3be7d067e7e3cce7831d1a03db2004b5dd540180d5"

TX_0_RAW=$(cast tx $TX_0_HASH --raw)
TX_1_RAW=$(cast tx $TX_1_HASH --raw)

anvil --silent --hardfork cancun --fork-url $RPC_URL --port=$ANVIL_PORT --fork-block-number=$FORK_BLOCK --no-mining --order=fifo &
sleep 1

cast rpc --rpc-url=$FORK_URL "anvil_setCoinbase" "$FORK_BLOCK_COINBASE" --silent

cast publish --rpc-url=$FORK_URL $TX_0_RAW --silent --async
cast publish --rpc-url=$FORK_URL $TX_1_RAW --silent --async

cast rpc --rpc-url=$FORK_URL "anvil_mine" --silent

cast receipt --rpc-url=$FORK_URL $TX_0_HASH 
cast receipt --rpc-url=$FORK_URL $TX_1_HASH 

killall anvil
unset FOUNDRY_DISABLE_NIGHTLY_WARNING

The first TX succeeds, but the second TX fails.

Here are the full receipts for both transactions:

TX 0:

blockHash            0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6
blockNumber          19922507
contractAddress      
cumulativeGasUsed    1594636
effectiveGasPrice    10620776711
from                 0x3b0eb3F7eD141e4f7153c612132f79C4C22147F4
gasUsed              1594636
logs                 [{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000008afacaa08de7189d84db9d87b9c21c2f1ac28113","0x00000000000000000000000038f5e5b4da37531a6e85161e337e0238bb27aa90"],"data":"0x00000000000000000000000000000000000000000000000000000000009c8750","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x0","removed":false},{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000008afacaa08de7189d84db9d87b9c21c2f1ac28113","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x00000000000000000000000000000000000000000000000000000000f37f59bd","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x1","removed":false},{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000004585fe77225b41b697c938b018e2ac67ac5a20c0","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x0000000000000000000000000000000000000000000000106411d1eb5b781c89","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x2","removed":false},{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18","0x0000000000000000000000004585fe77225b41b697c938b018e2ac67ac5a20c0"],"data":"0x00000000000000000000000000000000000000000000000000000000616623e6","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x3","removed":false},{"address":"0x4585fe77225b41b697c938b018e2ac67ac5a20c0","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x00000000000000000000000000000000000000000000000000000000616623e6ffffffffffffffffffffffffffffffffffffffffffffffef9bee2e14a487e3770000000000000000000000000000000000068ec05b7f279c44ef225bb6e72c9200000000000000000000000000000000000000000000000003b02a50fde2ce4e000000000000000000000000000000000000000000000000000000000003f568","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x4","removed":false},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000011b815efb8f581194ae79006d24e0d814b7697f6","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x000000000000000000000000000000000000000000000000000001094189a210","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x5","removed":false},{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x00000000000000000000000011b815efb8f581194ae79006d24e0d814b7697f6"],"data":"0x0000000000000000000000000000000000000000000000106411d1eb5b781c89","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x6","removed":false},{"address":"0x11b815efb8f581194ae79006d24e0d814b7697f6","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x0000000000000000000000000000000000000000000000106411d1eb5b781c89fffffffffffffffffffffffffffffffffffffffffffffffffffffef6be765df00000000000000000000000000000000000000000000404e44f8a97453d6f33120000000000000000000000000000000000000000000000006d9ec4111f2e7f2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd0a34","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x7","removed":false},{"address":"0x22f9dcf4647084d6c31b2765f6910cd85c178c18","topics":["0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8"],"data":"0x00000000000000000000000000000012556e69737761705633000000000000000000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000616623e6000000000000000000000000000000000000000000000000000001094189a210","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x8","removed":false},{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000cbcdf9626bc03e24f779434178a73a0b4bad62ed","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x00000000000000000000000000000000000000000000000c4235e22891574eed","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x9","removed":false},{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18","0x000000000000000000000000cbcdf9626bc03e24f779434178a73a0b4bad62ed"],"data":"0x00000000000000000000000000000000000000000000000000000000490c9aec","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0xa","removed":false},{"address":"0xcbcdf9626bc03e24f779434178a73a0b4bad62ed","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x00000000000000000000000000000000000000000000000000000000490c9aecfffffffffffffffffffffffffffffffffffffffffffffff3bdca1dd76ea8b1130000000000000000000000000000000000069012c641cfc2856f3c5d2f4b676600000000000000000000000000000000000000000000000010464c28698f6751000000000000000000000000000000000000000000000000000000000003f578","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0xb","removed":false},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000004e68ccd3e89f51c3074ca5072bbac773960dfa36","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x000000000000000000000000000000000000000000000000000000c6684b16ce","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0xc","removed":false},{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x0000000000000000000000004e68ccd3e89f51c3074ca5072bbac773960dfa36"],"data":"0x00000000000000000000000000000000000000000000000c4235e22891574eed","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0xd","removed":false},{"address":"0x4e68ccd3e89f51c3074ca5072bbac773960dfa36","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x00000000000000000000000000000000000000000000000c4235e22891574eedffffffffffffffffffffffffffffffffffffffffffffffffffffff3997b4e93200000000000000000000000000000000000000000004067a0f140a7e40ad9f7e000000000000000000000000000000000000000000000000655f0879111696befffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd0a53","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0xe","removed":false},{"address":"0x22f9dcf4647084d6c31b2765f6910cd85c178c18","topics":["0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8"],"data":"0x00000000000000000000000000000012556e69737761705633000000000000000000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000490c9aec000000000000000000000000000000000000000000000000000000c6684b16ce","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0xf","removed":false},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000009db9e0e53058c89e5b94e29621a205198648425b","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x000000000000000000000000000000000000000000000000000000952691c55f","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x10","removed":false},{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18","0x0000000000000000000000009db9e0e53058c89e5b94e29621a205198648425b"],"data":"0x0000000000000000000000000000000000000000000000000000000036c97431","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x11","removed":false},{"address":"0x9db9e0e53058c89e5b94e29621a205198648425b","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x0000000000000000000000000000000000000000000000000000000036c97431ffffffffffffffffffffffffffffffffffffffffffffffffffffff6ad96e3aa1000000000000000000000000000000000000001a60f84ebfde4da80fff8ac11b000000000000000000000000000000000000000000000000000004dcefe12c8f000000000000000000000000000000000000000000000000000000000000ffae","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x12","removed":false},{"address":"0x22f9dcf4647084d6c31b2765f6910cd85c178c18","topics":["0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8"],"data":"0x00000000000000000000000000000012556e69737761705633000000000000000000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000036c97431000000000000000000000000000000000000000000000000000000952691c55f","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x13","removed":false},{"address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000099ac8ca7087fa4a2a1fb6357269965a2014abc35","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x000000000000000000000000000000000000000000000000000000109730d526","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x14","removed":false},{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18","0x00000000000000000000000099ac8ca7087fa4a2a1fb6357269965a2014abc35"],"data":"0x000000000000000000000000000000000000000000000000000000000616623f","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x15","removed":false},{"address":"0x99ac8ca7087fa4a2a1fb6357269965a2014abc35","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x000000000000000000000000000000000000000000000000000000000616623fffffffffffffffffffffffffffffffffffffffffffffffffffffffef68cf2ada000000000000000000000000000000000000001a6a4170c55f82e3fac57912a7000000000000000000000000000000000000000000000000000000d839f768aa000000000000000000000000000000000000000000000000000000000000ffc9","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x16","removed":false},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000003416cf6c708da44db2624d63ea0aaef7113527c6","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x00000000000000000000000000000000000000000000000000000010976cbb0d","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x17","removed":false},{"address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x0000000000000000000000003416cf6c708da44db2624d63ea0aaef7113527c6"],"data":"0x000000000000000000000000000000000000000000000000000000109730d526","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x18","removed":false},{"address":"0x3416cf6c708da44db2624d63ea0aaef7113527c6","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x000000000000000000000000000000000000000000000000000000109730d526ffffffffffffffffffffffffffffffffffffffffffffffffffffffef689344f30000000000000000000000000000000000000001000507f948a1cbabdb5bb4f300000000000000000000000000000000000000000000000000a232d4507952640000000000000000000000000000000000000000000000000000000000000001","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x19","removed":false},{"address":"0x22f9dcf4647084d6c31b2765f6910cd85c178c18","topics":["0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8"],"data":"0x00000000000000000000000000000012556e69737761705633000000000000000000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000000000000000000000000000000000000616623f00000000000000000000000000000000000000000000000000000010976cbb0d","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x1a","removed":false},{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18","0x000000000000000000000000d51a44d3fae010294c616388b506acda1bfaae46"],"data":"0x000000000000000000000000000000000000000000000000000000000616623f","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x1b","removed":false},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000d51a44d3fae010294c616388b506acda1bfaae46","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x000000000000000000000000000000000000000000000000000000108cdd612c","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x1c","removed":false},{"address":"0xd51a44d3fae010294c616388b506acda1bfaae46","topics":["0xb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc98","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000616623f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000108cdd612c","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x1d","removed":false},{"address":"0x22f9dcf4647084d6c31b2765f6910cd85c178c18","topics":["0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8"],"data":"0x00000000000000000000000000000014437572766556320000000000000000000000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000000000000000000000000000000000000616623f000000000000000000000000000000000000000000000000000000108cdd612c","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x1e","removed":false},{"address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000009a772018fbd77fcd2d25657e5c547baff3fd7d16","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x000000000000000000000000000000000000000000000000000000109c3a32a0","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x1f","removed":false},{"address":"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18","0x0000000000000000000000009a772018fbd77fcd2d25657e5c547baff3fd7d16"],"data":"0x000000000000000000000000000000000000000000000000000000000616623c","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x20","removed":false},{"address":"0x9a772018fbd77fcd2d25657e5c547baff3fd7d16","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"],"data":"0x000000000000000000000000000000000000000000000000000000000616623cffffffffffffffffffffffffffffffffffffffffffffffffffffffef63c5cd60000000000000000000000000000000000000001a6344266f6b07eef8d2c992d7000000000000000000000000000000000000000000000000000000ab2c8fceca000000000000000000000000000000000000000000000000000000000000ffb5","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x21","removed":false},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000007858e59e0c01ea06df3af3d20ac7b0003275d4bf","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x0000000000000000000000000000000000000000000000000000001099fac9ae","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x22","removed":false},{"address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x0000000000000000000000007858e59e0c01ea06df3af3d20ac7b0003275d4bf"],"data":"0x000000000000000000000000000000000000000000000000000000109c3a32a0","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x23","removed":false},{"address":"0x7858e59e0c01ea06df3af3d20ac7b0003275d4bf","topics":["0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67","0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18"],"data":"0x000000000000000000000000000000000000000000000000000000109c3a32a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffef660536520000000000000000000000000000000000000000fffea926c686ee769df2ca100000000000000000000000000000000000000000000000000014a7dafeea00dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x24","removed":false},{"address":"0x22f9dcf4647084d6c31b2765f6910cd85c178c18","topics":["0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8"],"data":"0x00000000000000000000000000000012556e69737761705633000000000000000000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000000000000000000000000000000000000616623c0000000000000000000000000000000000000000000000000000001099fac9ae","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x25","removed":false},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000022f9dcf4647084d6c31b2765f6910cd85c178c18","0x0000000000000000000000008afacaa08de7189d84db9d87b9c21c2f1ac28113"],"data":"0x000000000000000000000000000000000000000000000000000002968eab6424","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x26","removed":false},{"address":"0xdef1c0ded9bec7f1a1670819833240f027b25eff","topics":["0x0f6672f78a59ba8e5e5b5d38df3ebc67f3c792e2c9259b8d97d7f00dd78ba1b3","0x0000000000000000000000008afacaa08de7189d84db9d87b9c21c2f1ac28113"],"data":"0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000f37f59bd000000000000000000000000000000000000000000000000000002968eab6424","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x27","removed":false},{"address":"0xdef1c0ded9bec7f1a1670819833240f027b25eff","topics":["0x7f4fe3ff8ae440e1570c558da08440b26f89fb1c1f2910cd91ca6452955f121a","0x415565b000000000000000000000000000000000000000000000000000000000"],"data":"0x378f8a6bd0df0518c8a010f5d485b2b9fe0b1abb645f255bd06aeadb8ae985c40000000000000000000000008afacaa08de7189d84db9d87b9c21c2f1ac281130000000000000000000000000000000000000000000000000000000000000000","blockHash":"0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6","blockNumber":"0x12ffe4b","blockTimestamp":"0x664d5ad0","transactionHash":"0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5","transactionIndex":"0x0","logIndex":"0x28","removed":false}]
logsBloom            0x000000020000018000000410000000000000010800002000700180010000000000010000001000000000000000000100320000000800a00000540000000008002000000010000008080802080040000000000088000008010000100000000010000800000000020000001810000000000200000000000000000000900008001000200000002000400001000000100200000000000100000804000080003010001180080000002200000100808001018000800400000200000000050000000040010000020010000000400a0000000000000000000200001000044000000000000000200001000400200000000020000480202000020000000008001010001600
root                 
status               1 (success)
transactionHash      0xce3acf3eeebd6ff6ab7b574c1ef15057b09845254bab110c4afee0c898dfb8d5
transactionIndex     0
type                 2
blobGasPrice         1
blobGasUsed          
authorizationList    
to                   0xDef1C0ded9bec7F1a1670819833240f027b25EfF

TX1:

blockHash            0x74d840c672f9da9b97bba111ef1ee58419a9031d6783df2e4003d872690acbf6
blockNumber          19922507
contractAddress      
cumulativeGasUsed    1665119
effectiveGasPrice    8620776711
from                 0x1c8F6A5F009E051CaB9C3851ca2DA2c936b2775A
gasUsed              70483
logs                 []
logsBloom            0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
root                 
status               0 (failed)
transactionHash      0x6c9ec85db14f593dd2290c3be7d067e7e3cce7831d1a03db2004b5dd540180d5
transactionIndex     1
type                 2
blobGasPrice         1
blobGasUsed          
authorizationList    
to                   0xA69babEF1cA67A37Ffaf7a485DfFF3382056e78C

@DicksonWu654 thank you, really useful! yep, was also looking at @BowTiedDevil example to set the time when block should be mined to avoid any internal logic / revert due to this, good to know this worked in your case.

Reopening per above, thanks for detailed steps

(Also the txn I’m replicating in this instance is: “0x2b023d65485c4bb68d781960c2196588d03b871dc9eb1c054f596b7ca6f7da56”)

@DicksonWu654 the proper way to do this is to start anvil at tx before the tx you want to replicate, as it could depend on state changed in the same block (if you start Anvil with --fork-block-number 14684306 it tries to replicate tx as first tx in that block), so try starting Anvil with --fork-transaction-hash flag (0xa42a038c3026c20e60f320d54c047b58e4e6c29cb636b58c557c790d6fa52ce3 is tx before the one you want to replicate)

anvil --chain-id 1 --port 8545 --base-fee 1000 --fork-transaction-hash 0xa42a038c3026c20e60f320d54c047b58e4e6c29cb636b58c557c790d6fa52ce3 -f "<NODE_URL>"

then eth_sendUnsignedTransaction always succeeds locally for me and produce 0x592ac1664ddbb569cd913f4745e402120bceffc55b8512116a6c4182dd07f915 tx which can be queried with

curl -X POST -H "Content-Type: application/json" --data \
'{
  "jsonrpc":"2.0",
  "method":"eth_getTransactionReceipt",            
  "params":["0x592ac1664ddbb569cd913f4745e402120bceffc55b8512116a6c4182dd07f915"
  "id":1,
  "jsonrpc":"2.0"
}' "http://127.0.0.1:8545"

@BowTiedDevil can you provide the curl commands you use to replicate txes from block 19922507?

thank you

Thanks for the reply ser. My concern was more based on the fact that I was getting inconsistent tracing behavior when simulating the same transaction at the same state…

Perhaps related to this issue - I was working on simulating a transaction using reth then sending that transaction to anvil. Reth trace succeeds but anvil fails when forked at the same block. I’m still isolating the bug (and make sure it’s actually anvil & have something reproduceable for others), but I think there might be something wonky with anvil.