is_execution_enabled function + misc review fixes
Co-Authored-By: Danny Ryan <dannyjryan@gmail.com>
This commit is contained in:
parent
8ac59b7317
commit
76b5974d11
|
@ -24,6 +24,7 @@
|
||||||
- [`ExecutionPayloadHeader`](#executionpayloadheader)
|
- [`ExecutionPayloadHeader`](#executionpayloadheader)
|
||||||
- [Helper functions](#helper-functions)
|
- [Helper functions](#helper-functions)
|
||||||
- [Misc](#misc)
|
- [Misc](#misc)
|
||||||
|
- [`is_execution_enabled`](#is_execution_enabled)
|
||||||
- [`is_transition_completed`](#is_transition_completed)
|
- [`is_transition_completed`](#is_transition_completed)
|
||||||
- [`is_transition_block`](#is_transition_block)
|
- [`is_transition_block`](#is_transition_block)
|
||||||
- [`compute_time_at_slot`](#compute_time_at_slot)
|
- [`compute_time_at_slot`](#compute_time_at_slot)
|
||||||
|
@ -140,6 +141,13 @@ class ExecutionPayloadHeader(Container):
|
||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
|
|
||||||
|
#### `is_execution_enabled`
|
||||||
|
|
||||||
|
```python
|
||||||
|
def is_execution_enabled(state: BeaconState, block: BeaconBlock) -> bool:
|
||||||
|
return is_transition_completed(state) or is_transition_block(state, block)
|
||||||
|
```
|
||||||
|
|
||||||
#### `is_transition_completed`
|
#### `is_transition_completed`
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
@ -173,7 +181,7 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
|
||||||
process_eth1_data(state, block.body)
|
process_eth1_data(state, block.body)
|
||||||
process_operations(state, block.body)
|
process_operations(state, block.body)
|
||||||
# Pre-merge, skip execution payload processing
|
# Pre-merge, skip execution payload processing
|
||||||
if is_transition_completed(state) or is_transition_block(state, block):
|
if is_execution_enabled(state, block):
|
||||||
process_execution_payload(state, block.body.execution_payload) # [New in Merge]
|
process_execution_payload(state, block.body.execution_payload) # [New in Merge]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,6 @@ def with_phases(phases, other_phases=None):
|
||||||
phase_dir[PHASE0] = spec_phase0
|
phase_dir[PHASE0] = spec_phase0
|
||||||
if ALTAIR in available_phases:
|
if ALTAIR in available_phases:
|
||||||
phase_dir[ALTAIR] = spec_altair
|
phase_dir[ALTAIR] = spec_altair
|
||||||
|
|
||||||
if MERGE in available_phases:
|
if MERGE in available_phases:
|
||||||
phase_dir[MERGE] = spec_merge
|
phase_dir[MERGE] = spec_merge
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ def run_execution_payload_processing(spec, state, execution_payload, valid=True,
|
||||||
If ``valid == False``, run expecting ``AssertionError``
|
If ``valid == False``, run expecting ``AssertionError``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
pre_exec_header = state.latest_execution_payload_header.copy()
|
||||||
|
|
||||||
yield 'pre', state
|
yield 'pre', state
|
||||||
yield 'execution', {'execution_valid': execution_valid}
|
yield 'execution', {'execution_valid': execution_valid}
|
||||||
yield 'execution_payload', execution_payload
|
yield 'execution_payload', execution_payload
|
||||||
|
@ -26,7 +28,8 @@ def run_execution_payload_processing(spec, state, execution_payload, valid=True,
|
||||||
|
|
||||||
yield 'post', state
|
yield 'post', state
|
||||||
|
|
||||||
# TODO: any assertions to make?
|
assert pre_exec_header != state.latest_execution_payload_header
|
||||||
|
# TODO: any more assertions to make?
|
||||||
|
|
||||||
|
|
||||||
@with_merge_and_later
|
@with_merge_and_later
|
||||||
|
|
Loading…
Reference in New Issue