Skip to content

Commit

Permalink
create N validator accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
gregcusack committed Apr 2, 2024
1 parent 8804371 commit 738a0b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
- [ ] RPC nodes
- [ ] Client
- [ ] Create accounts
- [ ] Validator (regular)
- [x] Validator (regular)
- [ ] RPC
- [ ] Client
- [ ] Add feature flags to configure:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ kubectl create ns <namespace>
```
cargo run --bin cluster --
-n <namespace>
--num_validators <number-of-non-bootstrap-voting-validators>
--local-path <path-to-local-agave-monorepo>
```

#### Build specific Agave release
```
cargo run --bin cluster --
-n <namespace>
--num_validators <number-of-non-bootstrap-voting-validators>
--release-channel <agave-version: e.g. v1.17.28> # note: MUST include the "v"
```

Expand All @@ -41,6 +43,7 @@ Example:
```
cargo run --bin cluster --
-n <namespace>
--num_validators <number-of-non-bootstrap-voting-validators>
--deploy-method local
--local-path /home/sol/solana
# genesis config. Optional: Many of these have defaults
Expand Down
21 changes: 21 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ fn parse_matches() -> clap::ArgMatches {
.default_value("default")
.help("namespace to deploy test cluster"),
)
.arg(
Arg::with_name("number_of_validators")
.long("num-validators")
.takes_value(true)
.default_value("1")
.help("Number of validator replicas to deploy")
.validator(|s| match s.parse::<i32>() {
Ok(n) if n > 0 => Ok(()),
_ => Err(String::from("number_of_validators should be >= 0")),
}),
)
.arg(
Arg::new("local_path")
.long("local-path")
Expand Down Expand Up @@ -275,6 +286,8 @@ async fn main() {
namespace: matches.value_of("cluster_namespace").unwrap_or_default(),
};

let num_validators = value_t_or_exit!(matches, "number_of_validators", usize);

let deploy_method = if let Some(local_path) = matches.value_of("local_path") {
DeployMethod::Local(local_path.to_owned())
} else if let Some(release_channel) = matches.value_of("release_channel") {
Expand Down Expand Up @@ -465,6 +478,14 @@ async fn main() {
}
}

match genesis.generate_accounts(ValidatorType::Standard, num_validators) {
Ok(_) => (),
Err(err) => {
error!("generate accounts error! {}", err);
return;
}
}

//unwraps are safe here. since their requirement is enforced by argmatches
let docker = DockerConfig::new(
matches
Expand Down

0 comments on commit 738a0b8

Please sign in to comment.