mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-24 01:20:56 +00:00
Apply the trivial suggestions
This commit is contained in:
parent
c8d05c60ec
commit
2fa595f784
@ -13,10 +13,10 @@ def validate_transition_execution_payload(spec, execution_payload):
|
|||||||
assert spec.is_valid_terminal_pow_block(pow_block, pow_parent)
|
assert spec.is_valid_terminal_pow_block(pow_block, pow_parent)
|
||||||
|
|
||||||
|
|
||||||
def run_process_merge_execution_payload(spec, block, parent_block, payload,
|
def run_validate_transition_execution_payload(spec, block, parent_block, payload,
|
||||||
valid=True, block_lookup_success=True):
|
valid=True, block_lookup_success=True):
|
||||||
"""
|
"""
|
||||||
Run ``process_merge_execution_payload``, yielding:
|
Run ``validate_transition_execution_payload``, yielding:
|
||||||
- current block ('block')
|
- current block ('block')
|
||||||
- parent block ('parent_block')
|
- parent block ('parent_block')
|
||||||
- execution payload ('payload')
|
- execution payload ('payload')
|
||||||
@ -100,7 +100,7 @@ def test_valid_terminal_pow_block_fail_just_after_terminal(spec, state):
|
|||||||
|
|
||||||
@with_merge_and_later
|
@with_merge_and_later
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_process_merge_execution_payload_success(spec, state):
|
def test_validate_transition_execution_payload_success(spec, state):
|
||||||
parent_block = prepare_empty_pow_block(spec)
|
parent_block = prepare_empty_pow_block(spec)
|
||||||
parent_block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY - uint256(1)
|
parent_block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY - uint256(1)
|
||||||
block = prepare_empty_pow_block(spec)
|
block = prepare_empty_pow_block(spec)
|
||||||
@ -120,26 +120,26 @@ def test_process_merge_execution_payload_fail_block_lookup(spec, state):
|
|||||||
block.parent_hash = parent_block.block_hash
|
block.parent_hash = parent_block.block_hash
|
||||||
block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY
|
block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY
|
||||||
payload = spec.ExecutionPayload()
|
payload = spec.ExecutionPayload()
|
||||||
yield from run_process_merge_execution_payload(spec, block, parent_block, payload,
|
yield from run_validate_transition_execution_payload(spec, block, parent_block, payload,
|
||||||
block_lookup_success=False)
|
block_lookup_success=False)
|
||||||
|
|
||||||
|
|
||||||
@with_merge_and_later
|
@with_merge_and_later
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_process_merge_execution_payload_fail_parent_block_lookup(spec, state):
|
def test_validate_transition_execution_payload_fail_parent_block_lookup(spec, state):
|
||||||
parent_block = prepare_empty_pow_block(spec)
|
parent_block = prepare_empty_pow_block(spec)
|
||||||
parent_block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY - uint256(1)
|
parent_block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY - uint256(1)
|
||||||
block = prepare_empty_pow_block(spec)
|
block = prepare_empty_pow_block(spec)
|
||||||
block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY
|
block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY
|
||||||
payload = spec.ExecutionPayload()
|
payload = spec.ExecutionPayload()
|
||||||
payload.parent_hash = block.block_hash
|
payload.parent_hash = block.block_hash
|
||||||
yield from run_process_merge_execution_payload(spec, block, parent_block, payload,
|
yield from run_validate_transition_execution_payload(spec, block, parent_block, payload,
|
||||||
block_lookup_success=False)
|
block_lookup_success=False)
|
||||||
|
|
||||||
|
|
||||||
@with_merge_and_later
|
@with_merge_and_later
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_process_merge_execution_payload_fail_after_terminal(spec, state):
|
def test_validate_transition_execution_payload_fail_after_terminal(spec, state):
|
||||||
parent_block = prepare_empty_pow_block(spec)
|
parent_block = prepare_empty_pow_block(spec)
|
||||||
parent_block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY
|
parent_block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY
|
||||||
block = prepare_empty_pow_block(spec)
|
block = prepare_empty_pow_block(spec)
|
||||||
@ -147,4 +147,4 @@ def test_process_merge_execution_payload_fail_after_terminal(spec, state):
|
|||||||
block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY + 1
|
block.total_difficulty = spec.config.TERMINAL_TOTAL_DIFFICULTY + 1
|
||||||
payload = spec.ExecutionPayload()
|
payload = spec.ExecutionPayload()
|
||||||
payload.parent_hash = block.block_hash
|
payload.parent_hash = block.block_hash
|
||||||
yield from run_process_merge_execution_payload(spec, block, parent_block, payload, valid=False)
|
yield from run_validate_transition_execution_payload(spec, block, parent_block, payload, valid=False)
|
||||||
|
@ -34,9 +34,8 @@ def test_fail_merge_block(spec, state):
|
|||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_fail_merge_block_complete_transition(spec, state):
|
def test_fail_merge_block_complete_transition(spec, state):
|
||||||
state = build_state_with_complete_transition(spec, state)
|
state = build_state_with_complete_transition(spec, state)
|
||||||
execution_payload = build_empty_execution_payload(spec, state)
|
|
||||||
body = spec.BeaconBlockBody()
|
body = spec.BeaconBlockBody()
|
||||||
body.execution_payload = execution_payload
|
body.execution_payload = build_empty_execution_payload(spec, state)
|
||||||
assert not spec.is_merge_block(state, body)
|
assert not spec.is_merge_block(state, body)
|
||||||
|
|
||||||
|
|
||||||
@ -44,9 +43,7 @@ def test_fail_merge_block_complete_transition(spec, state):
|
|||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_fail_merge_block_no_execution_payload(spec, state):
|
def test_fail_merge_block_no_execution_payload(spec, state):
|
||||||
state = build_state_with_incomplete_transition(spec, state)
|
state = build_state_with_incomplete_transition(spec, state)
|
||||||
execution_payload = spec.ExecutionPayload()
|
|
||||||
body = spec.BeaconBlockBody()
|
body = spec.BeaconBlockBody()
|
||||||
body.execution_payload = execution_payload
|
|
||||||
assert not spec.is_merge_block(state, body)
|
assert not spec.is_merge_block(state, body)
|
||||||
|
|
||||||
|
|
||||||
@ -54,9 +51,8 @@ def test_fail_merge_block_no_execution_payload(spec, state):
|
|||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_success_merge_block(spec, state):
|
def test_success_merge_block(spec, state):
|
||||||
state = build_state_with_incomplete_transition(spec, state)
|
state = build_state_with_incomplete_transition(spec, state)
|
||||||
execution_payload = build_empty_execution_payload(spec, state)
|
|
||||||
body = spec.BeaconBlockBody()
|
body = spec.BeaconBlockBody()
|
||||||
body.execution_payload = execution_payload
|
body.execution_payload = build_empty_execution_payload(spec, state)
|
||||||
assert spec.is_merge_block(state, body)
|
assert spec.is_merge_block(state, body)
|
||||||
|
|
||||||
|
|
||||||
@ -64,9 +60,7 @@ def test_success_merge_block(spec, state):
|
|||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_failed_execution_enabled(spec, state):
|
def test_failed_execution_enabled(spec, state):
|
||||||
state = build_state_with_incomplete_transition(spec, state)
|
state = build_state_with_incomplete_transition(spec, state)
|
||||||
execution_payload = spec.ExecutionPayload()
|
|
||||||
body = spec.BeaconBlockBody()
|
body = spec.BeaconBlockBody()
|
||||||
body.execution_payload = execution_payload
|
|
||||||
assert not spec.is_execution_enabled(state, body)
|
assert not spec.is_execution_enabled(state, body)
|
||||||
|
|
||||||
|
|
||||||
@ -74,9 +68,8 @@ def test_failed_execution_enabled(spec, state):
|
|||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_success_execution_enabled_before_terminal(spec, state):
|
def test_success_execution_enabled_before_terminal(spec, state):
|
||||||
state = build_state_with_incomplete_transition(spec, state)
|
state = build_state_with_incomplete_transition(spec, state)
|
||||||
execution_payload = build_empty_execution_payload(spec, state)
|
|
||||||
body = spec.BeaconBlockBody()
|
body = spec.BeaconBlockBody()
|
||||||
body.execution_payload = execution_payload
|
body.execution_payload = build_empty_execution_payload(spec, state)
|
||||||
assert spec.is_execution_enabled(state, body)
|
assert spec.is_execution_enabled(state, body)
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +77,7 @@ def test_success_execution_enabled_before_terminal(spec, state):
|
|||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_success_execution_enabled_no_execution_payload(spec, state):
|
def test_success_execution_enabled_no_execution_payload(spec, state):
|
||||||
state = build_state_with_complete_transition(spec, state)
|
state = build_state_with_complete_transition(spec, state)
|
||||||
execution_payload = spec.ExecutionPayload()
|
|
||||||
body = spec.BeaconBlockBody()
|
body = spec.BeaconBlockBody()
|
||||||
body.execution_payload = execution_payload
|
|
||||||
assert spec.is_execution_enabled(state, body)
|
assert spec.is_execution_enabled(state, body)
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +85,6 @@ def test_success_execution_enabled_no_execution_payload(spec, state):
|
|||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_success_execution_enabled(spec, state):
|
def test_success_execution_enabled(spec, state):
|
||||||
state = build_state_with_complete_transition(spec, state)
|
state = build_state_with_complete_transition(spec, state)
|
||||||
execution_payload = build_empty_execution_payload(spec, state)
|
|
||||||
body = spec.BeaconBlockBody()
|
body = spec.BeaconBlockBody()
|
||||||
body.execution_payload = execution_payload
|
body.execution_payload = build_empty_execution_payload(spec, state)
|
||||||
assert spec.is_execution_enabled(state, body)
|
assert spec.is_execution_enabled(state, body)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user