Skip to content
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

Fix engine tree tests with state root task enabled #14376

Open
fgimenez opened this issue Feb 10, 2025 · 1 comment · May be fixed by #14482
Open

Fix engine tree tests with state root task enabled #14376

fgimenez opened this issue Feb 10, 2025 · 1 comment · May be fixed by #14482
Assignees
Labels
A-engine Related to the engine implementation C-test A change that impacts how or what we test

Comments

@fgimenez
Copy link
Member

Ref #14371

engine tree tests are failing when enabling state root task for instance https://github.com/paradigmxyz/reth/actions/runs/13244337100/job/36967035426

and locally:

✗ cargo t -p reth-engine-tree live_sync_fcu_extends_canon_chain -- --nocapture

running 1 test

thread 'tree::tests::test_engine_tree_live_sync_fcu_extends_canon_chain' panicked at crates/engine/tree/src/tree/mod.rs:3497:50:
called `Result::unwrap()` on an `Err` value: InsertBlockError { error: Provider(ConsistentView(Syncing { best_block: GotExpected { got: 0, expected: 0 } })), hash: 0xd9fcc226ccaf94a53ba8403e49d34999c09eda53045a1283a8e1d3a7f667d31e, number: 1, parent_hash: 0xcef5e0064593f96b34fd8b992f061f0862a15fe26cd3e29ebb4ece031b86c448, num_txs: 3, .. }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test tree::tests::test_engine_tree_live_sync_fcu_extends_canon_chain ... FAILED

failures:

failures:
    tree::tests::test_engine_tree_live_sync_fcu_extends_canon_chain

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 59 filtered out; finished in 0.47s
@fgimenez fgimenez added C-test A change that impacts how or what we test A-engine Related to the engine implementation labels Feb 10, 2025
@fgimenez fgimenez self-assigned this Feb 13, 2025
@fgimenez
Copy link
Member Author

fgimenez commented Feb 13, 2025

The unit tests use a MockEthProvider as the engine provider

let provider = MockEthProvider::default();

and rely on its StateRootProvider impl to mock the state root calculation by setting the expected state root

self.tree.provider.add_state_root(block.state_root);

with state root task this trait impl is not used, and the failure happens when trying to create a readonly database provider required for the consistent view that state root task uses:

fn database_provider_ro(&self) -> ProviderResult<Self::Provider> {
Err(ConsistentViewError::Syncing { best_block: GotExpected::new(0, 0) }.into())
}

to keep the unit tests isolated we need to be able to mock the state root task results. we could also have them less isolated and use a test db provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-engine Related to the engine implementation C-test A change that impacts how or what we test
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant