Skip to content

Commit 507da24

Browse files
committed
working switchboard cli code
1 parent 83120fa commit 507da24

File tree

12 files changed

+1094
-722
lines changed

12 files changed

+1094
-722
lines changed

Cargo.lock

Lines changed: 1072 additions & 706 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ solana-instruction = { package = "solana-instruction", git = "https://github.com
9595
solana-ledger = { package = "solana-ledger", git = "https://github.com/jito-foundation/jito-solana.git", rev = "93c4da92ba1f2db5963a3ba678d6c34b123cca5a" }
9696
solana-measure = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "93c4da92ba1f2db5963a3ba678d6c34b123cca5a" }
9797
solana-metrics = { package = "solana-metrics", git = "https://github.com/jito-foundation/jito-solana.git", rev = "93c4da92ba1f2db5963a3ba678d6c34b123cca5a" }
98-
solana-program = { version = "3.0.0", default-features = false }
98+
solana-program = { version = "3.0.0", default-features = false, features = [] }
9999
solana-program-entrypoint = "3.0.0"
100100
solana-program-error = "=3.0.0"
101101
solana-program-test = { package = "solana-program-test", git = "https://github.com/jito-foundation/jito-solana.git", rev = "93c4da92ba1f2db5963a3ba678d6c34b123cca5a" }

cli/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jito-vault-sdk = { workspace = true }
4242
log = { workspace = true }
4343
num-derive = { workspace = true }
4444
num-traits = { workspace = true }
45-
solana-account-info = "3.0.0"
4645
solana-account-decoder = { workspace = true }
46+
solana-account-info = "3.0.0"
4747
solana-address-lookup-table-interface = { workspace = true }
4848
solana-cli-config = { workspace = true }
4949
solana-client = { workspace = true }
@@ -59,7 +59,7 @@ solana-system-interface = { workspace = true }
5959
solana-transaction-status = { workspace = true }
6060
spl-associated-token-account-interface = { workspace = true }
6161
spl-token-interface = { workspace = true }
62-
switchboard-on-demand-client = { package="switchboard-on-demand", version = "0.10.0", default-features = false, features = ["solana-v3", "client-v3"] }
62+
switchboard-on-demand-client = { package = "switchboard-on-demand", version = "0.10.1", default-features = false, features = ["solana-v3", "client-v3"] }
6363
thiserror = { workspace = true }
6464
tokio = { workspace = true }
6565

cli/src/handler.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub struct CliHandler {
6060
ncn: Option<Pubkey>,
6161
pub epoch: u64,
6262
rpc_client: RpcClient,
63-
switchboard_context: Arc<SbContext>,
63+
pub switchboard_context: Arc<SbContext>,
6464
pub retries: u64,
6565
pub priority_fee_micro_lamports: u64,
6666
pub(crate) print_tx: bool,
@@ -174,9 +174,9 @@ impl CliHandler {
174174
Ok(config)
175175
}
176176

177-
/*pub const fn switchboard_context(&self) -> &Arc<SbContext> {
177+
pub const fn switchboard_context(&self) -> &Arc<SbContext> {
178178
&self.switchboard_context
179-
}*/
179+
}
180180

181181
pub const fn keypair(&self) -> &Keypair {
182182
&self.keypair
@@ -361,12 +361,12 @@ impl CliHandler {
361361
ProgramCommand::CrankSwitchboard { switchboard_feed } => {
362362
let switchboard_feed =
363363
Pubkey::from_str(&switchboard_feed).expect("error parsing switchboard feed");
364-
crank_switchboard(self, &switchboard_feed).await;
364+
let _ = crank_switchboard(self, &switchboard_feed).await;
365365
Ok(())
366366
}
367367
ProgramCommand::SetWeight { vault } => {
368368
let vault = Pubkey::from_str(&vault).expect("error parsing vault");
369-
set_weight(self, &vault, self.epoch).await;
369+
let _ = set_weight(self, &vault, self.epoch).await;
370370
Ok(())
371371
}
372372

cli/src/instructions.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ use switchboard_on_demand_client::{
109109
},
110110
QueueAccountData,
111111
};
112-
use switchboard_on_demand_client::QueueAccountData;
113112
use tokio::time::sleep;
114113

115114
use jito_priority_fee_distribution_sdk;
@@ -876,6 +875,8 @@ pub async fn crank_switchboard(handler: &CliHandler, switchboard_feed: &Pubkey)
876875
Ok(())
877876
}
878877

