-
Notifications
You must be signed in to change notification settings - Fork 996
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3288 from dapplion/voluntary_exit-domain
EIP-7044: Lock voluntary exit domain on capella
- Loading branch information
Showing
5 changed files
with
148 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
tests/core/pyspec/eth2spec/test/deneb/block_processing/test_process_voluntary_exit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
from eth2spec.test.context import ( | ||
always_bls, | ||
spec_state_test, | ||
with_phases, | ||
with_deneb_and_later, | ||
) | ||
from eth2spec.test.helpers.constants import ( | ||
DENEB, | ||
) | ||
from eth2spec.test.bellatrix.block_processing.test_process_voluntary_exit import ( | ||
run_voluntary_exit_processing_test, | ||
) | ||
|
||
|
||
@with_deneb_and_later | ||
@spec_state_test | ||
@always_bls | ||
def test_invalid_voluntary_exit_with_current_fork_version_not_is_before_fork_epoch(spec, state): | ||
""" | ||
Since Deneb, the VoluntaryExit domain is fixed to `CAPELLA_FORK_VERSION` | ||
""" | ||
assert state.fork.current_version != spec.config.CAPELLA_FORK_VERSION | ||
yield from run_voluntary_exit_processing_test( | ||
spec, | ||
state, | ||
fork_version=state.fork.current_version, | ||
is_before_fork_epoch=False, | ||
valid=False, | ||
) | ||
|
||
|
||
@with_deneb_and_later | ||
@spec_state_test | ||
@always_bls | ||
def test_voluntary_exit_with_previous_fork_version_not_is_before_fork_epoch(spec, state): | ||
""" | ||
Since Deneb, the VoluntaryExit domain is fixed to `CAPELLA_FORK_VERSION` | ||
Note: This test is valid for ``spec.fork == DENEB`` and invalid for subsequent forks | ||
""" | ||
assert state.fork.previous_version != state.fork.current_version | ||
|
||
if spec.fork == DENEB: | ||
assert state.fork.previous_version == spec.config.CAPELLA_FORK_VERSION | ||
yield from run_voluntary_exit_processing_test( | ||
spec, | ||
state, | ||
fork_version=state.fork.previous_version, | ||
is_before_fork_epoch=False, | ||
) | ||
else: | ||
assert state.fork.previous_version != spec.config.CAPELLA_FORK_VERSION | ||
yield from run_voluntary_exit_processing_test( | ||
spec, | ||
state, | ||
fork_version=state.fork.previous_version, | ||
is_before_fork_epoch=False, | ||
valid=False, | ||
) | ||
|
||
|
||
@with_deneb_and_later | ||
@spec_state_test | ||
@always_bls | ||
def test_voluntary_exit_with_previous_fork_version_is_before_fork_epoch(spec, state): | ||
""" | ||
Since Deneb, the VoluntaryExit domain is fixed to `CAPELLA_FORK_VERSION` | ||
Note: This test is valid for ``spec.fork == DENEB`` and invalid for subsequent forks | ||
""" | ||
assert state.fork.previous_version != state.fork.current_version | ||
|
||
if spec.fork == DENEB: | ||
assert state.fork.previous_version == spec.config.CAPELLA_FORK_VERSION | ||
yield from run_voluntary_exit_processing_test( | ||
spec, | ||
state, | ||
fork_version=state.fork.previous_version, | ||
is_before_fork_epoch=True, | ||
) | ||
else: | ||
assert state.fork.previous_version != spec.config.CAPELLA_FORK_VERSION | ||
yield from run_voluntary_exit_processing_test( | ||
spec, | ||
state, | ||
fork_version=state.fork.previous_version, | ||
is_before_fork_epoch=True, | ||
valid=False, | ||
) |
20 changes: 11 additions & 9 deletions
20
tests/core/pyspec/eth2spec/test/helpers/voluntary_exits.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters