mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-12 11:44:41 +00:00
fix slicing, and support partial slice bounds
This commit is contained in:
parent
5ff13dd81a
commit
128bbbc665
@ -1294,7 +1294,7 @@ def process_justification_and_finalization(state: BeaconState) -> None:
|
|||||||
|
|
||||||
# Process justifications
|
# Process justifications
|
||||||
state.previous_justified_checkpoint = state.current_justified_checkpoint
|
state.previous_justified_checkpoint = state.current_justified_checkpoint
|
||||||
state.justification_bits[1:] == state.justification_bits[:JUSTIFICATION_BITS_LENGTH - 1]
|
state.justification_bits[1:] = state.justification_bits[:JUSTIFICATION_BITS_LENGTH - 1]
|
||||||
state.justification_bits[0] = 0b0
|
state.justification_bits[0] = 0b0
|
||||||
matching_target_attestations = get_matching_target_attestations(state, previous_epoch) # Previous epoch
|
matching_target_attestations = get_matching_target_attestations(state, previous_epoch) # Previous epoch
|
||||||
if get_attesting_balance(state, matching_target_attestations) * 3 >= get_total_active_balance(state) * 2:
|
if get_attesting_balance(state, matching_target_attestations) * 3 >= get_total_active_balance(state) * 2:
|
||||||
|
@ -325,7 +325,7 @@ class BaseList(list, Elements):
|
|||||||
|
|
||||||
def __setitem__(self, k, v):
|
def __setitem__(self, k, v):
|
||||||
if type(k) == slice:
|
if type(k) == slice:
|
||||||
if k.start < 0 or k.stop > len(self):
|
if (k.start is not None and k.start < 0) or (k.stop is not None and k.stop > len(self)):
|
||||||
raise IndexError(f"cannot set item in type {self.__class__}"
|
raise IndexError(f"cannot set item in type {self.__class__}"
|
||||||
f" at out of bounds slice {k} (to {v}, bound: {len(self)})")
|
f" at out of bounds slice {k} (to {v}, bound: {len(self)})")
|
||||||
super().__setitem__(k, [coerce_type_maybe(x, self.__class__.elem_type) for x in v])
|
super().__setitem__(k, [coerce_type_maybe(x, self.__class__.elem_type) for x in v])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user