Skip to content

Commit

Permalink
Merge branch 'master' into geyser_txn_accounts_data
Browse files Browse the repository at this point in the history
  • Loading branch information
4r33x authored Mar 4, 2025
2 parents 13ef9f8 + df2c93b commit 7a9b5d4
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 19 deletions.
1 change: 0 additions & 1 deletion ci/buildkite-pipeline-in-disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ all_test_steps() {
- command: "ci/test-stable-sbf.sh"
name: "stable-sbf"
timeout_in_minutes: 35
artifact_paths: "sbf-dumps.tar.bz2"
agents:
queue: "gcp"
EOF
Expand Down
1 change: 0 additions & 1 deletion ci/buildkite-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ all_test_steps() {
- command: "ci/docker-run-default-image.sh ci/test-stable-sbf.sh"
name: "stable-sbf"
timeout_in_minutes: 35
artifact_paths: "sbf-dumps.tar.bz2"
agents:
queue: "solana"
EOF
Expand Down
1 change: 0 additions & 1 deletion ci/buildkite-solana-private.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ all_test_steps() {
- command: "ci/docker-run-default-image.sh ci/test-stable-sbf.sh"
name: "stable-sbf"
timeout_in_minutes: 35
artifact_paths: "sbf-dumps.tar.bz2"
agents:
queue: "default"
EOF
Expand Down
10 changes: 0 additions & 10 deletions ci/test-stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ test-stable-sbf)
# SBF program tests
_ make -C programs/sbf test-v0

# SBF program instruction count assertion
sbf_target_path=programs/sbf/target
_ cargo test \
--manifest-path programs/sbf/Cargo.toml \
--features=sbf_c,sbf_rust assert_instruction_count \
-- --nocapture &> $sbf_target_path/deploy/instruction_counts.txt

sbf_dump_archive="sbf-dumps.tar.bz2"
rm -f "$sbf_dump_archive"
tar cjvf "$sbf_dump_archive" $sbf_target_path/deploy/{*.txt,*.so}
exit 0
;;
test-docs)
Expand Down
2 changes: 1 addition & 1 deletion validator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
.subcommand(commands::plugin::command(default_args))
.subcommand(commands::set_identity::command(default_args))
.subcommand(commands::set_log_filter::command())
.subcommand(commands::staked_nodes_overrides::command(default_args))
.subcommand(commands::staked_nodes_overrides::command())
.subcommand(commands::wait_for_restart_window::command())
.subcommand(commands::set_public_address::command());

Expand Down
57 changes: 52 additions & 5 deletions validator/src/commands/staked_nodes_overrides/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
use {
crate::{admin_rpc_service, cli::DefaultArgs},
crate::{admin_rpc_service, commands::FromClapArgMatches},
clap::{App, Arg, ArgMatches, SubCommand},
std::path::Path,
};

pub fn command(_default_args: &DefaultArgs) -> App<'_, '_> {
SubCommand::with_name("staked-nodes-overrides")
const COMMAND: &str = "staked-nodes-overrides";

#[derive(Debug, PartialEq)]
pub struct StakedNodesOverridesArgs {
pub path: String,
}

impl FromClapArgMatches for StakedNodesOverridesArgs {
fn from_clap_arg_match(matches: &ArgMatches) -> Result<Self, String> {
Ok(StakedNodesOverridesArgs {
path: matches
.value_of("path")
.expect("path is required")
.to_string(),
})
}
}

pub fn command<'a>() -> App<'a, 'a> {
SubCommand::with_name(COMMAND)
.about("Overrides stakes of specific node identities.")
.arg(
Arg::with_name("path")
Expand All @@ -22,15 +40,44 @@ pub fn command(_default_args: &DefaultArgs) -> App<'_, '_> {
}

pub fn execute(matches: &ArgMatches, ledger_path: &Path) -> Result<(), String> {
let path = matches.value_of("path").expect("path is required");
let staked_nodes_overrides_args = StakedNodesOverridesArgs::from_clap_arg_match(matches)?;

let admin_client = admin_rpc_service::connect(ledger_path);
admin_rpc_service::runtime()
.block_on(async move {
admin_client
.await?
.set_staked_nodes_overrides(path.to_string())
.set_staked_nodes_overrides(staked_nodes_overrides_args.path)
.await
})
.map_err(|err| format!("set staked nodes override request failed: {err}"))
}

#[cfg(test)]
mod tests {
use {
super::*,
crate::commands::tests::{
verify_args_struct_by_command, verify_args_struct_by_command_is_error,
},
};

#[test]
fn verify_args_struct_by_command_staked_nodes_overrides_default() {
verify_args_struct_by_command_is_error::<StakedNodesOverridesArgs>(
command(),
vec![COMMAND],
);
}

#[test]
fn verify_args_struct_by_command_staked_nodes_overrides_path() {
verify_args_struct_by_command(
command(),
vec![COMMAND, "test.json"],
StakedNodesOverridesArgs {
path: "test.json".to_string(),
},
);
}
}

0 comments on commit 7a9b5d4

Please sign in to comment.