Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP4844: Enable withdrawal #3181

Merged
merged 5 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,35 +638,6 @@ def preparations(cls):
@classmethod
def sundry_functions(cls) -> str:
return super().sundry_functions() + '\n\n' + '''
#
# Temporarily disable Withdrawals functions for EIP4844 testnets
#


def no_op(fn): # type: ignore
# pylint: disable=unused-argument
def wrapper(*args, **kw): # type: ignore
return None
return wrapper


def get_empty_list_result(fn): # type: ignore
# pylint: disable=unused-argument
def wrapper(*args, **kw): # type: ignore
return []
return wrapper


process_withdrawals = no_op(process_withdrawals)
process_bls_to_execution_change = no_op(process_bls_to_execution_change)
get_expected_withdrawals = get_empty_list_result(get_expected_withdrawals)
process_historical_summaries_update = no_op(process_historical_summaries_update)


#
# End
#

def retrieve_blobs_sidecar(slot: Slot, beacon_block_root: Root) -> PyUnion[BlobsSidecar, str]:
# pylint: disable=unused-argument
return "TEST"'''
Expand Down
9 changes: 0 additions & 9 deletions specs/eip4844/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- [`process_execution_payload`](#process_execution_payload)
- [Blob KZG commitments](#blob-kzg-commitments)
- [Testing](#testing)
- [Disabling Withdrawals](#disabling-withdrawals)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- /TOC -->
Expand Down Expand Up @@ -346,11 +345,3 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,

return state
```

### Disabling Withdrawals

During testing we avoid Capella-specific updates to the state transition. We do this by replacing the following functions with a no-op implementation:
- `process_withdrawals`
- `process_bls_to_execution_change`

The `get_expected_withdrawals` function is also modified to return an empty withdrawals list. As such, the `PayloadAttributes` used to update forkchoice does not contain withdrawals.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from eth2spec.test.helpers.constants import CAPELLA
from eth2spec.test.helpers.keys import pubkeys
from eth2spec.test.helpers.bls_to_execution_changes import get_signed_address_change

from eth2spec.test.context import spec_state_test, expect_assertion_error, with_phases, always_bls
from eth2spec.test.context import spec_state_test, expect_assertion_error, with_capella_and_later, always_bls


def run_bls_to_execution_change_processing(spec, state, signed_address_change, valid=True):
Expand Down Expand Up @@ -38,14 +37,14 @@ def run_bls_to_execution_change_processing(spec, state, signed_address_change, v
yield 'post', state


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_success(spec, state):
signed_address_change = get_signed_address_change(spec, state)
yield from run_bls_to_execution_change_processing(spec, state, signed_address_change)


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_success_not_activated(spec, state):
validator_index = 3
Expand All @@ -63,7 +62,7 @@ def test_success_not_activated(spec, state):
assert not spec.is_fully_withdrawable_validator(validator, balance, spec.get_current_epoch(state))


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_success_in_activation_queue(spec, state):
validator_index = 3
Expand All @@ -81,7 +80,7 @@ def test_success_in_activation_queue(spec, state):
assert not spec.is_fully_withdrawable_validator(validator, balance, spec.get_current_epoch(state))


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_success_in_exit_queue(spec, state):
validator_index = 3
Expand All @@ -94,7 +93,7 @@ def test_success_in_exit_queue(spec, state):
yield from run_bls_to_execution_change_processing(spec, state, signed_address_change)


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_success_exited(spec, state):
validator_index = 4
Expand All @@ -111,7 +110,7 @@ def test_success_exited(spec, state):
assert not spec.is_fully_withdrawable_validator(validator, balance, spec.get_current_epoch(state))


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_success_withdrawable(spec, state):
validator_index = 4
Expand All @@ -129,7 +128,7 @@ def test_success_withdrawable(spec, state):
assert spec.is_fully_withdrawable_validator(validator, balance, spec.get_current_epoch(state))


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_invalid_val_index_out_of_range(spec, state):
# Create for one validator beyond the validator list length
Expand All @@ -138,7 +137,7 @@ def test_invalid_val_index_out_of_range(spec, state):
yield from run_bls_to_execution_change_processing(spec, state, signed_address_change, valid=False)


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_invalid_already_0x01(spec, state):
# Create for one validator beyond the validator list length
Expand All @@ -150,7 +149,7 @@ def test_invalid_already_0x01(spec, state):
yield from run_bls_to_execution_change_processing(spec, state, signed_address_change, valid=False)


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_invalid_incorrect_from_bls_pubkey(spec, state):
# Create for one validator beyond the validator list length
Expand All @@ -164,7 +163,7 @@ def test_invalid_incorrect_from_bls_pubkey(spec, state):
yield from run_bls_to_execution_change_processing(spec, state, signed_address_change, valid=False)


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
@always_bls
def test_invalid_bad_signature(spec, state):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from eth2spec.test.context import (
spec_state_test,
with_phases,
with_capella_and_later,
)
from eth2spec.test.helpers.constants import CAPELLA
from eth2spec.test.helpers.state import next_epoch_via_block
from eth2spec.test.helpers.deposits import (
prepare_state_and_deposit,
Expand All @@ -11,7 +10,7 @@
from eth2spec.test.helpers.withdrawals import set_validator_fully_withdrawable


@with_phases([CAPELLA])
@with_capella_and_later
@spec_state_test
def test_success_top_up_to_withdrawn_validator(spec, state):
validator_index = 0
Expand Down
Loading