resolve some remaining list-rework rebase details

This commit is contained in:
protolambda 2019-06-20 20:38:42 +02:00
parent 82240d8dbd
commit f157745248
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
2 changed files with 8 additions and 8 deletions

View File

@ -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)
]

View File

@ -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):