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

Simplify ValidateAttestationTime #13813

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

potuz
Copy link
Contributor

@potuz potuz commented Mar 27, 2024

ValidateClock in ValidateAttestationTime is useless

The check is that the attSlot is not > than the currentslot + 128 slots.

Later there's a check that the attSlot start time is not > than current slot start time + clockDisparity.

if attSlot > than currentSlot + 128 slots, then the second check would fail anyway.

The lattest check already guarantees that the attSlot cannot be larger than the currentSlot, therefore it may never happen that attEpoch > currentEpoch. We just need to check for Deneb that attEpoch >= currentEpoch - 1.

Removes also some duplicated variables like the attestation epoch being computed twice.

ValidateClock in ValidateAttestationTime is useless

The check is that the attSlot is not > than the currentslot + 128 slots.

Later there's a check that the attSlot start time is not > than current slot
start time + clockDisparity.

if attSlot > than currentSlot + 128 slots, then the second check would fail
anyway.

The lattest check already guarantees that the attSlot cannot be larger than the
currentSlot, therefore it may never happen that attEpoch > currentEpoch. We just
need to check for Deneb that attEpoch >= currentEpoch - 1.

Removes also some duplicated variables like the attestation epoch being computed
twice.
@potuz potuz added the Cleanup Code health! label Mar 27, 2024
@potuz potuz requested a review from a team as a code owner March 27, 2024 12:57
@potuz potuz enabled auto-merge March 27, 2024 12:57
@potuz potuz added this pull request to the merge queue Mar 27, 2024
Merged via the queue into develop with commit fad118c Mar 27, 2024
17 checks passed
@potuz potuz deleted the simplify_validate_attestation_time branch March 27, 2024 14:38
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup Code health!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants