fix int encoding, fix list randomization size limit.
This commit is contained in:
parent
9befe09f82
commit
da858f1aae
|
@ -8,8 +8,8 @@ def encode(value: SSZValue, include_hash_tree_roots=False):
|
|||
if isinstance(value, uint):
|
||||
# Larger uints are boxed and the class declares their byte length
|
||||
if value.type().byte_len > 8:
|
||||
return str(value)
|
||||
return value
|
||||
return str(int(value))
|
||||
return int(value)
|
||||
elif isinstance(value, Bit):
|
||||
return value == 1
|
||||
elif isinstance(value, list): # normal python lists, ssz-List, Vector
|
||||
|
|
|
@ -95,6 +95,9 @@ def get_random_ssz_object(rng: Random,
|
|||
elif mode == RandomizationMode.mode_max_count:
|
||||
length = max_list_length
|
||||
|
||||
if typ.length < length: # SSZ imposes a hard limit on lists, we can't put in more than that
|
||||
length = typ.length
|
||||
|
||||
return typ(
|
||||
get_random_ssz_object(rng, typ.elem_type, max_bytes_length, max_list_length, mode, chaos)
|
||||
for _ in range(length)
|
||||
|
|
Loading…
Reference in New Issue