Skip to content

Commit

Permalink
rm stake account for rpc node
Browse files Browse the repository at this point in the history
  • Loading branch information
gregcusack committed Apr 4, 2024
1 parent febf952 commit 85b4b6d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use {
rand::Rng,
solana_core::gen_keys::GenKeys,
solana_sdk::signature::{write_keypair_file, Keypair},
std::{error::Error, path::PathBuf, result::Result},
std::{
error::Error,
path::{Path, PathBuf},
result::Result,
},
};

pub struct Genesis {
Expand All @@ -13,7 +17,7 @@ pub struct Genesis {
}

impl Genesis {
pub fn new(solana_root: &PathBuf) -> Self {
pub fn new(solana_root: &Path) -> Self {
let config_dir = solana_root.join("config-k8s");
if config_dir.exists() {
std::fs::remove_dir_all(&config_dir).unwrap();
Expand Down Expand Up @@ -48,11 +52,12 @@ impl Genesis {

info!("generating {number_of_accounts} {validator_type} accounts...");

let mut account_types = vec!["identity", "stake-account", "vote-account"];
match validator_type {
ValidatorType::Bootstrap | ValidatorType::Standard => (),
let account_types = match validator_type {
ValidatorType::Bootstrap | ValidatorType::Standard => {
vec!["identity", "stake-account", "vote-account"]
}
ValidatorType::RPC => {
account_types.pop(); // no vote-account for RPC
vec!["identity"] // no vote or stake account for RPC
}
ValidatorType::Client => panic!("Client type not supported"),
};
Expand All @@ -70,8 +75,8 @@ impl Genesis {
fn write_accounts_to_file(
&self,
validator_type: &ValidatorType,
account_types: &Vec<&str>,
keypairs: &Vec<Keypair>,
account_types: &[&str],
keypairs: &[Keypair],
) -> Result<(), Box<dyn Error>> {
for (i, keypair) in keypairs.iter().enumerate() {
let account_index = i / account_types.len();
Expand All @@ -87,7 +92,7 @@ impl Genesis {
};

let outfile = self.config_dir.join(&filename);
write_keypair_file(&keypair, outfile)?;
write_keypair_file(keypair, outfile)?;
}
Ok(())
}
Expand Down
11 changes: 8 additions & 3 deletions src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ use {
crate::{cat_file, download_to_temp, extract_release_archive},
git2::Repository,
log::*,
std::{error::Error, fs, path::PathBuf, time::Instant},
std::{
error::Error,
fs,
path::{Path, PathBuf},
time::Instant,
},
strum_macros::{EnumString, IntoStaticStr, VariantNames},
};

Expand Down Expand Up @@ -31,7 +36,7 @@ impl BuildConfig {
pub fn new(
deploy_method: DeployMethod,
build_type: BuildType,
solana_root_path: &PathBuf,
solana_root_path: &Path,
) -> Result<Self, Box<dyn std::error::Error>> {
let build_path = match deploy_method {
DeployMethod::Local(_) => solana_root_path.join("farf/bin"),
Expand All @@ -42,7 +47,7 @@ impl BuildConfig {
deploy_method,
build_type,
_build_path: build_path,
solana_root_path: solana_root_path.clone(),
solana_root_path: solana_root_path.to_path_buf(),
})
}

Expand Down

0 comments on commit 85b4b6d

Please sign in to comment.