Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion core/src/validators_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl Cluster {
match value.to_lowercase().as_ref() {
"testnet" | "t" => Cluster::Testnet,
"mainnet-beta" | "mainnet" | "m" => Cluster::MainnetBeta,
_ => Cluster::Testnet,
"devnet" | "d" => Cluster::Devnet,
_ => unreachable!(),
Comment thread
aoikurokawa marked this conversation as resolved.
Outdated
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions cranker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::time::Duration;
use backon::{ExponentialBuilder, Retryable};
use clap::Parser;
use env_logger::{Builder, Target};
use kobe_core::validators_app::Cluster;
use log::*;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_metrics::set_host_id;
Expand Down Expand Up @@ -95,6 +96,7 @@ fn main() {

Config {
rpc_client,
cluster: Cluster::get_cluster(&args.network),
fee_payer,
stake_pool_address,
dry_run: args.dry_run,
Expand Down
22 changes: 20 additions & 2 deletions cranker/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::HashMap, thread::sleep, time::Duration};

use anyhow::anyhow;
use backon::{ExponentialBuilder, Retryable};
use kobe_core::constants::CRANKER_UPDATE_CHANNEL;
use kobe_core::{constants::CRANKER_UPDATE_CHANNEL, validators_app::Cluster};
use log::*;
use solana_cli_output::display::new_spinner_progress_bar;
use solana_client::{
Expand Down Expand Up @@ -34,12 +34,27 @@ pub enum TransactionRetryError {
RetryError,
}

/// Kobe Cranker Config
pub struct Config {
/// RPC Client
pub rpc_client: RpcClient,

/// Cluster (Mainnet-beta, Testnet, Devnet)
pub cluster: Cluster,

/// Fee payer
pub fee_payer: Box<dyn Signer>,

/// Stake pool address
pub stake_pool_address: Pubkey,

/// Dry run mode
pub dry_run: bool,

/// Simulate
pub simulate: bool,

/// Slack API Token
pub slack_api_token: Option<String>,
}

Expand Down Expand Up @@ -234,7 +249,10 @@ pub async fn parallel_execute_stake_pool_update(
let validator_list = get_validator_list(&config.rpc_client, &stake_pool.validator_list)
.await
.map_err(|e| anyhow!("{e}"))?;
let program_id = spl_stake_pool::id();
let program_id = match config.cluster {
Cluster::MainnetBeta | Cluster::Testnet => spl_stake_pool::id(),
Cluster::Devnet => spl_stake_pool::devnet::id(),
};

let (update_list_instructions, final_instructions) = update_stake_pool(
&program_id,
Expand Down
Loading