paradigmxyz / reth

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

op-reth outputs bad data for "eth_getTransactionReceipt" method #10462

Closed AntonieDavid closed 1 month 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 difference is the l1Fee value, which should be identical and also the reth node is missing some params l1BaseFeeScalar/l1BlobBaseFee/l1BlobBaseFeeScalar and also there is l1FeeScalar this parameter in op-reth which isn't present in the op-geth result.

Steps to reproduce

payload for that request: {"method": "eth_getTransactionReceipt", "params": ["0xca564948e3e825f65731424da063240eec34ba921dd117ac5d06b8c2e0b2d962"], "id": 52, "jsonrpc": "2.0"} 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": {
    "status": "0x1",
    "cumulativeGasUsed": "0xc74f5e",
    "logs": [],
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "type": "0x2",
    "transactionHash": "0xca564948e3e825f65731424da063240eec34ba921dd117ac5d06b8c2e0b2d962",
    "transactionIndex": "0x3e",
    "blockHash": "0x70a8a64a0f8b141718f60e49c30f027cb9e4f91753d5f13a48d8e1ad263c08bf",
    "blockNumber": "0x1185e55",
    "gasUsed": "0x5208",
    "effectiveGasPrice": "0x31b41b",
    "from": "0x889ebdac39408782b5165c5185c1a769b4dd3ce6",
    "to": "0x7449061f45d7b39b3b80b4159286cd8682f60a3c",
    "contractAddress": null,
    "l1Fee": "0x84aaa7",
    "l1FeeScalar": "0.000004",
    "l1GasPrice": "0x50f928b4",
    "l1GasUsed": "0x640"
  },
  "id": 52
}

output from the op-geth client:
{
  "jsonrpc": "2.0",
  "id": 52,
  "result": {
    "blockHash": "0x70a8a64a0f8b141718f60e49c30f027cb9e4f91753d5f13a48d8e1ad263c08bf",
    "blockNumber": "0x1185e55",
    "contractAddress": null,
    "cumulativeGasUsed": "0xc74f5e",
    "effectiveGasPrice": "0x31b41b",
    "from": "0x889ebdac39408782b5165c5185c1a769b4dd3ce6",
    "gasUsed": "0x5208",
    "l1BaseFeeScalar": "0x8dd",
    "l1BlobBaseFee": "0x1",
    "l1BlobBaseFeeScalar": "0x101c12",
    "l1Fee": "0x125f723f3",
    "l1GasPrice": "0x50f928b4",
    "l1GasUsed": "0x640",
    "logs": [],
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "status": "0x1",
    "to": "0x7449061f45d7b39b3b80b4159286cd8682f60a3c",
    "transactionHash": "0xca564948e3e825f65731424da063240eec34ba921dd117ac5d06b8c2e0b2d962",
    "transactionIndex": "0x3e",
    "type": "0x2"
  }
}

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"

Location: /root/reth/crates/cli/commands/src/db/mod.rs:71:9

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

emhane commented 1 month ago

trait method EthTransaction::transaction_receipt needs an override in impl EthTransactions for OpEthApi<N>

emhane commented 1 month ago

at second look, it appears the reth code is correct, and bugs are caused by op-alloy. ref https://github.com/alloy-rs/op-alloy/pull/53.

emhane commented 1 month ago

l1FeeScalar shouldn't be set after ecotone, so we're probably mistakenly still setting this for fjord. we need new types to contain in op receipt envelopes, this type safety will help us setting these fields correctly, issue open https://github.com/alloy-rs/op-alloy/issues/54

emhane commented 1 month ago

l1_fee computation is off op-reth: "l1Fee": "0x84aaa7" op-geth: "l1Fee": "0x125f723f3"

this bug also caught by new unit test https://github.com/paradigmxyz/reth/pull/10620

emhane commented 1 month ago

seems like there is a new func for calculating l1Fee and L1GasUsed since Fjord

AntonieDavid commented 1 month ago

thanks for addressing parts of the issue, waiting for the l1Fee/L1GasUsed functions to be updated