Skip to content

Commit

Permalink
Remove is_execution_enabled condition since Capella
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed May 9, 2023
1 parent 1c424d7 commit 0f5ac11
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
8 changes: 3 additions & 5 deletions specs/_features/eip6110/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ class BeaconState(Container):
```python
def process_block(state: BeaconState, block: BeaconBlock) -> None:
process_block_header(state, block)
if is_execution_enabled(state, block.body):
process_withdrawals(state, block.body.execution_payload)
process_execution_payload(state, block.body.execution_payload, EXECUTION_ENGINE) # [Modified in EIP6110]
process_withdrawals(state, block.body.execution_payload)
process_execution_payload(state, block.body.execution_payload, EXECUTION_ENGINE) # [Modified in EIP6110]
process_randao(state, block.body)
process_eth1_data(state, block.body)
process_operations(state, block.body) # [Modified in EIP6110]
Expand Down Expand Up @@ -212,8 +211,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
for_ops(body.bls_to_execution_changes, process_bls_to_execution_change)

# [New in EIP6110]
if is_execution_enabled(state, body):
for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt)
for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt)
```

#### New `process_deposit_receipt`
Expand Down
3 changes: 1 addition & 2 deletions specs/_features/sharding/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
process_block_header(state, block)
verify_builder_block_bid(state, block)
process_sharded_data(state, block)
if is_execution_enabled(state, block.body):
process_execution_payload(state, block, EXECUTION_ENGINE)
process_execution_payload(state, block, EXECUTION_ENGINE)

if not is_builder_block_slot(block.slot):
process_randao(state, block.body)
Expand Down
6 changes: 3 additions & 3 deletions specs/capella/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ def process_historical_summaries_update(state: BeaconState) -> None:
```python
def process_block(state: BeaconState, block: BeaconBlock) -> None:
process_block_header(state, block)
if is_execution_enabled(state, block.body):
process_withdrawals(state, block.body.execution_payload) # [New in Capella]
process_execution_payload(state, block.body.execution_payload, EXECUTION_ENGINE) # [Modified in Capella]
# Removed `is_execution_enabled` check
process_withdrawals(state, block.body.execution_payload) # [New in Capella]
process_execution_payload(state, block.body.execution_payload, EXECUTION_ENGINE) # [Modified in Capella]
process_randao(state, block.body)
process_eth1_data(state, block.body)
process_operations(state, block.body) # [Modified in Capella]
Expand Down
5 changes: 2 additions & 3 deletions specs/deneb/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ def verify_kzg_commitments_against_transactions(transactions: Sequence[Transacti
```python
def process_block(state: BeaconState, block: BeaconBlock) -> None:
process_block_header(state, block)
if is_execution_enabled(state, block.body):
process_withdrawals(state, block.body.execution_payload)
process_execution_payload(state, block.body.execution_payload, EXECUTION_ENGINE) # [Modified in Deneb]
process_withdrawals(state, block.body.execution_payload)
process_execution_payload(state, block.body.execution_payload, EXECUTION_ENGINE) # [Modified in Deneb]
process_randao(state, block.body)
process_eth1_data(state, block.body)
process_operations(state, block.body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
build_randomized_execution_payload
)
from eth2spec.test.context import (
with_bellatrix_and_later, spec_state_test
BELLATRIX,
with_bellatrix_and_later,
with_phases,
spec_state_test,
)


Expand Down Expand Up @@ -44,7 +47,7 @@ def test_empty_block_transition_randomized_payload(spec, state):
yield 'post', state


@with_bellatrix_and_later
@with_phases([BELLATRIX])
@spec_state_test
def test_is_execution_enabled_false(spec, state):
# Set `latest_execution_payload_header` to empty
Expand Down
23 changes: 23 additions & 0 deletions tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,29 @@
from eth2spec.test.helpers.voluntary_exits import prepare_signed_exits


#
# `is_execution_enabled` has been removed from Capella
#

@with_capella_and_later
@spec_state_test
def test_invalid_is_execution_enabled_false(spec, state):
# Set `latest_execution_payload_header` to empty
state.latest_execution_payload_header = spec.ExecutionPayloadHeader()
yield 'pre', state

block = build_empty_block_for_next_slot(spec, state)

# Set `execution_payload` to empty
block.body.execution_payload = spec.ExecutionPayload()
assert len(block.body.execution_payload.transactions) == 0

signed_block = state_transition_and_sign_block(spec, state, block, expect_fail=True)

yield 'blocks', [signed_block]
yield 'post', None


#
# BLSToExecutionChange
#
Expand Down

0 comments on commit 0f5ac11

Please sign in to comment.