clean up test phase 1 testgen references
This commit is contained in:
parent
2bc3e814b0
commit
d28cac0e8f
|
@ -17,8 +17,8 @@ def apply_constants_config(spec_globals: Dict[str, Any], warn_if_unknown: bool =
|
|||
# Keep the same type as the default value indicates (which may be an SSZ basic type subclass, e.g. 'Gwei')
|
||||
spec_globals[k] = spec_globals[k].__class__(v)
|
||||
else:
|
||||
# Note: Phase 0 spec will not know the phase 1 config values.
|
||||
# Yet, during debugging you can enable explicit warnings.
|
||||
# Note: The phase 0 spec will not warn if Altair or later config values are applied.
|
||||
# During debugging you can enable explicit warnings.
|
||||
if warn_if_unknown:
|
||||
print(f"WARNING: unknown config key: '{k}' with value: '{v}'")
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@ def transition_to_slot_via_block(spec, state, slot):
|
|||
|
||||
def transition_to_valid_shard_slot(spec, state):
|
||||
"""
|
||||
Transition to slot `spec.PHASE_1_FORK_SLOT + 1` and fork at `spec.PHASE_1_FORK_SLOT`.
|
||||
Transition to slot `spec.SHARDING_FORK_SLOT + 1` and fork at `spec.SHARDING_FORK_SLOT`.
|
||||
"""
|
||||
transition_to(spec, state, spec.PHASE_1_FORK_SLOT)
|
||||
transition_to(spec, state, spec.SHARDING_FORK_SLOT)
|
||||
next_slot(spec, state)
|
||||
|
||||
|
||||
|
|
|
@ -292,8 +292,6 @@ def test_duplicate_attestation(spec, state):
|
|||
assert single_state.balances[index] == dup_state.balances[index]
|
||||
|
||||
|
||||
# TODO: update to all phases when https://github.com/ethereum/eth2.0-specs/pull/2024 is merged
|
||||
# Currently disabled for Phase 1+ due to the mechanics of on-time-attestations complicating what should be a simple test
|
||||
@with_phases([PHASE0])
|
||||
@spec_state_test
|
||||
def test_duplicate_participants_different_attestation_1(spec, state):
|
||||
|
@ -334,8 +332,6 @@ def test_duplicate_participants_different_attestation_1(spec, state):
|
|||
assert single_correct_state.balances[index] == dup_state.balances[index]
|
||||
|
||||
|
||||
# TODO: update to all phases when https://github.com/ethereum/eth2.0-specs/pull/2024 is merged
|
||||
# Currently disabled for Phase 1+ due to the mechanics of on-time-attestations complicating what should be a simple test
|
||||
@with_phases([PHASE0])
|
||||
@spec_state_test
|
||||
def test_duplicate_participants_different_attestation_2(spec, state):
|
||||
|
@ -377,8 +373,6 @@ def test_duplicate_participants_different_attestation_2(spec, state):
|
|||
assert single_correct_state.balances[index] == dup_state.balances[index]
|
||||
|
||||
|
||||
# TODO: update to all phases when https://github.com/ethereum/eth2.0-specs/pull/2024 is merged
|
||||
# Currently disabled for Phase 1+ due to the mechanics of on-time-attestations complicating what should be a simple test
|
||||
@with_phases([PHASE0])
|
||||
@spec_state_test
|
||||
def test_duplicate_participants_different_attestation_3(spec, state):
|
||||
|
|
|
@ -108,8 +108,8 @@ As a top level dir, it is not duplicated, and the used config can be copied righ
|
|||
|
||||
### `<fork or phase name>/`
|
||||
|
||||
This would be: "phase0", "transferparty", "phase1", etc. Each introduces new tests, but does not copy tests that do not change.
|
||||
If you like to test phase 1, you run phase 0 tests, with the configuration that includes phase 1 changes. Out of scope for now however.
|
||||
This would be: "phase0", "altair", etc. Each introduces new tests, and modifies any tests that change:
|
||||
some tests of earlier forks repeat with updated state data.
|
||||
|
||||
### `<test runner name>/`
|
||||
|
||||
|
|
|
@ -164,13 +164,12 @@ Another example, to generate tests from pytests:
|
|||
```python
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -181,15 +180,10 @@ if __name__ == "__main__":
|
|||
altair_mods = {**{key: 'eth2spec.test.altair.sanity.test_' + key for key in [
|
||||
'blocks',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests
|
||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [
|
||||
'blocks', # more phase 1 specific block tests
|
||||
'shard_blocks',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests (but against phase 1 spec)
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="sanity", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -27,16 +26,17 @@ if __name__ == "__main__":
|
|||
]},
|
||||
**phase_0_mods,
|
||||
} # also run the previous phase 0 tests
|
||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.epoch_processing.test_process_' + key for key in [
|
||||
'reveal_deadlines',
|
||||
'challenge_deadlines',
|
||||
'custody_final_updates',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests (but against phase 1 spec)
|
||||
|
||||
# TODO Custody Game testgen is disabled for now
|
||||
# custody_game_mods = {**{key: 'eth2spec.test.custody_game.epoch_processing.test_process_' + key for key in [
|
||||
# 'reveal_deadlines',
|
||||
# 'challenge_deadlines',
|
||||
# 'custody_final_updates',
|
||||
# ]}, **phase_0_mods} # also run the previous phase 0 tests (but against custody game spec)
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="epoch_processing", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
phase_0_mods = {'finality': 'eth2spec.test.phase0.finality.test_finality'}
|
||||
# No additional altair or phase 1 specific finality tests, yet.
|
||||
altair_mods = phase_0_mods
|
||||
phase_1_mods = phase_0_mods
|
||||
altair_mods = phase_0_mods # No additional altair specific finality tests
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="finality", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
phase_0_mods = {key: 'eth2spec.test.phase0.fork_choice.test_' + key for key in [
|
||||
'get_head',
|
||||
]}
|
||||
# No additional Altair or phase 1 specific finality tests, yet.
|
||||
# No additional Altair specific finality tests, yet.
|
||||
altair_mods = phase_0_mods
|
||||
phase_1_mods = phase_0_mods
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="fork_choice", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -14,11 +13,9 @@ if __name__ == "__main__":
|
|||
'validity',
|
||||
]}
|
||||
altair_mods = phase_0_mods
|
||||
phase_1_mods = phase_0_mods
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="genesis", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -23,19 +22,19 @@ if __name__ == "__main__":
|
|||
]},
|
||||
**phase_0_mods,
|
||||
} # also run the previous phase 0 tests
|
||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.block_processing.test_process_' + key for key in [
|
||||
'attestation',
|
||||
'chunk_challenge',
|
||||
'custody_key_reveal',
|
||||
'custody_slashing',
|
||||
'early_derived_secret_reveal',
|
||||
'shard_transition',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests (but against phase 1 spec)
|
||||
|
||||
# TODO Custody Game testgen is disabled for now
|
||||
# custody_game_mods = {**{key: 'eth2spec.test.custody_game.block_processing.test_process_' + key for key in [
|
||||
# 'attestation',
|
||||
# 'chunk_challenge',
|
||||
# 'custody_key_reveal',
|
||||
# 'custody_slashing',
|
||||
# 'early_derived_secret_reveal',
|
||||
# ]}, **phase_0_mods} # also run the previous phase 0 tests (but against custody game spec)
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="operations", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -14,14 +13,12 @@ if __name__ == "__main__":
|
|||
'leak',
|
||||
'random',
|
||||
]}
|
||||
# No additional altair or phase 1 specific rewards tests, yet.
|
||||
# No additional altair specific rewards tests, yet.
|
||||
altair_mods = phase_0_mods
|
||||
phase_1_mods = phase_0_mods
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="rewards", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, ALTAIR
|
||||
from eth2spec.test.context import PHASE0, ALTAIR
|
||||
|
||||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
|
||||
|
||||
specs = (spec_phase0, spec_altair, spec_phase1)
|
||||
specs = (spec_phase0, spec_altair)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -17,15 +16,10 @@ if __name__ == "__main__":
|
|||
altair_mods = {**{key: 'eth2spec.test.altair.sanity.test_' + key for key in [
|
||||
'blocks',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests
|
||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [
|
||||
'blocks', # more phase 1 specific block tests
|
||||
'shard_blocks',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests (but against phase 1 spec)
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
ALTAIR: altair_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
run_state_test_generators(runner_name="sanity", specs=specs, all_mods=all_mods)
|
||||
|
|
|
@ -8,9 +8,8 @@ from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
|
|||
from eth2spec.debug import random_value, encode
|
||||
from eth2spec.config import config_util
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.altair import spec as spec_altair
|
||||
from eth2spec.test.context import PHASE1, ALTAIR, TESTGEN_FORKS, MINIMAL, MAINNET
|
||||
from eth2spec.test.context import ALTAIR, TESTGEN_FORKS, MINIMAL, MAINNET
|
||||
from eth2spec.utils.ssz.ssz_typing import Container
|
||||
from eth2spec.utils.ssz.ssz_impl import (
|
||||
hash_tree_root,
|
||||
|
@ -64,15 +63,12 @@ def create_provider(fork_name, config_name: str, seed: int, mode: random_value.R
|
|||
# Apply changes to presets, this affects some of the vector types.
|
||||
config_util.prepare_config(configs_path, config_name)
|
||||
reload(spec_phase0)
|
||||
reload(spec_phase1)
|
||||
reload(spec_altair)
|
||||
return config_name
|
||||
|
||||
def cases_fn() -> Iterable[gen_typing.TestCase]:
|
||||
count = cases_if_random if chaos or mode.is_changing() else 1
|
||||
spec = spec_phase0
|
||||
if fork_name == PHASE1:
|
||||
spec = spec_phase1
|
||||
if fork_name == ALTAIR:
|
||||
spec = spec_altair
|
||||
|
||||
|
|
Loading…
Reference in New Issue