fix(consensus): prevent double-commit of equivocating blocks in Linearizer #24499
+397
−2
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.
Description
This PR fixes a safety vulnerability where the Linearizer could double-commit equivocating blocks at the same (Round, Author) slot.
Fixes #24498
Problem
In
linearize_sub_dag(), the commit status check usesis_committed(BlockRef)which includes the Digest:Since two equivocating blocks have different digests, they are treated as different blocks. If Block A is committed first,
is_committed(Block B)still returnsfalse, allowing Block B to be committed later through a different DAG path.Solution
Added
is_any_block_at_slot_committed(Slot)method to check if ANY block at a given (Round, Author) slot has been committed, regardless of digest:Changes
dag_state.rs: Addis_any_block_at_slot_committed()methodlinearizer.rs: Add trait method and use it inlinearize_sub_dag()test_dag_builder.rs: Implement trait method for test mockequivocation_commit_test.rs: Add test casesTest Plan
cargo test -p consensus-core equivocation_commit- New tests passcargo test -p consensus-core linearizer- Existing tests pass