Skip to content

Commit

Permalink
Merge branch 'tomas/move-verify-shielded' (#3419)
Browse files Browse the repository at this point in the history
* tomas/move-verify-shielded:
  changelog: add #3419
  shielded_token: feature guard validation to avoid compilation into wasm
  move masp validation from SDK into shielded_token crate
  • Loading branch information
brentstone committed Jun 28, 2024
2 parents e9dd1b2 + d6212b9 commit fef8a91
Show file tree
Hide file tree
Showing 15 changed files with 420 additions and 375 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Moved shielded tx validation out of the SDK crate into shielded token crate.
([\#3419](https://github.com/anoma/namada/pull/3419))
11 changes: 7 additions & 4 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ bimap = {version = "0.6.2", features = ["serde"]}
bit-set = "0.5.2"
bitflags = { version = "2.5.0", features = ["serde"] }
blake2b-rs = "0.2.0"
bls12_381 = "0.8"
byte-unit = "4.0.13"
byteorder = "1.4.2"
borsh = {version = "1.2.0", features = ["unstable__schema", "derive"]}
Expand Down Expand Up @@ -128,8 +127,8 @@ libc = "0.2.97"
libloading = "0.7.2"
linkme = "0.3.24"
# branch = "main"
masp_primitives = { git = "https://github.com/anoma/masp", rev = "4ede1c42d76d6348af8224bc8bfac4404321fe82" }
masp_proofs = { git = "https://github.com/anoma/masp", rev = "4ede1c42d76d6348af8224bc8bfac4404321fe82", default-features = false, features = ["local-prover"] }
masp_primitives = { git = "https://github.com/anoma/masp", rev = "71b36beba21e35f8611f3ba6910ed5b78ec11af1" }
masp_proofs = { git = "https://github.com/anoma/masp", rev = "71b36beba21e35f8611f3ba6910ed5b78ec11af1", default-features = false, features = ["local-prover"] }
num256 = "0.3.5"
num_cpus = "1.13.0"
num-derive = "0.4"
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", features = ["rand", "tendermint-rpc", "download-params"] }
namada = { path = "../namada", features = ["rand", "tendermint-rpc"] }
borsh.workspace = true
itertools.workspace = true
lazy_static.workspace = true
Expand Down
3 changes: 1 addition & 2 deletions crates/namada/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ testing = [
"namada_proof_of_stake/testing",
"namada_sdk/testing",
"namada_state/testing",
"namada_token/testing",
"async-client",
"proptest",
"tempfile",
Expand All @@ -72,8 +73,6 @@ multicore = [
"namada_sdk/multicore",
"namada_token/multicore",
]
# Download MASP params if they're not present
download-params = ["namada_sdk/download-params"]
rand = ["namada_sdk/rand"]
migrations = [
"namada_migrations",
Expand Down
3 changes: 2 additions & 1 deletion crates/namada/src/ledger/native_vp/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ use namada_ibc::core::channel::types::msgs::MsgRecvPacket as IbcMsgRecvPacket;
use namada_ibc::core::host::types::identifiers::Sequence;
use namada_ibc::storage::ibc_token;
use namada_ibc::{IbcCommonContext, IbcMessage};
use namada_sdk::masp::{verify_shielded_tx, TAddrData};
use namada_sdk::masp::TAddrData;
use namada_state::{ConversionState, OptionExt, ResultExt, StateRead};
use namada_token::read_denom;
use namada_token::validation::verify_shielded_tx;
use namada_tx::BatchedTxRef;
use namada_vp_env::VpEnv;
use thiserror::Error;
Expand Down
2 changes: 1 addition & 1 deletion crates/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ async fn run_aux(
};

tracing::info!("Loading MASP verifying keys.");
let _ = namada_sdk::masp::preload_verifying_keys();
let _ = namada::token::validation::preload_verifying_keys();
tracing::info!("Done loading MASP verifying keys.");

// Start ABCI server and broadcaster (the latter only if we are a validator
Expand Down
10 changes: 3 additions & 7 deletions crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ version.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["tendermint-rpc", "download-params", "std", "rand", "migrations"]
default = ["tendermint-rpc", "std", "rand", "migrations"]

mainnet = ["namada_core/mainnet", "namada_events/mainnet"]

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 @@ -51,11 +51,9 @@ testing = [
"async-client",
"proptest",
"jubjub",
"bls12_381",
]

# Download MASP params if they're not present
download-params = ["masp_proofs/download-params"]
download-params = ["namada_token/download-params"]
migrations = [
"namada_migrations",
"namada_account/migrations",
Expand Down Expand Up @@ -92,7 +90,6 @@ namada_vote_ext = { path = "../vote_ext" }

async-trait = { workspace = true, optional = true }
bimap.workspace = true
bls12_381 = { workspace = true, optional = true }
borsh.workspace = true
borsh-ext.workspace = true
circular-queue.workspace = true
Expand Down Expand Up @@ -167,7 +164,6 @@ namada_vote_ext = {path = "../vote_ext"}

assert_matches.workspace = true
base58.workspace = true
bls12_381.workspace = true
jubjub.workspace = true
masp_primitives = { workspace = true, features = ["test-dependencies"] }
proptest.workspace = true
Expand Down
Loading

0 comments on commit fef8a91

Please sign in to comment.