From 4f462bc88bc6b36f55b6427ed3d4e4f3315bf61e Mon Sep 17 00:00:00 2001 From: protolambda Date: Wed, 7 Aug 2019 13:33:41 +0200 Subject: [PATCH] make nil-count randomization work for lists --- test_libs/pyspec/eth2spec/debug/random_value.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_libs/pyspec/eth2spec/debug/random_value.py b/test_libs/pyspec/eth2spec/debug/random_value.py index 9a7d47239..ce1522c32 100644 --- a/test_libs/pyspec/eth2spec/debug/random_value.py +++ b/test_libs/pyspec/eth2spec/debug/random_value.py @@ -94,6 +94,8 @@ def get_random_ssz_object(rng: Random, length = 1 elif mode == RandomizationMode.mode_max_count: length = max_list_length + elif mode == RandomizationMode.mode_nil_count: + length = 0 if typ.length < length: # SSZ imposes a hard limit on lists, we can't put in more than that length = typ.length