Skip to content

Commit 59ef8de

Browse files
GabrielePiccolucacillarioLuca Cillario
authored
Log validator version on startup (#390)
See #374 by @lucacillario <!-- greptile_comment --> ## Greptile Summary Added version logging on validator startup with both Cargo package version and Git version information, along with minor string formatting improvements. - Added `git-version` dependency in `test-bins/Cargo.toml` for Git metadata tracking - Introduced `GIT_VERSION` constant using `git_version::git_version!()` macro in `test-bins/src/rpc.rs` - Enhanced startup logging to display version information for better observability - Updated string formatting in `magicblock-metrics/src/metrics/types.rs` to use modern string interpolation syntax <!-- /greptile_comment --> --------- Co-authored-by: Luca Cillario <luca.cillario.95@gmail.com> Co-authored-by: Luca Cillario <luca@magicblock.gg>
1 parent 3efafea commit 59ef8de

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

magicblock-metrics/src/metrics/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ impl fmt::Display for Outcome {
1616
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1717
use Outcome::*;
1818
match self {
19-
Success => write!(f, "{}", OUTCOME_SUCCESS),
20-
Error => write!(f, "{}", OUTCOME_ERROR),
19+
Success => write!(f, "{OUTCOME_SUCCESS}"),
20+
Error => write!(f, "{OUTCOME_ERROR}"),
2121
}
2222
}
2323
}

test-bins/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ magicblock-config = { workspace = true }
1717
solana-sdk = { workspace = true }
1818
test-tools = { workspace = true }
1919
tokio = { workspace = true, features = ["rt-multi-thread"] }
20+
git-version = { workspace = true }
2021

2122
[[bin]]
2223
name = "rpc"

test-bins/src/rpc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const TEST_KEYPAIR_BYTES: [u8; 64] = [
1616
202, 240, 105, 168, 157, 64, 233, 249, 100, 104, 210, 41, 83, 87,
1717
];
1818

19+
const GIT_VERSION: &str = git_version::git_version!();
20+
1921
fn init_logger() {
2022
if let Ok(style) = std::env::var("RUST_LOG_STYLE") {
2123
use std::io::Write;
@@ -99,6 +101,11 @@ async fn main() {
99101

100102
info!("");
101103
info!("🧙 Magicblock Validator is running!");
104+
info!(
105+
"🏷️ Validator version: {} (Git: {})",
106+
env!("CARGO_PKG_VERSION"),
107+
GIT_VERSION
108+
);
102109
info!("-----------------------------------");
103110
info!("📡 RPC endpoint: http://{}:{}", rpc_host, rpc_port);
104111
info!("🔌 WebSocket endpoint: ws://{}:{}", rpc_host, ws_port);

0 commit comments

Comments
 (0)