From cd0decd7b40891b1f3557b0800e7fc409763a214 Mon Sep 17 00:00:00 2001 From: Murisi Tarusenga Date: Wed, 18 Sep 2024 14:54:50 +0200 Subject: [PATCH] Now clear randomness buffers before attempting new parameter generation. --- Cargo.lock | 8 ++++---- Cargo.toml | 6 +++--- crates/apps_lib/src/client/tx.rs | 6 ++++++ crates/sdk/src/signing.rs | 4 +++- wasm/Cargo.lock | 6 +++--- wasm_for_tests/Cargo.lock | 6 +++--- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1d79a34572..9abd396a4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4171,7 +4171,7 @@ dependencies = [ [[package]] name = "ledger-namada-rs" version = "0.0.1" -source = "git+https://github.com/heliaxdev/ledger-namada?rev=96e71198665fcc35929d1be1f1f8347bf12ad166#96e71198665fcc35929d1be1f1f8347bf12ad166" +source = "git+https://github.com/heliaxdev/ledger-namada?rev=f54b76adcc1430db0496e894ad72cd74cfb6eb88#f54b76adcc1430db0496e894ad72cd74cfb6eb88" dependencies = [ "bincode", "byteorder", @@ -4401,7 +4401,7 @@ dependencies = [ [[package]] name = "masp_note_encryption" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "arbitrary", "borsh", @@ -4415,7 +4415,7 @@ dependencies = [ [[package]] name = "masp_primitives" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "aes", "arbitrary", @@ -4448,7 +4448,7 @@ dependencies = [ [[package]] name = "masp_proofs" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "bellman", "blake2b_simd", diff --git a/Cargo.toml b/Cargo.toml index 5da7945185..e47aa0149e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,15 +131,15 @@ konst = { version = "0.3.8", default-features = false } lazy_static = "1.4.0" # TODO: upstreamed in https://github.com/ledger-community/rust-ledger/pull/9 ledger-lib = { git = "https://github.com/heliaxdev/rust-ledger", rev = "f96f4559b3237d09218f7583df01acf36034ea79", default-features = false, features = ["transport_tcp"] } -ledger-namada-rs = { git = "https://github.com/heliaxdev/ledger-namada", rev = "96e71198665fcc35929d1be1f1f8347bf12ad166" } +ledger-namada-rs = { git = "https://github.com/heliaxdev/ledger-namada", rev = "f54b76adcc1430db0496e894ad72cd74cfb6eb88" } ledger-transport = "0.10.0" ledger-transport-hid = "0.10.0" libc = "0.2.97" libloading = "0.7.2" linkme = "0.3.24" # branch = "tomas/arbitrary" -masp_primitives = { git = "https://github.com/anoma/masp", rev = "f2b0cae3e495e4f7d482e587432ec4e5f2793528" } -masp_proofs = { git = "https://github.com/anoma/masp", rev = "f2b0cae3e495e4f7d482e587432ec4e5f2793528", default-features = false, features = ["local-prover"] } +masp_primitives = { git = "https://github.com/anoma/masp", rev = "a35f73be69b21ee62cd4940f37855161cbed2a56" } +masp_proofs = { git = "https://github.com/anoma/masp", rev = "a35f73be69b21ee62cd4940f37855161cbed2a56", default-features = false, features = ["local-prover"] } num256 = "0.3.5" num_cpus = "1.13.0" num-derive = "0.4" diff --git a/crates/apps_lib/src/client/tx.rs b/crates/apps_lib/src/client/tx.rs index fcff660aec..39f298e3a4 100644 --- a/crates/apps_lib/src/client/tx.rs +++ b/crates/apps_lib/src/client/tx.rs @@ -834,6 +834,12 @@ pub async fn submit_shielded_transfer( let mut bparams: Box = if args.tx.use_device { let transport = WalletTransport::from_arg(args.tx.device_transport); let app = NamadaApp::new(transport); + // Clear hardware wallet randomness buffers + app.clean_randomness_buffers().await.map_err(|err| { + error::Error::Other(format!( + "Unable to clear randomness buffer. Error: {}", err, + )) + })?; let wallet = namada.wallet().await; // Augment the pseudo spending key with a proof authorization key for data in &mut args.data { diff --git a/crates/sdk/src/signing.rs b/crates/sdk/src/signing.rs index 2f96d9e1c4..37b32ab11f 100644 --- a/crates/sdk/src/signing.rs +++ b/crates/sdk/src/signing.rs @@ -233,7 +233,9 @@ where for public_key in &signing_data.public_keys { if !used_pubkeys.contains(public_key) { - let secret_key = find_key_by_pk(&mut wallet, args, public_key)?; + let Ok(secret_key) = find_key_by_pk(&mut wallet, args, public_key) else { + continue; + }; used_pubkeys.insert(public_key.clone()); signing_tx_keypairs.push(secret_key); } diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index a15c6cd844..c4c48f3fdc 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "masp_note_encryption" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "borsh", "chacha20", @@ -3369,7 +3369,7 @@ dependencies = [ [[package]] name = "masp_primitives" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "aes", "bip0039", @@ -3401,7 +3401,7 @@ dependencies = [ [[package]] name = "masp_proofs" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "bellman", "blake2b_simd", diff --git a/wasm_for_tests/Cargo.lock b/wasm_for_tests/Cargo.lock index 50c45e35d7..ba47e332ed 100644 --- a/wasm_for_tests/Cargo.lock +++ b/wasm_for_tests/Cargo.lock @@ -1785,7 +1785,7 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "masp_note_encryption" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "borsh", "chacha20", @@ -1798,7 +1798,7 @@ dependencies = [ [[package]] name = "masp_primitives" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "aes", "bip0039", @@ -1829,7 +1829,7 @@ dependencies = [ [[package]] name = "masp_proofs" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=f2b0cae3e495e4f7d482e587432ec4e5f2793528#f2b0cae3e495e4f7d482e587432ec4e5f2793528" +source = "git+https://github.com/anoma/masp?rev=a35f73be69b21ee62cd4940f37855161cbed2a56#a35f73be69b21ee62cd4940f37855161cbed2a56" dependencies = [ "bellman", "blake2b_simd",