Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added initial implementations for packet forwarder in vortexor #5027

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ log-*.txt
log-*/
!log-collector/
!log-analyzer/*
!log-utils/

# intellij files
.idea/
Expand Down
8 changes: 6 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ solana-loader-v4-interface = "=2.2.1"
solana-loader-v4-program = { path = "programs/loader-v4", version = "=2.3.0" }
solana-local-cluster = { path = "local-cluster", version = "=2.3.0" }
solana-log-collector = { path = "log-collector", version = "=2.3.0" }
solana-logger = "=2.2.1"
solana-logger = "=2.3.1"
solana-measure = { path = "measure", version = "=2.3.0" }
solana-merkle-tree = { path = "merkle-tree", version = "=2.3.0" }
solana-message = "=2.2.1"
Expand Down
6 changes: 4 additions & 2 deletions programs/sbf/Cargo.lock

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

2 changes: 1 addition & 1 deletion programs/sbf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ solana-feature-set = "=2.2.4"
solana-fee = { path = "../../fee", version = "=2.3.0" }
solana-ledger = { path = "../../ledger", version = "=2.3.0" }
solana-log-collector = { path = "../../log-collector", version = "=2.3.0" }
solana-logger = "=2.2.1"
solana-logger = "=2.3.1"
solana-measure = { path = "../../measure", version = "=2.3.0" }
solana-poseidon = { path = "../../poseidon/", version = "=2.3.0" }
solana-program = "=2.2.1"
Expand Down
16 changes: 14 additions & 2 deletions svm/examples/Cargo.lock

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

2 changes: 1 addition & 1 deletion svm/examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ solana-account-decoder = { path = "../../account-decoder" }
solana-bpf-loader-program = { path = "../../programs/bpf_loader" }
solana-client = { path = "../../client" }
solana-compute-budget = { path = "../../compute-budget" }
solana-logger = "=2.2.1"
solana-logger = "=2.3.1"
solana-perf = { path = "../../perf" }
solana-program-runtime = { path = "../../program-runtime" }
solana-rpc-client-api = { path = "../../rpc-client-api" }
Expand Down
3 changes: 2 additions & 1 deletion validator/src/bin/solana-test-validator.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
agave_validator::{
admin_rpc_service, cli, dashboard::Dashboard, ledger_lockfile, lock_ledger,
println_name_value, redirect_stderr_to_file,
println_name_value,
},
clap::{crate_name, value_t, value_t_or_exit, values_t_or_exit},
crossbeam_channel::unbounded,
Expand All @@ -14,6 +14,7 @@ use {
},
solana_core::consensus::tower_storage::FileTowerStorage,
solana_faucet::faucet::run_local_faucet_with_port,
solana_logger::redirect_stderr_to_file,
solana_rpc::{
rpc::{JsonRpcConfig, RpcBigtableConfig},
rpc_pubsub_service::PubSubConfig,
Expand Down
6 changes: 3 additions & 3 deletions validator/src/commands/run/execute.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use {
crate::{
admin_rpc_service,
admin_rpc_service::{load_staked_nodes_overrides, StakedNodesOverrides},
admin_rpc_service::{self, load_staked_nodes_overrides, StakedNodesOverrides},
bootstrap,
cli::{self},
ledger_lockfile, lock_ledger, redirect_stderr_to_file,
ledger_lockfile, lock_ledger,
},
clap::{crate_name, value_t, value_t_or_exit, values_t, values_t_or_exit, ArgMatches},
crossbeam_channel::unbounded,
Expand Down Expand Up @@ -46,6 +45,7 @@ use {
},
use_snapshot_archives_at_startup::{self, UseSnapshotArchivesAtStartup},
},
solana_logger::redirect_stderr_to_file,
solana_perf::recycler::enable_recycler_warming,
solana_poh::poh_service,
solana_rpc::{
Expand Down
65 changes: 0 additions & 65 deletions validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ use {
indicatif::{ProgressDrawTarget, ProgressStyle},
std::{
borrow::Cow,
env,
fmt::Display,
fs::{File, OpenOptions},
path::Path,
process::exit,
thread::JoinHandle,
time::Duration,
},
};
Expand All @@ -22,69 +20,6 @@ pub mod cli;
pub mod commands;
pub mod dashboard;

#[cfg(unix)]
fn redirect_stderr(filename: &str) {
use std::os::unix::io::AsRawFd;
match OpenOptions::new().create(true).append(true).open(filename) {
Ok(file) => unsafe {
libc::dup2(file.as_raw_fd(), libc::STDERR_FILENO);
},
Err(err) => eprintln!("Unable to open {filename}: {err}"),
}
}

// Redirect stderr to a file with support for logrotate by sending a SIGUSR1 to the process.
//
// Upon success, future `log` macros and `eprintln!()` can be found in the specified log file.
pub fn redirect_stderr_to_file(logfile: Option<String>) -> Option<JoinHandle<()>> {
// Default to RUST_BACKTRACE=1 for more informative validator logs
if env::var_os("RUST_BACKTRACE").is_none() {
env::set_var("RUST_BACKTRACE", "1")
}

match logfile {
None => {
solana_logger::setup_with_default_filter();
None
}
Some(logfile) => {
#[cfg(unix)]
{
use log::info;
let mut signals =
signal_hook::iterator::Signals::new([signal_hook::consts::SIGUSR1])
.unwrap_or_else(|err| {
eprintln!("Unable to register SIGUSR1 handler: {err:?}");
exit(1);
});

solana_logger::setup_with_default_filter();
redirect_stderr(&logfile);
Some(
std::thread::Builder::new()
.name("solSigUsr1".into())
.spawn(move || {
for signal in signals.forever() {
info!(
"received SIGUSR1 ({}), reopening log file: {:?}",
signal, logfile
);
redirect_stderr(&logfile);
}
})
.unwrap(),
)
}
#[cfg(not(unix))]
{
println!("logrotate is not supported on this platform");
solana_logger::setup_file_with_default(&logfile, solana_logger::DEFAULT_FILTER);
None
}
}
}
}

pub fn format_name_value(name: &str, value: &str) -> String {
format!("{} {}", style(name).bold(), value)
}
Expand Down
4 changes: 3 additions & 1 deletion vortexor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
agave-banking-stage-ingress-types = { workspace = true }
async-channel = { workspace = true }
bytes = { workspace = true }
clap = { workspace = true }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not make sense to use modern clap version in vortexor? It would make much of the code cleaner.

Expand All @@ -32,10 +33,12 @@ quinn = { workspace = true }
quinn-proto = { workspace = true }
rand = { workspace = true }
rustls = { workspace = true }
signal-hook = { workspace = true }
smallvec = { workspace = true }
socket2 = { workspace = true }
solana-clap-utils = { workspace = true }
solana-core = { workspace = true }
solana-logger = { workspace = true }
solana-measure = { workspace = true }
solana-metrics = { workspace = true }
solana-net-utils = { workspace = true }
Expand All @@ -51,7 +54,6 @@ x509-parser = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
solana-logger = { workspace = true }
solana-streamer = { workspace = true, features = ["dev-context-only-utils"] }

[lib]
Expand Down
19 changes: 19 additions & 0 deletions vortexor/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,23 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
.validator(is_parsable::<u64>)
.help("Milliseconds to wait in the TPU receiver for packet coalescing."),
)
.arg(
Arg::with_name("logfile")
.long("log")
.value_name("FILE")
.takes_value(true)
.help(
"Redirect logging to the specified file, '-' for standard error. Sending the \
SIGUSR1 signal to the vortexor process will cause it to re-open the log file.",
),
)
.arg(
Arg::with_name("destination")
.long("destination")
.value_name("HOST:PORT")
.takes_value(true)
.multiple(true)
.validator(solana_net_utils::is_host_port)
.help("The destination validator address to which the vortexor will forward transactions."),
)
}
1 change: 1 addition & 0 deletions vortexor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod cli;
pub mod sender;
pub mod vortexor;
Loading
Loading