Skip to content

Commit

Permalink
fixup! shielded_token: feature guard validation to avoid compilation …
Browse files Browse the repository at this point in the history
…into wasm
  • Loading branch information
tzemanovic committed Jun 24, 2024
1 parent 1f6130b commit b588224
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 24 deletions.
2 changes: 1 addition & 1 deletion crates/apps_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namada-eth-bridge = [
namada = {path = "../namada", features = ["multicore", "http-client", "tendermint-rpc", "std"]}
namada_macros = {path = "../macros"}
namada_migrations = {path = "../migrations", optional = true}
namada_sdk = {path = "../sdk", default-features = false, features = ["validation", "std", "rand"]}
namada_sdk = {path = "../sdk", default-features = false, features = ["download-params", "std", "rand"]}
namada_test_utils = {path = "../test_utils", optional = true}

async-trait.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/encoding_spec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ default = []
namada-eth-bridge = ["namada/namada-eth-bridge"]

[dependencies]
namada = { path = "../namada" }
namada = { path = "../namada", features = ["rand", "tendermint-rpc"] }
borsh.workspace = true
itertools.workspace = true
lazy_static.workspace = true
Expand Down
1 change: 0 additions & 1 deletion crates/namada/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ multicore = [
"namada_sdk/multicore",
"namada_token/multicore",
]
validation = ["namada_sdk/validation"]
rand = ["namada_sdk/rand"]
migrations = [
"namada_migrations",
Expand Down
2 changes: 1 addition & 1 deletion crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namada-eth-bridge = [
namada = {path = "../namada", features = ["multicore", "http-client", "tendermint-rpc", "std"]}
namada_apps_lib = {path = "../apps_lib"}
namada_migrations = {path = "../migrations", optional = true}
namada_sdk = {path = "../sdk", default-features = false, features = ["validation", "std", "rand"]}
namada_sdk = {path = "../sdk", default-features = false, features = ["download-params", "std", "rand"]}
namada_test_utils = {path = "../test_utils", optional = true}

arse-merkle-tree = { workspace = true, features = ["blake2b"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ multicore = ["masp_proofs/multicore"]

namada-sdk = ["tendermint-rpc", "masp_primitives/transparent-inputs"]

std = ["fd-lock"]
std = ["fd-lock", "download-params"]
rand = ["dep:rand", "rand_core", "namada_core/rand"]

# tendermint-rpc support
Expand Down Expand Up @@ -53,7 +53,7 @@ testing = [
"jubjub",
]

validation = ["namada_token/validation"]
download-params = ["namada_token/download-params"]
migrations = [
"namada_migrations",
"namada_account/migrations",
Expand Down
20 changes: 5 additions & 15 deletions crates/shielded_token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,36 @@ version.workspace = true
[features]
default = []
multicore = ["dep:rayon"]
validation = [
"namada_gas",
"lazy_static",
"masp_proofs",
"rand_core",
]
testing = [
"multicore",
"validation",
"namada_core/testing",
"masp_primitives/test-dependencies",
]
download-params = ["masp_proofs/download-params"]

[dependencies]
namada_controller = { path = "../controller" }
namada_core = { path = "../core" }
namada_gas = { path = "../gas", optional = true }
namada_gas = { path = "../gas" }
namada_parameters = { path = "../parameters" }
namada_storage = { path = "../storage" }
namada_trans_token = { path = "../trans_token" }

borsh.workspace = true
lazy_static = { workspace = true, optional = true }
lazy_static.workspace = true
masp_primitives.workspace = true
masp_proofs = { workspace = true, optional = true, features = ["download-params"] }
rand_core = { workspace = true, optional = true }
masp_proofs = { workspace = true }
rand_core.workspace = true
rayon = { workspace = true, optional = true }
serde.workspace = true
smooth-operator.workspace = true
tracing.workspace = true

[dev-dependencies]
namada_core = { path = "../core", features = ["testing"] }
namada_gas = { path = "../gas" }
namada_parameters = { path = "../parameters", features = ["testing"] }
namada_storage = { path = "../storage", features = ["testing"] }

lazy_static.workspace = true
masp_proofs = { workspace = true, features = ["download-params"] }
proptest.workspace = true
rand_core.workspace = true
rayon.workspace = true
test-log.workspace = true
1 change: 0 additions & 1 deletion crates/shielded_token/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub mod conversion;
mod storage;
pub mod storage_key;
pub mod utils;
#[cfg(any(test, feature = "validation", feature = "testing"))]
pub mod validation;

use std::str::FromStr;
Expand Down
1 change: 1 addition & 0 deletions crates/shielded_token/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ lazy_static! {
let [spend_path, convert_path, output_path] =
[SPEND_NAME, CONVERT_NAME, OUTPUT_NAME].map(|p| params_dir.join(p));

#[cfg(feature = "download-params")]
if !spend_path.exists() || !convert_path.exists() || !output_path.exists() {
let paths = masp_proofs::download_masp_parameters(None).expect(
"MASP parameters were not present, expected the download to \
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namada-eth-bridge = [
[dependencies]
namada = {path = "../namada", features = ["testing"]}
namada_core = {path = "../core", features = ["testing"]}
namada_sdk = {path = "../sdk", default-features = false, features = ["tendermint-rpc", "validation", "std", "rand"]}
namada_sdk = {path = "../sdk", default-features = false, features = ["tendermint-rpc", "download-params", "std", "rand"]}
namada_test_utils = {path = "../test_utils"}
namada_tx_prelude = {path = "../tx_prelude"}
namada_vp_prelude = {path = "../vp_prelude"}
Expand Down
2 changes: 1 addition & 1 deletion crates/token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ version.workspace = true
[features]
default = []
multicore = ["namada_shielded_token/multicore"]
validation = ["namada_shielded_token/validation"]
download-params = ["namada_shielded_token/download-params"]
testing = ["namada_core/testing", "namada_shielded_token/testing", "proptest"]

[dependencies]
Expand Down

0 comments on commit b588224

Please sign in to comment.