-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Make Phase0 -> Altair
fork transition tests compatible with Altair -> Merge
#2706
Conversation
tests/core/pyspec/eth2spec/test/altair/transition/test_activations_and_exits.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still digesting but so far it looks great! one general comment is that this would be easier to review if it split apart the various concerns.
I see the following that could be N separate PRs:
- refactor of
with_phases
and additional typing in that file - the extension of the fork transition tests to re-use them across multiple pairs of forks/phases
The with_phases
refactor isn't huge but it is an important enough function to the integrity of the spec tests that changes to it should be very carefully reviewed! It would be a bit nicer to be able to consider it independently without the cognitive load of the other changes to the fork transition testing.
No worry on this PR but it is something to keep in mind in the future :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great!
i like that we can reuse the fork transition tests across multiple pairs of forks.
i left some things below, lets address those and then i'll make another round of review... in particular, it would be good to see the tests actually generated, so we can see all of the new code exercised
Co-authored-by: Alex Stokes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
ill verify if we have verified the test vectors, otherwise i think we can ship this
Issue
I really want to reuse
test/altair/transition/
tests instead of duplicating it for Merge fork transition.How did I fix it
High-level
ForkMeta
dataclass for passingpre_fork_name
,post_fork_name
andfork_epoch
.@fork_transition_test(PHASE0, ALTAIR, fork_epoch=2)
with@with_fork_metas(Sequence[ForkMeta])
.do_altair_fork
withdo_fork
, which handles both Altair and The Merge updates.Decorators
build_transition_test
intoyield_fork_meta
.with_phases
:if PHASE0: ... if ALTAIR: ...
code with for-loop. The phases should be been limited withDEFAULT_PYTEST_FORKS
.for fork_meta in fork_metas
loop to run test cases for each fork meta.Other
test_transition_with_voluntary_exit_*
only run with minimal presets.Merge
.Note
--fork=phase0
will get youPhase0 -> Altair
fork transition; run pytest with--fork=altair
will get youAltair -> Merge
fork transition.TODO