fix: clamp attestation target walk to finalized boundary#818
Open
latifkasuli wants to merge 1 commit into
Open
fix: clamp attestation target walk to finalized boundary#818latifkasuli wants to merge 1 commit into
latifkasuli wants to merge 1 commit into
Conversation
dd851b0 to
ab78ec1
Compare
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
Fixes an Lstar attestation-target boundary bug where
get_attestation_target()could walk below the latest finalized checkpoint whensafe_targetwas stale behind finalization.The target-selection walk now uses
max(safe_target.slot, latest_finalized.slot)as its lower bound, and the justifiability walk stops at the finalized boundary before callingis_justifiable_after().Root Cause
safe_targetcan legally lag behindlatest_finalized. In that state, the previous implementation walked backward from head toward the stale safe target, crossed below the finalized slot, and then called:on a candidate slot before finalization. That violates the slot helper invariant and raises:
Validation
Candidate slot must not be before finalized slotuv run --group test pytest tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.py -q --no-covuv run --group test pytest tests/lean_spec/spec/forks/lstar/forkchoice/test_block_production_justification_gap.py tests/lean_spec/spec/forks/lstar/state -q --no-covuv run --group lint ruff check src/lean_spec/spec/forks/lstar/validator_duties.py tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.pyuv run --group lint ruff format --check src/lean_spec/spec/forks/lstar/validator_duties.py tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.pyuv run --group lint ty check src/lean_spec/spec/forks/lstar/validator_duties.py tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.pygit diff --check