-
Notifications
You must be signed in to change notification settings - Fork 145
Conversation
…poch_and_root Update `process_justification`
1. Use `state.current_justified_root` as `source_root`` 2. Use `apply_state_transition_without_block
""" | ||
Validate ``source_epoch`` field of ``attestation_data``. | ||
Validate ``source_epoch`` and ``source_root`` fields of ``attestation_data``. | ||
Raise ``ValidationError`` if it's invalid. | ||
""" | ||
if slot_to_epoch(attestation_data.slot + 1, slots_per_epoch) >= current_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.
Note that + 1
will be removed when we have #391
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.
Justification and finalization parts looks good
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.
looks great! left a few comments about code but logic looks great :)
Raise ``ValidationError`` if it's invalid. | ||
""" | ||
if slot_to_epoch(attestation_data.slot + 1, slots_per_epoch) >= current_epoch: | ||
if attestation_data.source_epoch != justified_epoch: | ||
if attestation_data.source_epoch != state.current_justified_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.
could be nice to break this body out into a function (used here and in the body of the else
arm) but i think this is fine for now. i would say it is required if we end up nesting another level, i.e. if
inside if
inside if
.
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.
Agreed that would be ideal but I'm inclined to keep it simpler for now. i.e., two-level if
seems "acceptable" right now.
Added some minor comment/formatting in b8a0843
crosslink_committees_at_slot = get_crosslink_committees_at_slot( | ||
# To avoid the epoch boundary cases | ||
state.copy( | ||
slot=state.slot + 1, | ||
slot=state.slot, |
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 is unnecessary now that we are not modifying the slot, correct?
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.
state
pre-copy and state
post-copy are the same
What was wrong?
part 2 of #418
How was it fixed?
BeaconState
fieldsjustified_epoch
->current_ justified_epoch
previous_justified_root
current_justified_root
finalized_root
previous_justified_root
. Combinevalidate_attestation_source_epoch
andvalidate_attestation_source_root
intovalidate_attestation_source_epoch_and_root
._get_finalized_epoch
flow as the specstate.current_justified_root
assource_root
apply_state_transition_without_block
Cute Animal Picture