From d6dcce0d7910da7358f2b501f9abfd00ea89b827 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:13:30 +0300 Subject: [PATCH] Add test_config_invariants --- .../whisk/unittests/test_config_invariants.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/core/pyspec/eth2spec/test/whisk/unittests/test_config_invariants.py diff --git a/tests/core/pyspec/eth2spec/test/whisk/unittests/test_config_invariants.py b/tests/core/pyspec/eth2spec/test/whisk/unittests/test_config_invariants.py new file mode 100644 index 000000000..f48b7099c --- /dev/null +++ b/tests/core/pyspec/eth2spec/test/whisk/unittests/test_config_invariants.py @@ -0,0 +1,17 @@ +from eth2spec.test.context import spec_test, with_whisk_and_later +from eth2spec.test.context import single_phase + + +# Note: remove once whisk is rebased on top of deneb +def is_power_of_two(value: int) -> bool: + """ + Check if ``value`` is a power of two integer. + """ + return (value > 0) and (value & (value - 1) == 0) + + +@with_whisk_and_later +@spec_test +@single_phase +def test_curdleproof(spec): + assert is_power_of_two(spec.CURDLEPROOFS_N_BLINDERS + spec.WHISK_VALIDATORS_PER_SHUFFLE)