-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transaction/receipts data returned by Anvil is inconsistent with Ethereum spec #3840
Comments
hey @mslipper, could you pls tell me which chains these txs/blocks are from? if that's local, is there any way to repro? |
@mslipper @rkrasiuk The receipts of the block are: {
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"transactionHash": "0x6dfe8f4a3556854809fc1d49787ed90b8e8b812bf3a8357958360aab21d40c70",
"transactionIndex": "0x0",
"blockHash": "0xbc3b4ad6210408931e808a919800ca06a11a0d19dbca068bc0333cf2f7c3a6b7",
"blockNumber": "0x12a6f23",
"cumulativeGasUsed": "0x65b8",
"gasUsed": "0x65b8",
"effectiveGasPrice": "0x3b9aca03",
"from": "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
"to": "0xff00000000000000000000000000000000000901",
"contractAddress": null,
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"type": "0x2",
"deposit_nonce": null
},
{
"transactionHash": "0x2ef236a2336eb03e44aa4ce3f89ea5303dcc91dab50b7e2c454270644af3e6c5",
"transactionIndex": "0x1",
"blockHash": "0xbc3b4ad6210408931e808a919800ca06a11a0d19dbca068bc0333cf2f7c3a6b7",
"blockNumber": "0x12a6f23",
"cumulativeGasUsed": "0x1c143",
"gasUsed": "0x15b8b",
"effectiveGasPrice": "0x3b9aca03",
"from": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
"to": "0xb6aa91e8904d691a10372706e57ae1b390d26353",
"contractAddress": null,
"logs": [
{
"address": "0xb6aa91e8904d691a10372706e57ae1b390d26353",
"topics": [
"0xa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2",
"0x90f2770713ba137c167e7a4b409567ac2ede9c7cd96c966e989e6cc6621cde4e",
"0x0000000000000000000000000000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000000000000000000000000000014"
],
"data": "0x00000000000000000000000000000000000000000000000000000000660a2322",
"blockHash": "0xbc3b4ad6210408931e808a919800ca06a11a0d19dbca068bc0333cf2f7c3a6b7",
"blockNumber": "0x12a6f23",
"transactionHash": "0x2ef236a2336eb03e44aa4ce3f89ea5303dcc91dab50b7e2c454270644af3e6c5",
"transactionIndex": "0x1",
"logIndex": "0x1",
"removed": false
}
],
"logsBloom": "0x00000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000040000000000000000000000000000000000000000000001040000000000000000000000000000000000000002000000000000000000024000000000000000000000000000000000000000200000000000000000000000000400000000000004000000000800000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000040000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"type": "0x2",
"deposit_nonce": null
}
]
} The log index in the second transaction should be "0x0:, but it is "0x1" |
@0x6e616d could you please add details of the commands you used / forked chain to investigate this issue? thank you |
It's been quite a long time, and I forgot about it. Let me check again |
Component
Anvil
Have you ensured that all of these are up to date?
What version of Foundry are you on?
0.1.0 (a43313a 2022-11-30T17:15:08.718900657Z)
What command(s) is the bug in?
anvil fork
Operating System
Linux
Describe the bug
Overview
Optimism derives L2 blocks from log events and calldata submitted to L1. To prevent attacks from a malicious RPC provider, our system performs a series of sanity checks as well as a
receiptsRoot
check to verify that log events are valid and none are missing. While testing our op-node against a fork of L1 Goerli using Anvil, we observed these checks failing in the below ways.Mismatch between the
logIndex
field and actual log indexThe
logIndex
field sometimes doesn't match the actual index the log appears in the RPC. Here'scast
output from one of the affected receipts:You'll see that the
logIndex
in the first log above is0x1
, when it should be0x0
.Computed receipts root does not match returned
receiptsRoot
When we compute a receipt root for a given block using all the the transaction receipts within it, the computed receipts root does not match the
receiptsRoot
within the block.Unfortunately, I don't know exactly why this is. We've verified that our receipts root computation works by running the same code against Goerli with no issue. I wish I had more concrete information about the root cause here, but I'm fairly confident that you can reproduce this yourself by performing the same computation we do on an Anvil block with receipts in it. Here's the code we're using to compute the root, in case it helps: https://github.com/ethereum-optimism/optimism/blob/develop/op-node/sources/receipts.go#L65-L72.
Transaction hashes are duplicated
We're also seeing cases where transaction hashes appear in multiple blocks. Relevant
cast
output is below:We're able to work around these issues for now, but I thought I'd bring them to your attention anyway. Thanks for everything y'all do! Foundry is integral to our development process.
The text was updated successfully, but these errors were encountered: