Skip to content

Commit

Permalink
add validator config struct
Browse files Browse the repository at this point in the history
  • Loading branch information
nonast committed Mar 1, 2023
1 parent 121b95a commit b060fa8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/management/genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod waypoint; //////// 0L /////////
pub mod layout;
mod move_modules;
pub mod validator_builder;
mod validator_config;
pub mod validator_config;
pub mod validator_operator; //////// 0L ///////// make public
pub mod verify; //////// 0L ///////// make public

Expand Down
18 changes: 18 additions & 0 deletions config/management/genesis/src/validator_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ pub struct ValidatorConfig {
}

impl ValidatorConfig {
pub fn new(
owner_name: String,
validator_config: diem_management::validator_config::ValidatorConfig,
validator_address: NetworkAddress,
fullnode_address: NetworkAddress,
shared_backend: &SharedBackend,
disable_address_validation: bool,
) -> Self {
Self {
owner_name,
validator_config,
validator_address,
fullnode_address,
shared_backend: shared_backend.to_owned(),
disable_address_validation,
}
}

pub fn execute(self) -> Result<Transaction, Error> {
let config = self
.validator_config
Expand Down
17 changes: 15 additions & 2 deletions ol/genesis-tools/src/wizard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use dialoguer::{Confirm, Input};

use diem_genesis_tool::{
validator_operator::ValidatorOperator,
key::{OperatorKey, Key, OwnerKey}
key::{OperatorKey, Key, OwnerKey},
validator_config::ValidatorConfig,
};

use indicatif::{ProgressIterator, ProgressBar};
Expand All @@ -16,6 +17,7 @@ use dirs;
use ol_types::OLProgress;
use diem_github_client;
use std::path::PathBuf;
use diem_types::network_address::NetworkAddress;


#[test]
Expand Down Expand Up @@ -238,8 +240,19 @@ fn git_setup(&mut self) -> anyhow::Result<()> {


//TODO(nima) send the validator config. similar to above


// Have: shared_backend, validator_backend, owner_name, chain_id, validator_address, fullnode_address

let val_config = ValidatorConfig::new(
app_cfg.format_owner_namespace().clone(),
val_config,
NetworkAddress::from(app_cfg.profile.ip.clone()),
NetworkAddress::from(app_cfg.profile.vfn_ip.clone()),
&sh,
False);

val_config.execute()?;
pb.inc(1);


// # OPER does this
Expand Down

0 comments on commit b060fa8

Please sign in to comment.