mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: use 8 byte SHA in getClientVersionV1 (#9137)
This commit is contained in:
44
Cargo.lock
generated
44
Cargo.lock
generated
@ -1865,10 +1865,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "const-str"
|
name = "const_format"
|
||||||
version = "0.5.7"
|
version = "0.2.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3618cccc083bb987a415d85c02ca6c9994ea5b44731ec28b9ecf09658655fba9"
|
checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673"
|
||||||
|
dependencies = [
|
||||||
|
"const_format_proc_macros",
|
||||||
|
"konst",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const_format_proc_macros"
|
||||||
|
version = "0.2.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
@ -4500,6 +4515,21 @@ dependencies = [
|
|||||||
"sha3-asm",
|
"sha3-asm",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "konst"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "330f0e13e6483b8c34885f7e6c9f19b1a7bd449c673fbb948a51c99d66ef74f4"
|
||||||
|
dependencies = [
|
||||||
|
"konst_macro_rules",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "konst_macro_rules"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
@ -7539,7 +7569,7 @@ dependencies = [
|
|||||||
"alloy-genesis",
|
"alloy-genesis",
|
||||||
"alloy-rpc-types-engine",
|
"alloy-rpc-types-engine",
|
||||||
"clap",
|
"clap",
|
||||||
"const-str",
|
"const_format",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
"eyre",
|
"eyre",
|
||||||
@ -10358,6 +10388,12 @@ version = "0.1.13"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
|
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "universal-hash"
|
name = "universal-hash"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
|||||||
@ -414,6 +414,7 @@ aquamarine = "0.5"
|
|||||||
bytes = "1.5"
|
bytes = "1.5"
|
||||||
bitflags = "2.4"
|
bitflags = "2.4"
|
||||||
clap = "4"
|
clap = "4"
|
||||||
|
const_format = { version = "0.2.32", features = ["rust_1_64"] }
|
||||||
dashmap = "5.5"
|
dashmap = "5.5"
|
||||||
derive_more = "0.99.17"
|
derive_more = "0.99.17"
|
||||||
fdlimit = "0.3.0"
|
fdlimit = "0.3.0"
|
||||||
|
|||||||
@ -58,7 +58,7 @@ eyre.workspace = true
|
|||||||
clap = { workspace = true, features = ["derive"] }
|
clap = { workspace = true, features = ["derive"] }
|
||||||
humantime.workspace = true
|
humantime.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
const-str = "0.5.6"
|
const_format.workspace = true
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
derive_more.workspace = true
|
derive_more.workspace = true
|
||||||
once_cell.workspace = true
|
once_cell.workspace = true
|
||||||
|
|||||||
@ -8,19 +8,20 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
EmitBuilder::builder()
|
EmitBuilder::builder()
|
||||||
.git_describe(false, true, None)
|
.git_describe(false, true, None)
|
||||||
.git_dirty(true)
|
.git_dirty(true)
|
||||||
.git_sha(true)
|
.git_sha(false)
|
||||||
.build_timestamp()
|
.build_timestamp()
|
||||||
.cargo_features()
|
.cargo_features()
|
||||||
.cargo_target_triple()
|
.cargo_target_triple()
|
||||||
.emit_and_set()?;
|
.emit_and_set()?;
|
||||||
|
|
||||||
let sha = env::var("VERGEN_GIT_SHA")?;
|
let sha = env::var("VERGEN_GIT_SHA")?;
|
||||||
|
let sha_short = &sha[0..7];
|
||||||
|
|
||||||
let is_dirty = env::var("VERGEN_GIT_DIRTY")? == "true";
|
let is_dirty = env::var("VERGEN_GIT_DIRTY")? == "true";
|
||||||
// > git describe --always --tags
|
// > git describe --always --tags
|
||||||
// if not on a tag: v0.2.0-beta.3-82-g1939939b
|
// if not on a tag: v0.2.0-beta.3-82-g1939939b
|
||||||
// if on a tag: v0.2.0-beta.3
|
// if on a tag: v0.2.0-beta.3
|
||||||
let not_on_tag = env::var("VERGEN_GIT_DESCRIBE")?.ends_with(&format!("-g{sha}"));
|
let not_on_tag = env::var("VERGEN_GIT_DESCRIBE")?.ends_with(&format!("-g{sha_short}"));
|
||||||
let is_dev = is_dirty || not_on_tag;
|
let is_dev = is_dirty || not_on_tag;
|
||||||
println!("cargo:rustc-env=RETH_VERSION_SUFFIX={}", if is_dev { "-dev" } else { "" });
|
println!("cargo:rustc-env=RETH_VERSION_SUFFIX={}", if is_dev { "-dev" } else { "" });
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
//! This exposes reth's version information over prometheus.
|
//! This exposes reth's version information over prometheus.
|
||||||
|
|
||||||
use crate::version::build_profile_name;
|
use crate::version::{build_profile_name, VERGEN_GIT_SHA};
|
||||||
use metrics::gauge;
|
use metrics::gauge;
|
||||||
|
|
||||||
const LABELS: [(&str, &str); 6] = [
|
const LABELS: [(&str, &str); 6] = [
|
||||||
("version", env!("CARGO_PKG_VERSION")),
|
("version", env!("CARGO_PKG_VERSION")),
|
||||||
("build_timestamp", env!("VERGEN_BUILD_TIMESTAMP")),
|
("build_timestamp", env!("VERGEN_BUILD_TIMESTAMP")),
|
||||||
("cargo_features", env!("VERGEN_CARGO_FEATURES")),
|
("cargo_features", env!("VERGEN_CARGO_FEATURES")),
|
||||||
("git_sha", env!("VERGEN_GIT_SHA")),
|
("git_sha", VERGEN_GIT_SHA),
|
||||||
("target_triple", env!("VERGEN_CARGO_TARGET_TRIPLE")),
|
("target_triple", env!("VERGEN_CARGO_TARGET_TRIPLE")),
|
||||||
("build_profile", build_profile_name()),
|
("build_profile", build_profile_name()),
|
||||||
];
|
];
|
||||||
|
|||||||
@ -11,8 +11,11 @@ pub const NAME_CLIENT: &str = "Reth";
|
|||||||
/// The latest version from Cargo.toml.
|
/// The latest version from Cargo.toml.
|
||||||
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
|
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
/// The short SHA of the latest commit.
|
/// The full SHA of the latest commit.
|
||||||
pub const VERGEN_GIT_SHA: &str = env!("VERGEN_GIT_SHA");
|
pub const VERGEN_GIT_SHA_LONG: &str = env!("VERGEN_GIT_SHA");
|
||||||
|
|
||||||
|
/// The 8 character short SHA of the latest commit.
|
||||||
|
pub const VERGEN_GIT_SHA: &str = const_format::str_index!(VERGEN_GIT_SHA_LONG, ..8);
|
||||||
|
|
||||||
/// The build timestamp.
|
/// The build timestamp.
|
||||||
pub const VERGEN_BUILD_TIMESTAMP: &str = env!("VERGEN_BUILD_TIMESTAMP");
|
pub const VERGEN_BUILD_TIMESTAMP: &str = env!("VERGEN_BUILD_TIMESTAMP");
|
||||||
@ -27,11 +30,11 @@ pub const VERGEN_BUILD_TIMESTAMP: &str = env!("VERGEN_BUILD_TIMESTAMP");
|
|||||||
/// ```text
|
/// ```text
|
||||||
/// 0.1.0 (defa64b2)
|
/// 0.1.0 (defa64b2)
|
||||||
/// ```
|
/// ```
|
||||||
pub const SHORT_VERSION: &str = concat!(
|
pub const SHORT_VERSION: &str = const_format::concatcp!(
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
env!("RETH_VERSION_SUFFIX"),
|
env!("RETH_VERSION_SUFFIX"),
|
||||||
" (",
|
" (",
|
||||||
env!("VERGEN_GIT_SHA"),
|
VERGEN_GIT_SHA,
|
||||||
")"
|
")"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -52,13 +55,13 @@ pub const SHORT_VERSION: &str = concat!(
|
|||||||
/// Build Features: jemalloc
|
/// Build Features: jemalloc
|
||||||
/// Build Profile: maxperf
|
/// Build Profile: maxperf
|
||||||
/// ```
|
/// ```
|
||||||
pub const LONG_VERSION: &str = const_str::concat!(
|
pub const LONG_VERSION: &str = const_format::concatcp!(
|
||||||
"Version: ",
|
"Version: ",
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
env!("RETH_VERSION_SUFFIX"),
|
env!("RETH_VERSION_SUFFIX"),
|
||||||
"\n",
|
"\n",
|
||||||
"Commit SHA: ",
|
"Commit SHA: ",
|
||||||
env!("VERGEN_GIT_SHA"),
|
VERGEN_GIT_SHA_LONG,
|
||||||
"\n",
|
"\n",
|
||||||
"Build Timestamp: ",
|
"Build Timestamp: ",
|
||||||
env!("VERGEN_BUILD_TIMESTAMP"),
|
env!("VERGEN_BUILD_TIMESTAMP"),
|
||||||
@ -81,11 +84,11 @@ pub const LONG_VERSION: &str = const_str::concat!(
|
|||||||
/// reth/v{major}.{minor}.{patch}-{sha1}/{target}
|
/// reth/v{major}.{minor}.{patch}-{sha1}/{target}
|
||||||
/// ```
|
/// ```
|
||||||
/// e.g.: `reth/v0.1.0-alpha.1-428a6dc2f/aarch64-apple-darwin`
|
/// e.g.: `reth/v0.1.0-alpha.1-428a6dc2f/aarch64-apple-darwin`
|
||||||
pub(crate) const P2P_CLIENT_VERSION: &str = concat!(
|
pub(crate) const P2P_CLIENT_VERSION: &str = const_format::concatcp!(
|
||||||
"reth/v",
|
"reth/v",
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
"-",
|
"-",
|
||||||
env!("VERGEN_GIT_SHA"),
|
VERGEN_GIT_SHA,
|
||||||
"/",
|
"/",
|
||||||
env!("VERGEN_CARGO_TARGET_TRIPLE")
|
env!("VERGEN_CARGO_TARGET_TRIPLE")
|
||||||
);
|
);
|
||||||
@ -118,9 +121,13 @@ pub(crate) const fn build_profile_name() -> &'static str {
|
|||||||
// We split on the path separator of the *host* machine, which may be different from
|
// We split on the path separator of the *host* machine, which may be different from
|
||||||
// `std::path::MAIN_SEPARATOR_STR`.
|
// `std::path::MAIN_SEPARATOR_STR`.
|
||||||
const OUT_DIR: &str = env!("OUT_DIR");
|
const OUT_DIR: &str = env!("OUT_DIR");
|
||||||
const SEP: char = if const_str::contains!(OUT_DIR, "/") { '/' } else { '\\' };
|
let unix_parts = const_format::str_split!(OUT_DIR, '/');
|
||||||
let parts = const_str::split!(OUT_DIR, SEP);
|
if unix_parts.len() >= 4 {
|
||||||
parts[parts.len() - 4]
|
unix_parts[unix_parts.len() - 4]
|
||||||
|
} else {
|
||||||
|
let win_parts = const_format::str_split!(OUT_DIR, '\\');
|
||||||
|
win_parts[win_parts.len() - 4]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@ -43,6 +43,7 @@ allow = [
|
|||||||
"Unicode-DFS-2016",
|
"Unicode-DFS-2016",
|
||||||
"Unlicense",
|
"Unlicense",
|
||||||
"Unicode-3.0",
|
"Unicode-3.0",
|
||||||
|
"Zlib",
|
||||||
# https://github.com/briansmith/ring/issues/902
|
# https://github.com/briansmith/ring/issues/902
|
||||||
"LicenseRef-ring",
|
"LicenseRef-ring",
|
||||||
# https://github.com/rustls/webpki/blob/main/LICENSE ISC Style
|
# https://github.com/rustls/webpki/blob/main/LICENSE ISC Style
|
||||||
|
|||||||
Reference in New Issue
Block a user