Skip to content

Commit

Permalink
working. but hard coded
Browse files Browse the repository at this point in the history
  • Loading branch information
gregcusack committed Aug 22, 2024
1 parent a2a65b2 commit 3439520
Showing 1 changed file with 69 additions and 64 deletions.
133 changes: 69 additions & 64 deletions src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,50 +205,50 @@ impl Genesis {
let outfile = self.config_dir.join(&filename);
write_keypair_file(keypair, outfile)?;

match node_type {
&NodeType::Standard => {
let mut owner = "11111111111111111111111111111111";
let mut internal_node_sol: u64 = 12345678900000; //self.flags.internal_node_sol;
if account.contains("stake") {
continue;
// owner = "Stake11111111111111111111111111111111111111";
// internal_node_sol = internal_node_sol/10;
} else if account.contains("vote") {
continue;
// owner = "Vote111111111111111111111111111111111111111";
// internal_node_sol = internal_node_sol/10;
};
info!("greg: got standard and identity");
// Open the validator_accounts_file in append mode
let mut file = OpenOptions::new()
.write(true)
.append(true)
.open(&self.validator_accounts_file)?;
// create validator_accounts_file here
// and add "---" at the top of the file
// Delete the file if it exists
// match node_type {
// &NodeType::Standard => {
// let mut owner = "11111111111111111111111111111111";
// let mut internal_node_sol: u64 = 12345678900000; //self.flags.internal_node_sol;
// if account.contains("stake") {
// continue;
// // owner = "Stake11111111111111111111111111111111111111";
// // internal_node_sol = internal_node_sol/10;
// } else if account.contains("vote") {
// continue;
// // owner = "Vote111111111111111111111111111111111111111";
// // internal_node_sol = internal_node_sol/10;
// };
// info!("greg: got standard and identity");
// // Open the validator_accounts_file in append mode
// let mut file = OpenOptions::new()
// .write(true)
// .append(true)
// .open(&self.validator_accounts_file)?;
// // create validator_accounts_file here
// // and add "---" at the top of the file
// // Delete the file if it exists


// let internal_node_sol: u64 = 123456789000; //self.flags.internal_node_sol;
let pubkey = keypair.pubkey().to_string();
// Append to validator_accounts_file here
// in the following format:
/*
$pubkey:
balance: $internal_node_sol
owner: 11111111111111111111111111111111
data:
executable: false
*/
// Append the necessary data to the validator_accounts_file
writeln!(file, "{pubkey}:")?;
writeln!(file, " balance: {internal_node_sol}")?;
writeln!(file, " owner: {owner}")?;
writeln!(file, " data:")?;
writeln!(file, " executable: false")?;
}
_ => info!("diff noad type: {}", node_type),
}
// // let internal_node_sol: u64 = 123456789000; //self.flags.internal_node_sol;
// let pubkey = keypair.pubkey().to_string();
// // Append to validator_accounts_file here
// // in the following format:
// /*
// $pubkey:
// balance: $internal_node_sol
// owner: 11111111111111111111111111111111
// data:
// executable: false
// */
// // Append the necessary data to the validator_accounts_file
// writeln!(file, "{pubkey}:")?;
// writeln!(file, " balance: {internal_node_sol}")?;
// writeln!(file, " owner: {owner}")?;
// writeln!(file, " data:")?;
// writeln!(file, " executable: false")?;
// }
// _ => info!("diff noad type: {}", node_type),
// }
}
Ok(())
}
Expand Down Expand Up @@ -415,30 +415,35 @@ impl Genesis {
args.push(path);
}

// if !self.flags.skip_primordial_stakes {
// for i in 0..num_validators {
// args.push("--bootstrap-validator".to_string());
// for account_type in ["identity", "vote-account", "stake-account"].iter() {
// let path = self
// .config_dir
// .join(format!("validator-{account_type}-{image_tag}-{i}.json"))
// .into_os_string()
// .into_string()
// .map_err(|_| "Failed to convert path to string")?;
// args.push(path);
// }
if !self.flags.skip_primordial_stakes {
for i in 0..num_validators {
args.push("--validator".to_string());
for account_type in ["identity", "vote-account", "stake-account"].iter() {
let path = self
.config_dir
.join(format!("validator-{account_type}-{image_tag}-{i}.json"))
.into_os_string()
.into_string()
.map_err(|_| "Failed to convert path to string")?;
args.push(path);
}
}
args.push("--validator-stake-lamports".to_string());
args.push("123456789000".to_string());
}
// if self.flags.skip_primordial_stakes {
// args.push("--validator".to_string());
// for account_type in ["identity", "vote-account", "stake-account"].iter() {
// let path = self
// .config_dir
// .join(format!("validator-{account_type}-{image_tag}-0.json"))
// .into_os_string()
// .into_string()
// .map_err(|_| "Failed to convert path to string")?;
// args.push(path);
// }
// args.push(path);
// }
if self.flags.skip_primordial_stakes {
args.push("--primordial-accounts-file".to_string());
let path = self
.validator_accounts_file
.clone()
.into_os_string()
.into_string()
.map_err(|_| "Failed to convert valdiator-accounts.yml path into string")?;
args.push(path);
}

if let Some(slots_per_epoch) = self.flags.slots_per_epoch {
args.push("--slots-per-epoch".to_string());
Expand Down

0 comments on commit 3439520

Please sign in to comment.