Skip to content

Commit

Permalink
Merge branch 'fraccaman/respect-wasm-dir' (#3432)
Browse files Browse the repository at this point in the history
* fraccaman/respect-wasm-dir:
  added changelog
  respect warm-dir on init-network
  • Loading branch information
brentstone committed Jul 3, 2024
2 parents 2863dc3 + dd4506e commit d22c1e5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/3432-respect-wasm-dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Respect --wasm-dir on init-network.
([\#3432](https://github.com/anoma/namada/pull/3432))
2 changes: 1 addition & 1 deletion crates/apps_lib/src/cli/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ impl CliApi {
utils::validate_wasm(args)
}
ClientUtils::InitNetwork(InitNetwork(args)) => {
utils::init_network(args);
utils::init_network(global_args, args);
}
ClientUtils::GenesisBond(GenesisBond(args)) => {
utils::genesis_bond(args)
Expand Down
9 changes: 6 additions & 3 deletions crates/apps_lib/src/client/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ pub fn id_from_pk(pk: &common::PublicKey) -> TendermintNodeId {

/// Initialize a new test network from the given configuration.
pub fn init_network(
global_args: args::Global,
args::InitNetwork {
templates_path,
wasm_checksums_path,
Expand Down Expand Up @@ -393,9 +394,11 @@ pub fn init_network(
// Try to copy the built WASM, if they're present with the checksums
let checksums = wasm_loader::Checksums::read_checksums(&wasm_dir_full)
.unwrap_or_else(|_| safe_exit(1));
let base_wasm_path = std::env::current_dir()
.unwrap()
.join(crate::config::DEFAULT_WASM_DIR);
let base_wasm_path = global_args.wasm_dir.unwrap_or_else(|| {
std::env::current_dir()
.unwrap()
.join(crate::config::DEFAULT_WASM_DIR)
});
for (_, full_name) in checksums.0 {
// try to copy built file from the Namada WASM root dir
let file = base_wasm_path.join(&full_name);
Expand Down
8 changes: 5 additions & 3 deletions crates/tests/src/integration/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ pub fn initialize_genesis(
};

// Create genesis chain release archive
let release_archive_path =
namada_apps_lib::client::utils::init_network(args::InitNetwork {
let release_archive_path = namada_apps_lib::client::utils::init_network(
global_args.clone(),
args::InitNetwork {
templates_path: genesis_path,
wasm_checksums_path,
chain_id_prefix,
consensus_timeout_commit: Timeout::from_str("30s").unwrap(),
archive_dir: None,
genesis_time,
});
},
);

// Decode and unpack the release archive
let mut archive = {
Expand Down

0 comments on commit d22c1e5

Please sign in to comment.