-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Merge attestation verification logic #831
Conversation
Also rename slashable attestation to standalone attestation to reflect its broader functionality in phase 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this reorg! 👍
IMHO the name StandaloneAttestation
is still kind of confusing and hard to link to "standalone-verifiable". Even VerifiableAttestation
is more understandable than StandaloneAttestation
.
Co-Authored-By: vbuterin <[email protected]>
I still like Let's argue about it in the next call? |
specs/core/0_beacon-chain.md
Outdated
return StandaloneAttestation( | ||
validator_indices=get_attestation_participants(state, attestation.data, attestation.aggregation_bitfield), | ||
data=attestation.data, | ||
custody_bitfield=attestation.custody_bitfield, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To confirm with @vbuterin:
- I assumed that before this conversion, the committee size of this
Attestation.custody_bitfield
is the committee of the given crosslink committee - but actually, the size ofAttestation.custody_bitfield
is not restricted in thedev
branch. - And after this conversion, in
verify_standalone_attestation
, it expects that the committee
size ofStandaloneAttestation.custody_bitfield
islen(StandaloneAttestation.validator_indices)
?
The benefit of having len(Attestation.custody_bitfield) == len(Attestation.aggregation_bitfield) == (len(crosslink_committee) + 7) // 8
is that we can simply merge the bitfields with or
operator when aggregating
many Attestation
s. If the size of len(Attestation.custody_bitfield) != (len(crosslink_committee) + 7) // 8
, it seems it would add additional overhead to generate the new custody_bitfield
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed that before this conversion, the committee size of this Attestation.custody_bitfield is the committee of the given crosslink committee - but actually, the size of Attestation.custody_bitfield is not restricted in the dev branch.
An attestation committee will not exceed 4096 already because that's the "all ETH is validating" threshold. In any case, having the same threshold in both regular attestations and standalone attestations seems necessary for slashing to be possible in any case.
it expects that the committee
size of StandaloneAttestation.custody_bitfield is len(StandaloneAttestation.validator_indices)?
You are right that the proposed change does increase strictness because the current approach requires the custody bitfield to be any quantity of zero bytes. I would argue again that the current approach is wrong and the new approach is correct.
Brainstorming names:
|
specs/core/0_beacon-chain.md
Outdated
return IndexedAttestation( | ||
validator_indices=get_attestation_participants(state, attestation.data, attestation.aggregation_bitfield), | ||
data=attestation.data, | ||
custody_bitfield=attestation.custody_bitfield, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This custody_bitfield
here is incorrect. We need to truncate the bitfield to be the ceildiv8
of the size of the participants (validator_indices
) and if we sort the validator_indices
, the newly constructed custody_bitfield needs to reflect this sort order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise it:
- fails
verify_bitfield
because the length ofvalidator_indices
can easily be less than the length of the original committee - even if all validators participated the custody_bitfield, it is then in the incorrect order wrt
validator_indices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best I've thought of so far is to modify IndexedAttestation
so that it has bit_0_validator_indices
and bit_1_validator_indices
, and get rid of the custody bitfield.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will make IndexedAttestation
inside of AttesterSlashing
almost 2x in size.
Did you check out the fix I put in place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will make IndexedAttestation inside of AttesterSlashing almost 2x in size.
Why would it? The total size of the two lists would still equal the size of the original list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the current proposed fix; adding two whole new functions in a PR that's supposed to be simplifying things feels very not-worth-it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, missed that you wanted to get rid of the original validator indices list.
Making the change, thanks!
Also rename slashable attestation to indexed attestation to reflect its broader functionality in phase 1.