-
Notifications
You must be signed in to change notification settings - Fork 997
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
Refactor signature handling #633
Conversation
# Signature | ||
'signature': 'bytes96', | ||
} | ||
``` |
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.
Why do we even need to do this? Why not be more radical and just remove the Proposal class entirely and directly sign the block? Or is that to reduce the number of slashing conditions down the line when we have shard blocks?
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 do like the idea of having two separate slashing conditions for two reasons:
- It's somewhat cleaner (don't need
Proposal
andBEACON_CHAIN_SHARD_NUMBER
) - Beacon chain proposer slashing is arguably more important than shard proposer slashing. So with two separate transaction types we have guaranteed throughput for beacon chain proposer slashings.
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.
It's not completely trivial if we remove Proposal
. The reason is that for the proposer slashing you would need a Merkle path to the block root to prove the slot number.
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.
Wait, why? Why not just have a ProposerSlashing
object that contains two block headers? Sure it's maybe a hundred bytes longer, but that's nothing compared to attester slashings in any case...
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.
We could replace Proposal
with a BeaconBlockHeader
object but would that be more verbose (Proposal
only have 4 fields, BeaconBlockHeader
would have 7) and slightly less efficient?
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.
Aah I see, BeaconBlock
objects themselves are too big, and we technically don't have a BeaconBlockHeader
(well, from any block you can create a block header with an equivalent SSZ root by replacing the body with a hash of the body, but if we're going to take advantage of this fact in the spec it would be good to document it well...
I see a few possibilities:
- Modify the
BeaconBlock
object so it has an explicit header that containshash(body)
and a separate body - Define a
BeaconBlockHeader
as a header that can be derived from anyBeaconBlock
- Keep the current approach
Note that in terms of hashes and bytes, (1) and (2) are exactly equivalent; object1 containing the SSZ root of object2 with object2 living "somewhere else", and obect1 literally containing object2 in its entirety, are in some sense exactly the same thing and will have exactly the same SSZ root. So it's a choice of presentation rather than content.
(3) would change things less relative to the status quo and it would not introduce this weirdness of the header being kinda part of and kinda separate from the rest of the block, though it would lead to a slightly longer spec. I guess my "don't change things at this stage of the game unless it's a really really good idea" bias does make me lean slightly toward (3)....
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.
Ok, I'll keep as is and mull over it a bit.
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.
Can you approve the PR?
Yay! Love PRs that delete more LoCs than they add as usual. Made two comments, otherwise can't find any issues yet. |
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'd like to take a quick look at this before merge. Give me today |
Goes with #625.
Related issue: #540