fix #1169 bytes type error

This commit is contained in:
Danny Ryan 2019-06-13 14:32:45 -06:00
parent 54c6b035ce
commit 7c0cc7f801
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 5 additions and 0 deletions

View File

@ -33,6 +33,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
@ -51,6 +52,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