From d18d32d5942a0ecf218d16717ac694b6a7a04736 Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Tue, 22 Oct 2024 15:23:00 +0100 Subject: [PATCH 1/4] chore: pin `serde` reference in `evmlib` There seems to be some sort of issue with the `serde` crate. It is not possible to publish `evmlib` without it being pinned to this version. --- evmlib/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evmlib/Cargo.toml b/evmlib/Cargo.toml index fa5b2d9769..8aa1dd027f 100644 --- a/evmlib/Cargo.toml +++ b/evmlib/Cargo.toml @@ -15,7 +15,7 @@ local = [] [dependencies] alloy = { version = "0.4.2", default-features = false, features = ["std", "reqwest-rustls-tls", "provider-anvil-node", "sol-types", "json", "signers", "contract", "signer-local", "network"] } dirs-next = "~2.0.0" -serde = "1.0" +serde = "=1.0.210" serde_with = { version = "3.11.0", features = ["macros"] } thiserror = "1.0" tracing = { version = "~0.1.26" } From 0d5e244d6c33224535918121e1246e6d046ef146 Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Tue, 22 Oct 2024 16:13:51 +0100 Subject: [PATCH 2/4] chore: include release cycle info in crate For some reason the `sn_build_info` crate started to manifest an error that it couldn't find the `release-cycle-info` file. The solution was to embed the information in the crate. This is less than ideal, because it now needs to be updated in two places. However, we could have the other parts of the release process read the Rust file. We can do that later. --- sn_build_info/Cargo.toml | 1 + sn_build_info/build.rs | 56 +++++-------------------------- sn_build_info/src/release_info.rs | 4 +++ 3 files changed, 14 insertions(+), 47 deletions(-) create mode 100644 sn_build_info/src/release_info.rs diff --git a/sn_build_info/Cargo.toml b/sn_build_info/Cargo.toml index de2f27b5cb..8c5c4b7dfa 100644 --- a/sn_build_info/Cargo.toml +++ b/sn_build_info/Cargo.toml @@ -10,6 +10,7 @@ readme = "README.md" repository = "https://github.com/maidsafe/safe_network" version = "0.1.16" build = "build.rs" +include = ["Cargo.toml", "src/**/*", "build.rs"] [build-dependencies] vergen = { version = "8.0.0", features = ["build", "git", "gitcl"] } diff --git a/sn_build_info/build.rs b/sn_build_info/build.rs index 7ca807729d..8373a9b34f 100644 --- a/sn_build_info/build.rs +++ b/sn_build_info/build.rs @@ -5,62 +5,24 @@ // under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use std::fs; -use std::path::Path; use vergen::EmitBuilder; +mod release_info { + include!("src/release_info.rs"); +} + fn main() -> Result<(), Box> { EmitBuilder::builder() .build_date() - // Emit the short SHA-1 hash of the current commit .git_sha(true) - // Emit the current branch name .git_branch() - // Emit the annotated tag of the current commit, or fall back to abbreviated commit object. .git_describe(true, false, None) .emit()?; - let release_info_path = Path::new("../release-cycle-info"); - let contents = - fs::read_to_string(release_info_path).expect("Failed to read release-cycle-info"); - - let mut year = String::new(); - let mut month = String::new(); - let mut cycle = String::new(); - let mut counter = String::new(); - - for line in contents.lines() { - if line.starts_with("release-year:") { - year = line - .split(':') - .nth(1) - .map(|s| s.trim().to_string()) - .unwrap_or_default(); - } else if line.starts_with("release-month:") { - month = line - .split(':') - .nth(1) - .map(|s| s.trim().to_string()) - .unwrap_or_default(); - } else if line.starts_with("release-cycle:") { - cycle = line - .split(':') - .nth(1) - .map(|s| s.trim().to_string()) - .unwrap_or_default(); - } else if line.starts_with("release-cycle-counter:") { - counter = line - .split(':') - .nth(1) - .map(|s| s.trim().to_string()) - .unwrap_or_default(); - } - } - - println!("cargo:rustc-env=RELEASE_YEAR={year}"); - println!("cargo:rustc-env=RELEASE_MONTH={month}"); - println!("cargo:rustc-env=RELEASE_CYCLE={cycle}"); - println!("cargo:rustc-env=RELEASE_CYCLE_COUNTER={counter}"); + println!("cargo:rustc-env=RELEASE_YEAR={}", release_info::RELEASE_YEAR); + println!("cargo:rustc-env=RELEASE_MONTH={}", release_info::RELEASE_MONTH); + println!("cargo:rustc-env=RELEASE_CYCLE={}", release_info::RELEASE_CYCLE); + println!("cargo:rustc-env=RELEASE_CYCLE_COUNTER={}", release_info::RELEASE_CYCLE_COUNTER); Ok(()) -} +} \ No newline at end of file diff --git a/sn_build_info/src/release_info.rs b/sn_build_info/src/release_info.rs new file mode 100644 index 0000000000..a57250ddfd --- /dev/null +++ b/sn_build_info/src/release_info.rs @@ -0,0 +1,4 @@ +pub const RELEASE_YEAR: &str = "2024"; +pub const RELEASE_MONTH: &str = "10"; +pub const RELEASE_CYCLE: &str = "3"; +pub const RELEASE_CYCLE_COUNTER: &str = "2"; \ No newline at end of file From 080d1e5dbe0be68f5b56a139c3b2b9d6f1a85e55 Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Tue, 22 Oct 2024 23:15:55 +0530 Subject: [PATCH 3/4] fix: remove test utils reference from production code --- autonomi/Cargo.toml | 3 +-- autonomi/src/client/wasm.rs | 16 +++++++++++++++- sn_build_info/build.rs | 22 +++++++++++++++++----- sn_node/Cargo.toml | 2 +- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 617452db53..b44ca2233c 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -18,7 +18,7 @@ full = ["data", "registers", "vault"] data = [] vault = ["data"] fs = ["tokio/fs", "data"] -local = ["sn_networking/local", "test_utils/local", "sn_evm/local"] +local = ["sn_networking/local", "sn_evm/local"] registers = ["data"] loud = [] @@ -70,7 +70,6 @@ evmlib = { path = "../evmlib", version = "0.1.1", features = ["wasm-bindgen"] } # See https://github.com/sebcrozet/instant/blob/7bd13f51f5c930239fddc0476a837870fb239ed7/README.md#using-instant-for-a-wasm-platform-where-performancenow-is-not-available instant = { version = "0.1", features = ["wasm-bindgen", "inaccurate"] } js-sys = "0.3.70" -test_utils = { path = "../test_utils" } tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-web = "0.1.3" diff --git a/autonomi/src/client/wasm.rs b/autonomi/src/client/wasm.rs index b6149776fe..4607949ee2 100644 --- a/autonomi/src/client/wasm.rs +++ b/autonomi/src/client/wasm.rs @@ -81,7 +81,21 @@ pub struct Wallet(evmlib::wallet::Wallet); /// environment variable that was used during the build process of this library. #[wasm_bindgen(js_name = getFundedWallet)] pub fn funded_wallet() -> Wallet { - Wallet(test_utils::evm::get_funded_wallet()) + let network = evmlib::utils::get_evm_network_from_env() + .expect("Failed to get EVM network from environment variables"); + if matches!(network, evmlib::Network::ArbitrumOne) { + panic!("You're trying to use ArbitrumOne network. Use a custom network for testing."); + } + // Default deployer wallet of the testnet. + const DEFAULT_WALLET_PRIVATE_KEY: &str = + "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; + + let private_key = std::env::var("SECRET_KEY").unwrap_or(DEFAULT_WALLET_PRIVATE_KEY.to_string()); + + let wallet = evmlib::wallet::Wallet::new_from_private_key(network, &private_key) + .expect("Invalid private key"); + + Wallet(wallet) } /// Enable tracing logging in the console. diff --git a/sn_build_info/build.rs b/sn_build_info/build.rs index 8373a9b34f..bf07248574 100644 --- a/sn_build_info/build.rs +++ b/sn_build_info/build.rs @@ -19,10 +19,22 @@ fn main() -> Result<(), Box> { .git_describe(true, false, None) .emit()?; - println!("cargo:rustc-env=RELEASE_YEAR={}", release_info::RELEASE_YEAR); - println!("cargo:rustc-env=RELEASE_MONTH={}", release_info::RELEASE_MONTH); - println!("cargo:rustc-env=RELEASE_CYCLE={}", release_info::RELEASE_CYCLE); - println!("cargo:rustc-env=RELEASE_CYCLE_COUNTER={}", release_info::RELEASE_CYCLE_COUNTER); + println!( + "cargo:rustc-env=RELEASE_YEAR={}", + release_info::RELEASE_YEAR + ); + println!( + "cargo:rustc-env=RELEASE_MONTH={}", + release_info::RELEASE_MONTH + ); + println!( + "cargo:rustc-env=RELEASE_CYCLE={}", + release_info::RELEASE_CYCLE + ); + println!( + "cargo:rustc-env=RELEASE_CYCLE_COUNTER={}", + release_info::RELEASE_CYCLE_COUNTER + ); Ok(()) -} \ No newline at end of file +} diff --git a/sn_node/Cargo.toml b/sn_node/Cargo.toml index 85619de0b5..c05ed93d3a 100644 --- a/sn_node/Cargo.toml +++ b/sn_node/Cargo.toml @@ -15,7 +15,7 @@ path = "src/bin/safenode/main.rs" [features] default = ["metrics", "upnp", "open-metrics", "encrypt-records"] -local = ["sn_networking/local", "test_utils/local", "sn_evm/local"] +local = ["sn_networking/local", "sn_evm/local"] otlp = ["sn_logging/otlp"] metrics = ["sn_logging/process-metrics"] network-contacts = ["sn_peers_acquisition/network-contacts"] From 5cba4f59725a9c76d4a7c924ff28a6c592b32db8 Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Tue, 22 Oct 2024 19:28:48 +0100 Subject: [PATCH 4/4] chore: meet requirements for publishing new cli crate --- autonomi-cli/Cargo.toml | 6 ++++++ autonomi-cli/README.md | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/autonomi-cli/Cargo.toml b/autonomi-cli/Cargo.toml index 83adf193d2..70b361d4be 100644 --- a/autonomi-cli/Cargo.toml +++ b/autonomi-cli/Cargo.toml @@ -1,7 +1,13 @@ [package] +authors = ["MaidSafe Developers "] name = "autonomi-cli" +description = "Autonomi CLI" +license = "GPL-3.0" version = "0.1.1" edition = "2021" +homepage = "https://maidsafe.net" +readme = "README.md" +repository = "https://github.com/maidsafe/safe_network" [[bin]] name = "autonomi" diff --git a/autonomi-cli/README.md b/autonomi-cli/README.md index b10d2128fb..8bc2277655 100644 --- a/autonomi-cli/README.md +++ b/autonomi-cli/README.md @@ -24,4 +24,12 @@ Options: Print help (see more with '--help') -V, --version Print version -``` \ No newline at end of file +``` + +## License + +This Safe Network repository is licensed under the General Public License (GPL), version 3 ([LICENSE](LICENSE) http://www.gnu.org/licenses/gpl-3.0.en.html). + +--- + +Feel free to modify or expand upon this README as needed. Would you like to add or change anything else?