Merge pull request #1175 from ethereum/bytes-type-error

fix #1169 bytes type error
This commit is contained in:
Diederik Loerakker
2019-06-13 22:49:19 +02:00
committed by GitHub
2 changed files with 5 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ def test_empty_block_transition(spec, state):
assert len(state.eth1_data_votes) == pre_eth1_votes + 1
assert spec.get_block_root_at_slot(state, pre_slot) == block.parent_root
assert spec.get_randao_mix(state, spec.get_current_epoch(state)) != spec.ZERO_HASH
@with_all_phases
@@ -49,6 +50,7 @@ def test_skipped_slots(spec, state):
yield 'post', state
assert state.slot == block.slot
assert spec.get_randao_mix(state, spec.get_current_epoch(state)) != spec.ZERO_HASH
for slot in range(pre_slot, state.slot):
assert spec.get_block_root_at_slot(state, slot) == block.parent_root

View File

@@ -1,3 +1,4 @@
from types import GeneratorType
from typing import List, Iterable, TypeVar, Type, NewType
from typing import Union
from typing_inspect import get_origin
@@ -356,6 +357,8 @@ def parse_bytes(val):
return val
elif isinstance(val, int):
return bytes([val])
elif isinstance(val, (list, GeneratorType)):
return bytes(val)
else:
return None