Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
jacderida committed Oct 23, 2024
2 parents bb54425 + 81e9630 commit 379ef20
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 60 deletions.
6 changes: 6 additions & 0 deletions autonomi-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[package]
authors = ["MaidSafe Developers <dev@maidsafe.net>"]
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"
Expand Down
10 changes: 9 additions & 1 deletion autonomi-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ Options:
Print help (see more with '--help')
-V, --version
Print version
```
```

## 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?
3 changes: 1 addition & 2 deletions autonomi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ full = ["data", "registers", "vault"]
data = []
vault = ["data", "registers"]
fs = ["tokio/fs", "data"]
local = ["sn_networking/local", "test_utils/local", "sn_evm/local"]
local = ["sn_networking/local", "sn_evm/local"]
registers = ["data"]
loud = []
external-signer = ["sn_evm/external-signer", "data"]
Expand Down Expand Up @@ -72,7 +72,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"
xor_name = { version = "5.0.0", features = ["serialize-hex"] }
Expand Down
24 changes: 15 additions & 9 deletions autonomi/src/client/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,22 @@ pub struct JsWallet(evmlib::wallet::Wallet);
/// Get a funded wallet for testing. This either uses a default private key or the `EVM_PRIVATE_KEY`
/// environment variable that was used during the build process of this library.
#[wasm_bindgen(js_name = getFundedWallet)]
pub fn funded_wallet() -> JsWallet {
JsWallet(test_utils::evm::get_funded_wallet())
}
pub fn funded_wallet() -> 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");

/// Get the current `EvmNetwork` that was set using environment variables that were used during the build process of this library.
#[wasm_bindgen(js_name = getEvmNetwork)]
pub fn evm_network() -> Result<JsValue, JsError> {
let evm_network = evmlib::utils::get_evm_network_from_env()?;
let js_value = serde_wasm_bindgen::to_value(&evm_network)?;
Ok(js_value)
Wallet(wallet)
}

/// Enable tracing logging in the console.
Expand Down
2 changes: 1 addition & 1 deletion evmlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ external-signer = []
[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" }
Expand Down
1 change: 1 addition & 0 deletions sn_build_info/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
66 changes: 20 additions & 46 deletions sn_build_info/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,36 @@
// 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<dyn std::error::Error>> {
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(())
}
4 changes: 4 additions & 0 deletions sn_build_info/src/release_info.rs
Original file line number Diff line number Diff line change
@@ -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";
2 changes: 1 addition & 1 deletion sn_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 379ef20

Please sign in to comment.