Make phase0 pass
This commit is contained in:
parent
f2c33529df
commit
7a366828ba
|
@ -13,6 +13,7 @@ from typing import (
|
|||
|
||||
PHASE0_IMPORTS = '''from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Set,
|
||||
|
@ -39,6 +40,7 @@ from eth2spec.utils.hash_function import hash
|
|||
'''
|
||||
PHASE1_IMPORTS = '''from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Set,
|
||||
|
|
|
@ -1634,15 +1634,15 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
|
|||
assert len(body.deposits) == min(MAX_DEPOSITS, state.latest_eth1_data.deposit_count - state.deposit_index)
|
||||
# Verify that there are no duplicate transfers
|
||||
assert len(body.transfers) == len(set(body.transfers))
|
||||
|
||||
for operations, max_operations, function in (
|
||||
all_operations = [
|
||||
(body.proposer_slashings, MAX_PROPOSER_SLASHINGS, process_proposer_slashing),
|
||||
(body.attester_slashings, MAX_ATTESTER_SLASHINGS, process_attester_slashing),
|
||||
(body.attestations, MAX_ATTESTATIONS, process_attestation),
|
||||
(body.deposits, MAX_DEPOSITS, process_deposit),
|
||||
(body.voluntary_exits, MAX_VOLUNTARY_EXITS, process_voluntary_exit),
|
||||
(body.transfers, MAX_TRANSFERS, process_transfer),
|
||||
):
|
||||
] # type: List[Tuple[List[Container], int, Callable]]
|
||||
for operations, max_operations, function in all_operations:
|
||||
assert len(operations) <= max_operations
|
||||
for operation in operations:
|
||||
function(state, operation)
|
||||
|
|
|
@ -414,12 +414,12 @@ class Bytes96(BytesN):
|
|||
# SSZ Defaults
|
||||
# -----------------------------
|
||||
def get_zero_value(typ):
|
||||
if is_list_type(typ):
|
||||
if is_uint_type(typ):
|
||||
return uint64(0)
|
||||
elif is_list_type(typ):
|
||||
return []
|
||||
elif is_bool_type(typ):
|
||||
return False
|
||||
elif is_uint_type(typ):
|
||||
return uint64(0)
|
||||
elif is_vector_type(typ):
|
||||
return typ()
|
||||
elif is_bytesn_type(typ):
|
||||
|
@ -437,12 +437,12 @@ def get_zero_value(typ):
|
|||
|
||||
|
||||
def infer_type(obj):
|
||||
if isinstance(obj, int):
|
||||
if is_uint_type(obj.__class__):
|
||||
return obj.__class__
|
||||
elif isinstance(obj, int):
|
||||
return uint64
|
||||
elif isinstance(obj, list):
|
||||
return List[infer_type(obj[0])]
|
||||
elif is_uint_type(obj.__class__):
|
||||
return obj.__class__
|
||||
elif isinstance(obj, (Vector, Container, bool, BytesN, bytes)):
|
||||
return obj.__class__
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue