Fixed lint errors for merge tests

This commit is contained in:
Dmitrii Shmatko 2021-09-14 15:26:10 +03:00
parent 7ff173bd0b
commit cf1bd6ccc0
3 changed files with 15 additions and 12 deletions

View File

@ -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)

View File

@ -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)
yield from run_process_merge_execution_payload(spec, transition_store, block, parent_block, payload, valid=False)

View File

@ -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)