Skip to content
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

Merged
merged 3 commits into from
Jul 14, 2023

Conversation

etan-status
Copy link
Contributor

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.

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.

# 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
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@github-actions
Copy link

github-actions bot commented Jul 12, 2023

Unit Test Results

         9 files  ±0    1 071 suites  ±0   37m 8s ⏱️ - 6m 21s
  3 712 tests ±0    3 433 ✔️ ±0  279 💤 ±0  0 ±0 
15 826 runs  ±0  15 521 ✔️ ±0  305 💤 ±0  0 ±0 

Results for commit fbf06aa. ± Comparison against base commit 74bb4b1.

♻️ This comment has been updated with latest results.

@etan-status etan-status enabled auto-merge (squash) July 13, 2023 13:02
@etan-status etan-status merged commit f1963bf into unstable Jul 14, 2023
@etan-status etan-status deleted the dev/etan/ts-forkedgen branch July 14, 2023 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants