From cf1bd6ccc014ab002f519eba1e58b00230919906 Mon Sep 17 00:00:00 2001 From: Dmitrii Shmatko Date: Tue, 14 Sep 2021 15:26:10 +0300 Subject: [PATCH] Fixed lint errors for merge tests --- .../test_process_execution_payload.py | 8 ++++---- .../eth2spec/test/merge/fork_choice/test_on_block.py | 12 +++++++----- .../pyspec/eth2spec/test/merge/unit/test_unit.py | 7 ++++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/merge/block_processing/test_process_execution_payload.py b/tests/core/pyspec/eth2spec/test/merge/block_processing/test_process_execution_payload.py index a2af7dc92..93cc925fb 100644 --- a/tests/core/pyspec/eth2spec/test/merge/block_processing/test_process_execution_payload.py +++ b/tests/core/pyspec/eth2spec/test/merge/block_processing/test_process_execution_payload.py @@ -276,7 +276,7 @@ def test_gaslimit_upper_plus_regular_payload(spec, state): # execution payload execution_payload = build_empty_execution_payload(spec, state) execution_payload.gas_limit = execution_payload.gas_limit + \ - execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR + execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR yield from run_execution_payload_processing(spec, state, execution_payload, valid=False) @@ -291,7 +291,7 @@ def test_gaslimit_upper_regular_payload(spec, state): # execution payload execution_payload = build_empty_execution_payload(spec, state) execution_payload.gas_limit = execution_payload.gas_limit + \ - execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR - uint64(1) + execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR - uint64(1) yield from run_execution_payload_processing(spec, state, execution_payload) @@ -306,7 +306,7 @@ def test_gaslimit_lower_minus_regular_payload(spec, state): # execution payload execution_payload = build_empty_execution_payload(spec, state) execution_payload.gas_limit = execution_payload.gas_limit - \ - execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR + execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR yield from run_execution_payload_processing(spec, state, execution_payload, valid=False) @@ -321,7 +321,7 @@ def test_gaslimit_lower_regular_payload(spec, state): # execution payload execution_payload = build_empty_execution_payload(spec, state) execution_payload.gas_limit = execution_payload.gas_limit - \ - execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR + uint64(1) + execution_payload.gas_limit // spec.GAS_LIMIT_DENOMINATOR + uint64(1) yield from run_execution_payload_processing(spec, state, execution_payload) diff --git a/tests/core/pyspec/eth2spec/test/merge/fork_choice/test_on_block.py b/tests/core/pyspec/eth2spec/test/merge/fork_choice/test_on_block.py index f096fb138..983cab89a 100644 --- a/tests/core/pyspec/eth2spec/test/merge/fork_choice/test_on_block.py +++ b/tests/core/pyspec/eth2spec/test/merge/fork_choice/test_on_block.py @@ -1,8 +1,8 @@ -from eth2spec.utils.ssz.ssz_typing import uint64, uint256 +from eth2spec.utils.ssz.ssz_typing import uint256 from eth2spec.test.helpers.block import ( prepare_empty_pow_block ) -from eth2spec.test.context import spec_state_test, expect_assertion_error, with_merge_and_later +from eth2spec.test.context import spec_state_test, with_merge_and_later def create_transition_store(spec): @@ -139,7 +139,8 @@ def test_process_merge_execution_payload_fail_block_lookup(spec, state): block.total_difficulty = transition_store.terminal_total_difficulty payload = spec.ExecutionPayload() payload.parent_hash = spec.Hash32(spec.hash(b'02')) - yield from run_process_merge_execution_payload(spec, transition_store, block, parent_block, payload, block_lookup_success=False) + yield from run_process_merge_execution_payload(spec, transition_store, block, parent_block, payload, + block_lookup_success=False) @with_merge_and_later @@ -155,7 +156,8 @@ def test_process_merge_execution_payload_fail_parent_block_lookup(spec, state): block.total_difficulty = transition_store.terminal_total_difficulty payload = spec.ExecutionPayload() payload.parent_hash = block.block_hash - yield from run_process_merge_execution_payload(spec, transition_store, block, parent_block, payload, block_lookup_success=False) + yield from run_process_merge_execution_payload(spec, transition_store, block, parent_block, payload, + block_lookup_success=False) @with_merge_and_later @@ -171,4 +173,4 @@ def test_process_merge_execution_payload_fail_after_terminal(spec, state): block.total_difficulty = transition_store.terminal_total_difficulty + 1 payload = spec.ExecutionPayload() payload.parent_hash = block.block_hash - yield from run_process_merge_execution_payload(spec, transition_store, block, parent_block, payload, valid=False) \ No newline at end of file + yield from run_process_merge_execution_payload(spec, transition_store, block, parent_block, payload, valid=False) diff --git a/tests/core/pyspec/eth2spec/test/merge/unit/test_unit.py b/tests/core/pyspec/eth2spec/test/merge/unit/test_unit.py index 24caa03b1..ff153d9ab 100644 --- a/tests/core/pyspec/eth2spec/test/merge/unit/test_unit.py +++ b/tests/core/pyspec/eth2spec/test/merge/unit/test_unit.py @@ -1,4 +1,4 @@ -from eth2spec.utils.ssz.ssz_typing import uint64, uint256 +from eth2spec.utils.ssz.ssz_typing import uint256 from eth2spec.test.helpers.execution_payload import ( build_empty_execution_payload, build_state_with_incomplete_transition, @@ -7,7 +7,7 @@ from eth2spec.test.helpers.execution_payload import ( from eth2spec.test.helpers.block import ( prepare_empty_pow_block ) -from eth2spec.test.context import spec_state_test, expect_assertion_error, with_merge_and_later +from eth2spec.test.context import spec_state_test, with_merge_and_later @with_merge_and_later @@ -108,7 +108,8 @@ def compute_terminal_total_difficulty_reference(spec) -> uint256: seconds_per_voting_period = spec.EPOCHS_PER_ETH1_VOTING_PERIOD * spec.SLOTS_PER_EPOCH * spec.config.SECONDS_PER_SLOT pow_blocks_per_voting_period = seconds_per_voting_period // spec.config.SECONDS_PER_ETH1_BLOCK pow_blocks_to_merge = spec.TARGET_SECONDS_TO_MERGE // spec.config.SECONDS_PER_ETH1_BLOCK - pow_blocks_after_anchor_block = spec.config.ETH1_FOLLOW_DISTANCE + pow_blocks_per_voting_period + pow_blocks_to_merge + pow_blocks_after_anchor_block = spec.config.ETH1_FOLLOW_DISTANCE + pow_blocks_per_voting_period +\ + pow_blocks_to_merge return spec.config.MIN_ANCHOR_POW_BLOCK_DIFFICULTY * uint256(pow_blocks_after_anchor_block)