Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-audit
version: "0.21.1"
version: "0.22.0"
- run: cargo audit --ignore RUSTSEC-2022-0093 --ignore RUSTSEC-2024-0344 --ignore RUSTSEC-2024-0421 --ignore RUSTSEC-2025-0022 --ignore RUSTSEC-2025-0009 --ignore RUSTSEC-2025-0004 --ignore RUSTSEC-2024-0357 --ignore RUSTSEC-2024-0336 --ignore RUSTSEC-2025-0055

lint:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ solana-account-decoder = "=2.3.3"
solana-bincode = "=2.2.1"
solana-clap-utils = "=1.8.26"
solana-client = "=2.3.3"
solana-connection-cache = "2.3.3"
solana-gossip = { git = "https://github.com/gzalz/agave", branch = "gzalz/v2.3.3" }
solana-metrics = "=2.3.3"
solana-native-token = "=2.2.2"
Expand All @@ -40,12 +41,14 @@ solana-packet = "=2.2.1"
solana-program = "=2.3.0"
solana-program-test = "=2.3.3"
solana-pubkey = "=2.4.0"
solana-quic-client = "2.3.3"
solana-remote-wallet = "=2.3.3"
solana-rpc-client = "=2.3.3"
solana-rpc-client-api = "=2.3.3"
solana-sdk = "=2.3.1"
solana-streamer = { git = "https://github.com/gzalz/agave", branch = "gzalz/v2.3.3" }
solana-system-interface = "1.0.0"
solana-tpu-client = "=2.3.3"
solana-transaction-status = "=2.3.3"
solana-version = "=2.3.3"
spl-associated-token-account = { version = "7.0.0", features = ["no-entrypoint"] }
Expand Down
3 changes: 3 additions & 0 deletions utils/steward-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ serde_json = { workspace = true }
sha2 = "0.10.8"
solana-account-decoder = { workspace = true }
solana-client = { workspace = true }
solana-connection-cache = { workspace = true }
solana-metrics = { workspace = true }
solana-program = { workspace = true }
solana-quic-client = { workspace = true }
solana-remote-wallet = { workspace = true }
solana-sdk = { workspace = true }
solana-system-interface = { workspace = true }
solana-tpu-client = { workspace = true }
spl-pod = { workspace = true }
spl-stake-pool = { features = ["no-entrypoint"], workspace = true }
squads-multisig = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions utils/steward-cli/src/commands/command_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ pub struct Args {
)]
pub json_rpc_url: String,

/// WebSocket URL for the cluster
#[arg(short, long, env, default_value = "wss://api.mainnet-beta.solana.com")]
pub ws_url: String,

/// Steward program ID
#[arg(
long,
Expand Down
65 changes: 46 additions & 19 deletions utils/steward-cli/src/commands/cranks/idle.rs
Original file line number Diff line number Diff line change
@@ -1,45 +1,52 @@
use std::sync::Arc;

use anchor_lang::{InstructionData, ToAccountMetas};
use anyhow::Result;
use anyhow::{anyhow, Result};
use jito_steward::StewardStateEnum;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_client::{nonblocking::rpc_client::RpcClient, tpu_client::TpuClientConfig};
use solana_connection_cache::connection_cache::NewConnectionConfig;
use solana_program::instruction::Instruction;

use solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool};
use solana_sdk::{
pubkey::Pubkey, signature::read_keypair_file, signer::Signer, transaction::Transaction,
};
use solana_tpu_client::nonblocking::tpu_client::TpuClient;

use crate::commands::command_args::CrankIdle;
use stakenet_sdk::utils::{
accounts::get_all_steward_accounts,
transactions::{configure_instruction, print_base58_tx},
};

type QuicTpuClient = TpuClient<QuicPool, QuicConnectionManager, QuicConfig>;

pub async fn command_crank_idle(
args: CrankIdle,
client: &Arc<RpcClient>,
rpc_client: &Arc<RpcClient>,
ws_url: &str,
program_id: Pubkey,
) -> Result<()> {
let args = args.permissionless_parameters;

// Creates config account
let payer =
read_keypair_file(args.payer_keypair_path).expect("Failed reading keypair file ( Payer )");
let payer = read_keypair_file(args.payer_keypair_path)
.map_err(|e| anyhow!("Failed reading keypair file ( Payer ): {e}"))?;

let steward_config = args.steward_config;

let steward_accounts = get_all_steward_accounts(client, &program_id, &steward_config).await?;
let steward_accounts =
get_all_steward_accounts(rpc_client, &program_id, &steward_config).await?;

match steward_accounts.state_account.state.state_tag {
StewardStateEnum::Idle => { /* Continue */ }
_ => {
println!(
"State account is not in Idle state: {}",
steward_accounts.state_account.state.state_tag
);
return Ok(());
}
if !matches!(
steward_accounts.state_account.state.state_tag,
StewardStateEnum::Idle
) {
println!(
"State account is not in Idle state: {}",
steward_accounts.state_account.state.state_tag
);
return Ok(());
}

let ix = Instruction {
Expand All @@ -53,7 +60,7 @@ pub async fn command_crank_idle(
data: jito_steward::instruction::Idle {}.data(),
};

let blockhash = client.get_latest_blockhash().await?;
let blockhash = rpc_client.get_latest_blockhash().await?;

let configured_ix = configure_instruction(
&[ix],
Expand All @@ -72,11 +79,31 @@ pub async fn command_crank_idle(
if args.transaction_parameters.print_tx {
print_base58_tx(&configured_ix)
} else {
let signature = client
.send_and_confirm_transaction_with_spinner(&transaction)
let quic_config = QuicConfig::new()?;
let connection_manager = QuicConnectionManager::new_with_connection_config(quic_config);
let tpu_config = TpuClientConfig::default();

let tpu_client: QuicTpuClient = TpuClient::new(
"tpu-client",
rpc_client.clone(),
ws_url,
tpu_config,
connection_manager,
)
.await?;

let errors = tpu_client
.send_and_confirm_messages_with_spinner(&[transaction.message], &[&payer])
.await?;

println!("Signature: {}", signature);
let mut has_error = false;
for error in errors.into_iter().flatten() {
println!("Error: {error:?}");
has_error = true;
}
if !has_error {
println!("Transaction confirmed!");
}
}

Ok(())
Expand Down
4 changes: 3 additions & 1 deletion utils/steward-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ async fn main() -> Result<()> {
Commands::ComputeDirectedStakeMeta(args) => {
command_crank_compute_directed_stake_meta(args, &client, steward_program_id).await
}
Commands::CrankIdle(args) => command_crank_idle(args, &client, steward_program_id).await,
Commands::CrankIdle(command_args) => {
command_crank_idle(command_args, &client, &args.ws_url, steward_program_id).await
}
Commands::CrankComputeInstantUnstake(args) => {
command_crank_compute_instant_unstake(args, &client, steward_program_id).await
}
Expand Down
Loading