Add assertion to ensure eval usage is fine

This commit is contained in:
Hsiao-Wei Wang 2023-12-21 22:55:46 +08:00
parent b123f9faee
commit 9fbf75139d
No known key found for this signature in database
GPG Key ID: AE3D6B174F971DE4
1 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,7 @@ from eth2spec.test.helpers.block import (
from eth2spec.test.helpers.bls_to_execution_changes import get_signed_address_change
from eth2spec.test.helpers.constants import (
PHASE0,
POST_FORK_OF,
PREVIOUS_FORK_OF,
)
from eth2spec.test.helpers.deposits import (
@ -143,6 +144,9 @@ def state_transition_across_slots_with_ignoring_proposers(spec,
def get_upgrade_fn(spec, fork):
# pylint: disable=unused-argument
# NOTE: `spec` is used for the `eval` call
assert fork in POST_FORK_OF.values()
try:
# TODO: make all upgrade_to_* function names consistent?
fn = eval(f"spec.upgrade_to_{fork}")