Skip to content

Commit

Permalink
fix relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Jan 12, 2024
1 parent 64b0f47 commit 43e5ed0
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 32 deletions.
5 changes: 3 additions & 2 deletions crates/apps/src/lib/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ use crate::facade::tendermint_proto::google::protobuf::Timestamp;
use crate::node::ledger::shell::Shell;
use crate::wallet::{defaults, CliWalletUtils};

pub const WASM_DIR: &str = "../wasm";
pub const WASM_DIR: &str = "../../wasm";

pub const ALBERT_PAYMENT_ADDRESS: &str = "albert_payment";
pub const ALBERT_SPENDING_KEY: &str = "albert_spending";
Expand Down Expand Up @@ -552,7 +552,8 @@ impl BenchShell {
}

pub fn generate_foreign_key_tx(signer: &SecretKey) -> Tx {
let wasm_code = std::fs::read("../wasm_for_tests/tx_write.wasm").unwrap();
let wasm_code =
std::fs::read("../../wasm_for_tests/tx_write.wasm").unwrap();

let mut tx = Tx::from_type(namada::tx::data::TxType::Decrypted(
namada::tx::data::DecryptedTx::Decrypted,
Expand Down
2 changes: 2 additions & 0 deletions crates/apps/src/lib/config/genesis/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ mod test {
fn test_finalize_is_deterministic() {
// Load the localnet templates
let templates_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.parent()
.unwrap()
.join("genesis/localnet");
Expand Down
4 changes: 4 additions & 0 deletions crates/apps/src/lib/config/genesis/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,8 @@ mod tests {
#[test]
fn test_validate_localnet_genesis_templates() {
let templates_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.parent()
.unwrap()
.join("genesis/localnet");
Expand All @@ -950,6 +952,8 @@ mod tests {
#[test]
fn test_validate_starter_genesis_templates() {
let templates_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.parent()
.unwrap()
.join("genesis/starter");
Expand Down
2 changes: 2 additions & 0 deletions crates/apps/src/lib/node/ledger/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,8 @@ mod test_utils {
while current_path.file_name().unwrap() != "apps" {
current_path.pop();
}
// Two-dirs up to root
current_path.pop();
current_path.pop();
current_path
}
Expand Down
10 changes: 4 additions & 6 deletions crates/sdk/src/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet};
use std::env;
use std::fmt::Debug;
use std::ops::Deref;
use std::path::PathBuf;
use std::path::{Path, PathBuf};

// use async_std::io::prelude::WriteExt;
// use async_std::io::{self};
Expand Down Expand Up @@ -1841,13 +1841,11 @@ impl<U: ShieldedUtils + MaybeSend + MaybeSync> ShieldedContext<U> {

let saved_filepath = env::current_dir()
.map_err(|e| Error::Other(e.to_string()))?
// One up from "tests" dir to the root dir
// Two up from "tests" dir to the root dir
.parent()
.and_then(Path::parent)
.ok_or_else(|| {
Error::Other(
"Can not get parent directory of the current dir"
.to_string(),
)
Error::Other("Can not get root dir".to_string())
})?
.join(MASP_TEST_PROOFS_DIR)
.join(format!("{builder_hash}.bin"));
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/src/e2e/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ impl Test {

/// A helper that should be ran on start of every e2e test case.
pub fn working_dir() -> PathBuf {
let working_dir = fs::canonicalize("..").unwrap();
let working_dir = fs::canonicalize("../..").unwrap();

// Check that cometbft is either on $PATH or `COMETBFT` env var is set
if std::env::var("COMETBFT").is_err() {
Expand Down
4 changes: 2 additions & 2 deletions crates/tests/src/integration/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn setup() -> Result<(MockNode, MockServicesController)> {

/// Setup folders with genesis, configs, wasm, etc.
pub fn initialize_genesis() -> Result<(MockNode, MockServicesController)> {
let working_dir = std::fs::canonicalize("..").unwrap();
let working_dir = std::fs::canonicalize("../..").unwrap();
let keep_temp = match std::env::var(ENV_VAR_KEEP_TEMP) {
Ok(val) => val.to_ascii_lowercase() != "false",
_ => false,
Expand Down Expand Up @@ -158,7 +158,7 @@ fn create_node(

// copy compiled wasms into the wasm directory
copy_wasm_to_chain_dir(
&std::fs::canonicalize("..").unwrap(),
&std::fs::canonicalize("../..").unwrap(),
&global_args.base_dir,
&chain_id,
);
Expand Down
2 changes: 2 additions & 0 deletions crates/tests/src/native_vp/eth_bridge_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ mod test_bridge_pool_vp {
while current_path.file_name().unwrap() != "tests" {
current_path.pop();
}
// Two-dirs up to root
current_path.pop();
current_path.pop();
current_path.join("wasm")
}
Expand Down
2 changes: 1 addition & 1 deletion crates/tx/proto
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ path = "generate_txs.rs"

[dev-dependencies]
masp_proofs = { workspace = true, default-features = false, features = ["local-prover", "download-params"] }
namada_sdk = { path = "../sdk", default-features = false, features = ["namada-sdk", "std", "testing"] }
namada_sdk = { path = "../crates/sdk", default-features = false, features = ["namada-sdk", "std", "testing"] }
proptest.workspace = true
serde_json.workspace = true
tokio = {workspace = true, default-features = false}
2 changes: 0 additions & 2 deletions wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions wasm/tx_template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ version = "0.29.0"
crate-type = ["cdylib"]

[dependencies]
namada_tx_prelude = {path = "../../tx_prelude"}
borsh = "1.2.0"
namada_tx_prelude = {path = "../../crates/tx_prelude"}
wee_alloc = "0.4.5"
getrandom = { version = "0.2", features = ["custom"] }

[dev-dependencies]
namada_tests = {path = "../../tests"}
namada_tests = {path = "../../crates/tests"}
5 changes: 2 additions & 3 deletions wasm/vp_template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ version = "0.29.0"
crate-type = ["cdylib"]

[dependencies]
namada_vp_prelude = {path = "../../vp_prelude"}
borsh = "1.2.0"
namada_vp_prelude = {path = "../../crates/vp_prelude"}
wee_alloc = "0.4.5"
getrandom = { version = "0.2", features = ["custom"] }

[dev-dependencies]
namada_tests = {path = "../../tests"}
namada_tests = {path = "../../crates/tests"}
16 changes: 9 additions & 7 deletions wasm/wasm_source/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ vp_implicit = ["namada_vp_prelude", "once_cell"]
vp_user = ["namada_vp_prelude", "once_cell"]

[dependencies]
namada_tx_prelude = {path = "../../tx_prelude", optional = true}
namada_vp_prelude = {path = "../../vp_prelude", optional = true}
namada_tx_prelude = {path = "../../crates/tx_prelude", optional = true}
namada_vp_prelude = {path = "../../crates/vp_prelude", optional = true}

once_cell = {version = "1.8.0", optional = true}
wee_alloc = "0.4.5"
getrandom = { version = "0.2", features = ["custom"] }

[dev-dependencies]
namada = {path = "../../shared"}
namada_tests = {path = "../../tests"}
namada_test_utils = {path = "../../test_utils"}
namada_tx_prelude = {path = "../../tx_prelude"}
namada_vp_prelude = {path = "../../vp_prelude"}
namada = {path = "../../crates/shared"}
namada_tests = {path = "../../crates/tests"}
namada_test_utils = {path = "../../crates/test_utils"}
namada_tx_prelude = {path = "../../crates/tx_prelude"}
namada_vp_prelude = {path = "../../crates/vp_prelude"}

proptest = "1.4.0"
test-log = {version = "0.2.14", default-features = false, features = ["trace"]}
tracing = "0.1.30"
Expand Down
8 changes: 4 additions & 4 deletions wasm_for_tests/wasm_source/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ vp_read_storage_key = []
tx_proposal_code = []

[dependencies]
namada_test_utils = {path = "../../test_utils"}
namada_tx_prelude = {path = "../../tx_prelude"}
namada_vp_prelude = {path = "../../vp_prelude"}
namada_test_utils = {path = "../../crates/test_utils"}
namada_tx_prelude = {path = "../../crates/tx_prelude"}
namada_vp_prelude = {path = "../../crates/vp_prelude"}
wee_alloc = "0.4.5"
getrandom = { version = "0.2", features = ["custom"] }

[dev-dependencies]
namada_tests = {path = "../../tests"}
namada_tests = {path = "../../crates/tests"}

[profile.release]
# smaller and faster wasm https://rustwasm.github.io/book/reference/code-size.html#compiling-with-link-time-optimizations-lto
Expand Down

0 comments on commit 43e5ed0

Please sign in to comment.