-
Notifications
You must be signed in to change notification settings - Fork 252
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
allow initializing test DBs from later forks #5186
Conversation
Running `makeTestDB` in tests currently always initializes DB with a `phase0` state, preventing tests that configure a fork schedule that starts in a different fork from working properly. Fix that by upgrading the genesis state to whatever fork the fork schedule starts with.
tests/testdbutil.nim
Outdated
|
||
# Override Eth1Data on request, skipping the lengthy Eth1 voting process | ||
if eth1Data.isOk: | ||
withState(genState[]): | ||
forkyState.data.eth1_data = eth1Data.get | ||
forkyState.root = hash_tree_root(forkyState.data) | ||
|
||
# Upgrade genesis state to later fork, if not starting at Phase0 |
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.
Is the intent here indeed just to update the state to newer forks, not to have this happen naturally by running through enough slots to trigger the maybeUpgradeState
organically?
ethereum/consensus-specs#2902 means this can produce odd effects in general, though for this purpose, it should be fine -- if there are no attestations or similar from before it upgrades forks, then there's nothing to get rejected by the fork-dependent signature checks.
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 is for the genesis state (slot == 0), e.g., starting at bellatrix
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.
Adjusted it so that fork.previous_version == fork.current_version
in that case, e.g., both set to Bellatrix.
Running
makeTestDB
in tests currently always initializes DB with aphase0
state, preventing tests that configure a fork schedule that starts in a different fork from working properly. Fix that by upgrading the genesis state to whatever fork the fork schedule starts with.