Make Phase0 -> Altair fork transition tests compatible with Altair -> Merge#2706
Make Phase0 -> Altair fork transition tests compatible with Altair -> Merge#2706
Phase0 -> Altair fork transition tests compatible with Altair -> Merge#2706Conversation
tests/core/pyspec/eth2spec/test/altair/transition/test_activations_and_exits.py
Show resolved
Hide resolved
ralexstokes
left a comment
There was a problem hiding this comment.
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_phasesand 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 :)
ralexstokes
left a comment
There was a problem hiding this comment.
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 <r.alex.stokes@gmail.com>
ralexstokes
left a comment
There was a problem hiding this comment.
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
ForkMetadataclass for passingpre_fork_name,post_fork_nameandfork_epoch.@fork_transition_test(PHASE0, ALTAIR, fork_epoch=2)with@with_fork_metas(Sequence[ForkMeta]).do_altair_forkwithdo_fork, which handles both Altair and The Merge updates.Decorators
build_transition_testintoyield_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_metasloop to run test cases for each fork meta.Other
test_transition_with_voluntary_exit_*only run with minimal presets.Merge.Note
--fork=phase0will get youPhase0 -> Altairfork transition; run pytest with--fork=altairwill get youAltair -> Mergefork transition.TODO