paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.95k stars 1.19k forks source link

op-reth outputs bad data for "eth_getTransactionByBlockHashAndIndex" method #10463

Open AntonieDavid opened 2 months ago

AntonieDavid commented 2 months ago

Describe the bug

I've been testing the op-reth client on base mainnet and found a big difference when comparing the results from the node running on op-reth to the ones from a node running op-geth. for simplicity, the main differences are for the following params: nonce - differint values and for the following params they are existent in one response and nonexistent in the other gasPrice/yParity/isSystemTx/mint/depositReceiptVersion

Steps to reproduce

payload for that request: { "jsonrpc":"2.0", "method":"eth_getTransactionByBlockHashAndIndex", "params": "0xa7f29213cecdb3d3f2f861d02156c128724f96f4b7a0c32fee15584325184301", "0x0"], "id":1} op-reth service file flags/description: ExecStart=/usr/local/bin/op-reth node \ --ws --ws.port=8546 --ws.addr=0.0.0.0 --ws.origins="*" \ --http --http.port=8545 --http.addr=0.0.0.0 \ --http.corsdomain="*" \ --authrpc.addr=0.0.0.0 \ --authrpc.jwtsecret=/node/data/secret.jwt \ --authrpc.port=8551 \ --datadir=/node/data/reth/ \ --rollup.sequencer-http=https://mainnet-sequencer.base.org \ --http.api=admin,debug,eth,net,trace,web3,rpc,reth,ots,eth-call-bundle \ --ws.api=admin,debug,eth,net,trace,web3,rpc,reth,ots,eth-call-bundle \ --metrics 0.0.0.0:6060 \ --chain base \ --rpc.gascap 18446744073709551615 \ --rpc.max-connections 429496729 \ --rpc.max-logs-per-response 0 \ --rpc.max-subscriptions-per-connection 10000 \ --rollup.disable-tx-pool-gossip

Node logs

output from the op-reth client:
{"jsonrpc":"2.0","result":{"hash":"0xc468b38a20375922828c8126912740105125143b9856936085474b2590bbca91","nonce":"0x0","blockHash":"0xa7f29213cecdb3d3f2f861d02156c128724f96f4b7a0c32fee15584325184301","blockNumber":"0x11c7b4b","transactionIndex":"0x0","from":"0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001","to":"0x4200000000000000000000000000000000000015","value":"0x0","gas":"0xf4240","input":"0x440a5e20000008dd00101c1200000000000000040000000066c352bb000000000139c4f500000000000000000000000000000000000000000000000000000000c0cff1460000000000000000000000000000000000000000000000000000000000000001d4c88f4065ac9671e8b1329b90773e89b5ddff9cf8675b2b5e9c1b28320609930000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9","r":"0x0","s":"0x0","v":"0x0","yParity":"0x0","type":"0x7e","isSystemTx":false,"sourceHash":"0x417d134467f4737fcdf2475f0ecdd2a0ed6d87ecffc888ba9f60ee7e3b8ac26a"},"id":1}

output from the op-geth client:
{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0xa7f29213cecdb3d3f2f861d02156c128724f96f4b7a0c32fee15584325184301","blockNumber":"0x11c7b4b","from":"0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001","gas":"0xf4240","gasPrice":"0x0","hash":"0xc468b38a20375922828c8126912740105125143b9856936085474b2590bbca91","input":"0x440a5e20000008dd00101c1200000000000000040000000066c352bb000000000139c4f500000000000000000000000000000000000000000000000000000000c0cff1460000000000000000000000000000000000000000000000000000000000000001d4c88f4065ac9671e8b1329b90773e89b5ddff9cf8675b2b5e9c1b28320609930000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9","nonce":"0x11c7b4c","to":"0x4200000000000000000000000000000000000015","transactionIndex":"0x0","value":"0x0","type":"0x7e","v":"0x0","r":"0x0","s":"0x0","sourceHash":"0x417d134467f4737fcdf2475f0ecdd2a0ed6d87ecffc888ba9f60ee7e3b8ac26a","mint":"0x0","depositReceiptVersion":"0x1"}}

Platform(s)

Linux (x86)

What version/commit are you on?

op-reth --version reth Version: 1.0.3 Commit SHA: 390f30aadebcdd509e72cc04327c3b854de076a6 Build Timestamp: 2024-08-05T23:59:17.371843433Z Build Features: jemalloc,optimism Build Profile: maxperf

What database version are you on?

op-reth db version 2024-08-22T18:23:51.766359Z INFO Initialized tracing, debug log directory: /root/.cache/reth/logs/optimism Error: Datadir does not exist: "/root/.local/share/reth/optimism"

Which chain / network are you on?

base mainnet

What type of node are you running?

Archive (default)

What prune config do you use, if any?

No response

If you've built Reth from source, provide the full command you used

source "$HOME/.cargo/env" && RUSTFLAGS="-C target-cpu=native" cargo build --profile maxperf --features jemalloc,asm-keccak,optimism --bin op-reth

Code of Conduct

mattsse commented 2 months ago

thanks for this

two more things missing now: https://github.com/ethereum-optimism/op-geth/blob/641e996a2dcf1f81bac9416cb6124f86a69f1de7/internal/ethapi/api.go#L1521-L1528

emhane commented 2 months ago

trait method EthTransactions::transaction_by_block_and_tx_index requires an op override. are you under way with this already @mattsse ?

mattsse commented 2 months ago

completed should be

missing mint is actually correct in the op-reth response because this should be omitted from rpc if there's no mint in the tx, it is present in op-geth because there's an rlp issue that results in mint 0x0 for deposit txs without mints. But for consistency, we could also return mint: 0x0 in those cases until fixed if you want @AntonieDavid ?

how to deal with the additional yParity field is tbd

AntonieDavid commented 2 months ago

there's no need for mint: 0x0 if there's no mint in the tx. thanks for the solution so far, looking forward for the yParity also.

emhane commented 1 month ago

how to deal with yParity field needs design