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

Address dev branch toolchain issues. #149

Merged
merged 13 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ async-trait = { version = "0.1.74", optional = true }
base16 = "0.2.1"
casper-hashing = "3.0.0"
casper-types = { version = "4.0.1", features = ["std"] }
clap = { version = "4.4.10", optional = true, features = ["cargo", "deprecated", "wrap_help"] }
clap_complete = { version = "4.4.4", optional = true }
clap = { version = "=4.4.10", optional = true, features = ["cargo", "deprecated", "wrap_help"] }
clap_complete = { version = "=4.4.4", optional = true }
hex-buffer-serde = "0.4.0"
humantime = "2.1.0"
itertools = "0.12.0"
jsonrpc-lite = "0.6.0"
num-traits = "0.2.15"
once_cell = "1.18.0"
rand = "0.8.5"
reqwest = { version = "0.11.22", features = ["json"] }
reqwest = { version = "0.12.3", features = ["json"] }
schemars = "=0.8.5"
serde = { version = "1.0.193", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.108", features = ["preserve_order"] }
Expand All @@ -51,7 +51,6 @@ uint = "0.9.5"
tempfile = "3.8.1"

[build-dependencies]
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you can remove [build-dependencies] now.

Are you really really sure you have to fix clap ?

Copy link
Contributor

Choose a reason for hiding this comment

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

At least I observed issues where clap_lex (and likely other clap packages) specified a minimum Rust version (the is already on 1.74).

You can see that clap 4.4.18 fixes it at 1.70, whereas 4.5.0 already requires 1.74.

We could consider something less strict like <4.5.0 instead of =... though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that the more liberal we can be with the versioning the better. I don't know what the SOP is for moving the toolchain version forward on the node. That is, when should we be moving the versioning forward vs leaving it the same.

Seeing as we currently don't use any of these cutting edge clap features, I don't see any reason to increment the toolchain version as we don't have a need to do so on the client.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it turns out the best I can do on this is pinning clap to ~4.4 and putting clap_complete at <4.5.0.

Setting clap at <4.5, for some esoteric reason, results in issues with clap_lex specifying Rust version 1.74

vergen = { version = "7", default-features = false, features = ["git"] }

[patch.crates-io]
casper-hashing = { git = "https://github.com/casper-network/casper-node", branch = "dev" }
Expand Down
21 changes: 17 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
use vergen::{Config, ShaKind};
use std::process::Command;

const GIT_HASH_ENV_VAR: &str = "GIT_SHA_SHORT";
fn main() {
let mut config = Config::default();
*config.git_mut().sha_kind_mut() = ShaKind::Short;
let _ = vergen::vergen(config);
//Build command to retrieve the short git commit hash
let git_process_output = Command::new("git")
.arg("rev-parse")
.arg("--short")
.arg("HEAD")
.output()
.expect("Failed to retrieve short git commit hash");

//Parse the raw output into a string, we still need to remove the newline character
let git_hash_raw =
String::from_utf8(git_process_output.stdout).expect("Failed to convert git hash to string");
//Remove the newline character from the short git commit hash
let git_hash = git_hash_raw.trim_end_matches('\n');

println!("cargo:rustc-env={}={}", GIT_HASH_ENV_VAR, git_hash);
}
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.73.0"
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const APP_NAME: &str = "Casper client";

static VERSION: Lazy<String> =
Lazy::new(
|| match option_env!("VERGEN_GIT_SHA_SHORT").map(|sha| sha.to_lowercase()) {
|| match option_env!("GIT_SHA_SHORT").map(|sha| sha.to_lowercase()) {
None => crate_version!().to_string(),
Some(git_sha_short) => {
if git_sha_short.to_lowercase() == "unknown" {
Expand Down
Loading