diff --git a/Cargo.lock b/Cargo.lock index c8fc877c..f456b9d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -273,7 +273,7 @@ dependencies = [ [[package]] name = "commit_encoding_derive" version = "0.11.0-beta.4" -source = "git+https://github.com/LNP-BP/client_side_validation?branch=master#e963d5df29e9c04cb24dfc7d0b3553d286bb1986" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=reserved#b01ea9cd3def3e4155afb9a7a60a4248607fb208" dependencies = [ "amplify", "amplify_syn", @@ -285,7 +285,7 @@ dependencies = [ [[package]] name = "commit_verify" version = "0.11.0-beta.4" -source = "git+https://github.com/LNP-BP/client_side_validation?branch=master#e963d5df29e9c04cb24dfc7d0b3553d286bb1986" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=reserved#b01ea9cd3def3e4155afb9a7a60a4248607fb208" dependencies = [ "amplify", "commit_encoding_derive", diff --git a/Cargo.toml b/Cargo.toml index 64124e58..7e583189 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -88,7 +88,7 @@ getrandom = { version = "0.2", features = ["js"] } wasm-bindgen-test = "0.3" [package.metadata.docs.rs] -features = [ "all" ] +features = ["all"] [patch.crates-io] -commit_verify = { git = "https://github.com/LNP-BP/client_side_validation", branch = "master" } +commit_verify = { git = "https://github.com/LNP-BP/client_side_validation", branch = "reserved" } diff --git a/dbc/src/anchor.rs b/dbc/src/anchor.rs index 6299db07..295e3a9c 100644 --- a/dbc/src/anchor.rs +++ b/dbc/src/anchor.rs @@ -29,6 +29,7 @@ use std::marker::PhantomData; use bc::{Tx, Txid}; use commit_verify::mpc::{self, Message, ProtocolId}; +use commit_verify::ReservedBytes; use strict_encoding::{StrictDumb, StrictEncode}; use crate::{DbcMethod, Method, LIB_NAME_BPCORE}; @@ -68,9 +69,15 @@ pub enum VerifyError { serde(crate = "serde_crate", rename_all = "camelCase") )] pub struct Anchor, M: DbcMethod = Method> { + /// Bytes reserved for enum tag for the future versions of anchors. + pub reserved1: ReservedBytes<1>, + /// Transaction containing deterministic bitcoin commitment. pub txid: Txid, + /// Bytes reserved for the optional SPV information. + pub reserved2: ReservedBytes<1>, + /// Structured multi-protocol LNPBP-4 data the transaction commits to. pub mpc_proof: L, @@ -87,7 +94,9 @@ impl, M: DbcMethod> Anchor /// proofs. pub fn new(witness_txid: Txid, mpc_proof: L, dbc_proof: D) -> Self { Self { + reserved1: default!(), txid: witness_txid, + reserved2: default!(), mpc_proof, dbc_proof, _method: PhantomData, @@ -121,7 +130,9 @@ impl, M: DbcMethod> Anchor { let lnpbp4_proof = mpc::MerkleBlock::with(&self.mpc_proof, protocol_id.into(), message.into())?; Ok(Anchor { + reserved1: self.reserved1, txid: self.txid, + reserved2: self.reserved2, mpc_proof: lnpbp4_proof, dbc_proof: self.dbc_proof, _method: default!(), @@ -181,7 +192,9 @@ impl, M: DbcMethod> Anchor { ) -> Result, mpc::LeafNotKnown> { let lnpbp4_proof = self.mpc_proof.to_merkle_proof(protocol.into())?; Ok(Anchor { + reserved1: self.reserved1, txid: self.txid, + reserved2: self.reserved2, mpc_proof: lnpbp4_proof, dbc_proof: self.dbc_proof, _method: default!(), diff --git a/src/stl.rs b/src/stl.rs index a0f80417..068b96e7 100644 --- a/src/stl.rs +++ b/src/stl.rs @@ -32,7 +32,7 @@ use strict_types::{CompileError, LibBuilder, TypeLib}; /// Strict types id for the library providing data types from [`dbc`] and /// [`seals`] crates. pub const LIB_ID_BPCORE: &str = - "urn:ubideco:stl:BeAiDVK898mzgHrmWgxHtysDhmffgMEoDwBgNuZo7QeZ#connect-verona-secret"; + "urn:ubideco:stl:9pKFs7Gw7gwerYGVcPCDqiCv5fa165qC6PvFxiotJjaG#rebel-herbert-tourist"; fn _bp_core_stl() -> Result { LibBuilder::new(libname!(LIB_NAME_BPCORE), tiny_bset! { diff --git a/stl/Anchor.MerkleBlock.Tapret.vesper b/stl/Anchor.MerkleBlock.Tapret.vesper index 4aac1ce2..ee1faf7d 100644 --- a/stl/Anchor.MerkleBlock.Tapret.vesper +++ b/stl/Anchor.MerkleBlock.Tapret.vesper @@ -1,5 +1,7 @@ AnchorMerkleBlockTapretProof rec + reserved1 bytes len=1 aka=ReservedBytes1 txid bytes len=32 aka=Txid + reserved2 bytes len=1 aka=ReservedBytes1 mpcProof rec MerkleBlock depth enum { U5 _0=0 _1=1 _2=2 _3=3 _4=4 _5=5 _6=6 _7=7 diff --git a/stl/Anchor.MerkleProof.Tapret.vesper b/stl/Anchor.MerkleProof.Tapret.vesper index 027b1e08..404dd83a 100644 --- a/stl/Anchor.MerkleProof.Tapret.vesper +++ b/stl/Anchor.MerkleProof.Tapret.vesper @@ -1,5 +1,7 @@ AnchorMerkleProofTapretProof rec + reserved1 bytes len=1 aka=ReservedBytes1 txid bytes len=32 aka=Txid + reserved2 bytes len=1 aka=ReservedBytes1 mpcProof rec MerkleProof pos is U32 cofactor is U16 diff --git a/stl/Anchor.MerkleTree.Opret.vesper b/stl/Anchor.MerkleTree.Opret.vesper index 13de5143..1dcce595 100644 --- a/stl/Anchor.MerkleTree.Opret.vesper +++ b/stl/Anchor.MerkleTree.Opret.vesper @@ -1,5 +1,7 @@ AnchorMerkleTreeOpretProof rec + reserved1 bytes len=1 aka=ReservedBytes1 txid bytes len=32 aka=Txid + reserved2 bytes len=1 aka=ReservedBytes1 mpcProof rec MerkleTree depth enum { U5 _0=0 _1=1 _2=2 _3=3 _4=4 _5=5 _6=6 _7=7 diff --git a/stl/Anchor.MerkleTree.Tapret.vesper b/stl/Anchor.MerkleTree.Tapret.vesper index 5de7efaa..6ae4b760 100644 --- a/stl/Anchor.MerkleTree.Tapret.vesper +++ b/stl/Anchor.MerkleTree.Tapret.vesper @@ -1,5 +1,7 @@ AnchorMerkleTreeTapretProof rec + reserved1 bytes len=1 aka=ReservedBytes1 txid bytes len=32 aka=Txid + reserved2 bytes len=1 aka=ReservedBytes1 mpcProof rec MerkleTree depth enum { U5 _0=0 _1=1 _2=2 _3=3 _4=4 _5=5 _6=6 _7=7 diff --git a/stl/BPCore@0.1.0.sta b/stl/BPCore@0.1.0.sta index 08de4580..f22e681c 100644 --- a/stl/BPCore@0.1.0.sta +++ b/stl/BPCore@0.1.0.sta @@ -1,12 +1,12 @@ -----BEGIN STRICT TYPE LIB----- -Id: urn:ubideco:stl:BeAiDVK898mzgHrmWgxHtysDhmffgMEoDwBgNuZo7QeZ#connect-verona-secret +Id: urn:ubideco:stl:9pKFs7Gw7gwerYGVcPCDqiCv5fa165qC6PvFxiotJjaG#rebel-herbert-tourist Name: BPCore -Dependency: 7qvjR4HCwJKF3mxE5GqsAaADces5JDRwb8ajAse9mkz3#exhibit-karate-ritual +Dependency: 7EpM1uymEteG4g4xmF5ntKYX1wXXpbQj5iLiDreH4jWa#protein-donald-cool Dependency: DzTvt9gGhPUKD8Dkkjk9PDBhkJ4gtWxXWQjxnmUYLNrs#voyage-kimono-disco Dependency: HX2UBak8vPsTokug1DGMDvTpzns3xUdwZ7QJdyt4qBA9#speed-atlanta-trilogy -Checksum-SHA256: 64929409fba4ac73a0e4add2e174504c170ed17008f31180956f05569ceee36c +Checksum-SHA256: f7bced17d414c08d760e039a06c43277e985cc1fba332ddfe415af8a36008cb3 -20~CnZ*pY=Wv;<0l-(Pe$^)UD5K7r}*s>bq5$WSxcMKAy3WKnC3`1{iZE18?WpZg +20~CnZ*pY=T(C5e*2&|@7ZL8K8p|GAt|gDDdvc%!k2x;ddcL`H3`1{iZE18?WpZg |dBFtCMqVsrZe&e(V->r|?y|b&t*2isXxNhAA_oAshyzn}Wc6$lVk7oBr%DNv+($ ;q`HHK!gIHa)*%m(-e#9sm3I{@IbYpL6ZUYBGX>?<6X>JGrA>%$n#j0HLDJN5-IK gM_J7b(p+0MPGk2Gl)y2(Rz1Xgc#bS10xxe^o?x}!PNUwajGr*TW+dUY6G&@nZ7) @@ -15,69 +15,88 @@ a87SzWk_LjXkV<^ZRI~s#T41Gjc0(`3ajfaCJX&HEu+ACq+L0mO$tn9VP;cfa%pg Mqk=;7%h%D+p%U7S;b1RT)c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