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

pd(upgrade): create fresh validator state and accept --genesis-start #3491

Merged
merged 3 commits into from
Dec 7, 2023

Conversation

erwanor
Copy link
Member

@erwanor erwanor commented Dec 7, 2023

This PR makes the SimpleUpgrade migration script generate a fresh validator state file to populate comet's view of the validator data. It also adds an optional --genesis-start flag to pd upgrade to help testing with multinode setups.

let mut genesis_path = path_to_export.clone();
genesis_path.push("genesis.json");
std::fs::write(genesis_path, genesis_json).expect("can write genesis");
let genesis_json = serde_json::to_string(&genesis).expect("can serialize genesis");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: because this fn is fallible already, we should be using .context rather than .expect. but that was true before this PR, so let's not block on it. Mostly sounding you out for agreement, so I can look for opportunities to reshape next time I'm in here.

let mut validator_state_path = path_to_export.clone();
validator_state_path.push("priv_validator_state.json");
let fresh_validator_state =
crate::testnet::generate::TestnetValidator::initial_state();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful, this'll solve our problems! As an aside, is there any kind of chain upgrade where we wouldn't want the validator state reset? I can't think of one.

@conorsch conorsch merged commit 3a09cb9 into main Dec 7, 2023
7 checks passed
@conorsch conorsch deleted the erwan/fresh_validator_state branch December 7, 2023 21:20
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