Skip to content

Commit

Permalink
[tools] Testnet automation, setting up a testnet with one command
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Sep 3, 2023
1 parent 3817453 commit 96188bd
Show file tree
Hide file tree
Showing 21 changed files with 486 additions and 248 deletions.
4 changes: 2 additions & 2 deletions tools/config/src/config_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl ConfigCli {
if *address {
let mut account_keys = legacy_config::prompt_for_account()?;

let client = Client::new(cfg.pick_url(self.chain_name.clone())?);
let client = Client::new(cfg.pick_url(self.chain_name)?);

if client.get_index().await.is_ok() {
account_keys.account = client
Expand Down Expand Up @@ -134,7 +134,7 @@ impl ConfigCli {
}

if let Some(u) = upstream_url {
let np = cfg.get_network_profile_mut(self.chain_name.clone())?;
let np = cfg.get_network_profile_mut(self.chain_name)?;
np.add_url(u.to_owned());
}
dbg!(&cfg);
Expand Down
12 changes: 10 additions & 2 deletions tools/genesis/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ use std::io::Write;
use std::path::PathBuf;
use diem_framework::ReleaseBundle;
use diem_types::{
chain_id::ChainId,
chain_id::{ChainId, NamedChain},
transaction::{Transaction, WriteSetPayload},
};
use diem_vm_genesis::{GenesisConfiguration, Validator};

#[cfg(test)]
use diem_types::chain_id::NamedChain;
#[cfg(test)]
use crate::vm::libra_genesis_default;

/// Make a recovery genesis blob
pub fn make_recovery_genesis_from_vec_legacy_recovery(
recovery: Option<&[LegacyRecovery]>,
Expand Down Expand Up @@ -60,6 +66,7 @@ fn test_basic_genesis() {
&head_release_bundle(),
ChainId::test(),
None,
&libra_genesis_default(NamedChain::TESTING),
)
.unwrap();
}
Expand All @@ -77,7 +84,7 @@ fn test_recovery_genesis() {
let p = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("tests/fixtures/sample_end_user_single.json");

let recovery = parse_json::parse(p).unwrap();
let recovery = parse_json::recovery_file_parse(p).unwrap();

let test_validators = TestValidator::new_test_set(Some(4), Some(100_000_000));
let validators: Vec<Validator> = test_validators.iter().map(|t| t.data.clone()).collect();
Expand All @@ -87,6 +94,7 @@ fn test_recovery_genesis() {
&head_release_bundle(),
ChainId::test(),
None,
&libra_genesis_default(NamedChain::TESTING),
)
.unwrap();

Expand Down
Loading

0 comments on commit 96188bd

Please sign in to comment.