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

process_attestation: Validate epoch before using it #1996

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

arnetheduck
Copy link
Contributor

data.target.epoch is used to count the active validator set.

Because get_committee_count_per_slot is extremely inefficient the way
the spec is written, clients cache it, or the underlying active
validator set.

Performing the checks in the given order leads to a (very unlikely)
security issue where the a cold and above all, distant value may get
used which may be costly - reordering the checks brings the value into a
more reasonable range before using it.

`data.target.epoch` is used to count the active validator set.

Because `get_committee_count_per_slot` is extremely inefficient the way
the spec is written, clients cache it, or the underlying active
validator set.

Performing the checks in the given order leads to a (very unlikely)
security issue where the a cold and above all, distant value may get
used which may be costly - reordering the checks brings the value into a
more reasonable range before using it.
@arnetheduck
Copy link
Contributor Author

Notably, this is predominantly an issue for implementations - the outcome, even if processed in the order given by the spec, remains the same.

Copy link
Collaborator

@protolambda protolambda left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good, not a breaking change, so I think it can go into next release.

Regarding slowness: pre-computing committee data helps a lot with performance, and makes the committee-per-slot lookup just a fast epoch range check + length read (ZRNT example). Moving this epoch comparison should not be a reason to not consider pre-computing the committees.

cc @djrtwo non-breaking beacon spec change for v0.12.2

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

Just in time for v0.12.2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants