Skip to content

Commit

Permalink
send validator config to github
Browse files Browse the repository at this point in the history
  • Loading branch information
nonast committed Mar 1, 2023
1 parent b060fa8 commit 3070000
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
14 changes: 7 additions & 7 deletions config/management/genesis/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use diem_global_constants::{GENESIS_WAYPOINT, OPERATOR_ACCOUNT, OWNER_ACCOUNT, W
use diem_management::{
config::ConfigPath,
error::Error,
secure_backend::{MGMTSecureBackend, SharedBackend},
secure_backend::{MGMTSecureBackend, SharedBackend, ValidatorBackend},
};
use std::{convert::TryFrom, path::PathBuf, str::FromStr};
use diem_secure_storage::{
Expand All @@ -16,12 +16,12 @@ use diem_secure_storage::{
use diem_types::{waypoint::Waypoint, account_address::AccountAddress};
use structopt::StructOpt;

diem_management::secure_backend!(
ValidatorBackend,
validator_backend,
"validator configuration",
"path-to-key"
);
// diem_management::secure_backend!(
// ValidatorBackend,
// validator_backend,
// "validator configuration",
// "path-to-key"
// );

#[derive(Debug, StructOpt)]
pub struct Key {
Expand Down
15 changes: 11 additions & 4 deletions config/management/genesis/src/validator_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// SPDX-License-Identifier: Apache-2.0

use diem_global_constants::{OWNER_ACCOUNT, OWNER_KEY};
use diem_management::{constants, error::Error, secure_backend::SharedBackend};
use diem_management::{constants, error::Error, secure_backend::{SharedBackend, ValidatorBackend}};
use diem_types::{
network_address::NetworkAddress,
transaction::{authenticator::AuthenticationKey, Transaction}
};
use structopt::StructOpt;
use diem_management::config::ConfigPath;
use diem_types::chain_id::{ChainId};

#[derive(Debug, StructOpt)]
pub struct ValidatorConfig {
Expand All @@ -28,19 +30,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,
validator_backend: &ValidatorBackend,
disable_address_validation: bool,
chain_id: ChainId,
) -> Self {
Self {
owner_name,
validator_config,
validator_config: diem_management::validator_config::ValidatorConfig{
config: ConfigPath { config: None},
validator_backend: validator_backend.to_owned(),
chain_id: Some(chain_id)
},
validator_address,
fullnode_address,
shared_backend: shared_backend.to_owned(),
disable_address_validation,
disable_address_validation
}
}

Expand Down
23 changes: 13 additions & 10 deletions ol/genesis-tools/src/wizard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ use dirs;
use ol_types::OLProgress;
use diem_github_client;
use std::path::PathBuf;
use diem_types::network_address::NetworkAddress;
use std::str::FromStr;
use diem_types::chain_id::ChainId;
use diem_types::network_address::{NetworkAddress, Protocol};


#[test]
Expand Down Expand Up @@ -92,6 +94,7 @@ pub fn start_wizard(&mut self) -> anyhow::Result<()>{


// Download the snapshot from the epoch archive. Ask user which epoch to use.
// ol/cli/src/mgmt/restore.rs

// run genesis

Expand Down Expand Up @@ -241,18 +244,18 @@ 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()),
NetworkAddress::from_str(&*format!("{}{}", Protocol::Ip4(app_cfg.profile.ip), Protocol::Tcp(6180))).unwrap(),
NetworkAddress::from_str(&*format!("{}{}", Protocol::Ip4(app_cfg.profile.vfn_ip.unwrap()), Protocol::Tcp(6179))).unwrap(),
&sh,
False);

val_config.execute()?;
pb.inc(1);
&val,
false,
ChainId::new(app_cfg.chain_info.chain_id.id()),
);
println!("val_config: {:?}", val_config);
val_config.execute()?;
pb.inc(1);


// # OPER does this
Expand Down

0 comments on commit 3070000

Please sign in to comment.