-
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
phase 1 validator guide (round 1) #1704
Conversation
|
||
##### Head shard root | ||
|
||
Set `attestation_data.head_shard_root = hash_tree_root(head_shard_block)`. | ||
|
||
##### Shard transition | ||
|
||
Set `shard_transition` to the value returned by `get_shard_transition()`. | ||
Set `shard_transition` to the value returned by `get_shard_transition(head_state, shard, 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.
@hwwhww I moved get_shard_transition
from shard-transition.md
to the validator guide (I think the appropriate place).
I also greatly reduced the complexity of what is going on here. I think previously, much of the helper functions were implementing some weird version of the fork choice. Now, we assume that shard_blocks
is the already validated sequence of blocks received from the fork choice leading to the current head of the shard chain.
One important thing is that I am currently assuming that the fork choice is only going to give me heads of chains that fit the expected offset_slots
. The forkchoice doesn't currently provide this safety mechanism, but I think that it probably should.
Can you take a look at this attestation data section (mainly the mods I made to get_shard_transition
) and the proposed addition of offset_slots
being enforced by fork choice? Happy to hop on a quick call to help you go over this and discuss in more depth
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.
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.
Great work!! ✨
I reviewed the shard transition part. will review other parts later.
|
||
##### Head shard root | ||
|
||
Set `attestation_data.head_shard_root = hash_tree_root(head_shard_block)`. | ||
|
||
##### Shard transition | ||
|
||
Set `shard_transition` to the value returned by `get_shard_transition()`. | ||
Set `shard_transition` to the value returned by `get_shard_transition(head_state, shard, 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.
Followup note of #1704 (comment): These are some cases I see for attesting If EDIT: added more lines |
Do you consider 4a and 4b as 2 different cases? If yes, does it break current transition? 4a: B100 crosslinks S99 |
Thank! It looks like an extended 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.
Another round :)
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.
Updated the domain types table a bit.
LGTM except for an is_in_next_light_client_committee
question.
Good job! 💯
specs/phase1/validator.md
Outdated
current_source_epoch = compute_committee_source_epoch(get_current_epoch(state), LIGHT_CLIENT_COMMITTEE_PERIOD) | ||
next_source_epoch = current_source_epoch + LIGHT_CLIENT_COMMITTEE_PERIOD | ||
next_committee = get_light_client_committee(state, next_source_epoch) |
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 input epoch
of get_light_client_committee
should be the epoch that the light clients have to vote for, not the source epoch.
I suppose it should be:
current_source_epoch = compute_committee_source_epoch(get_current_epoch(state), LIGHT_CLIENT_COMMITTEE_PERIOD) | |
next_source_epoch = current_source_epoch + LIGHT_CLIENT_COMMITTEE_PERIOD | |
next_committee = get_light_client_committee(state, next_source_epoch) | |
next_committee = get_light_client_committee(state,get_current_epoch(state) + LIGHT_CLIENT_COMMITTEE_PERIOD) |
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 actually argue that the above logic is the same, and I considered writing it as you had originally but wasn't sure if the logic was clear.
Making the change regardless. (curious if I am incorrect in saying that you'll get the same result either way)
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.
@djrtwo
No, they are not the same result. I argued the function logic correctness:
get_light_client_committee
itself will compute the correct source epoch internally, so we don't have to pass the source epoch to it.- The
epoch
we pass toget_light_client_committee
should have been the epoch that the light client is going to vote for. In this case, setting it toget_current_epoch(state) + LIGHT_CLIENT_COMMITTEE_PERIOD
can make it forward to the next period.
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.
But getting the current_source_epoch
and adding LIGHT_CLIENT_COMMITTEE_PERIOD
to it will put you certainly in the next period. Just as get_current_epoch + LIGHT_CLIENT_COMMITTEE_PERIOD
will also put you in the next period
Remove `ShardState.transition_digest`
No, because |
Add phase 1 validator guide.
Add the following checked items. Leave the remaining for a subsequent PR(s)
shard_transition
, when to broadcast, when to aggregate)shard_transition
fromattestation_data
in p2p for deduplication gains (OR splitattestation_data
fromattestation
...)