Skip to content

Conversation

@GrapeBaBa
Copy link
Contributor

🗒️ Description

This pull request makes a small fix to the logic in the process_attestations function in src/lean_spec/subspecs/containers/state/state.py. The change corrects the conditional statement to ensure that votes about unknown or conflicting forks are properly filtered.

  • Updated the conditional logic in process_attestations to use or instead of and, preventing votes about unknown or conflicting forks more accurately

🔗 Related Issues or PRs

✅ Checklist

  • Ran tox checks to avoid unnecessary CI fails:
    uvx tox
  • Considered adding appropriate tests for the changes.
  • Considered updating the online docs in the ./docs/ directory.

Signed-off-by: Chen Kai <281165273grape@gmail.com>
Copilot AI review requested due to automatic review settings January 7, 2026 15:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical logical error in the attestation validation logic within the process_attestations function. The change corrects a conditional check that validates whether attestation source and target roots match the canonical chain's historical block hashes.

Key Changes:

  • Changed logical operator from and to or in the fork validation check, ensuring attestations are properly rejected if either the source or target root doesn't match the historical block hash

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 461 to 465
if (
source.root != self.historical_block_hashes[source.slot]
and target.root != self.historical_block_hashes[target.slot]
or target.root != self.historical_block_hashes[target.slot]
):
continue
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug fix corrects critical validation logic, but there appears to be no test coverage for this specific check. Consider adding tests that verify attestations are properly rejected when:

  1. The source root doesn't match the historical block hash at the source slot
  2. The target root doesn't match the historical block hash at the target slot
  3. Both roots don't match (edge case)

These tests would help prevent similar bugs in the future and validate that the fix works correctly.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@tcoratger tcoratger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@tcoratger tcoratger merged commit 5239e39 into leanEthereum:main Jan 7, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants