ethereum / consensus-specs

Ethereum Proof-of-Stake Consensus Specifications
Creative Commons Zero v1.0 Universal
3.56k stars 973 forks source link

Refactor signature handling #540

Closed JustinDrake closed 5 years ago

JustinDrake commented 5 years ago

Right now the signature logic across SSZ object is ad-hoc. The following are dealt differently:

Here's one way to unify the signature logic (discussed with Danny and Vitalik):

{
    epoch: Epoch,
    shard: Shard,
    root: Bytes32,
    signature: Signature,
}
vbuterin commented 5 years ago

Adding an empty signature field to every SSZ object seems like a bad idea; it would just add a lot of hashing overhead. The cleanest would just be for every type T have a type SignedT = {data: T, signature: Signature}.

However there is another issue which is that for attestations, we need to have the attestation and custody bitfields not be signed over, because the signers don't know who each other are, so the signature mechanism is not going to fit it well no matter how it is done.

Another more general possibility that covers these cases and others is to establish a rule that the signature is the signature of all fields that come before it. This way we can just use order of appearance in the object to denote order of signing and what does and does not need to be signed.

JustinDrake commented 5 years ago

Closing in favour of #649.