mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-14 04:34:43 +00:00
bitfield length limit style improvement
This commit is contained in:
parent
509354582c
commit
7ffcdcfd7c
@ -1817,10 +1817,8 @@ def update_justification_and_finalization(state: BeaconState) -> None:
|
|||||||
new_justified_epoch = state.current_justified_epoch
|
new_justified_epoch = state.current_justified_epoch
|
||||||
new_finalized_epoch = state.finalized_epoch
|
new_finalized_epoch = state.finalized_epoch
|
||||||
|
|
||||||
# Rotate the justification bitfield up one epoch to make room for the current epoch
|
# Rotate the justification bitfield up one epoch to make room for the current epoch (and limit to 64 bits)
|
||||||
state.justification_bitfield <<= 1
|
state.justification_bitfield = (state.justification_bitfield << 1) % 2**64
|
||||||
# Python var length integers: justification bitfield is 64 bits, and may not be bigger (for SSZ serialization)
|
|
||||||
state.justification_bitfield &= (1 << 64) - 1
|
|
||||||
# If the previous epoch gets justified, fill the second last bit
|
# If the previous epoch gets justified, fill the second last bit
|
||||||
previous_boundary_attesting_balance = get_attesting_balance(state, get_previous_epoch_boundary_attestations(state))
|
previous_boundary_attesting_balance = get_attesting_balance(state, get_previous_epoch_boundary_attestations(state))
|
||||||
if previous_boundary_attesting_balance * 3 >= get_previous_total_balance(state) * 2:
|
if previous_boundary_attesting_balance * 3 >= get_previous_total_balance(state) * 2:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user