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

Let validator reads key pair from network config and remove --address and --validator_idx #1736

Merged
merged 11 commits into from
May 4, 2022

Conversation

longbowlu
Copy link
Contributor

Since we separate private keys out of AuthorityPrivateInfo into a single KeyPair in network/genesis config, now we can deterministically know which authority to represent when running a validator. This PR adds this logic to pick AuthorityPrivateInfo and removes --address and --validator_idx as they become unnecessary.

@longbowlu longbowlu requested review from oxade, huitseeker and gdanezis May 3, 2022 17:28
genesis(genesis_conf_copy, Some(authority.address)).await?;
let genesis_conf: GenesisConfig = PersistedConfig::read(&cfg.genesis_config_path)?;
let adddress = SuiAddress::from(genesis_conf.key_pair.public_key_bytes());
let (network_config, _, _) = genesis(genesis_conf, Some(adddress)).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, we don't need address here
We can infer it from the config
So we should remove the field in genesis method

Copy link
Contributor

@oxade oxade May 3, 2022

Choose a reason for hiding this comment

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

We can get the address from here implicitly

let num_to_provision = if single_address.is_none() {

Copy link
Contributor Author

@longbowlu longbowlu May 3, 2022

Choose a reason for hiding this comment

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

right we don't (https://github.com/MystenLabs/sui/pull/1661/files#r863973592). We should clean that up later, trying to get this PR very small and modest

Copy link
Contributor

Choose a reason for hiding this comment

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

Dont you think its small enough that we can fix it now?

Copy link
Contributor Author

@longbowlu longbowlu May 4, 2022

Choose a reason for hiding this comment

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

I don't think it's tiny enough that we should make it here - calls into genesis are spread into multiple files. Also this PR itself does not trigger address becoming unused, so they are sorta orthogonal

@longbowlu longbowlu enabled auto-merge (squash) May 3, 2022 21:27
@longbowlu longbowlu requested a review from oxade May 3, 2022 21:27
Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

I'd be happy with an issue addressing the cleaning up of the superfluous address calculation, as long as the bench isn't broken here (@oxade feel free to chime in).

@longbowlu longbowlu merged commit 532a751 into main May 4, 2022
@longbowlu longbowlu deleted the validator-read-network-key branch May 4, 2022 01:41
@longbowlu
Copy link
Contributor Author

@huitseeker #1758 has context

longbowlu added a commit that referenced this pull request May 12, 2022
… and --validator_idx (#1736)

* remove duplicated src/validator.rs

* validator can read network config keypair to decide identity

* fmt

* revert

* fix

* update bench too

Co-authored-by: Lu Zhang <luzhang@Lus-MacBook-Pro.local>
punwai pushed a commit that referenced this pull request Jul 27, 2022
… and --validator_idx (#1736)

* remove duplicated src/validator.rs

* validator can read network config keypair to decide identity

* fmt

* revert

* fix

* update bench too

Co-authored-by: Lu Zhang <luzhang@Lus-MacBook-Pro.local>
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.

3 participants