878+
let switchboard_context = handler.switchboard_context();
879+
879880
let client = handler.rpc_client();
880881
let payer = handler.keypair();
881882

@@ -892,7 +893,6 @@ pub async fn crank_switchboard(handler: &CliHandler, switchboard_feed: &Pubkey)
892893
.get_account_with_commitment(&queue_key, handler.commitment)
893894
.await?
894895
.value
895-
.map(|a| a)
896896
.expect("Queue account not found");
897897
let queue_account_info = AccountInfo {
898898
key: &queue_key,
@@ -902,14 +902,15 @@ pub async fn crank_switchboard(handler: &CliHandler, switchboard_feed: &Pubkey)
902902
lamports: Rc::new(RefCell::new(&mut queue_account.lamports)),
903903
data: Rc::new(RefCell::new(&mut queue_account.data)),
904904
executable: false,
905+
#[allow(deprecated)]
905906
_unused: 0,
906907
};
907908

908909
let queue = *QueueAccountData::new(&queue_account_info)?;
909910

910-
//let gateways = &queue.fetch_gateways(client).await?;
911+
let gateways = &queue.fetch_gateways(client).await?;
911912

912-
/*if gateways.is_empty() {
913+
if gateways.is_empty() {
913914
return Err(anyhow!("No gateways found"));
914915
}
915916

@@ -938,7 +939,7 @@ pub async fn crank_switchboard(handler: &CliHandler, switchboard_feed: &Pubkey)
938939
"Crank Switchboard",
939940
&[format!("FEED: {:?}", switchboard_feed)],
940941
)
941-
.await?;*/
942+
.await?;
942943

943944
Ok(())
944945
}

cli/src/keeper/keeper_state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub struct KeeperState {
4343
pub is_epoch_completed: bool,
4444
}
4545

46+
#[allow(clippy::unnecessary_unwrap)]
4647
impl KeeperState {
4748
pub async fn fetch(&mut self, handler: &CliHandler, epoch: u64) -> Result<()> {
4849
// Fetch all vaults and operators

cli/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::future_not_send)]
2+
#![allow(clippy::cognitive_complexity)]
13
#![allow(clippy::arithmetic_side_effects)]
24
pub mod args;
35
pub mod getters;

cli/src/log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn format_log_message(buf: &mut Formatter, record: &Record) -> std::io::Result<(
3232
)
3333
}
3434

35-
fn colored_level(style: &mut Style, level: log::Level) -> StyledValue<&'static str> {
35+
fn colored_level(style: &mut Style, level: log::Level) -> StyledValue<'_, &'static str> {
3636
match level {
3737
log::Level::Trace => style.set_color(Color::Magenta).value("TRACE"),
3838
log::Level::Debug => style.set_color(Color::Blue).value("DEBUG"),

meta_merkle_tree/src/merkle_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl MerkleTree {
166166
self.nodes.iter().last()
167167
}
168168

169-
pub fn find_path(&self, index: usize) -> Option<Proof> {
169+
pub fn find_path(&self, index: usize) -> Option<Proof<'_>> {
170170
if index >= self.leaf_count {
171171
return None;
172172
}

tip-router-operator-cli/src/claim.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ pub async fn get_claimer_balance(
286286
Ok(balance)
287287
}
288288

289+
#[allow(clippy::cognitive_complexity)]
289290
#[allow(clippy::too_many_arguments)]
290291
pub async fn claim_mev_tips(
291292
merkle_trees: &GeneratedMerkleTreeCollection,

0 commit comments

Comments
 (0)