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

Assertion failed: key > self.key with op-reth #10924

Closed Zacholme7 closed 3 weeks ago

Zacholme7 commented 1 month ago

Describe the bug

This is a reoccurring bug that has happens to me before. Sometimes It can fix itself and sometimes it cannot. Execution is unable to boot due to the above assertion.

Steps to reproduce

I am not sure the exact cause, but it has to do with reading from the db. Most recently, the following code is what caused the error.

 let db_env = DatabaseEnv::open(
    db_path,
    DatabaseEnvKind::RO,
    DatabaseArguments::new(ClientVersion::default())
).unwrap();
let db_ev = Arc::new(db_env);

let static_file_provider = StaticFileProvider::read_only(static_path, true).unwrap();
static_file_provider.watch_directory();

let chain_spec = Arc::new(BASE_MAINNET.inner.clone());
let database: ProviderFactory<NodeTypesWithDBAdapter<EthereumNode, _>> = 
    ProviderFactory::new(db_ev.clone(), chain_spec.clone(), static_file_provider);

let db_provider = database.provider().unwrap();
let state_provider = database.latest().unwrap();

while true {
    let db_number = db_provider.best_block_number().unwrap();
    let provider_number = provider.get_block_number().await.unwrap();
    println!("db {:?}, provider {:?}", db_number, provider_number);
}

Node logs

base_reth    | thread 'tokio-runtime-worker' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/alloy-trie-0.5.0/src/hash_builder/mod.rs:115:9:
base_reth    | assertion failed: key > self.key
base_reth    | stack backtrace:
base_reth    | note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
base_reth    | 2024-09-15T14:17:31.199993Z ERROR Critical task `pipeline task` panicked: `assertion failed: key > self.key`
base_reth    | 2024-09-15T14:17:31.200069Z ERROR shutting down due to error
base_reth    | Error: Critical task `pipeline task` panicked: `assertion failed: key > self.key`
base_reth    |
base_reth    | Location:
base_reth    |     /project/crates/cli/runner/src/lib.rs:161:32

Platform(s)

Linux (x86)

What version/commit are you on?

1.0.6

What database version are you on?

2

Which chain / network are you on?

base

What type of node are you running?

Full via --full flag

What prune config do you use, if any?

[prune] block_interval = 5

[prune.segments] sender_recovery = "full"

[prune.segments.account_history] distance = 10064

[prune.segments.storage_history] distance = 10064

[prune.segments.receipts_log_filter]

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

No response

Code of Conduct

Rjected commented 1 month ago

Hi, is that code from reth or your own app?

Zacholme7 commented 1 month ago

Hi, is that code from reth or your own app?

own app. running this/some variation of this has caused the error on 3 separate occasions.

rkrasiuk commented 1 month ago

@Zacholme7 do you have any additional state root related code you are calling? because that is what's causing the error

Zacholme7 commented 1 month ago

@Zacholme7 do you have any additional state root related code you are calling? because that is what's causing the error

Not in this situation no, sorry. This code was ran directly after the main function, so it was basically the entire program in this case.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 21 days with no activity.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been inactive for 7 days since being marked as stale.