From f157745248492114da19b14c45e8831493368853 Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 20 Jun 2019 20:38:42 +0200 Subject: [PATCH] resolve some remaining list-rework rebase details --- specs/core/0_beacon-chain.md | 6 +++--- test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 9a02c16e4..9c871f5f2 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -535,8 +535,8 @@ class BeaconState(Container): # Slashings slashed_balances: Vector[Gwei, EPOCHS_PER_SLASHED_BALANCES_VECTOR] # Sums of the effective balances of slashed validators # Attestations - previous_epoch_attestations: List[PendingAttestation, MAX_ATTESTATIONS * EPOCH_LENGTH] - current_epoch_attestations: List[PendingAttestation, MAX_ATTESTATIONS * EPOCH_LENGTH] + previous_epoch_attestations: List[PendingAttestation, MAX_ATTESTATIONS * SLOTS_PER_EPOCH] + current_epoch_attestations: List[PendingAttestation, MAX_ATTESTATIONS * SLOTS_PER_EPOCH] # Crosslinks previous_crosslinks: Vector[Crosslink, SHARD_COUNT] # Previous epoch snapshot current_crosslinks: Vector[Crosslink, SHARD_COUNT] @@ -1282,7 +1282,7 @@ def get_matching_source_attestations(state: BeaconState, epoch: Epoch) -> Iterab ```python def get_matching_target_attestations(state: BeaconState, epoch: Epoch) -> Iterable[PendingAttestation]: - return [ + return [ a for a in get_matching_source_attestations(state, epoch) if a.data.target_root == get_block_root(state, epoch) ] diff --git a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py index 6595c966f..bd7fe0950 100644 --- a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py +++ b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py @@ -1,4 +1,4 @@ -from typing import Tuple, Iterator +from typing import Dict, Iterator from types import GeneratorType @@ -40,7 +40,7 @@ class Bit(BasicValue): # can't subclass bool. @classmethod def default(cls): - return cls(False) + return cls(0) def __bool__(self): return self > 0 @@ -103,7 +103,7 @@ def coerce_type_maybe(v, typ: SSZType, strict: bool = False): elif isinstance(v, GeneratorType): return typ(v) else: - # just return as-is, Value-checkers will take care of it not being coerced. + # just return as-is, Value-checkers will take care of it not being coerced, if we are not strict. if strict and not isinstance(v, typ): raise ValueError("Type coercion of {} to {} failed".format(v, typ)) return v @@ -181,10 +181,10 @@ class Container(Series, metaclass=SSZType): @classmethod def is_fixed_size(cls): - return all(t.is_fixed_size() for t in cls.get_field_types()) + return all(t.is_fixed_size() for t in cls.get_fields().values()) def __iter__(self) -> Iterator[SSZValue]: - return iter([getattr(self, field) for field in self.get_fields()]) + return iter([getattr(self, field) for field in self.get_fields().keys()]) class ParamsBase(Series):