Skip to content

Commit 0560901

Browse files
authored
fix: support for NU6.1 (#683)
1 parent 5e4d291 commit 0560901

File tree

18 files changed

+120
-71
lines changed

18 files changed

+120
-71
lines changed

rust/Cargo.lock

Lines changed: 53 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,18 @@ rayon = "1.10"
4545
qrcode = "0.14.1"
4646
raptorq = "2.0.0"
4747

48-
zcash_address = "0.9"
48+
zcash_address = "0.10"
4949
zcash_encoding = "0.3"
50-
zcash_keys = {version = "0.10", features = ["sapling", "orchard", "transparent-inputs"]}
50+
zcash_keys = {version = "0.12", features = ["sapling", "orchard", "transparent-inputs"]}
5151
zcash_note_encryption = "0.4"
52-
zcash_primitives = {version = "0.24", features = ["transparent-inputs"]}
53-
zcash_proofs = {version = "0.24", features = ["bundled-prover"]}
54-
zcash_protocol = {version = "0.6", features = ["local-consensus"]}
55-
zcash_transparent = {version = "0.4", features = ["transparent-inputs"]}
56-
pczt = { version = "0.3", features = ["zcp-builder", "io-finalizer", "prover", "signer", "spend-finalizer", "tx-extractor", "transparent", "sapling", "orchard"] }
52+
zcash_script = "0.4"
53+
zcash_primitives = {version = "0.26", features = ["transparent-inputs"]}
54+
zcash_proofs = {version = "0.26", features = ["bundled-prover"]}
55+
zcash_protocol = {version = "0.7", features = ["local-consensus"]}
56+
zcash_transparent = {version = "0.6", features = ["transparent-inputs"]}
57+
pczt = { version = "0.5", features = ["zcp-builder", "io-finalizer", "prover", "signer", "spend-finalizer", "tx-extractor", "transparent", "sapling", "orchard"] }
5758
orchard = {version = "0.11", features = ["unstable-frost"]}
58-
zip321 = "0.5"
59+
zip321 = "0.6"
5960

6061
reddsa = {git="https://github.com/ZcashFoundation/reddsa.git", rev="975f9ca835c4b9196c81608e55192b0f711e951d", features=["frost"]}
6162
frost-rerandomized = "2.1.0"
@@ -125,15 +126,15 @@ orchard = { git = "https://github.com/hhanh00/orchard.git", rev = "c06fec6d69c7e
125126
zcash_note_encryption = { git = "https://github.com/zcash/zcash_note_encryption.git", rev = "ede44ea608e667c78309c598fbf4d70f69c15c29" }
126127

127128
sapling-crypto = { git = "https://github.com/zcash/sapling-crypto.git", rev = "0475817b60fced17ec59b0c9412d2b2d29ef529f" }
128-
zcash_address = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
129-
zcash_encoding = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
130-
zcash_keys = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
131-
zcash_primitives = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
132-
zcash_proofs = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
133-
zcash_protocol = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
134-
zcash_transparent = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
135-
pczt = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
136-
zip321 = { git = "https://github.com/hhanh00/librustzcash.git", rev = "0621a88485c947909664d0d94a1b8b2c3ebf21e2" }
129+
zcash_address = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
130+
zcash_encoding = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
131+
zcash_keys = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
132+
zcash_primitives = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
133+
zcash_proofs = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
134+
zcash_protocol = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
135+
zcash_transparent = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
136+
pczt = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
137+
zip321 = { git = "https://github.com/hhanh00/librustzcash.git", rev = "27c170eee23d51cc2d5ee1bf161a12042fd387a1" }
137138

138139
# sapling-crypto = { path = "../../sapling-crypto" }
139140
# zcash_address = { path = "../../librustzcash/components/zcash_address" }

rust/src/account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use crate::{
2929
};
3030
use secp256k1::{PublicKey, SecretKey};
3131
use zcash_keys::keys::{sapling::ExtendedSpendingKey, UnifiedFullViewingKey, UnifiedSpendingKey};
32+
use zcash_transparent::address::TransparentAddress;
3233

3334
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
3435
use crate::ledger::fvk::{get_hw_next_diversifier_address, get_hw_transparent_address};
@@ -53,7 +54,6 @@ use sqlx::{sqlite::SqliteRow, Connection, Row, SqliteConnection};
5354
use zcash_keys::{
5455
address::UnifiedAddress, encoding::AddressCodec as _, keys::UnifiedAddressRequest,
5556
};
56-
use zcash_primitives::legacy::TransparentAddress;
5757
use zcash_protocol::consensus::{NetworkConstants, NetworkUpgrade, Parameters};
5858
use zcash_transparent::keys::{
5959
AccountPrivKey, AccountPubKey, NonHardenedChildIndex, TransparentKeyScope,

rust/src/api/account.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use zcash_keys::{
1515
encoding::AddressCodec,
1616
keys::{UnifiedAddressRequest, UnifiedFullViewingKey, UnifiedSpendingKey},
1717
};
18-
use zcash_primitives::{
19-
consensus::Parameters as ZkParams, legacy::TransparentAddress, zip32::AccountId,
20-
};
18+
use zcash_transparent::address::TransparentAddress;
19+
use zip32::AccountId;
20+
use zcash_protocol::consensus::Parameters as ZkParams;
2121

2222
use crate::{
2323
account::derive_transparent_address,

rust/src/api/coin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl Coin {
5858

5959
let mut connection = pool.acquire().await?;
6060

61-
let coin = crate::db::get_prop(&mut *connection, "coin")
61+
let coin = crate::db::get_prop(&mut connection, "coin")
6262
.await?
6363
.unwrap_or("0".to_string());
6464
let coin = coin.parse::<u8>()?;
@@ -211,7 +211,7 @@ impl Coin {
211211

212212
async fn try_open(db_filepath: &str, password: &Option<String>) -> Result<SqlitePool> {
213213
// Create a connection pool
214-
let options = get_connect_options(&db_filepath, password);
214+
let options = get_connect_options(db_filepath, password);
215215
let pool = SqlitePoolOptions::new()
216216
.max_connections(5)
217217
.idle_timeout(std::time::Duration::from_secs(30))

rust/src/api/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use flutter_rust_bridge::frb;
33
use futures::TryStreamExt as _;
44
use sqlx::SqliteConnection;
55
use sqlx::{sqlite::SqliteRow, Connection as _, Row};
6+
use zcash_transparent::address::TransparentAddress;
67
use std::collections::HashMap;
78
use std::sync::LazyLock;
89
use tokio::sync::mpsc::channel;
@@ -12,7 +13,6 @@ use zcash_keys::encoding::AddressCodec as _;
1213

1314
use crate::budget::merge_pending_txs;
1415
use crate::api::coin::{Coin, Network};
15-
use zcash_primitives::legacy::TransparentAddress;
1616

1717
use crate::db::{calculate_balance, store_block_header};
1818
use crate::io::SyncHeight;

rust/src/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use zcash_keys::{
1212
encoding::{decode_extended_full_viewing_key, decode_extended_spending_key, AddressCodec as _},
1313
keys::UnifiedFullViewingKey,
1414
};
15-
use zcash_primitives::legacy::TransparentAddress;
1615
use zcash_protocol::consensus::NetworkConstants as _;
16+
use zcash_transparent::address::TransparentAddress;
1717

1818
use crate::{
1919
bip38,

rust/src/ledger/builder.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ use sqlx::{pool::PoolConnection, Sqlite, SqliteConnection};
2727
use tracing::info;
2828
use zcash_keys::encoding::AddressCodec;
2929
use zcash_note_encryption::{try_output_recovery_with_ovk, Domain, EphemeralKeyBytes};
30-
use zcash_primitives::legacy::{Script, TransparentAddress};
30+
use zcash_script::script::Evaluable;
31+
use zcash_transparent::address::TransparentAddress;
3132
use zcash_proofs::prover::LocalTxProver;
3233
use zcash_protocol::{consensus::NetworkConstants, memo::Memo};
3334

@@ -144,7 +145,9 @@ pub async fn sign_transaction<D: Device + Sync, R: RngCore + CryptoRng>(
144145
data.write_u32::<LE>(aindex | 0x80000000)?;
145146
data.write_u32::<LE>(scope)?;
146147
data.write_u32::<LE>(dindex)?;
147-
address.script().write(&mut data)?;
148+
let address_script = address.script();
149+
data.write_u8(address_script.byte_len() as u8)?;
150+
data.write_all(&address_script.to_bytes())?;
148151
data.write_u64::<LE>(*tin.value())?;
149152
assert_eq!(data.len(), 54);
150153
buffers.push(data);
@@ -160,7 +163,9 @@ pub async fn sign_transaction<D: Device + Sync, R: RngCore + CryptoRng>(
160163
touts.push(pczt_tout);
161164

162165
let mut data = vec![];
163-
Script(tout.script_pubkey().to_vec()).write(&mut data)?;
166+
let output_script = tout.script_pubkey();
167+
data.write_u8(output_script.len() as u8)?;
168+
data.write_all(output_script)?;
164169
data.write_u64::<LE>(*tout.value())?;
165170
assert_eq!(data.len(), 34);
166171
buffers.push(data);
@@ -461,7 +466,9 @@ pub async fn sign_transaction<D: Device + Sync, R: RngCore + CryptoRng>(
461466
let mut data = vec![];
462467
data.write_all(tin.prevout_txid())?;
463468
data.write_u32::<LE>(*tin.prevout_index())?;
464-
Script(tin.script_pubkey().to_vec()).write(&mut data)?;
469+
let input_script = tin.script_pubkey();
470+
data.write_u8(input_script.len() as u8)?;
471+
data.write_all(input_script)?;
465472
data.write_u64::<LE>(*tin.value())?;
466473
data.write_u32::<LE>(tin.sequence().unwrap_or(0xFFFFFFFFu32))?;
467474
assert_eq!(data.len(), 74);

rust/src/ledger/fvk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use sapling_crypto::{keys::FullViewingKey, PaymentAddress};
55
use secp256k1::PublicKey;
66
use sqlx::SqliteConnection;
77
use zcash_keys::encoding::AddressCodec;
8-
use zcash_primitives::legacy::TransparentAddress;
98
use zcash_protocol::consensus::NetworkConstants;
9+
use zcash_transparent::address::TransparentAddress;
1010

1111
use crate::{
1212
account::get_sapling_address, api::coin::Network, db::{get_account_aindex, get_account_dindex}, ledger::{connect_ledger, APDUCommand, Device, LedgerError, LedgerResult}, tiu, IntoAnyhow

0 commit comments

Comments
 (0)