Skip to content

Commit

Permalink
Revert "copy over ledger utils fn"
Browse files Browse the repository at this point in the history
This reverts commit fe39a97.
ebatsell committed Jan 27, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent fe39a97 commit 26dc401
Showing 9 changed files with 484 additions and 2,649 deletions.
1,762 changes: 463 additions & 1,299 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -68,7 +68,6 @@ spl-memo = "4.0.0"
solana-account-decoder = { package = "solana-account-decoder", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-metrics = { package = "solana-metrics", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-accounts-db = { package = "solana-accounts-db", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-clap-utils = { package = "solana-clap-utils", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-client = { package = "solana-client", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-ledger = { package = "solana-ledger", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-program = { package = "solana-program", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
@@ -107,16 +106,6 @@ jito-vault-core = { git = "https://github.com/jito-foundation/restaking.git", re
jito-vault-program = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d", features = ["no-entrypoint"] }
jito-vault-sdk = { git = "https://github.com/jito-foundation/restaking.git", rev = "eaf88e7e5ca2845fe3108c4fc4a06a25f9a8514d" }

solana-core = { package = "solana-core", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-geyser-plugin-manager = { package = "solana-geyser-plugin-manager", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-gossip = { package = "solana-gossip", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-measure = { package = "solana-measure", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-rpc = { package = "solana-rpc", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-streamer = { package = "solana-streamer", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-unified-scheduler-pool = { package = "solana-unified-scheduler-pool", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }



[patch.crates-io]
# Force all Solana dependencies to use the Jito fork
solana-program = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
@@ -126,12 +115,3 @@ solana-rpc-client = { git = "https://github.com/jito-foundation/jito-solana.git"
solana-rpc-client-api = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
# necessary for ellipsis client
solana-transaction-status = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }

solana-core = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-geyser-plugin-manager = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-gossip = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-measure = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-rpc = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-streamer = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-unified-scheduler-pool = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }

12 changes: 0 additions & 12 deletions tip-router-operator-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ anchor-lang = { workspace = true }
anyhow = { workspace = true }
base64 = "0.13"
clap = { workspace = true }
clap_old = { package = "clap", version = "2.33.1" }
ellipsis-client = "0.1"
env_logger = { workspace = true }
hex = "0.4"
@@ -29,7 +28,6 @@ serde_json = { workspace = true }
solana-account-decoder = { workspace = true }
solana-accounts-db = { workspace = true }
solana-client = { workspace = true }
solana-clap-utils = { workspace = true }
solana-ledger = { workspace = true }
solana-metrics = { workspace = true }
solana-program = { workspace = true }
@@ -42,16 +40,6 @@ spl-memo = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }

crossbeam-channel = "0.5"

solana-core = { workspace = true }
solana-geyser-plugin-manager = { workspace = true }
solana-gossip = { workspace = true }
solana-measure = { workspace = true }
solana-rpc = { workspace = true }
solana-streamer = { workspace = true }
solana-unified-scheduler-pool = { workspace = true }

[dev-dependencies]
solana-program-test = { workspace = true }
solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
597 changes: 0 additions & 597 deletions tip-router-operator-cli/src/arg_matches.rs

This file was deleted.

6 changes: 3 additions & 3 deletions tip-router-operator-cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{fmt::Display, path::PathBuf};
use std::path::PathBuf;

use clap::Parser;
use solana_sdk::pubkey::Pubkey;

#[derive(Clone, Parser, Debug)]
#[derive(Clone, Parser)]
#[command(author, version, about)]
pub struct Cli {
#[arg(short, long, env)]
@@ -37,7 +37,7 @@ pub struct Cli {
pub command: Commands,
}

#[derive(clap::Subcommand, Clone, Debug)]
#[derive(clap::Subcommand, Clone)]
pub enum Commands {
Run {
#[arg(short, long, env)]
20 changes: 0 additions & 20 deletions tip-router-operator-cli/src/ledger_utils.rs
Original file line number Diff line number Diff line change
@@ -173,26 +173,6 @@ pub fn get_bank_from_ledger(
..Default::default()
};
let exit = Arc::new(AtomicBool::new(false));

// Call ledger_utils::load_and_process_ledger here
// let LoadAndProcessLedgerOutput {
// bank_forks,
// starting_snapshot_hashes,
// accounts_background_service,
// ..
// } = match solana_ledger_tool::ledger_utils::load_and_process_ledger(
// &genesis_config,
// &blockstore,
// account_paths,
// None,
// Some(&snapshot_config),
// ) {
// Ok(res) => res,
// Err(e) => {
// panic!("Failed to load bank forks: {}", e);
// }
// };

let (bank_forks, leader_schedule_cache, _starting_snapshot_hashes, ..) =
match bank_forks_utils::load_bank_forks(
&genesis_config,
110 changes: 0 additions & 110 deletions tip-router-operator-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -4,15 +4,11 @@ pub mod tip_router;
pub use crate::cli::{Cli, Commands};
pub mod cli;
pub use crate::process_epoch::process_epoch;
pub mod arg_matches;
pub mod backup_snapshots;
mod load_and_process_ledger;
pub mod process_epoch;
pub mod submit;

use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::time::Instant;

use anchor_lang::prelude::*;
@@ -190,109 +186,3 @@ pub fn get_meta_merkle_root(

Ok(meta_merkle_tree)
}

fn get_validator_cmdline() -> Result<String> {
let output = Command::new("pgrep").arg("solana-validator").output()?;

let pid = String::from_utf8_lossy(&output.stdout).trim().to_string();

let cmdline = fs::read_to_string(format!("/proc/{}/cmdline", pid))?;

Ok(cmdline.replace('\0', " "))
}

pub fn emit_solana_validator_args() -> std::result::Result<(), anyhow::Error> {
// Find solana-validator process and get its command line args
let validator_cmdline = match get_validator_cmdline() {
Ok(cmdline) => cmdline,
Err(_) => return Err(anyhow::anyhow!("Validator process not found")),
};

let validator_config: Vec<String> = validator_cmdline
.split_whitespace()
.map(String::from)
.collect();

if validator_config.is_empty() {
return Err(anyhow::anyhow!("Validator process not found"));
}

let mut limit_ledger_size = None;
let mut full_snapshot_interval = None;
let mut max_full_snapshots = None;
let mut incremental_snapshot_path = None;
let mut incremental_snapshot_interval = None;
let mut max_incremental_snapshots = None;

for (i, arg) in validator_config.iter().enumerate() {
match arg.as_str() {
"--limit-ledger-size" => {
if let Some(value) = validator_config.get(i + 1) {
limit_ledger_size = Some(value.clone());
}
}
"--full-snapshot-interval-slots" => {
if let Some(value) = validator_config.get(i + 1) {
full_snapshot_interval = Some(value.clone());
}
}
"--maximum-full-snapshots-to-retain" => {
if let Some(value) = validator_config.get(i + 1) {
max_full_snapshots = Some(value.clone());
}
}
"--incremental-snapshot-archive-path" => {
if let Some(value) = validator_config.get(i + 1) {
incremental_snapshot_path = Some(value.clone());
}
}
"--incremental-snapshot-interval-slots" => {
if let Some(value) = validator_config.get(i + 1) {
incremental_snapshot_interval = Some(value.clone());
}
}
"--maximum-incremental-snapshots-to-retain" => {
if let Some(value) = validator_config.get(i + 1) {
max_incremental_snapshots = Some(value.clone());
}
}
_ => {}
}
}

datapoint_info!(
"tip_router_cli.validator_config",
(
"limit_ledger_size",
limit_ledger_size.unwrap_or_default(),
String
),
(
"full_snapshot_interval",
full_snapshot_interval.unwrap_or_default(),
String
),
(
"max_full_snapshots",
max_full_snapshots.unwrap_or_default(),
String
),
(
"incremental_snapshot_path",
incremental_snapshot_path.unwrap_or_default(),
String
),
(
"incremental_snapshot_interval",
incremental_snapshot_interval.unwrap_or_default(),
String
),
(
"max_incremental_snapshots",
max_incremental_snapshots.unwrap_or_default(),
String
)
);

Ok(())
}
586 changes: 0 additions & 586 deletions tip-router-operator-cli/src/load_and_process_ledger.rs

This file was deleted.

20 changes: 18 additions & 2 deletions tip-router-operator-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ use ::{
clap::Parser,
ellipsis_client::{ClientSubset, EllipsisClient},
log::{error, info},
solana_metrics::{datapoint_info, set_host_id},
solana_metrics::set_host_id,
solana_rpc_client::rpc_client::RpcClient,
solana_sdk::{
clock::DEFAULT_SLOTS_PER_EPOCH,
@@ -40,7 +40,23 @@ async fn main() -> Result<()> {
let tx = Transaction::new_with_payer(&[ix], Some(&keypair.pubkey()));
rpc_client.process_transaction(tx, &[&keypair]).await?;

info!("CLI Arguments: {:?}", cli);
info!(
"CLI Arguments:
keypair_path: {}
operator_address: {}
rpc_url: {}
ledger_path: {}
account_paths: {:?}
full_snapshots_path: {:?}
snapshot_output_dir: {}",
cli.keypair_path,
cli.operator_address,
cli.rpc_url,
cli.ledger_path.display(),
cli.account_paths,
cli.full_snapshots_path,
cli.snapshot_output_dir.display()
);

match cli.command {
Commands::Run {

0 comments on commit 26dc401

Please sign in to comment.