From b4a5775dbbd6f5e991a6f8dc8e2a24ae39f50f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Mon, 25 Nov 2024 13:09:43 +0100 Subject: [PATCH 01/13] fix nightly build --- derive/src/xkey.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/derive/src/xkey.rs b/derive/src/xkey.rs index 6b933e2..cf2186c 100644 --- a/derive/src/xkey.rs +++ b/derive/src/xkey.rs @@ -642,7 +642,7 @@ impl XkeyOrigin { self.derivation.iter().copied().map(DerivationIndex::from).collect() } - pub fn child_derivation<'a>(&'a self, child: &'a KeyOrigin) -> Option<&[DerivationIndex]> { + pub fn child_derivation<'a>(&'a self, child: &'a KeyOrigin) -> Option<&'a [DerivationIndex]> { if self.master_fp() == child.master_fp() { let d = child.derivation(); let shared = d.shared_prefix(self.derivation()); From 02ffba72cbb21a1d6a0ca7aaf8765ea61f83fc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Mon, 2 Dec 2024 15:33:02 +0100 Subject: [PATCH 02/13] fix manifest for wasm-testing --- descriptors/Cargo.toml | 2 +- psbt/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/descriptors/Cargo.toml b/descriptors/Cargo.toml index 00a47a5..3989562 100644 --- a/descriptors/Cargo.toml +++ b/descriptors/Cargo.toml @@ -6,7 +6,7 @@ keywords = { workspace = true } categories = { workspace = true } readme = "../README.md" authors = { workspace = true } -homepage = { workspace = true } +homepage.workspace = true repository = { workspace = true } rust-version = { workspace = true } edition = { workspace = true } diff --git a/psbt/Cargo.toml b/psbt/Cargo.toml index b3c6ee1..e0f3739 100644 --- a/psbt/Cargo.toml +++ b/psbt/Cargo.toml @@ -6,7 +6,7 @@ keywords = { workspace = true } categories = { workspace = true } readme = "../README.md" authors = { workspace = true } -homepage = { workspace = true } +homepage.workspace = true repository = { workspace = true } rust-version = { workspace = true } edition = { workspace = true } From 78e84166da3f1fd2e7cd5239a88f76eca5f8005d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Mon, 2 Dec 2024 15:38:09 +0100 Subject: [PATCH 03/13] fix lint with 1.85.0-nightly --- psbt/src/coders.rs | 4 ++-- psbt/src/data.rs | 2 +- src/signers.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/psbt/src/coders.rs b/psbt/src/coders.rs index d0e46ba..43cfb95 100644 --- a/psbt/src/coders.rs +++ b/psbt/src/coders.rs @@ -185,7 +185,7 @@ pub trait Encode { fn encode(&self, writer: &mut dyn Write) -> Result; } -impl<'a, T: Encode> Encode for &'a T { +impl Encode for &'_ T { fn encode(&self, writer: &mut dyn Write) -> Result { (*self).encode(writer) } } @@ -677,7 +677,7 @@ macro_rules! psbt_code_using_consensus { } struct WriteWrap<'a>(&'a mut dyn Write); -impl<'a> Write for WriteWrap<'a> { +impl Write for WriteWrap<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { self.0.write(buf) } fn flush(&mut self) -> io::Result<()> { self.0.flush() } } diff --git a/psbt/src/data.rs b/psbt/src/data.rs index 28e4a22..cc1e283 100644 --- a/psbt/src/data.rs +++ b/psbt/src/data.rs @@ -1041,7 +1041,7 @@ impl Output { if terminal.len() != 1 { return None; } - return terminal.first().copied(); + terminal.first().copied() } } diff --git a/src/signers.rs b/src/signers.rs index c8b898e..15bd42c 100644 --- a/src/signers.rs +++ b/src/signers.rs @@ -80,7 +80,7 @@ impl<'a> TestnetRefSigner<'a> { } } -impl<'a> Signer for TestnetRefSigner<'a> { +impl Signer for TestnetRefSigner<'_> { type Sign<'s> = Self where Self: 's; @@ -88,7 +88,7 @@ impl<'a> Signer for TestnetRefSigner<'a> { fn approve(&self, _: &Psbt) -> Result, Rejected> { Ok(self.clone()) } } -impl<'a> TestnetRefSigner<'a> { +impl TestnetRefSigner<'_> { fn get(&self, origin: Option<&KeyOrigin>) -> Option { let origin = origin?; self.keys.iter().find_map(|(xo, xpriv)| { @@ -100,7 +100,7 @@ impl<'a> TestnetRefSigner<'a> { } } -impl<'a> Sign for TestnetRefSigner<'a> { +impl Sign for TestnetRefSigner<'_> { fn sign_ecdsa( &self, message: Sighash, From f81848a0751e073c92881c2d6c9c06c87e7a58bd Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Tue, 17 Dec 2024 21:50:29 +0100 Subject: [PATCH 04/13] chore: release v0.11.0-beta.9.1 --- Cargo.lock | 10 +++++----- Cargo.toml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd9c059..e2e2dab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,7 +209,7 @@ dependencies = [ [[package]] name = "bp-derive" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bp-consensus", @@ -223,7 +223,7 @@ dependencies = [ [[package]] name = "bp-invoice" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bech32", @@ -250,7 +250,7 @@ dependencies = [ [[package]] name = "bp-std" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bp-consensus", @@ -380,7 +380,7 @@ dependencies = [ [[package]] name = "descriptors" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bp-derive", @@ -580,7 +580,7 @@ dependencies = [ [[package]] name = "psbt" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "base64", diff --git a/Cargo.toml b/Cargo.toml index 848e7d9..32e05d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["invoice", "derive", "descriptors", "psbt", "."] resolver = "2" [workspace.package] -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" keywords = ["bitcoin", "wallet", "descriptors", "psbt", "taproot"] categories = ["cryptography::cryptocurrencies"] authors = ["Dr Maxim Orlovsky "] @@ -21,10 +21,10 @@ strict_encoding = "2.7.0" commit_verify = "0.11.0-beta.9" bp-consensus = "0.11.0-beta.9" bp-core = { version = "0.11.0-beta.9" } -bp-invoice = { version = "0.11.0-beta.9", path = "invoice" } -bp-derive = { version = "0.11.0-beta.9", path = "derive" } -descriptors = { version = "0.11.0-beta.9", path = "descriptors" } -psbt = { version = "0.11.0-beta.9", path = "psbt" } +bp-invoice = { version = "0.11.0-beta.9.1", path = "invoice" } +bp-derive = { version = "0.11.0-beta.9.1", path = "derive" } +descriptors = { version = "0.11.0-beta.9.1", path = "descriptors" } +psbt = { version = "0.11.0-beta.9.1", path = "psbt" } indexmap = "2.4.0" serde_crate = { package = "serde", version = "1", features = ["derive"] } From 7d81b69fee98d5d70d53ccdff274bab3a4be198d Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 11 Jan 2025 05:10:39 +0100 Subject: [PATCH 05/13] psbt: verify address network upon a construction --- psbt/src/constructor.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psbt/src/constructor.rs b/psbt/src/constructor.rs index a5b06ae..70ea4b2 100644 --- a/psbt/src/constructor.rs +++ b/psbt/src/constructor.rs @@ -57,6 +57,9 @@ pub enum ConstructionError { output_value: Sats, fee: Sats, }, + + /// network for address {0} mismatch the one used by the wallet. + NetworkMismatch(Address), } #[derive(Clone, Debug, Display, Error, From)] @@ -231,6 +234,9 @@ pub trait PsbtConstructor { let mut max = Vec::new(); let mut output_value = Sats::ZERO; for beneficiary in beneficiaries { + if beneficiary.address.network != self.network().into() { + return Err(ConstructionError::NetworkMismatch(beneficiary.address)); + } let amount = beneficiary.amount.unwrap_or(Sats::ZERO); output_value .checked_add_assign(amount) From 361bc6820111e0f3471e0b5b823b7b76739559fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Wed, 12 Feb 2025 15:03:16 +0100 Subject: [PATCH 06/13] update bp-core to 0.11.1-alpha.1 --- Cargo.lock | 32 ++++++++++++++++---------------- Cargo.toml | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2e2dab..f8799f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "amplify" -version = "4.7.0" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7147b742325842988dd6c793d55f58df3ae36bccf7d9b6e07db10ab035be343d" +checksum = "b2090b9b79b61d4047a307a46de043d0ee5ec406d99a7d652341b96d48ed5567" dependencies = [ "amplify_apfloat", "amplify_derive", @@ -164,9 +164,9 @@ dependencies = [ [[package]] name = "bp-consensus" -version = "0.11.0-beta.9" +version = "0.11.1-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54db63118d55e32ea78f8775e98871d442a33e3bdef6419c7964d71b308316c0" +checksum = "40f227ce25d185bc5fc9109ca83dfa8bd0e745f219e320f3da658aaf4fd7e0c5" dependencies = [ "amplify", "chrono", @@ -178,9 +178,9 @@ dependencies = [ [[package]] name = "bp-core" -version = "0.11.0-beta.9" +version = "0.11.1-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e51a329150531b12243adf51d978490c796a6a20ec76c506b41c8e1226022bc" +checksum = "40c6b213ada98fe5e78a978e67a7044d16d2571edb3f85fcdb4246324ec9514a" dependencies = [ "amplify", "bp-consensus", @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "bp-dbc" -version = "0.11.0-beta.9" +version = "0.11.1-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9286fb448160672148262317f4647ebdcdd4699ed2bd34401f9799d0920cc376" +checksum = "d33d4cc345a595236441fc2b8726ca7eb693947914b278849d1e2c1923dcb314" dependencies = [ "amplify", "base85", @@ -234,9 +234,9 @@ dependencies = [ [[package]] name = "bp-seals" -version = "0.11.0-beta.9" +version = "0.11.1-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9873cfe420f4ce5cc539c394c75df0669cdbe2c23eed1930dffe024cb0f13a57" +checksum = "6a7a009fbf7e71be7ab5f43e032c69927f58cd7f59a6a822af64f84d3e8d41c5" dependencies = [ "amplify", "baid64", @@ -310,9 +310,9 @@ dependencies = [ [[package]] name = "commit_encoding_derive" -version = "0.11.0-beta.8" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea07c5ad73a637276dc4f8a957f8285764018d45bdefef35eb9137f32d0e3c81" +checksum = "dc09678c15e9280cc6eaf29bf437a2cf18fadedd8bf78c369b8ac15fa217dbe5" dependencies = [ "amplify", "amplify_syn", @@ -323,9 +323,9 @@ dependencies = [ [[package]] name = "commit_verify" -version = "0.11.0-beta.9" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf08c4941e147937551f6a3d370552d67f98cf72c9eb18948142596beadd31e" +checksum = "0fcf5f557e112c684f2458f20c66bab865c01cab56d6a318f64243cba9b163a7" dependencies = [ "amplify", "commit_encoding_derive", @@ -727,9 +727,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "single_use_seals" -version = "0.11.0-beta.9" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec071f3b3153217f1cb2bca5ba7ac87eeafc446cb35a5c0643dec33495a37244" +checksum = "b01aad2d785dc858c4f652d1e18d0c815cd10aa8f15ac7accd2b12b894d7c367" dependencies = [ "amplify_derive", ] diff --git a/Cargo.toml b/Cargo.toml index 32e05d4..b2208d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,8 @@ bech32 = "0.9.1" secp256k1 = "0.30.0" strict_encoding = "2.7.0" commit_verify = "0.11.0-beta.9" -bp-consensus = "0.11.0-beta.9" -bp-core = { version = "0.11.0-beta.9" } +bp-consensus = "0.11.1-alpha.1" +bp-core = { version = "0.11.1-alpha.1" } bp-invoice = { version = "0.11.0-beta.9.1", path = "invoice" } bp-derive = { version = "0.11.0-beta.9.1", path = "derive" } descriptors = { version = "0.11.0-beta.9.1", path = "descriptors" } From cf7b197ef8d429c57fdbe8bb46c05d2b925d61c3 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 14 Feb 2025 18:00:42 +0100 Subject: [PATCH 07/13] chore: release v0.11.1-alpha.1 --- Cargo.lock | 10 +++++----- Cargo.toml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f8799f6..949ac2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,7 +209,7 @@ dependencies = [ [[package]] name = "bp-derive" -version = "0.11.0-beta.9.1" +version = "0.11.1-alpha.1" dependencies = [ "amplify", "bp-consensus", @@ -223,7 +223,7 @@ dependencies = [ [[package]] name = "bp-invoice" -version = "0.11.0-beta.9.1" +version = "0.11.1-alpha.1" dependencies = [ "amplify", "bech32", @@ -250,7 +250,7 @@ dependencies = [ [[package]] name = "bp-std" -version = "0.11.0-beta.9.1" +version = "0.11.1-alpha.1" dependencies = [ "amplify", "bp-consensus", @@ -380,7 +380,7 @@ dependencies = [ [[package]] name = "descriptors" -version = "0.11.0-beta.9.1" +version = "0.11.1-alpha.1" dependencies = [ "amplify", "bp-derive", @@ -580,7 +580,7 @@ dependencies = [ [[package]] name = "psbt" -version = "0.11.0-beta.9.1" +version = "0.11.1-alpha.1" dependencies = [ "amplify", "base64", diff --git a/Cargo.toml b/Cargo.toml index b2208d7..0c85939 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["invoice", "derive", "descriptors", "psbt", "."] resolver = "2" [workspace.package] -version = "0.11.0-beta.9.1" +version = "0.11.1-alpha.1" keywords = ["bitcoin", "wallet", "descriptors", "psbt", "taproot"] categories = ["cryptography::cryptocurrencies"] authors = ["Dr Maxim Orlovsky "] @@ -21,10 +21,10 @@ strict_encoding = "2.7.0" commit_verify = "0.11.0-beta.9" bp-consensus = "0.11.1-alpha.1" bp-core = { version = "0.11.1-alpha.1" } -bp-invoice = { version = "0.11.0-beta.9.1", path = "invoice" } -bp-derive = { version = "0.11.0-beta.9.1", path = "derive" } -descriptors = { version = "0.11.0-beta.9.1", path = "descriptors" } -psbt = { version = "0.11.0-beta.9.1", path = "psbt" } +bp-invoice = { version = "0.11.1-alpha.1", path = "invoice" } +bp-derive = { version = "0.11.1-alpha.1", path = "derive" } +descriptors = { version = "0.11.1-alpha.1", path = "descriptors" } +psbt = { version = "0.11.1-alpha.1", path = "psbt" } indexmap = "2.4.0" serde_crate = { package = "serde", version = "1", features = ["derive"] } From 77e215dc3e8e2993ea02c8a6f4e089589f4611ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Tue, 18 Mar 2025 15:20:06 +0100 Subject: [PATCH 08/13] allow multiple tweaks per terminal --- derive/src/derive.rs | 81 +++++++++++++++++++++-------------- derive/src/index.rs | 1 + descriptors/src/descriptor.rs | 6 +-- descriptors/src/factory.rs | 48 --------------------- descriptors/src/lib.rs | 2 - descriptors/src/segwit.rs | 15 ++++--- descriptors/src/taproot.rs | 30 ++++++------- psbt/src/constructor.rs | 8 +++- psbt/src/data.rs | 36 ++++++++++------ 9 files changed, 101 insertions(+), 126 deletions(-) delete mode 100644 descriptors/src/factory.rs diff --git a/derive/src/derive.rs b/derive/src/derive.rs index 95372db..fb894b4 100644 --- a/derive/src/derive.rs +++ b/derive/src/derive.rs @@ -23,6 +23,7 @@ use std::cmp::Ordering; use std::collections::BTreeSet; use std::fmt::Display; +use std::iter; use std::num::ParseIntError; use std::str::FromStr; @@ -31,10 +32,9 @@ use bc::{ TapNodeHash, WitnessScript, XOnlyPk, }; use indexmap::IndexMap; -use invoice::AddressError; use crate::{ - Address, AddressNetwork, AddressParseError, ControlBlockFactory, DerivationIndex, Idx, IdxBase, + Address, AddressNetwork, AddressParseError, ControlBlockFactory, DerivationIndex, IdxBase, IndexParseError, NormalIndex, TapTree, XpubAccount, XpubDerivable, }; @@ -335,25 +335,23 @@ pub trait Derive { fn keychains(&self) -> BTreeSet; - fn derive(&self, keychain: impl Into, index: impl Into) -> D; + fn derive( + &self, + keychain: impl Into, + index: impl Into, + ) -> impl Iterator; - fn derive_batch( + fn derive_range( &self, keychain: impl Into, from: impl Into, - max_count: u8, - ) -> Vec { - let mut index = from.into(); - let mut count = 0u8; - let mut batch = Vec::with_capacity(max_count as usize); + to: impl Into, + ) -> impl Iterator { + let from = from.into().child_number(); + let to = to.into().child_number(); let keychain = keychain.into(); - loop { - batch.push(self.derive(keychain, index)); - count += 1; - if index.checked_inc_assign().is_none() || count >= max_count { - return batch; - } - } + (from..to) + .flat_map(move |index| self.derive(keychain, NormalIndex::normal_unchecked(index))) } } @@ -371,28 +369,33 @@ pub trait DeriveXOnly: DeriveKey {} impl> DeriveXOnly for T {} pub trait DeriveScripts: Derive { + /// Derives addresses for a given index. + /// + /// If the descriptor is not representable in form of an address (uses non-standard script etc), + /// returns an empty iterator. fn derive_address( &self, network: AddressNetwork, keychain: impl Into, index: impl Into, - ) -> Result { - let spk = self.derive(keychain, index).to_script_pubkey(); - Address::with(&spk, network) + ) -> impl Iterator { + self.derive(keychain, index) + .flat_map(move |spk| Address::with(&spk.to_script_pubkey(), network).ok()) } - fn derive_address_batch( + /// Derives addresses for a range of indexes. + /// + /// If the descriptor is not representable in form of an address (uses non-standard script etc), + /// returns an empty iterator. + fn derive_address_range( &self, network: AddressNetwork, keychain: impl Into, from: impl Into, - max_count: u8, - ) -> Result, AddressError> { - self.derive_batch(keychain, from, max_count) - .iter() - .map(DerivedScript::to_script_pubkey) - .map(|spk| Address::with(&spk, network)) - .collect() + to: impl Into, + ) -> impl Iterator { + self.derive_range(keychain, from, to) + .flat_map(move |spk| Address::with(&spk.to_script_pubkey(), network).ok()) } } impl> DeriveScripts for T {} @@ -416,8 +419,12 @@ impl Derive for XpubDerivable { #[inline] fn keychains(&self) -> BTreeSet { self.keychains.to_set() } - fn derive(&self, keychain: impl Into, index: impl Into) -> LegacyPk { - self.xpub().derive_pub([keychain.into().into(), index.into()]).to_legacy_pk() + fn derive( + &self, + keychain: impl Into, + index: impl Into, + ) -> impl Iterator { + iter::once(self.xpub().derive_pub([keychain.into().into(), index.into()]).to_legacy_pk()) } } @@ -428,8 +435,12 @@ impl Derive for XpubDerivable { #[inline] fn keychains(&self) -> BTreeSet { self.keychains.to_set() } - fn derive(&self, keychain: impl Into, index: impl Into) -> CompressedPk { - self.xpub().derive_pub([keychain.into().into(), index.into()]).to_compr_pk() + fn derive( + &self, + keychain: impl Into, + index: impl Into, + ) -> impl Iterator { + iter::once(self.xpub().derive_pub([keychain.into().into(), index.into()]).to_compr_pk()) } } @@ -440,8 +451,12 @@ impl Derive for XpubDerivable { #[inline] fn keychains(&self) -> BTreeSet { self.keychains.to_set() } - fn derive(&self, keychain: impl Into, index: impl Into) -> XOnlyPk { - self.xpub().derive_pub([keychain.into().into(), index.into()]).to_xonly_pk() + fn derive( + &self, + keychain: impl Into, + index: impl Into, + ) -> impl Iterator { + iter::once(self.xpub().derive_pub([keychain.into().into(), index.into()]).to_xonly_pk()) } } diff --git a/derive/src/index.rs b/derive/src/index.rs index 1be7d37..d5e0d6e 100644 --- a/derive/src/index.rs +++ b/derive/src/index.rs @@ -291,6 +291,7 @@ impl From<&NormalIndex> for NormalIndex { impl NormalIndex { pub const fn normal(child_number: u16) -> Self { NormalIndex(child_number as u32) } + pub(crate) const fn normal_unchecked(child_number: u32) -> Self { NormalIndex(child_number) } } impl IdxBase for NormalIndex { diff --git a/descriptors/src/descriptor.rs b/descriptors/src/descriptor.rs index bc88988..6f8b0d4 100644 --- a/descriptors/src/descriptor.rs +++ b/descriptors/src/descriptor.rs @@ -212,10 +212,10 @@ impl Derive for StdDescr { &self, keychain: impl Into, index: impl Into, - ) -> DerivedScript { + ) -> impl Iterator { match self { - StdDescr::Wpkh(d) => d.derive(keychain, index), - StdDescr::TrKey(d) => d.derive(keychain, index), + StdDescr::Wpkh(d) => d.derive(keychain, index).collect::>().into_iter(), + StdDescr::TrKey(d) => d.derive(keychain, index).collect::>().into_iter(), } } } diff --git a/descriptors/src/factory.rs b/descriptors/src/factory.rs deleted file mode 100644 index 6896234..0000000 --- a/descriptors/src/factory.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Modern, minimalistic & standard-compliant cold wallet library. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Written in 2020-2024 by -// Dr Maxim Orlovsky -// -// Copyright (C) 2020-2024 LNP/BP Standards Association. All rights reserved. -// Copyright (C) 2020-2024 Dr Maxim Orlovsky. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use derive::{Address, AddressError, AddressNetwork, DeriveScripts, Idx, Keychain, NormalIndex}; - -#[derive(Clone, Eq, PartialEq, Hash, Debug)] -pub struct AddressFactory { - pub descriptor: D, - pub network: AddressNetwork, - pub keychain: Keychain, - pub unused_tip: NormalIndex, -} - -impl Iterator for AddressFactory { - type Item = Address; - - fn next(&mut self) -> Option { - let addr = - self.descriptor.derive_address(self.network, self.keychain, self.unused_tip).ok()?; - self.unused_tip.wrapping_inc_assign(); - Some(addr) - } -} - -impl AddressFactory { - pub fn address(&self, index: NormalIndex) -> Result { - self.descriptor.derive_address(self.network, self.keychain, index) - } -} diff --git a/descriptors/src/lib.rs b/descriptors/src/lib.rs index 4265f01..8b45a49 100644 --- a/descriptors/src/lib.rs +++ b/descriptors/src/lib.rs @@ -26,13 +26,11 @@ extern crate amplify; #[macro_use] extern crate serde_crate as serde; -mod factory; mod descriptor; mod multisig; mod segwit; mod taproot; pub use descriptor::{Descriptor, LegacyKeySig, SpkClass, StdDescr, TaprootKeySig}; -pub use factory::AddressFactory; pub use segwit::Wpkh; pub use taproot::TrKey; diff --git a/descriptors/src/segwit.rs b/descriptors/src/segwit.rs index e378a0b..514160b 100644 --- a/descriptors/src/segwit.rs +++ b/descriptors/src/segwit.rs @@ -52,9 +52,10 @@ impl Derive for Wpkh { &self, keychain: impl Into, index: impl Into, - ) -> DerivedScript { - let key = self.0.derive(keychain, index); - DerivedScript::Bare(ScriptPubkey::p2wpkh(WPubkeyHash::from(key))) + ) -> impl Iterator { + self.0 + .derive(keychain, index) + .map(|key| DerivedScript::Bare(ScriptPubkey::p2wpkh(WPubkeyHash::from(key)))) } } @@ -72,10 +73,10 @@ impl Descriptor for Wpkh { fn xpubs(&self) -> impl Iterator { iter::once(self.0.xpub_spec()) } fn legacy_keyset(&self, terminal: Terminal) -> IndexMap { - let mut map = IndexMap::with_capacity(1); - let key = self.0.derive(terminal.keychain, terminal.index); - map.insert(key.into(), KeyOrigin::with(self.0.xpub_spec().origin().clone(), terminal)); - map + self.0 + .derive(terminal.keychain, terminal.index) + .map(|key| (key.into(), KeyOrigin::with(self.0.xpub_spec().origin().clone(), terminal))) + .collect() } fn xonly_keyset(&self, _terminal: Terminal) -> IndexMap { diff --git a/descriptors/src/taproot.rs b/descriptors/src/taproot.rs index e5cf436..decfe8d 100644 --- a/descriptors/src/taproot.rs +++ b/descriptors/src/taproot.rs @@ -52,9 +52,10 @@ impl Derive for TrKey { &self, keychain: impl Into, index: impl Into, - ) -> DerivedScript { - let internal_key = self.0.derive(keychain, index); - DerivedScript::TaprootKeyOnly(InternalPk::from_unchecked(internal_key)) + ) -> impl Iterator { + self.0.derive(keychain, index).map(|internal_key| { + DerivedScript::TaprootKeyOnly(InternalPk::from_unchecked(internal_key)) + }) } } @@ -76,13 +77,15 @@ impl Descriptor for TrKey { } fn xonly_keyset(&self, terminal: Terminal) -> IndexMap { - let mut map = IndexMap::with_capacity(1); - let key = self.0.derive(terminal.keychain, terminal.index); - map.insert( - key, - TapDerivation::with_internal_pk(self.0.xpub_spec().origin().clone(), terminal), - ); - map + self.0 + .derive(terminal.keychain, terminal.index) + .map(|key| { + ( + key, + TapDerivation::with_internal_pk(self.0.xpub_spec().origin().clone(), terminal), + ) + }) + .collect() } fn legacy_witness( @@ -103,10 +106,3 @@ impl Descriptor for TrKey { impl Display for TrKey { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "tr({})", self.0) } } - -/* -pub struct TrScript { - internal_key: K, - tap_tree: TapTree>, -} -*/ diff --git a/psbt/src/constructor.rs b/psbt/src/constructor.rs index 70ea4b2..1e5a7c5 100644 --- a/psbt/src/constructor.rs +++ b/psbt/src/constructor.rs @@ -37,6 +37,9 @@ pub enum ConstructionError { #[display(inner)] Psbt(PsbtError), + /// the input spending {0} is not known for the current wallet. + UnknownInput(Outpoint), + /// impossible to construct transaction having no inputs. NoInputs, @@ -195,7 +198,7 @@ pub trait PsbtConstructor { type Descr: Descriptor; fn descriptor(&self) -> &Self::Descr; - fn utxo(&self, outpoint: Outpoint) -> Option; + fn utxo(&self, outpoint: Outpoint) -> Option<(Utxo, ScriptPubkey)>; fn network(&self) -> Network; fn next_derivation_index(&mut self, keychain: impl Into, shift: bool) -> NormalIndex; @@ -217,11 +220,12 @@ pub trait PsbtConstructor { // 1. Add inputs for coin in coins { - let utxo = self.utxo(coin).expect("wallet data inconsistency"); + let (utxo, spk) = self.utxo(coin).ok_or(ConstructionError::UnknownInput(coin))?; psbt.construct_input_expect( utxo.to_prevout(), self.descriptor(), utxo.terminal, + spk, params.seq_no, ); } diff --git a/psbt/src/data.rs b/psbt/src/data.rs index cc1e283..dc1e37d 100644 --- a/psbt/src/data.rs +++ b/psbt/src/data.rs @@ -322,13 +322,17 @@ impl Psbt { prevout: Prevout, descriptor: &D, terminal: Terminal, + script_pubkey: ScriptPubkey, sequence: SeqNo, ) -> Result<&mut Input, Unmodifiable> { if !self.are_inputs_modifiable() { return Err(Unmodifiable); } - let scripts = descriptor.derive(terminal.keychain, terminal.index); + let script = descriptor + .derive(terminal.keychain, terminal.index) + .find(|script| script.to_script_pubkey() == script_pubkey) + .expect("unable to generate input matching prevout"); let input = Input { index: self.inputs.len(), previous_outpoint: prevout.outpoint(), @@ -336,11 +340,11 @@ impl Psbt { required_time_lock: None, required_height_lock: None, non_witness_tx: None, - witness_utxo: Some(TxOut::new(scripts.to_script_pubkey(), prevout.value)), + witness_utxo: Some(TxOut::new(script.to_script_pubkey(), prevout.value)), partial_sigs: none!(), sighash_type: None, - redeem_script: scripts.to_redeem_script(), - witness_script: scripts.to_witness_script(), + redeem_script: script.to_redeem_script(), + witness_script: script.to_witness_script(), bip32_derivation: descriptor.legacy_keyset(terminal), // TODO #36: Fill hash preimages from descriptor final_script_sig: None, @@ -352,10 +356,10 @@ impl Psbt { hash256: none!(), tap_key_sig: None, tap_script_sig: none!(), - tap_leaf_script: scripts.to_leaf_scripts(), + tap_leaf_script: script.to_leaf_scripts(), tap_bip32_derivation: descriptor.xonly_keyset(terminal), - tap_internal_key: scripts.to_internal_pk(), - tap_merkle_root: scripts.to_tap_root(), + tap_internal_key: script.to_internal_pk(), + tap_merkle_root: script.to_tap_root(), proprietary: none!(), unknown: none!(), }; @@ -368,9 +372,10 @@ impl Psbt { prevout: Prevout, descriptor: &D, terminal: Terminal, + script_pubkey: ScriptPubkey, sequence: SeqNo, ) -> &mut Input { - self.construct_input(prevout, descriptor, terminal, sequence) + self.construct_input(prevout, descriptor, terminal, script_pubkey, sequence) .expect("PSBT inputs are expected to be modifiable") } @@ -411,16 +416,19 @@ impl Psbt { return Err(Unmodifiable); } - let scripts = descriptor.derive(change_terminal.keychain, change_terminal.index); + let script = descriptor + .derive(change_terminal.keychain, change_terminal.index) + .next() + .expect("unable to generate change script"); let output = Output { index: self.outputs.len(), amount: value, - script: scripts.to_script_pubkey(), - redeem_script: scripts.to_redeem_script(), - witness_script: scripts.to_witness_script(), + script: script.to_script_pubkey(), + redeem_script: script.to_redeem_script(), + witness_script: script.to_witness_script(), bip32_derivation: descriptor.legacy_keyset(change_terminal), - tap_internal_key: scripts.to_internal_pk(), - tap_tree: scripts.to_tap_tree(), + tap_internal_key: script.to_internal_pk(), + tap_tree: script.to_tap_tree(), tap_bip32_derivation: descriptor.xonly_keyset(change_terminal), proprietary: none!(), unknown: none!(), From 61acc8a9b4074039c296760875751f375b275e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Wed, 2 Apr 2025 18:36:04 +0200 Subject: [PATCH 09/13] chore: bump MSRV to 1.81.0 --- .github/workflows/build.yml | 2 +- Cargo.lock | 288 ++++++++++++++++++++---------------- Cargo.toml | 7 +- MANIFEST.yml | 2 +- 4 files changed, 167 insertions(+), 132 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4403df9..d1dc4bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,7 @@ jobs: strategy: fail-fast: false matrix: - toolchain: [ nightly, beta, stable, 1.77.0 ] + toolchain: [ nightly, beta, stable, 1.81.0 ] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master diff --git a/Cargo.lock b/Cargo.lock index 949ac2a..188af1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -133,9 +133,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bitcoin-io" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" +checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf" [[package]] name = "bitcoin_hashes" @@ -149,9 +149,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "block-buffer" @@ -165,8 +165,7 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.1-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40f227ce25d185bc5fc9109ca83dfa8bd0e745f219e320f3da658aaf4fd7e0c5" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" dependencies = [ "amplify", "chrono", @@ -179,8 +178,7 @@ dependencies = [ [[package]] name = "bp-core" version = "0.11.1-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c6b213ada98fe5e78a978e67a7044d16d2571edb3f85fcdb4246324ec9514a" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" dependencies = [ "amplify", "bp-consensus", @@ -196,8 +194,7 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.1-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d33d4cc345a595236441fc2b8726ca7eb693947914b278849d1e2c1923dcb314" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" dependencies = [ "amplify", "base85", @@ -235,8 +232,7 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.1-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a7a009fbf7e71be7ab5f43e032c69927f58cd7f59a6a822af64f84d3e8d41c5" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" dependencies = [ "amplify", "baid64", @@ -269,21 +265,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "byteorder" -version = "1.5.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "cc" -version = "1.1.31" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] @@ -296,23 +286,22 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", ] [[package]] name = "commit_encoding_derive" version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc09678c15e9280cc6eaf29bf437a2cf18fadedd8bf78c369b8ac15fa217dbe5" +source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#c6bdd35814dc2d316bc5d1f0f1d13293ca2ec64e" dependencies = [ "amplify", "amplify_syn", @@ -324,8 +313,7 @@ dependencies = [ [[package]] name = "commit_verify" version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcf5f557e112c684f2458f20c66bab865c01cab56d6a318f64243cba9b163a7" +source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#c6bdd35814dc2d316bc5d1f0f1d13293ca2ec64e" dependencies = [ "amplify", "commit_encoding_derive", @@ -337,16 +325,6 @@ dependencies = [ "vesper-lang", ] -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -355,18 +333,18 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-common" @@ -401,9 +379,9 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "generic-array" @@ -430,9 +408,9 @@ dependencies = [ [[package]] name = "half" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1" dependencies = [ "cfg-if", "crunchy", @@ -440,9 +418,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -470,14 +448,15 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -493,9 +472,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown", @@ -504,30 +483,31 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.161" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "log" -version = "0.4.22" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "minicov" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def6d99771d7c499c26ad4d40eb6645eafd3a1553b35fc26ea5a489a45e82d9a" +checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b" dependencies = [ "cc", "walkdir", @@ -550,9 +530,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "paste" @@ -562,18 +542,18 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] @@ -596,9 +576,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -642,6 +622,12 @@ dependencies = [ "digest", ] +[[package]] +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + [[package]] name = "same-file" version = "1.0.6" @@ -651,12 +637,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "secp256k1" version = "0.30.0" @@ -680,22 +660,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.100", ] [[package]] @@ -736,21 +716,20 @@ dependencies = [ [[package]] name = "strict_encoding" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69b4893cf054e129d5288a565102124520d7b94eb9589d1e78202abc7e2092d" +checksum = "22e4b581b61221082818d58db91630aed6e4a3237afb775fc7e5e4e2eba50d5e" dependencies = [ "amplify", - "half", "strict_encoding_derive", "wasm-bindgen", ] [[package]] name = "strict_encoding_derive" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4f9b678862372f8e439bcaafc27df7610ea93b06d2deb6244dec0af4259ce6" +checksum = "34e3bc6e4a2450420b4dbfb6929d9ce005e8c36cf73bf215db99f0d09c9fa79f" dependencies = [ "amplify_syn", "heck", @@ -804,9 +783,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -815,35 +794,35 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.100", ] [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "version_check" @@ -879,47 +858,48 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -927,33 +907,34 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "wasm-bindgen-test" -version = "0.3.45" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d381749acb0943d357dcbd8f0b100640679883fcdeeef04def49daf8d33a5426" +checksum = "66c8d5e33ca3b6d9fa3b4676d774c5778031d27a578c2b007f905acf816152c3" dependencies = [ - "console_error_panic_hook", "js-sys", "minicov", - "scoped-tls", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test-macro", @@ -961,20 +942,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.45" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0" +checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.100", ] [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -991,11 +972,61 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.52.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" dependencies = [ - "windows-targets", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-result" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" +dependencies = [ + "windows-link", ] [[package]] @@ -1073,21 +1104,20 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.100", ] diff --git a/Cargo.toml b/Cargo.toml index 0c85939..26b390e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies"] authors = ["Dr Maxim Orlovsky "] homepage = "https://lnp-bp.org" repository = "https://github.com/BP-WG/bp-wallet" -rust-version = "1.77.0" # Due to `rustfix` +rust-version = "1.81.0" edition = "2021" license = "Apache-2.0" @@ -71,3 +71,8 @@ getrandom = { version = "0.2", features = ["js"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3" + +[patch.crates-io] +commit_verify = { git = "https://github.com/zoedberg/client_side_validation", branch = "0.11.1-2" } +bp-consensus = { git = "https://github.com/zoedberg/bp-core", branch = "0.11.1-2" } +bp-core = { git = "https://github.com/zoedberg/bp-core", branch = "0.11.1-2" } diff --git a/MANIFEST.yml b/MANIFEST.yml index 25819fd..722679a 100644 --- a/MANIFEST.yml +++ b/MANIFEST.yml @@ -3,7 +3,7 @@ Type: Library Kind: Free software License: Apache-2.0 Language: Rust -Compiler: 1.77 +Compiler: 1.81 Author: Maxim Orlovsky Maintained: LNP/BP Standards Association, Switzerland Maintainers: From 6ce4c93b26e382f34f47dc2dbdcb37ffee727c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Thu, 3 Apr 2025 15:43:55 +0200 Subject: [PATCH 10/13] refactor anchor and related structures --- Cargo.lock | 8 ++++---- psbt/src/csval/dbc.rs | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 188af1e..32e054c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,7 +165,7 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" dependencies = [ "amplify", "chrono", @@ -178,7 +178,7 @@ dependencies = [ [[package]] name = "bp-core" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" dependencies = [ "amplify", "bp-consensus", @@ -194,7 +194,7 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" dependencies = [ "amplify", "base85", @@ -232,7 +232,7 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#2f0fd1f6c5cd81f748bacd8237993bdb7bdfe9d1" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" dependencies = [ "amplify", "baid64", diff --git a/psbt/src/csval/dbc.rs b/psbt/src/csval/dbc.rs index 9e13406..864b75f 100644 --- a/psbt/src/csval/dbc.rs +++ b/psbt/src/csval/dbc.rs @@ -21,7 +21,7 @@ use bp::dbc::opret::OpretProof; use bp::dbc::tapret::TapretProof; -use bp::dbc::{self, Anchor, Method}; +use bp::dbc::{self, Method}; use commit_verify::mpc; use crate::{MpcPsbtError, OpretKeyError, Output, Psbt, TapretKeyError}; @@ -70,17 +70,14 @@ impl Psbt { }) } - pub fn dbc_commit( - &mut self, - ) -> Result, DbcPsbtError> { + pub fn dbc_commit(&mut self) -> Result<(mpc::MerkleBlock, D), DbcPsbtError> { if self.are_outputs_modifiable() { return Err(DbcPsbtError::TxOutputsModifiable); } let output = self.dbc_output_mut::().ok_or(DbcPsbtError::NoProperOutput(D::METHOD))?; - let (mpc_proof, dbc_proof) = D::dbc_commit(output)?; - Ok(Anchor::new(mpc_proof, dbc_proof)) + D::dbc_commit(output) } } From 093cd51d7a9d61d2ce7f458770e67c8fccd1f957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Fri, 11 Apr 2025 16:11:24 +0200 Subject: [PATCH 11/13] add Psbt serde deserialization + fix JSON serialization --- Cargo.lock | 87 ++++++++++++++- derive/src/taptree.rs | 8 +- psbt/Cargo.toml | 5 + psbt/src/data.rs | 158 ++++++++++++++++++++++++-- psbt/src/keys.rs | 2 +- psbt/src/lib.rs | 4 +- psbt/src/serde_utils.rs | 242 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 490 insertions(+), 16 deletions(-) create mode 100644 psbt/src/serde_utils.rs diff --git a/Cargo.lock b/Cargo.lock index 32e054c..7016a9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,7 +165,7 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" dependencies = [ "amplify", "chrono", @@ -178,7 +178,7 @@ dependencies = [ [[package]] name = "bp-core" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" dependencies = [ "amplify", "bp-consensus", @@ -194,7 +194,7 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" dependencies = [ "amplify", "base85", @@ -232,7 +232,7 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#55e5cd9ba902c198ae4cfdcc241047a6190630cd" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" dependencies = [ "amplify", "baid64", @@ -298,6 +298,33 @@ dependencies = [ "windows-link", ] +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "commit_encoding_derive" version = "0.11.0" @@ -481,6 +508,12 @@ dependencies = [ "serde", ] +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + [[package]] name = "js-sys" version = "0.3.77" @@ -503,6 +536,12 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + [[package]] name = "minicov" version = "0.3.7" @@ -567,10 +606,13 @@ dependencies = [ "bp-core", "bp-derive", "chrono", + "ciborium", "commit_verify", "descriptors", "indexmap", "serde", + "serde_json", + "serde_yaml", "strict_encoding", ] @@ -628,6 +670,12 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + [[package]] name = "same-file" version = "1.0.6" @@ -678,6 +726,18 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + [[package]] name = "serde_str_helpers" version = "0.1.2" @@ -688,6 +748,19 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sha2" version = "0.10.8" @@ -824,6 +897,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "version_check" version = "0.9.5" diff --git a/derive/src/taptree.rs b/derive/src/taptree.rs index 6b8a2f9..4b8ec84 100644 --- a/derive/src/taptree.rs +++ b/derive/src/taptree.rs @@ -97,7 +97,11 @@ impl TapTreeBuilder { /// Non-empty taproot script tree. #[derive(Clone, Eq, PartialEq, Hash, Debug, Default)] -#[cfg_attr(feature = "serde", derive(Serialize), serde(crate = "serde_crate", transparent))] +#[cfg_attr( + feature = "serde", + derive(Serialize, Deserialize), + serde(crate = "serde_crate", transparent) +)] pub struct TapTree(Vec); impl Deref for TapTree { @@ -153,7 +157,7 @@ impl TapTree { #[derive(Clone, Eq, PartialEq, Hash, Debug)] #[cfg_attr( feature = "serde", - derive(Serialize), + derive(Serialize, Deserialize), serde(crate = "serde_crate", rename_all = "camelCase") )] pub struct LeafInfo { diff --git a/psbt/Cargo.toml b/psbt/Cargo.toml index e0f3739..294cc0f 100644 --- a/psbt/Cargo.toml +++ b/psbt/Cargo.toml @@ -24,6 +24,11 @@ base64 = "0.22.1" chrono = "0.4.38" serde_crate = { workspace = true, optional = true } +[dev-dependencies] +ciborium = "0.2.2" +serde_json = "1.0.140" +serde_yaml = "0.9.34" + [features] default = [] all = ["serde", "client-side-validation"] diff --git a/psbt/src/data.rs b/psbt/src/data.rs index dc1e37d..bbc0c92 100644 --- a/psbt/src/data.rs +++ b/psbt/src/data.rs @@ -174,12 +174,9 @@ impl UnsignedTxIn { #[derive(Clone, Eq, PartialEq, Debug)] #[cfg_attr( feature = "serde", - derive(Serialize), + derive(Serialize, Deserialize), serde(crate = "serde_crate", rename_all = "camelCase") )] -// Serde deserialize is not implemented and require manual implementation instead of derive, since -// we need to correctly initialize inputs and outputs with their indexes and account for unknown -// fields. pub struct Psbt { /// PSBT version pub version: PsbtVer, @@ -204,6 +201,7 @@ pub struct Psbt { pub(crate) tx_modifiable: Option, /// Proprietary keys + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq_byte_values"))] pub proprietary: IndexMap, /// Unknown keys @@ -609,12 +607,11 @@ impl Weight for Psbt { #[derive(Clone, Eq, PartialEq, Debug)] #[cfg_attr( feature = "serde", - derive(Serialize), + derive(Serialize, Deserialize), serde(crate = "serde_crate", rename_all = "camelCase") )] pub struct Input { /// The index of this input. Used in error reporting. - #[cfg_attr(feature = "serde", serde(skip))] pub(crate) index: usize, /// Previous transaction outpoint to spent. @@ -646,6 +643,7 @@ pub struct Input { /// A map from public keys to their corresponding signature as would be /// pushed to the stack from a scriptSig or witness for a non-taproot /// inputs. + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq"))] pub partial_sigs: IndexMap, /// The sighash type to be used for this input. Signatures for this input @@ -660,6 +658,7 @@ pub struct Input { /// A map from public keys needed to sign this input to their corresponding master key /// fingerprints and derivation paths. + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq"))] pub bip32_derivation: IndexMap, /// The finalized, fully-constructed scriptSig with signatures and any other scripts necessary @@ -696,12 +695,14 @@ pub struct Input { /// The 64 or 65 byte Schnorr signature for this pubkey and leaf combination. Finalizers /// should remove this field after `PSBT_IN_FINAL_SCRIPTWITNESS` is constructed. + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq"))] pub tap_script_sig: IndexMap<(XOnlyPk, TapLeafHash), Bip340Sig>, /// The script for this leaf as would be provided in the witness stack followed by the single /// byte leaf version. Note that the leaves included in this field should be those that the /// signers of this input are expected to be able to sign for. Finalizers should remove this /// field after `PSBT_IN_FINAL_SCRIPTWITNESS` is constructed. + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq"))] pub tap_leaf_script: IndexMap, /// A compact size unsigned integer representing the number of leaf hashes, followed by a list @@ -722,6 +723,7 @@ pub struct Input { pub tap_merkle_root: Option, /// Proprietary keys + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq_byte_values"))] pub proprietary: IndexMap, /// Unknown keys @@ -938,12 +940,11 @@ impl Input { #[derive(Clone, Eq, PartialEq, Debug)] #[cfg_attr( feature = "serde", - derive(Serialize), + derive(Serialize, Deserialize), serde(crate = "serde_crate", rename_all = "camelCase") )] pub struct Output { /// The index of this output. Used in error reporting. - #[cfg_attr(feature = "serde", serde(skip))] pub(crate) index: usize, /// The output's amount in satoshis. @@ -960,6 +961,7 @@ pub struct Output { /// A map from public keys needed to spend this output to their corresponding master key /// fingerprints and derivation paths. + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq"))] pub bip32_derivation: IndexMap, /// The X-only pubkey used as the internal key in this output. @@ -984,6 +986,7 @@ pub struct Output { pub tap_bip32_derivation: IndexMap, /// Proprietary keys + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::indexmap_as_seq_byte_values"))] pub proprietary: IndexMap, /// Unknown keys @@ -1120,6 +1123,16 @@ impl ModifiableFlags { #[cfg(test)] mod tests { + #![allow(unused)] + + use std::io::Cursor; + use std::str::FromStr; + + use amplify::confinement::Confined; + use commit_verify::mpc::ProtocolId; + use derive::{DerivationPath, Idx, Keychain, NormalIndex}; + use strict_encoding::StrictDumb; + use super::*; #[test] @@ -1197,4 +1210,133 @@ mod tests { let result = std::panic::catch_unwind(|| format!("{v0_psbt:#03x}")); assert!(result.is_err(), "Should fail on unsupported psbt version"); } + + #[cfg(feature = "serde")] + #[test] + fn psbt_serde_roundtrip() { + let proprietary = IndexMap::from([( + PropKey::mpc_message(ProtocolId::strict_dumb()), + ValueData::from(vec![7]), + )]); + + let unknown = IndexMap::from([( + 5, + IndexMap::from([(KeyData::strict_dumb(), ValueData::from(vec![9]))]), + )]); + + let xpub = Xpub::from_str("xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8").unwrap(); + let xkeyorigin = XkeyOrigin::from_str("c5e95ba5/86h/1h/0h").unwrap(); + let xpubs = IndexMap::from([(xpub, xkeyorigin.clone())]); + + let derivation_path = DerivationPath::from_str("86h/1h/0h").unwrap(); + let keyorigin = KeyOrigin::new(xkeyorigin.master_fp(), derivation_path); + let bip32_derivation = IndexMap::from([(LegacyPk::strict_dumb(), keyorigin.clone())]); + + let tx = Tx { + version: TxVer::V2, + inputs: Confined::from_checked(vec![TxIn { + prev_output: Outpoint::strict_dumb(), + sig_script: SigScript::strict_dumb(), + sequence: SeqNo::strict_dumb(), + witness: Witness::strict_dumb(), + }]), + outputs: Confined::from_checked(vec![TxOut { + value: Sats::ZERO, + script_pubkey: ScriptPubkey::strict_dumb(), + }]), + lock_time: LockTime::ZERO, + }; + + let input_1 = Input { + index: 8, + previous_outpoint: Outpoint::strict_dumb(), + sequence_number: Some(SeqNo::ZERO), + required_time_lock: Some(LockTimestamp::anytime()), + required_height_lock: Some(LockHeight::anytime()), + non_witness_tx: Some(tx), + witness_utxo: Some(TxOut::strict_dumb()), + partial_sigs: IndexMap::from([(LegacyPk::strict_dumb(), LegacySig::strict_dumb())]), + sighash_type: Some(SighashType::all()), + redeem_script: Some(RedeemScript::strict_dumb()), + witness_script: Some(WitnessScript::strict_dumb()), + bip32_derivation: bip32_derivation.clone(), + final_script_sig: Some(SigScript::strict_dumb()), + final_witness: Some(Witness::strict_dumb()), + proof_of_reserves: Some(s!("proof_of_reserves")), + ripemd160: IndexMap::from([(Bytes20::with_fill(5), ByteStr::strict_dumb())]), + sha256: IndexMap::from([(Bytes32::with_fill(5), ByteStr::strict_dumb())]), + hash160: IndexMap::from([(Bytes20::with_fill(5), ByteStr::strict_dumb())]), + hash256: IndexMap::from([(Bytes32::with_fill(5), ByteStr::strict_dumb())]), + tap_key_sig: Some(Bip340Sig::strict_dumb()), + tap_script_sig: IndexMap::from([( + (XOnlyPk::strict_dumb(), TapLeafHash::strict_dumb()), + Bip340Sig::strict_dumb(), + )]), + tap_leaf_script: IndexMap::from([( + ControlBlock::strict_dumb(), + LeafScript::strict_dumb(), + )]), + tap_bip32_derivation: IndexMap::from([(XOnlyPk::strict_dumb(), TapDerivation { + leaf_hashes: vec![TapLeafHash::strict_dumb()], + origin: keyorigin, + })]), + tap_internal_key: Some(InternalPk::strict_dumb()), + tap_merkle_root: Some(TapNodeHash::strict_dumb()), + proprietary: proprietary.clone(), + unknown: unknown.clone(), + }; + + let mut input_2 = input_1.clone(); + input_2.index = 3; + + let output = Output { + index: 1, + amount: Sats::from_sats(5u64), + script: ScriptPubkey::strict_dumb(), + redeem_script: Some(RedeemScript::strict_dumb()), + witness_script: Some(WitnessScript::strict_dumb()), + bip32_derivation, + tap_internal_key: Some(InternalPk::strict_dumb()), + tap_tree: Some(TapTree::with_single_leaf(LeafScript::strict_dumb())), + tap_bip32_derivation: IndexMap::from([( + XOnlyPk::strict_dumb(), + TapDerivation::with_internal_pk(xkeyorigin, Terminal { + keychain: Keychain::INNER, + index: NormalIndex::ZERO, + }), + )]), + proprietary: proprietary.clone(), + unknown: unknown.clone(), + }; + + let tx_modifiable = Some(ModifiableFlags::modifiable()); + + let psbt_orig = Psbt { + version: PsbtVer::V2, + tx_version: TxVer::V2, + fallback_locktime: Some(LockTime::ZERO), + inputs: vec![input_1, input_2], + outputs: vec![output], + xpubs, + tx_modifiable, + proprietary, + unknown, + }; + + // CBOR + let mut buf = Vec::new(); + ciborium::into_writer(&psbt_orig, &mut buf).unwrap(); + let psbt_post: Psbt = ciborium::from_reader(Cursor::new(&buf)).unwrap(); + assert_eq!(psbt_orig, psbt_post); + + // JSON + let psbt_str = serde_json::to_string(&psbt_orig).unwrap(); + let psbt_post: Psbt = serde_json::from_str(&psbt_str).unwrap(); + assert_eq!(psbt_orig, psbt_post); + + // YAML + let psbt_str = serde_yaml::to_string(&psbt_orig).unwrap(); + let psbt_post: Psbt = serde_yaml::from_str(&psbt_str).unwrap(); + assert_eq!(psbt_orig, psbt_post); + } } diff --git a/psbt/src/keys.rs b/psbt/src/keys.rs index 28c0cc2..f82e927 100644 --- a/psbt/src/keys.rs +++ b/psbt/src/keys.rs @@ -730,7 +730,7 @@ impl<'a, T: KeyType> KeyPair, Box> { #[derive(Clone, PartialOrd, Ord, Eq, PartialEq, Hash, Debug, Display)] #[cfg_attr( feature = "serde", - derive(Serialize), + derive(Serialize, Deserialize), serde(crate = "serde_crate", rename_all = "camelCase") )] #[display("{identifier} {subtype:#x} {data:#x}")] diff --git a/psbt/src/lib.rs b/psbt/src/lib.rs index d56a6b3..481884e 100644 --- a/psbt/src/lib.rs +++ b/psbt/src/lib.rs @@ -37,6 +37,8 @@ mod coders; mod csval; pub mod constructor; mod sign; +#[cfg(feature = "serde")] +mod serde_utils; pub use coders::{Decode, DecodeError, Encode, PsbtError}; pub use constructor::{ @@ -63,7 +65,7 @@ pub struct PsbtUnsupportedVer(u32); #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)] #[cfg_attr( feature = "serde", - derive(Serialize), + derive(Serialize, Deserialize), serde(crate = "serde_crate", rename_all = "camelCase") )] pub enum PsbtVer { diff --git a/psbt/src/serde_utils.rs b/psbt/src/serde_utils.rs new file mode 100644 index 0000000..85c1fc7 --- /dev/null +++ b/psbt/src/serde_utils.rs @@ -0,0 +1,242 @@ +// Modern, minimalistic & standard-compliant cold wallet library. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Written in 2025 by +// Zoe FaltibĂ  +// +// Copyright (C) 2025 LNP/BP Standards Association. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Bitcoin serde utilities. +//! +//! This module is for special serde serializations. + +pub(crate) struct SerializeBytesAsHex<'a>(pub(crate) &'a [u8]); + +impl serde::Serialize for SerializeBytesAsHex<'_> { + fn serialize(&self, serializer: S) -> Result + where S: serde::Serializer { + use amplify::hex::ToHex; + + serializer.collect_str(&format_args!("{}", self.0.to_hex())) + } +} + +pub mod indexmap_as_seq { + //! Module for serialization of IndexMaps as lists of sequences because + //! serde_json will not serialize hashmaps with non-string keys be default. + #![allow(missing_docs)] + + use indexmap::IndexMap; + + pub fn serialize(v: &IndexMap, s: S) -> Result + where + S: serde::Serializer, + T: serde::Serialize + core::hash::Hash + Eq + Ord, + U: serde::Serialize, + { + use serde::ser::SerializeSeq; + + // Don't do anything special when not human readable. + if !s.is_human_readable() { + serde::Serialize::serialize(v, s) + } else { + let mut seq = s.serialize_seq(Some(v.len()))?; + for pair in v.iter() { + seq.serialize_element(&pair)?; + } + seq.end() + } + } + + pub fn deserialize<'de, D, T, U>(d: D) -> Result, D::Error> + where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de> + core::hash::Hash + Eq + Ord, + U: serde::Deserialize<'de>, + { + use core::marker::PhantomData; + + struct Visitor(PhantomData<(T, U)>); + impl<'de, T, U> serde::de::Visitor<'de> for Visitor + where + T: serde::Deserialize<'de> + core::hash::Hash + Eq + Ord, + U: serde::Deserialize<'de>, + { + type Value = IndexMap; + + fn expecting(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + write!(f, "a sequence of pairs") + } + + fn visit_seq>( + self, + mut a: A, + ) -> Result { + let mut ret = IndexMap::new(); + while let Some((key, value)) = a.next_element()? { + ret.insert(key, value); + } + Ok(ret) + } + } + + // Don't do anything special when not human readable. + if !d.is_human_readable() { + serde::Deserialize::deserialize(d) + } else { + d.deserialize_seq(Visitor(PhantomData)) + } + } +} + +pub mod indexmap_as_seq_byte_values { + //! Module for serialization of IndexMaps as lists of sequences because + //! serde_json will not serialize hashmaps with non-string keys be default. + #![allow(missing_docs)] + + use indexmap::IndexMap; + + use crate::ValueData; + + /// A custom key-value pair type that serialized the bytes as hex. + #[derive(Debug, Deserialize)] + #[cfg_attr(feature = "serde", serde(crate = "serde_crate"))] + struct OwnedPair( + T, + #[serde(deserialize_with = "crate::serde_utils::hex_bytes::deserialize")] ValueData, + ); + + /// A custom key-value pair type that serialized the bytes as hex. + #[derive(Debug, Serialize)] + #[cfg_attr(feature = "serde", serde(crate = "serde_crate"))] + struct BorrowedPair<'a, T: 'static>( + &'a T, + #[serde(serialize_with = "crate::serde_utils::hex_bytes::serialize")] &'a [u8], + ); + + pub fn serialize(v: &IndexMap, s: S) -> Result + where + S: serde::Serializer, + T: serde::Serialize + core::hash::Hash + Eq + Ord + 'static, + { + use serde::ser::SerializeSeq; + + // Don't do anything special when not human readable. + if !s.is_human_readable() { + serde::Serialize::serialize(v, s) + } else { + let mut seq = s.serialize_seq(Some(v.len()))?; + for (key, value) in v.iter() { + seq.serialize_element(&BorrowedPair(key, value))?; + } + seq.end() + } + } + + pub fn deserialize<'de, D, T>(d: D) -> Result, D::Error> + where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de> + core::hash::Hash + Eq + Ord, + { + use core::marker::PhantomData; + + struct Visitor(PhantomData); + impl<'de, T> serde::de::Visitor<'de> for Visitor + where T: serde::Deserialize<'de> + core::hash::Hash + Eq + Ord + { + type Value = IndexMap; + + fn expecting(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + write!(f, "a sequence of pairs") + } + + fn visit_seq>( + self, + mut a: A, + ) -> Result { + let mut ret = IndexMap::new(); + while let Option::Some(OwnedPair(key, value)) = a.next_element()? { + ret.insert(key, value); + } + Ok(ret) + } + } + + // Don't do anything special when not human readable. + if !d.is_human_readable() { + serde::Deserialize::deserialize(d) + } else { + d.deserialize_seq(Visitor(PhantomData)) + } + } +} + +pub mod hex_bytes { + //! Module for serialization of byte arrays as hex strings. + #![allow(missing_docs)] + + use amplify::hex::FromHex; + + pub fn serialize(bytes: &T, s: S) -> Result + where + T: serde::Serialize + AsRef<[u8]>, + S: serde::Serializer, + { + // Don't do anything special when not human readable. + if !s.is_human_readable() { + serde::Serialize::serialize(bytes, s) + } else { + serde::Serialize::serialize(&super::SerializeBytesAsHex(bytes.as_ref()), s) + } + } + + pub fn deserialize<'de, D, B>(d: D) -> Result + where + D: serde::Deserializer<'de>, + B: serde::Deserialize<'de> + FromHex, + { + struct Visitor(core::marker::PhantomData); + + impl serde::de::Visitor<'_> for Visitor { + type Value = B; + + fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result { + formatter.write_str("an ASCII hex string") + } + + fn visit_bytes(self, v: &[u8]) -> Result + where E: serde::de::Error { + if let Ok(hex) = core::str::from_utf8(v) { + FromHex::from_hex(hex).map_err(E::custom) + } else { + Err(E::invalid_value(serde::de::Unexpected::Bytes(v), &self)) + } + } + + fn visit_str(self, v: &str) -> Result + where E: serde::de::Error { + FromHex::from_hex(v).map_err(E::custom) + } + } + + // Don't do anything special when not human readable. + if !d.is_human_readable() { + serde::Deserialize::deserialize(d) + } else { + d.deserialize_str(Visitor(core::marker::PhantomData)) + } + } +} From 31056fded67bbd1a3ceb10cfefd08846e5a081de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Fri, 18 Apr 2025 18:41:55 +0200 Subject: [PATCH 12/13] update deps --- .github/workflows/test.yml | 2 +- Cargo.lock | 149 +++++++++++++++++++++++++++---------- Cargo.toml | 9 ++- 3 files changed, 115 insertions(+), 45 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9821d00..b56e176 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,4 +36,4 @@ jobs: - name: Add wasm32 target run: rustup target add wasm32-unknown-unknown - name: Test in headless Chrome - run: wasm-pack test --headless --chrome + run: RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack test --headless --chrome diff --git a/Cargo.lock b/Cargo.lock index 7016a9a..0a47da7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "amplify" -version = "4.7.1" +version = "4.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2090b9b79b61d4047a307a46de043d0ee5ec406d99a7d652341b96d48ed5567" +checksum = "3a9d7cb29f1d4c6ec8650abbee35948b8bdefb7f0750a26445ff593eb9bf7fcf" dependencies = [ "amplify_apfloat", "amplify_derive", @@ -100,9 +100,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "baid64" -version = "0.2.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95dabc2759e01e2c382968639868a701f384a18890934f9e75d4feb4d6623794" +checksum = "6cb4a8b2f1afee4ef00a190b260ad871842b93206177b59631fecd325d48d538" dependencies = [ "amplify", "base64", @@ -165,7 +165,7 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" dependencies = [ "amplify", "chrono", @@ -173,19 +173,21 @@ dependencies = [ "secp256k1", "serde", "strict_encoding", + "strict_types", ] [[package]] name = "bp-core" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" dependencies = [ "amplify", "bp-consensus", "bp-dbc", "bp-seals", "commit_verify", - "getrandom", + "getrandom 0.2.16", + "getrandom 0.3.2", "single_use_seals", "strict_encoding", "wasm-bindgen", @@ -194,7 +196,7 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" dependencies = [ "amplify", "base85", @@ -232,14 +234,14 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#a439ba556e078fe7a070d633dfcb9fa40e28e1bf" +source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" dependencies = [ "amplify", "baid64", "bp-consensus", "bp-dbc", "commit_verify", - "rand", + "rand 0.9.1", "single_use_seals", "strict_encoding", ] @@ -254,9 +256,10 @@ dependencies = [ "bp-derive", "bp-invoice", "descriptors", - "getrandom", + "getrandom 0.2.16", + "getrandom 0.3.2", "psbt", - "rand", + "rand 0.9.1", "secp256k1", "serde", "wasm-bindgen", @@ -271,9 +274,9 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "cc" -version = "1.2.17" +version = "1.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +checksum = "04da6a0d40b948dfc4fa8f5bbf402b0fc1a64a28dbf7d12ffd683550f2c1b63a" dependencies = [ "shlex", ] @@ -328,7 +331,7 @@ dependencies = [ [[package]] name = "commit_encoding_derive" version = "0.11.0" -source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#c6bdd35814dc2d316bc5d1f0f1d13293ca2ec64e" +source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#f8dd8410fbe4b841c40056822ba3756d2b8159bf" dependencies = [ "amplify", "amplify_syn", @@ -340,11 +343,11 @@ dependencies = [ [[package]] name = "commit_verify" version = "0.11.0" -source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#c6bdd35814dc2d316bc5d1f0f1d13293ca2ec64e" +source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#f8dd8410fbe4b841c40056822ba3756d2b8159bf" dependencies = [ "amplify", "commit_encoding_derive", - "rand", + "rand 0.9.1", "ripemd", "sha2", "strict_encoding", @@ -422,22 +425,36 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] [[package]] name = "half" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" dependencies = [ "cfg-if", "crunchy", @@ -499,9 +516,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", "hashbrown", @@ -526,9 +543,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "log" @@ -590,9 +607,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -625,6 +642,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "rand" version = "0.8.5" @@ -632,8 +655,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -643,7 +676,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -652,7 +695,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", ] [[package]] @@ -692,7 +744,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252" dependencies = [ "bitcoin_hashes", - "rand", + "rand 0.8.5", "secp256k1-sys", "serde", ] @@ -789,9 +841,9 @@ dependencies = [ [[package]] name = "strict_encoding" -version = "2.7.2" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e4b581b61221082818d58db91630aed6e4a3237afb775fc7e5e4e2eba50d5e" +checksum = "8553c0321466c11aa1e33f082c9190194f380efd8824bf5ce4fa56b64b875be9" dependencies = [ "amplify", "strict_encoding_derive", @@ -813,13 +865,12 @@ dependencies = [ [[package]] name = "strict_types" -version = "2.7.2" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bae7475fc901144d8a35d25e36d76aa020b840f233d60532d6d52318718781b" +checksum = "07dd1bdf4bfce0a1ff3eec041e7d4d20b06d22ca2aaf71338726dd9609e57a5e" dependencies = [ "amplify", "baid64", - "half", "indexmap", "sha2", "strict_encoding", @@ -911,9 +962,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vesper-lang" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f72ebd3b32f16ee8ace2bd3058c2bfa0f4820992bd4ea86e73ba228bb13dd2b0" +checksum = "cd2b7e3e27aeb0524204e58042f6e4531a720745d1b1a3978d3a084f1885f63d" dependencies = [ "amplify", "strict_encoding", @@ -935,6 +986,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" version = "0.2.100" @@ -1181,6 +1241,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + [[package]] name = "zerocopy" version = "0.8.24" diff --git a/Cargo.toml b/Cargo.toml index 26b390e..a9c3eba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ edition = "2021" license = "Apache-2.0" [workspace.dependencies] -amplify = "4.7.0" +amplify = "4.8.0" bech32 = "0.9.1" secp256k1 = "0.30.0" -strict_encoding = "2.7.0" +strict_encoding = "2.8.2" commit_verify = "0.11.0-beta.9" bp-consensus = "0.11.1-alpha.1" bp-core = { version = "0.11.1-alpha.1" } @@ -66,8 +66,9 @@ serde = ["serde_crate", "bp-consensus/serde", "bp-invoice/serde", "bp-derive/ser [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen = "0.2" -rand = { version = "0.8.4", optional = true } -getrandom = { version = "0.2", features = ["js"] } +rand = { version = "0.9.1", optional = true } +getrandom = { version = "0.3", features = ["wasm_js"] } +getrandom2 = { package = "getrandom", version = "0.2", features = ["js"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3" From 55ca7e987fc531e4e4304a56ee98627d5c4444c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Thu, 1 May 2025 18:49:44 +0200 Subject: [PATCH 13/13] chore: bump version to 0.11.1-alpha.2+unreviewed --- Cargo.lock | 84 +++++++++++++++++++++++++++++------------------------- Cargo.toml | 21 ++++++-------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a47da7..bf90b0d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,8 +164,9 @@ dependencies = [ [[package]] name = "bp-consensus" -version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" +version = "0.11.1-alpha.2+unreviewed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d473a0cea358746ab5ef820b62f2530ce6516cb59226c9a3736a8e60c4943d9" dependencies = [ "amplify", "chrono", @@ -178,8 +179,9 @@ dependencies = [ [[package]] name = "bp-core" -version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" +version = "0.11.1-alpha.2+unreviewed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d248df4e1ab41de97556bb092891c8c5208604f471a20c4129dc357fd9eade39" dependencies = [ "amplify", "bp-consensus", @@ -195,8 +197,9 @@ dependencies = [ [[package]] name = "bp-dbc" -version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" +version = "0.11.1-alpha.2+unreviewed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2670bd384743ba75ca6d8cf821bcdcb74bfd5715e8798e545331dc00652f612c" dependencies = [ "amplify", "base85", @@ -208,7 +211,7 @@ dependencies = [ [[package]] name = "bp-derive" -version = "0.11.1-alpha.1" +version = "0.11.1-alpha.2+unreviewed" dependencies = [ "amplify", "bp-consensus", @@ -222,7 +225,7 @@ dependencies = [ [[package]] name = "bp-invoice" -version = "0.11.1-alpha.1" +version = "0.11.1-alpha.2+unreviewed" dependencies = [ "amplify", "bech32", @@ -233,8 +236,9 @@ dependencies = [ [[package]] name = "bp-seals" -version = "0.11.1-alpha.1" -source = "git+https://github.com/zoedberg/bp-core?branch=0.11.1-2#63b3e18acfa00fb8180bbc5cca5630c372860203" +version = "0.11.1-alpha.2+unreviewed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3aab0c94862b08721f7a60eb0d13502605147ebc2fc3cfe0ceacdb6d58aeb43c" dependencies = [ "amplify", "baid64", @@ -248,7 +252,7 @@ dependencies = [ [[package]] name = "bp-std" -version = "0.11.1-alpha.1" +version = "0.11.1-alpha.2+unreviewed" dependencies = [ "amplify", "bp-consensus", @@ -289,9 +293,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -330,8 +334,9 @@ dependencies = [ [[package]] name = "commit_encoding_derive" -version = "0.11.0" -source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#f8dd8410fbe4b841c40056822ba3756d2b8159bf" +version = "0.11.1-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d12f2e05ae7d81bc49d9f0856ff97968da750bf09f145043155e9c7f13ce4ace" dependencies = [ "amplify", "amplify_syn", @@ -342,8 +347,9 @@ dependencies = [ [[package]] name = "commit_verify" -version = "0.11.0" -source = "git+https://github.com/zoedberg/client_side_validation?branch=0.11.1-2#f8dd8410fbe4b841c40056822ba3756d2b8159bf" +version = "0.11.1-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171940b95b456f7c8906c78cd548c1dcf30310c4dc2e2a5ba352ac183bf163b3" dependencies = [ "amplify", "commit_encoding_derive", @@ -388,7 +394,7 @@ dependencies = [ [[package]] name = "descriptors" -version = "0.11.1-alpha.1" +version = "0.11.1-alpha.2+unreviewed" dependencies = [ "amplify", "bp-derive", @@ -462,9 +468,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" [[package]] name = "heck" @@ -616,7 +622,7 @@ dependencies = [ [[package]] name = "psbt" -version = "0.11.1-alpha.1" +version = "0.11.1-alpha.2+unreviewed" dependencies = [ "amplify", "base64", @@ -775,7 +781,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -815,9 +821,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -832,9 +838,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "single_use_seals" -version = "0.11.0" +version = "0.11.1-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01aad2d785dc858c4f652d1e18d0c815cd10aa8f15ac7accd2b12b894d7c367" +checksum = "8c36139c6f642d05f2d74501a8f84ccfb5833caeb7c8cde1e6b811261cd526bd" dependencies = [ "amplify_derive", ] @@ -907,9 +913,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -933,7 +939,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1017,7 +1023,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", "wasm-bindgen-shared", ] @@ -1052,7 +1058,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1087,7 +1093,7 @@ checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1130,7 +1136,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1141,7 +1147,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1252,20 +1258,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] diff --git a/Cargo.toml b/Cargo.toml index a9c3eba..6011789 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["invoice", "derive", "descriptors", "psbt", "."] resolver = "2" [workspace.package] -version = "0.11.1-alpha.1" +version = "0.11.1-alpha.2+unreviewed" keywords = ["bitcoin", "wallet", "descriptors", "psbt", "taproot"] categories = ["cryptography::cryptocurrencies"] authors = ["Dr Maxim Orlovsky "] @@ -18,13 +18,13 @@ amplify = "4.8.0" bech32 = "0.9.1" secp256k1 = "0.30.0" strict_encoding = "2.8.2" -commit_verify = "0.11.0-beta.9" -bp-consensus = "0.11.1-alpha.1" -bp-core = { version = "0.11.1-alpha.1" } -bp-invoice = { version = "0.11.1-alpha.1", path = "invoice" } -bp-derive = { version = "0.11.1-alpha.1", path = "derive" } -descriptors = { version = "0.11.1-alpha.1", path = "descriptors" } -psbt = { version = "0.11.1-alpha.1", path = "psbt" } +commit_verify = "0.11.1-alpha.2" +bp-consensus = "0.11.1-alpha.2+unreviewed" +bp-core = { version = "0.11.1-alpha.2+unreviewed" } +bp-invoice = { version = "0.11.1-alpha.2+unreviewed", path = "invoice" } +bp-derive = { version = "0.11.1-alpha.2+unreviewed", path = "derive" } +descriptors = { version = "0.11.1-alpha.2+unreviewed", path = "descriptors" } +psbt = { version = "0.11.1-alpha.2+unreviewed", path = "psbt" } indexmap = "2.4.0" serde_crate = { package = "serde", version = "1", features = ["derive"] } @@ -72,8 +72,3 @@ getrandom2 = { package = "getrandom", version = "0.2", features = ["js"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3" - -[patch.crates-io] -commit_verify = { git = "https://github.com/zoedberg/client_side_validation", branch = "0.11.1-2" } -bp-consensus = { git = "https://github.com/zoedberg/bp-core", branch = "0.11.1-2" } -bp-core = { git = "https://github.com/zoedberg/bp-core", branch = "0.11.1-2" }