From 3b4886e8435d39214c132b176df99ada9938396a Mon Sep 17 00:00:00 2001 From: sqhell Date: Mon, 13 Apr 2026 13:30:18 -0600 Subject: [PATCH 1/3] fix: regex validation form error fixes --- Cargo.lock | 49 ++++--------------- Cargo.toml | 32 ++++++------ crates/webzjs-requests/src/requests.rs | 9 ++-- crates/webzjs-wallet/src/bindgen/wallet.rs | 6 ++- crates/webzjs-wallet/src/wallet.rs | 5 +- packages/snap/snap.manifest.json | 8 ++- .../web-wallet/src/hooks/useWebzjsActions.ts | 4 +- packages/web-wallet/src/utils/balance.ts | 9 +++- 8 files changed, 52 insertions(+), 70 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0748ff41..0ab62355 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -722,7 +722,6 @@ checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" [[package]] name = "equihash" version = "0.2.2" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "blake2b_simd", "core2", @@ -774,7 +773,6 @@ dependencies = [ [[package]] name = "f4jumble" version = "0.1.1" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "blake2b_simd", ] @@ -1681,8 +1679,7 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "orchard" version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c01cd4ea711aab5f263f2b7aa6966687a2d6c7df4f78eb1b97a66a7a4e78e3b" +source = "git+https://github.com/zcash/orchard.git?rev=6b12c77260aa7fac0d804983fc31b71b584d48e0#6b12c77260aa7fac0d804983fc31b71b584d48e0" dependencies = [ "aes", "bitvec", @@ -1767,8 +1764,7 @@ dependencies = [ [[package]] name = "pczt" -version = "0.5.0" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" +version = "0.5.1" dependencies = [ "blake2b_simd", "bls12_381", @@ -2268,9 +2264,8 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "sapling-crypto" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5433ab8c1cd52dfad3b903143e371d5bdd514ab7952f71414e6d66a5da8223cd" +version = "0.6.2" +source = "git+https://github.com/zcash/sapling-crypto.git?rev=e99f38a8f4685c381bb4cca94874092e50e3f7e9#e99f38a8f4685c381bb4cca94874092e50e3f7e9" dependencies = [ "aes", "bellman", @@ -2487,9 +2482,9 @@ dependencies = [ [[package]] name = "shardtree" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637e95dcd06bc1bb3f86ed9db1e1832a70125f32daae071ef37dcb7701b7d4fe" +checksum = "359e552886ae54d1642091645980d83f7db465fd9b5b0248e3680713c1773388" dependencies = [ "bitflags", "either", @@ -3608,7 +3603,6 @@ dependencies = [ [[package]] name = "zcash_address" version = "0.10.1" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bech32", "bs58", @@ -3620,8 +3614,7 @@ dependencies = [ [[package]] name = "zcash_client_backend" -version = "0.21.0" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" +version = "0.21.2" dependencies = [ "async-trait", "base64", @@ -3676,7 +3669,6 @@ dependencies = [ [[package]] name = "zcash_client_memory" version = "0.0.0" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "async-trait", "bip32", @@ -3717,8 +3709,7 @@ dependencies = [ [[package]] name = "zcash_client_sqlite" -version = "0.19.1" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" +version = "0.19.5" dependencies = [ "bitflags", "bs58", @@ -3761,7 +3752,6 @@ dependencies = [ [[package]] name = "zcash_encoding" version = "0.3.0" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "core2", "hex", @@ -3771,7 +3761,6 @@ dependencies = [ [[package]] name = "zcash_keys" version = "0.12.0" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bech32", "bip32", @@ -3813,49 +3802,35 @@ dependencies = [ [[package]] name = "zcash_primitives" version = "0.26.4" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ - "bip32", "blake2b_simd", "block-buffer 0.11.0-rc.3", - "bs58", "core2", "crypto-common 0.2.0-rc.1", "document-features", "equihash", "ff", - "fpe", - "getset", - "group", "hex", "incrementalmerkletree", "jubjub", "memuse", "nonempty", "orchard", - "rand", "rand_core", "redjubjub", - "ripemd 0.1.3", "sapling-crypto", "secp256k1", "sha2 0.10.9", - "subtle", - "tracing", - "zcash_address", "zcash_encoding", "zcash_note_encryption", "zcash_protocol", "zcash_script", - "zcash_spec", "zcash_transparent", - "zip32", ] [[package]] name = "zcash_proofs" version = "0.26.1" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bellman", "blake2b_simd", @@ -3874,7 +3849,6 @@ dependencies = [ [[package]] name = "zcash_protocol" version = "0.7.2" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "core2", "document-features", @@ -3885,9 +3859,9 @@ dependencies = [ [[package]] name = "zcash_script" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bed6cf5b2b4361105d4ea06b2752f0c8af4641756c7fbc9858a80af186c234f" +checksum = "c6ef9d04e0434a80b62ad06c5a610557be358ef60a98afa5dbc8ecaf19ad72e7" dependencies = [ "bip32", "bitflags", @@ -3912,10 +3886,8 @@ dependencies = [ [[package]] name = "zcash_transparent" version = "0.6.3" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bip32", - "blake2b_simd", "bs58", "core2", "document-features", @@ -3990,7 +3962,6 @@ dependencies = [ [[package]] name = "zip321" version = "0.6.0" -source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "base64", "nom", diff --git a/Cargo.toml b/Cargo.toml index a2783266..cee0c450 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,18 +30,19 @@ console_error_panic_hook = { version = "0.1.7" } tonic-web-wasm-client = "0.8.0" tokio_with_wasm = { version = "0.7.1", features = ["rt", "rt-multi-thread", "sync", "macros", "time"] } -## Zcash dependencies - Using ChainSafe/librustzcash-nu61 fork with NU6.1 fixes -zcash_keys = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", features = ["transparent-inputs", "orchard", "sapling", "unstable"] } -zcash_client_backend = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["sync", "lightwalletd-tonic", "orchard"] } -zcash_client_memory = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", features = ["orchard", "transparent-inputs"] } -zcash_primitives = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61" } -zcash_transparent = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false } -zcash_address = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61" } -zcash_proofs = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["bundled-prover", "multicore"] } -zip321 = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61" } +## Zcash dependencies - Using local upstream librustzcash with our PR changes +## TODO: Switch back to git deps once upstream PRs are merged before deployment +zcash_keys = { path = "../librustzcash/zcash_keys", features = ["transparent-inputs", "orchard", "sapling", "unstable"] } +zcash_client_backend = { path = "../librustzcash/zcash_client_backend", default-features = false, features = ["sync", "lightwalletd-tonic", "orchard"] } +zcash_client_memory = { path = "../librustzcash/zcash_client_memory", features = ["orchard", "transparent-inputs"] } +zcash_primitives = { path = "../librustzcash/zcash_primitives" } +zcash_transparent = { path = "../librustzcash/zcash_transparent", default-features = false } +zcash_address = { path = "../librustzcash/components/zcash_address" } +zcash_proofs = { path = "../librustzcash/zcash_proofs", default-features = false, features = ["bundled-prover", "multicore"] } +zip321 = { path = "../librustzcash/components/zip321" } zip32 = { version = "0.2" } -zcash_protocol = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false } -pczt = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["orchard", "sapling", "transparent"] } +zcash_protocol = { path = "../librustzcash/components/zcash_protocol", default-features = false } +pczt = { path = "../librustzcash/pczt", default-features = false, features = ["orchard", "sapling", "transparent"] } sapling = { package = "sapling-crypto", version = "0.6", default-features = false } bip32 = { version = "=0.6.0-pre.1", default-features = false, features = ["alloc"] } ## gRPC Web dependencies @@ -50,7 +51,7 @@ tonic = { version = "0.14", default-features = false } # Used in Native tests -zcash_client_sqlite = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["unstable", "orchard"] } +zcash_client_sqlite = { path = "../librustzcash/zcash_client_sqlite", default-features = false, features = ["unstable", "orchard"] } getrandom = { version = "0.2", features = ["js"] } thiserror = "1.0.63" @@ -81,10 +82,9 @@ tokio = { version = "1.0", features = ["rt", "macros"] } byte-unit = { version = "5.1.4", features = ["byte"] } [patch.crates-io] -# Also patching for pczt improvments -# See: https://github.com/zcash/librustzcash/pull/1661 -# orchard = { git = "https://github.com/zcash/orchard.git", rev = "4fa6d3b549f8803016a309281404eab095d04de8" } -# sapling = { package = "sapling-crypto", git = "https://github.com/zcash/sapling-crypto.git", rev = "3c2235747553da642fb142d1eeb9b1afa8391987" } +# Patching to match upstream librustzcash's pinned revisions +orchard = { git = "https://github.com/zcash/orchard.git", rev = "6b12c77260aa7fac0d804983fc31b71b584d48e0" } +sapling = { package = "sapling-crypto", git = "https://github.com/zcash/sapling-crypto.git", rev = "e99f38a8f4685c381bb4cca94874092e50e3f7e9" } [workspace.lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen)', 'cfg(wasm_bindgen_unstable_test_coverage)'] } \ No newline at end of file diff --git a/crates/webzjs-requests/src/requests.rs b/crates/webzjs-requests/src/requests.rs index 68b6da7f..848fe432 100644 --- a/crates/webzjs-requests/src/requests.rs +++ b/crates/webzjs-requests/src/requests.rs @@ -91,12 +91,9 @@ impl PaymentRequest { }; let other_params = serde_wasm_bindgen::from_value(other_params)?; - if let Some(payment) = - zip321::Payment::new(address, Some(amount), memo, label, message, other_params) - { - Ok(PaymentRequest(payment)) - } else { - Err(Error::UnsupportedMemoRecipient) + match zip321::Payment::new(address, Some(amount), memo, label, message, other_params) { + Ok(payment) => Ok(PaymentRequest(payment)), + Err(_) => Err(Error::UnsupportedMemoRecipient), } } diff --git a/crates/webzjs-wallet/src/bindgen/wallet.rs b/crates/webzjs-wallet/src/bindgen/wallet.rs index 2d9f6b83..7b29651b 100644 --- a/crates/webzjs-wallet/src/bindgen/wallet.rs +++ b/crates/webzjs-wallet/src/bindgen/wallet.rs @@ -297,7 +297,7 @@ impl WebWallet { match sync_handler.await { Ok(Ok(())) => Ok(()), Ok(Err(err_string)) => { - tracing::error!("Sync error: {}", err_string); + tracing::warn!("Sync error (will be retried by caller): {}", err_string); Err(Error::Sync(err_string)) } Err(panic_error) => { @@ -396,7 +396,9 @@ impl WebWallet { }) .unwrap_throw() .join_async(); - let txids = sync_handler.await.unwrap(); + let txids = sync_handler.await.map_err(|e| { + Error::Generic(format!("Transaction creation thread panicked: {:?}", e)) + })?; let flattened_txid_bytes = txids.iter().flat_map(|&x| x.as_ref().clone()).collect(); Ok(flattened_txid_bytes) diff --git a/crates/webzjs-wallet/src/wallet.rs b/crates/webzjs-wallet/src/wallet.rs index 025bc093..1b03e671 100644 --- a/crates/webzjs-wallet/src/wallet.rs +++ b/crates/webzjs-wallet/src/wallet.rs @@ -32,7 +32,8 @@ use zcash_client_backend::data_api::wallet::{ propose_shielding, propose_transfer, ConfirmationsPolicy, SpendingKeys, }; use zcash_client_backend::data_api::{ - Account, AccountBirthday, AccountPurpose, InputSource, WalletRead, WalletSummary, WalletWrite, + Account, AccountBirthday, AccountPurpose, InputSource, TransparentOutputFilter, WalletRead, + WalletSummary, WalletWrite, }; use zcash_client_backend::data_api::{WalletCommitmentTrees, Zip32Derivation}; use zcash_client_backend::fees::standard::MultiOutputChangeStrategy; @@ -133,6 +134,7 @@ where + Hash + Default + Send + + Sync + ConditionallySelectable + Serialize + DeserializeOwned @@ -542,6 +544,7 @@ where &from_addrs, account_id, self.min_confirmations, // librustzcash operates under the assumption of zero or one conf being the same but that could change. + TransparentOutputFilter::All, ) .map_err(|e| { tracing::error!("pczt_shield: propose_shielding failed: {:?}", e); diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index d26200c4..d2ceaa58 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ChainSafe/WebZjs.git" }, "source": { - "shasum": "qzUODaU2KfdU1JVKRMUDL+wReKvUPUX4sx5Jx58D76k=", + "shasum": "rts2qKfqiudn+vEA6WldhOjT0f4Oy7G+HO1+figIiME=", "location": { "npm": { "filePath": "dist/bundle.js", @@ -22,7 +22,11 @@ "endowment:lifecycle-hooks": {}, "endowment:webassembly": {}, "endowment:rpc": { - "allowedOrigins": ["https://webzjs.chainsafe.dev"] + "allowedOrigins": [ + "https://webzjs.chainsafe.dev", + "http://localhost:3000", + "http://app-provider.localhost:3000" + ] }, "snap_getBip44Entropy": [ { diff --git a/packages/web-wallet/src/hooks/useWebzjsActions.ts b/packages/web-wallet/src/hooks/useWebzjsActions.ts index c155b4f9..2217bdf7 100644 --- a/packages/web-wallet/src/hooks/useWebzjsActions.ts +++ b/packages/web-wallet/src/hooks/useWebzjsActions.ts @@ -488,7 +488,7 @@ export function useWebZjsActions(): WebzjsActions { } } catch (syncErr) { consecutiveFailures++; - console.warn(`Full resync: sync round ${round} failed (${consecutiveFailures}/${MAX_CONSECUTIVE_FAILURES}):`, syncErr); + console.debug(`Full resync: sync round ${round} failed (${consecutiveFailures}/${MAX_CONSECUTIVE_FAILURES}):`, syncErr); if (consecutiveFailures >= MAX_CONSECUTIVE_FAILURES) { throw syncErr; // give up after too many consecutive failures @@ -496,7 +496,7 @@ export function useWebZjsActions(): WebzjsActions { // Back off longer after failures const backoff = SYNC_ROUND_DELAY * Math.pow(2, consecutiveFailures - 1); - console.info(`Full resync: backing off ${backoff}ms before retry`); + console.debug(`Full resync: backing off ${backoff}ms before retry`); await new Promise(r => setTimeout(r, backoff)); } } diff --git a/packages/web-wallet/src/utils/balance.ts b/packages/web-wallet/src/utils/balance.ts index 4dafbc32..d850652e 100644 --- a/packages/web-wallet/src/utils/balance.ts +++ b/packages/web-wallet/src/utils/balance.ts @@ -7,12 +7,17 @@ function zatsToZec(zats: number): number { } function zecToZats(zecAmount: string): bigint { + const trimmed = zecAmount.trim(); - if (!/^\d+(\.\d+)?$/.test(zecAmount)) { + if (!/^(\d+\.?\d*|\.\d+)$/.test(trimmed)) { throw new Error('Invalid ZEC format: must be positive number'); } - const amount = new Decimal(zecAmount); + const amount = new Decimal(trimmed); + + if (!amount.isPositive() || amount.isZero()) { + throw new Error('Invalid ZEC format: must be positive number'); + } if (amount.decimalPlaces() > 8) { throw new Error('Maximum 8 decimal places allowed'); From 81a500aff5be6d825788d2bcd8fb7fbc29d185e4 Mon Sep 17 00:00:00 2001 From: sqhell Date: Tue, 14 Apr 2026 08:44:51 -0600 Subject: [PATCH 2/3] fix: localhost commmited to snap by mistake --- packages/snap/snap.manifest.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index d2ceaa58..d26200c4 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ChainSafe/WebZjs.git" }, "source": { - "shasum": "rts2qKfqiudn+vEA6WldhOjT0f4Oy7G+HO1+figIiME=", + "shasum": "qzUODaU2KfdU1JVKRMUDL+wReKvUPUX4sx5Jx58D76k=", "location": { "npm": { "filePath": "dist/bundle.js", @@ -22,11 +22,7 @@ "endowment:lifecycle-hooks": {}, "endowment:webassembly": {}, "endowment:rpc": { - "allowedOrigins": [ - "https://webzjs.chainsafe.dev", - "http://localhost:3000", - "http://app-provider.localhost:3000" - ] + "allowedOrigins": ["https://webzjs.chainsafe.dev"] }, "snap_getBip44Entropy": [ { From 550946b31a58ef19dc7e8a75e5fb369d8132b889 Mon Sep 17 00:00:00 2001 From: sqhell Date: Tue, 14 Apr 2026 09:08:55 -0600 Subject: [PATCH 3/3] fix: moving back to fork references of librustzcash for the scope of this bug --- Cargo.lock | 49 ++++++++++++++++++++------ Cargo.toml | 32 ++++++++--------- crates/webzjs-requests/src/requests.rs | 9 +++-- crates/webzjs-wallet/src/wallet.rs | 5 +-- 4 files changed, 62 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ab62355..0748ff41 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -722,6 +722,7 @@ checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" [[package]] name = "equihash" version = "0.2.2" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "blake2b_simd", "core2", @@ -773,6 +774,7 @@ dependencies = [ [[package]] name = "f4jumble" version = "0.1.1" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "blake2b_simd", ] @@ -1679,7 +1681,8 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "orchard" version = "0.12.0" -source = "git+https://github.com/zcash/orchard.git?rev=6b12c77260aa7fac0d804983fc31b71b584d48e0#6b12c77260aa7fac0d804983fc31b71b584d48e0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c01cd4ea711aab5f263f2b7aa6966687a2d6c7df4f78eb1b97a66a7a4e78e3b" dependencies = [ "aes", "bitvec", @@ -1764,7 +1767,8 @@ dependencies = [ [[package]] name = "pczt" -version = "0.5.1" +version = "0.5.0" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "blake2b_simd", "bls12_381", @@ -2264,8 +2268,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "sapling-crypto" -version = "0.6.2" -source = "git+https://github.com/zcash/sapling-crypto.git?rev=e99f38a8f4685c381bb4cca94874092e50e3f7e9#e99f38a8f4685c381bb4cca94874092e50e3f7e9" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5433ab8c1cd52dfad3b903143e371d5bdd514ab7952f71414e6d66a5da8223cd" dependencies = [ "aes", "bellman", @@ -2482,9 +2487,9 @@ dependencies = [ [[package]] name = "shardtree" -version = "0.6.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "359e552886ae54d1642091645980d83f7db465fd9b5b0248e3680713c1773388" +checksum = "637e95dcd06bc1bb3f86ed9db1e1832a70125f32daae071ef37dcb7701b7d4fe" dependencies = [ "bitflags", "either", @@ -3603,6 +3608,7 @@ dependencies = [ [[package]] name = "zcash_address" version = "0.10.1" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bech32", "bs58", @@ -3614,7 +3620,8 @@ dependencies = [ [[package]] name = "zcash_client_backend" -version = "0.21.2" +version = "0.21.0" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "async-trait", "base64", @@ -3669,6 +3676,7 @@ dependencies = [ [[package]] name = "zcash_client_memory" version = "0.0.0" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "async-trait", "bip32", @@ -3709,7 +3717,8 @@ dependencies = [ [[package]] name = "zcash_client_sqlite" -version = "0.19.5" +version = "0.19.1" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bitflags", "bs58", @@ -3752,6 +3761,7 @@ dependencies = [ [[package]] name = "zcash_encoding" version = "0.3.0" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "core2", "hex", @@ -3761,6 +3771,7 @@ dependencies = [ [[package]] name = "zcash_keys" version = "0.12.0" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bech32", "bip32", @@ -3802,35 +3813,49 @@ dependencies = [ [[package]] name = "zcash_primitives" version = "0.26.4" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ + "bip32", "blake2b_simd", "block-buffer 0.11.0-rc.3", + "bs58", "core2", "crypto-common 0.2.0-rc.1", "document-features", "equihash", "ff", + "fpe", + "getset", + "group", "hex", "incrementalmerkletree", "jubjub", "memuse", "nonempty", "orchard", + "rand", "rand_core", "redjubjub", + "ripemd 0.1.3", "sapling-crypto", "secp256k1", "sha2 0.10.9", + "subtle", + "tracing", + "zcash_address", "zcash_encoding", "zcash_note_encryption", "zcash_protocol", "zcash_script", + "zcash_spec", "zcash_transparent", + "zip32", ] [[package]] name = "zcash_proofs" version = "0.26.1" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bellman", "blake2b_simd", @@ -3849,6 +3874,7 @@ dependencies = [ [[package]] name = "zcash_protocol" version = "0.7.2" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "core2", "document-features", @@ -3859,9 +3885,9 @@ dependencies = [ [[package]] name = "zcash_script" -version = "0.4.3" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ef9d04e0434a80b62ad06c5a610557be358ef60a98afa5dbc8ecaf19ad72e7" +checksum = "9bed6cf5b2b4361105d4ea06b2752f0c8af4641756c7fbc9858a80af186c234f" dependencies = [ "bip32", "bitflags", @@ -3886,8 +3912,10 @@ dependencies = [ [[package]] name = "zcash_transparent" version = "0.6.3" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "bip32", + "blake2b_simd", "bs58", "core2", "document-features", @@ -3962,6 +3990,7 @@ dependencies = [ [[package]] name = "zip321" version = "0.6.0" +source = "git+https://github.com/ChainSafe/librustzcash-nu61?branch=feat%2Fsnap-nu61#52efe30ef39b2d1871be5673d1921ff33472b347" dependencies = [ "base64", "nom", diff --git a/Cargo.toml b/Cargo.toml index cee0c450..a2783266 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,19 +30,18 @@ console_error_panic_hook = { version = "0.1.7" } tonic-web-wasm-client = "0.8.0" tokio_with_wasm = { version = "0.7.1", features = ["rt", "rt-multi-thread", "sync", "macros", "time"] } -## Zcash dependencies - Using local upstream librustzcash with our PR changes -## TODO: Switch back to git deps once upstream PRs are merged before deployment -zcash_keys = { path = "../librustzcash/zcash_keys", features = ["transparent-inputs", "orchard", "sapling", "unstable"] } -zcash_client_backend = { path = "../librustzcash/zcash_client_backend", default-features = false, features = ["sync", "lightwalletd-tonic", "orchard"] } -zcash_client_memory = { path = "../librustzcash/zcash_client_memory", features = ["orchard", "transparent-inputs"] } -zcash_primitives = { path = "../librustzcash/zcash_primitives" } -zcash_transparent = { path = "../librustzcash/zcash_transparent", default-features = false } -zcash_address = { path = "../librustzcash/components/zcash_address" } -zcash_proofs = { path = "../librustzcash/zcash_proofs", default-features = false, features = ["bundled-prover", "multicore"] } -zip321 = { path = "../librustzcash/components/zip321" } +## Zcash dependencies - Using ChainSafe/librustzcash-nu61 fork with NU6.1 fixes +zcash_keys = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", features = ["transparent-inputs", "orchard", "sapling", "unstable"] } +zcash_client_backend = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["sync", "lightwalletd-tonic", "orchard"] } +zcash_client_memory = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", features = ["orchard", "transparent-inputs"] } +zcash_primitives = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61" } +zcash_transparent = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false } +zcash_address = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61" } +zcash_proofs = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["bundled-prover", "multicore"] } +zip321 = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61" } zip32 = { version = "0.2" } -zcash_protocol = { path = "../librustzcash/components/zcash_protocol", default-features = false } -pczt = { path = "../librustzcash/pczt", default-features = false, features = ["orchard", "sapling", "transparent"] } +zcash_protocol = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false } +pczt = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["orchard", "sapling", "transparent"] } sapling = { package = "sapling-crypto", version = "0.6", default-features = false } bip32 = { version = "=0.6.0-pre.1", default-features = false, features = ["alloc"] } ## gRPC Web dependencies @@ -51,7 +50,7 @@ tonic = { version = "0.14", default-features = false } # Used in Native tests -zcash_client_sqlite = { path = "../librustzcash/zcash_client_sqlite", default-features = false, features = ["unstable", "orchard"] } +zcash_client_sqlite = { git = "https://github.com/ChainSafe/librustzcash-nu61", branch = "feat/snap-nu61", default-features = false, features = ["unstable", "orchard"] } getrandom = { version = "0.2", features = ["js"] } thiserror = "1.0.63" @@ -82,9 +81,10 @@ tokio = { version = "1.0", features = ["rt", "macros"] } byte-unit = { version = "5.1.4", features = ["byte"] } [patch.crates-io] -# Patching to match upstream librustzcash's pinned revisions -orchard = { git = "https://github.com/zcash/orchard.git", rev = "6b12c77260aa7fac0d804983fc31b71b584d48e0" } -sapling = { package = "sapling-crypto", git = "https://github.com/zcash/sapling-crypto.git", rev = "e99f38a8f4685c381bb4cca94874092e50e3f7e9" } +# Also patching for pczt improvments +# See: https://github.com/zcash/librustzcash/pull/1661 +# orchard = { git = "https://github.com/zcash/orchard.git", rev = "4fa6d3b549f8803016a309281404eab095d04de8" } +# sapling = { package = "sapling-crypto", git = "https://github.com/zcash/sapling-crypto.git", rev = "3c2235747553da642fb142d1eeb9b1afa8391987" } [workspace.lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen)', 'cfg(wasm_bindgen_unstable_test_coverage)'] } \ No newline at end of file diff --git a/crates/webzjs-requests/src/requests.rs b/crates/webzjs-requests/src/requests.rs index 848fe432..68b6da7f 100644 --- a/crates/webzjs-requests/src/requests.rs +++ b/crates/webzjs-requests/src/requests.rs @@ -91,9 +91,12 @@ impl PaymentRequest { }; let other_params = serde_wasm_bindgen::from_value(other_params)?; - match zip321::Payment::new(address, Some(amount), memo, label, message, other_params) { - Ok(payment) => Ok(PaymentRequest(payment)), - Err(_) => Err(Error::UnsupportedMemoRecipient), + if let Some(payment) = + zip321::Payment::new(address, Some(amount), memo, label, message, other_params) + { + Ok(PaymentRequest(payment)) + } else { + Err(Error::UnsupportedMemoRecipient) } } diff --git a/crates/webzjs-wallet/src/wallet.rs b/crates/webzjs-wallet/src/wallet.rs index 1b03e671..025bc093 100644 --- a/crates/webzjs-wallet/src/wallet.rs +++ b/crates/webzjs-wallet/src/wallet.rs @@ -32,8 +32,7 @@ use zcash_client_backend::data_api::wallet::{ propose_shielding, propose_transfer, ConfirmationsPolicy, SpendingKeys, }; use zcash_client_backend::data_api::{ - Account, AccountBirthday, AccountPurpose, InputSource, TransparentOutputFilter, WalletRead, - WalletSummary, WalletWrite, + Account, AccountBirthday, AccountPurpose, InputSource, WalletRead, WalletSummary, WalletWrite, }; use zcash_client_backend::data_api::{WalletCommitmentTrees, Zip32Derivation}; use zcash_client_backend::fees::standard::MultiOutputChangeStrategy; @@ -134,7 +133,6 @@ where + Hash + Default + Send - + Sync + ConditionallySelectable + Serialize + DeserializeOwned @@ -544,7 +542,6 @@ where &from_addrs, account_id, self.min_confirmations, // librustzcash operates under the assumption of zero or one conf being the same but that could change. - TransparentOutputFilter::All, ) .map_err(|e| { tracing::error!("pczt_shield: propose_shielding failed: {:?}", e);