From a4e04ebf64f95b681e607dd84b0c1f58b93588eb Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Sat, 27 Apr 2024 12:11:29 +0800 Subject: [PATCH] Misc fix --- configs/mainnet.yaml | 9 ++++----- configs/minimal.yaml | 6 +++--- specs/_features/eip7594/fork.md | 2 +- .../test_process_execution_payload.py | 12 ++++++++---- .../test_process_effective_balance_updates.py | 2 +- tests/core/pyspec/eth2spec/utils/bls.py | 8 +++++--- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index bbe9195135..cda09fca72 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -52,14 +52,13 @@ DENEB_FORK_VERSION: 0x04000000 DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC # Electra ELECTRA_FORK_VERSION: 0x05000000 -ELECTRA_FORK_EPOCH: 18446744073709551615 +ELECTRA_FORK_EPOCH: 18446744073709551615 # temporary stub +# EIP7594 +EIP7594_FORK_VERSION: 0x06000000 # temporary stub +EIP7594_FORK_EPOCH: 18446744073709551615 # WHISK WHISK_FORK_VERSION: 0x08000000 # temporary stub WHISK_FORK_EPOCH: 18446744073709551615 -# EIP7594 -EIP7594_FORK_VERSION: 0x06000001 -EIP7594_FORK_EPOCH: 18446744073709551615 - # Time parameters # --------------------------------------------------------------- diff --git a/configs/minimal.yaml b/configs/minimal.yaml index 99e84e5fbe..e7a92a811e 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -52,12 +52,12 @@ DENEB_FORK_EPOCH: 18446744073709551615 # Electra ELECTRA_FORK_VERSION: 0x05000001 ELECTRA_FORK_EPOCH: 18446744073709551615 -# WHISK -WHISK_FORK_VERSION: 0x08000001 -WHISK_FORK_EPOCH: 18446744073709551615 # EIP7594 EIP7594_FORK_VERSION: 0x06000001 EIP7594_FORK_EPOCH: 18446744073709551615 +# WHISK +WHISK_FORK_VERSION: 0x08000001 +WHISK_FORK_EPOCH: 18446744073709551615 # Time parameters # --------------------------------------------------------------- diff --git a/specs/_features/eip7594/fork.md b/specs/_features/eip7594/fork.md index d8e8f208cc..790ab0287d 100644 --- a/specs/_features/eip7594/fork.md +++ b/specs/_features/eip7594/fork.md @@ -28,7 +28,7 @@ Warning: this configuration is not definitive. | Name | Value | | - | - | -| `EIP7594_FORK_VERSION` | `Version('0x05000000')` | +| `EIP7594_FORK_VERSION` | `Version('0x06000000')` | | `EIP7594_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** | ## Helper functions diff --git a/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_execution_payload.py b/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_execution_payload.py index 0f3a0b0b8f..8eb6b4eab3 100644 --- a/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_execution_payload.py +++ b/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_execution_payload.py @@ -338,26 +338,30 @@ def run_randomized_non_validated_execution_fields_test(spec, state, execution_va @with_bellatrix_and_later @spec_state_test def test_randomized_non_validated_execution_fields_first_payload__execution_valid(spec, state): + rng = Random(1111) state = build_state_with_incomplete_transition(spec, state) - yield from run_randomized_non_validated_execution_fields_test(spec, state) + yield from run_randomized_non_validated_execution_fields_test(spec, state, rng=rng) @with_bellatrix_and_later @spec_state_test def test_randomized_non_validated_execution_fields_regular_payload__execution_valid(spec, state): + rng = Random(2222) state = build_state_with_complete_transition(spec, state) - yield from run_randomized_non_validated_execution_fields_test(spec, state) + yield from run_randomized_non_validated_execution_fields_test(spec, state, rng=rng) @with_bellatrix_and_later @spec_state_test def test_invalid_randomized_non_validated_execution_fields_first_payload__execution_invalid(spec, state): + rng = Random(3333) state = build_state_with_incomplete_transition(spec, state) - yield from run_randomized_non_validated_execution_fields_test(spec, state, execution_valid=False) + yield from run_randomized_non_validated_execution_fields_test(spec, state, execution_valid=False, rng=rng) @with_bellatrix_and_later @spec_state_test def test_invalid_randomized_non_validated_execution_fields_regular_payload__execution_invalid(spec, state): + rng = Random(4444) state = build_state_with_complete_transition(spec, state) - yield from run_randomized_non_validated_execution_fields_test(spec, state, execution_valid=False) + yield from run_randomized_non_validated_execution_fields_test(spec, state, execution_valid=False, rng=rng) diff --git a/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_effective_balance_updates.py b/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_effective_balance_updates.py index ddff613407..34e31b2748 100644 --- a/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_effective_balance_updates.py +++ b/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_effective_balance_updates.py @@ -7,6 +7,6 @@ @with_electra_and_later @spec_state_test def test_effective_balance_hysteresis_with_compounding_credentials(spec, state): - run_test_effective_balance_hysteresis( + yield from run_test_effective_balance_hysteresis( spec, state, with_compounding_credentials=True ) diff --git a/tests/core/pyspec/eth2spec/utils/bls.py b/tests/core/pyspec/eth2spec/utils/bls.py index 299495322f..666de68094 100644 --- a/tests/core/pyspec/eth2spec/utils/bls.py +++ b/tests/core/pyspec/eth2spec/utils/bls.py @@ -11,6 +11,8 @@ pairing as py_ecc_pairing, final_exponentiate as py_ecc_final_exponentiate, FQ12 as py_ecc_GT, + FQ, + FQ2, ) from py_ecc.bls.g2_primitives import ( # noqa: F401 curve_order as BLS_MODULUS, @@ -252,14 +254,14 @@ def multi_exp(points, integers): raise Exception("Invalid point type") result = None - if isinstance(points[0], py_ecc_G1): + if isinstance(points[0][0], FQ): result = Z1() - elif isinstance(points[0], py_ecc_G2): + elif isinstance(points[0][0], FQ2): result = Z2() else: raise Exception("Invalid point type") - for point, scalar in points.zip(integers): + for point, scalar in zip(points, integers): result = add(result, multiply(point, scalar)) return result