gnosischain / reth_gnosis

22 stars 3 forks source link

Reth doesn't import block RLPs exported by Geth #25

Closed debjit-bw closed 4 weeks ago

debjit-bw commented 1 month ago

Block RLPs provided by Geth raise the following error:

Error: file client has no tip

Full trace:

# ./target/debug/reth import genesis.rlp --chain=./scripts/chiado_genesis_alloc.json         
2024-10-24T16:21:13.601843Z  INFO Initialized tracing, debug log directory: /Users/debjit/Library/Caches/reth/logs/chiado
2024-10-24T16:21:13.609322Z  INFO reth 1.0.8-dev (9a732f6b) starting
2024-10-24T16:21:13.620808Z  INFO Opening storage db_path="/Users/debjit/Library/Application Support/reth/chiado/db" sf_path="/Users/debjit/Library/Application Support/reth/chiado/static_files"
2024-10-24T16:21:13.650432Z  INFO Verifying storage consistency.
2024-10-24T16:21:13.798502Z  INFO Consensus engine initialized
2024-10-24T16:21:13.805114Z  INFO Importing chain file chunk
[/Users/debjit/.cargo/git/checkouts/reth-36d3ea1d1152b20c/9a732f6/crates/cli/commands/src/import.rs:96:13] "debug len:" = "debug len:"
[/Users/debjit/.cargo/git/checkouts/reth-36d3ea1d1152b20c/9a732f6/crates/cli/commands/src/import.rs:96:13] file_client.bodies_len() = 0
Error: file client has no tip

Location:
    /Users/debjit/.cargo/git/checkouts/reth-36d3ea1d1152b20c/9a732f6/crates/cli/commands/src/import.rs:98:47

Diving deeper

We also generate block RLPs using reth itself. For that, the file client has no tip doesn't happen. The file read is successful, but a separate (later in the sequence) error orrurs: #24.

Writing manual RLP decoders in python, we see the difference between the decoded RLPs: By Geth By Reth
Screenshot 2024-10-24 at 9 59 38 PM Screenshot 2024-10-24 at 10 00 11 PM

The file containing the RLP from reth gets accepted, however the file containing the RLP from geth errors out.

Suspicions:

debjit-bw commented 4 weeks ago

this is because of block structure differences. https://github.com/paradigmxyz/reth/pull/12134 makes importing blocks optional. closing since that PR is almost ready to be merged