test(e2e): repro reth-ahead-of-consensus cross-store desync (audit #703/#704)#745
Open
keanji-x wants to merge 1 commit into
Open
test(e2e): repro reth-ahead-of-consensus cross-store desync (audit #703/#704)#745keanji-x wants to merge 1 commit into
keanji-x wants to merge 1 commit into
Conversation
#704) Adds a single-node e2e suite that deterministically reproduces the non-atomic cross-store commit bug (reth execution rocksdb ahead of the aptos consensus DB) and the recovery-path panic it triggers. Repro (no power-loss race needed): 1. bring node live, commit past H, node.stop() cleanly 2. gravity_cli unwind the CONSENSUS DB back to ~H/2, leaving reth at H (NOTE: --consensus-db-path must be the parent <data> dir, the tool joins "consensus_db" internally; passing <data>/consensus_db no-ops) 3. node.start(): recovery anchors on reth's height (recover_block_number), the unwound consensus index lacks it, RecoveryData::new -> find_root fails "unable to find root" -> persistent_liveness_storage.rs:550 panic!("") and the node CRASHES (no PartialRecoveryData/state-sync fallback; recovery_manager.rs:104 is todo!()). Observed evidence captured by the test: ERROR persistent_liveness_storage.rs:549 Failed to construct recovery data {"error":"unable to find root: ..."} ; panicked at persistent_liveness_storage.rs:550 ; node process dead. The sibling silent-stall path (block_buffer_manager.rs:343 early-return leaving the buffer Uninitialized -> get_ordered_blocks awaits ready_notifier forever) is also asserted as a recovery failure. The test asserts the CORRECT post-fix behaviour (node reconciles reth_height > consensus_index and resumes), so it is xfail(strict) on current code. Remove the xfail once startup auto-reconciles instead of panicking/stalling. Test-only; no production code changed. Refs Galxe/gravity-audit#703, Galxe/gravity-audit#704 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a deterministic single-node e2e suite (
gravity_e2e/cluster_test_cases/cross_store_desync_703_704/) that reproduces the non-atomic cross-store commit bug and the recovery-path crash it triggers — findings F1/F2 ingalxe/RESTART_RECOVERY_FINDINGS.md.reth (execution rocksdb) and the aptos consensus DB persist on independent stores with no write-ordering barrier. A crash in the commit window can leave reth at block N while consensus is at N-1. On restart, recovery anchors on reth's height (
bin/gravity_node/src/main.rs:123recover_block_number) but the consensus index no longer contains it, so recovery cannot find the root and the node dies — there is no reconcile / state-sync fallback.Reproduction (no power-loss race needed)
node.stop()cleanly.gravity_cli unwindthe consensus DB back to ~H/2, leaving reth at H.--consensus-db-pathmust be the parent<data>dir, becauseConsensusDB::newjoinsconsensus_dbinternally (aptos-core/consensus/src/consensusdb/mod.rs:112). Passing<data>/consensus_dboperates on an empty nested DB and silently no-ops.node.start()and observe recovery.Observed failure (current code)
This is F1 (#703): the
PartialRecoveryData/ state-sync fallback at:551is commented out andrecovery_manager.rs:104istodo!(), so any inconsistent recovery data is apanic!(""). The sibling F2 (#704) silent-stall path (crates/block-buffer-manager/src/block_buffer_manager.rs:343early-return leaving the bufferUninitialized→get_ordered_blocksawaitsready_notifierforever) is also asserted as a recovery failure.Test status
The test asserts the correct post-fix behaviour (node detects
reth_height > consensus_index, reconciles, and resumes producing blocks), so it is@pytest.mark.xfail(strict=True)on current code:Remove the xfail once startup auto-reconciles instead of panicking/stalling.
Notes
base_dir=/tmp/gravity-cluster-desyncand unique ports (rpc 8945, validator 6480, vfn 6490, authrpc 8953, reth_p2p 12324, metrics 9050, inspection 10300) — no collision with existing suites.🤖 Generated with Claude Code