From c014bad013c99e4eb828eabc37c1c5ccc30acf75 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 30 Mar 2024 12:57:29 +0100 Subject: [PATCH 1/3] dbc: make Anchor consensus-only data (remove txid) --- dbc/src/anchor.rs | 29 +----- seals/src/txout/witness.rs | 9 +- src/stl.rs | 14 +-- stl/Anchor.MerkleBlock.Tapret.vesper | 3 - stl/Anchor.MerkleProof.Tapret.vesper | 3 - stl/Anchor.MerkleTree.Opret.vesper | 3 - stl/Anchor.MerkleTree.Tapret.vesper | 3 - stl/BPCore@0.1.0.sta | 133 +++++++++++---------------- stl/BPCore@0.1.0.stl | Bin 4615 -> 3248 bytes stl/BPCore@0.1.0.sty | 51 +++------- 10 files changed, 79 insertions(+), 169 deletions(-) diff --git a/dbc/src/anchor.rs b/dbc/src/anchor.rs index 295e3a9c..d3b248b7 100644 --- a/dbc/src/anchor.rs +++ b/dbc/src/anchor.rs @@ -27,9 +27,8 @@ use std::error::Error; use std::marker::PhantomData; -use bc::{Tx, Txid}; +use bc::Tx; use commit_verify::mpc::{self, Message, ProtocolId}; -use commit_verify::ReservedBytes; use strict_encoding::{StrictDumb, StrictEncode}; use crate::{DbcMethod, Method, LIB_NAME_BPCORE}; @@ -69,15 +68,6 @@ 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, @@ -92,11 +82,8 @@ pub struct Anchor, M: DbcMethod = M impl, M: DbcMethod> Anchor { /// Constructs anchor for a given witness transaction id, MPC and DBC /// proofs. - pub fn new(witness_txid: Txid, mpc_proof: L, dbc_proof: D) -> Self { + pub fn new(mpc_proof: L, dbc_proof: D) -> Self { Self { - reserved1: default!(), - txid: witness_txid, - reserved2: default!(), mpc_proof, dbc_proof, _method: PhantomData, @@ -113,9 +100,6 @@ pub enum MergeError { #[from] MpcMismatch(mpc::MergeError), - /// anchors can't be merged since they have different witness transactions - TxidMismatch, - /// anchors can't be merged since they have different DBC proofs DbcMismatch, } @@ -130,9 +114,6 @@ 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!(), @@ -192,9 +173,6 @@ 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!(), @@ -211,9 +189,6 @@ impl, M: DbcMethod> Anchor { /// Merges two anchors keeping revealed data. pub fn merge_reveal(mut self, other: Self) -> Result { - if self.txid != other.txid { - return Err(MergeError::TxidMismatch); - } if self.dbc_proof != other.dbc_proof { return Err(MergeError::DbcMismatch); } diff --git a/seals/src/txout/witness.rs b/seals/src/txout/witness.rs index bc639acb..576a7fa0 100644 --- a/seals/src/txout/witness.rs +++ b/seals/src/txout/witness.rs @@ -23,9 +23,8 @@ use std::marker::PhantomData; use bc::{Tx, Txid}; use commit_verify::mpc; -use dbc::{Anchor, DbcMethod, Method}; +use dbc::{DbcMethod, Method}; use single_use_seals::SealWitness; -use strict_encoding::StrictDumb; use crate::txout::{TxoSeal, VerifyError}; use crate::SealCloseMethod; @@ -50,11 +49,11 @@ pub struct Witness, M: DbcMethod = Method> { impl, M: DbcMethod> Witness { /// Constructs witness from a witness transaction and extra-transaction /// proof, taken from an anchor. - pub fn with(tx: Tx, anchor: Anchor) -> Witness { + pub fn with(tx: Tx, dbc: D) -> Witness { Witness { + txid: tx.txid(), tx, - txid: anchor.txid, - proof: anchor.dbc_proof, + proof: dbc, _phantom: default!(), } } diff --git a/src/stl.rs b/src/stl.rs index 068b96e7..bebc03bb 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:9pKFs7Gw7gwerYGVcPCDqiCv5fa165qC6PvFxiotJjaG#rebel-herbert-tourist"; + "urn:ubideco:stl:6skrch4mJzDzVaTYnCgCxFJLw23SSUxNhK7PKgPdSapR#roof-parent-reunion"; fn _bp_core_stl() -> Result { LibBuilder::new(libname!(LIB_NAME_BPCORE), tiny_bset! { @@ -40,12 +40,12 @@ fn _bp_core_stl() -> Result { bc::stl::bp_tx_stl().to_dependency(), commit_verify::stl::commit_verify_stl().to_dependency() }) - .transpile::>() - .transpile::>() - .transpile::>() - .transpile::>() - .transpile::>() - .transpile::>() + .transpile::>() + .transpile::>() + .transpile::>() + .transpile::>() + .transpile::>() + .transpile::>() .transpile::>() .transpile::>() .transpile::() diff --git a/stl/Anchor.MerkleBlock.Tapret.vesper b/stl/Anchor.MerkleBlock.Tapret.vesper index ee1faf7d..9eb0988a 100644 --- a/stl/Anchor.MerkleBlock.Tapret.vesper +++ b/stl/Anchor.MerkleBlock.Tapret.vesper @@ -1,7 +1,4 @@ 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 404dd83a..dd18c240 100644 --- a/stl/Anchor.MerkleProof.Tapret.vesper +++ b/stl/Anchor.MerkleProof.Tapret.vesper @@ -1,7 +1,4 @@ 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 1dcce595..dbcb800b 100644 --- a/stl/Anchor.MerkleTree.Opret.vesper +++ b/stl/Anchor.MerkleTree.Opret.vesper @@ -1,7 +1,4 @@ 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 6ae4b760..e61fb2fe 100644 --- a/stl/Anchor.MerkleTree.Tapret.vesper +++ b/stl/Anchor.MerkleTree.Tapret.vesper @@ -1,7 +1,4 @@ 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 f22e681c..ba141116 100644 --- a/stl/BPCore@0.1.0.sta +++ b/stl/BPCore@0.1.0.sta @@ -1,10 +1,10 @@ -----BEGIN STRICT TYPE LIB----- -Id: urn:ubideco:stl:9pKFs7Gw7gwerYGVcPCDqiCv5fa165qC6PvFxiotJjaG#rebel-herbert-tourist +Id: urn:ubideco:stl:6skrch4mJzDzVaTYnCgCxFJLw23SSUxNhK7PKgPdSapR#roof-parent-reunion Name: BPCore Dependency: 7EpM1uymEteG4g4xmF5ntKYX1wXXpbQj5iLiDreH4jWa#protein-donald-cool Dependency: DzTvt9gGhPUKD8Dkkjk9PDBhkJ4gtWxXWQjxnmUYLNrs#voyage-kimono-disco Dependency: HX2UBak8vPsTokug1DGMDvTpzns3xUdwZ7QJdyt4qBA9#speed-atlanta-trilogy -Checksum-SHA256: f7bced17d414c08d760e039a06c43277e985cc1fba332ddfe415af8a36008cb3 +Checksum-SHA256: f0890e90f6a52f1697d3a4dc5aaeb8b1d758afb15e825d2d8ea2cbe275c49196 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+($ @@ -15,88 +15,61 @@ a87SzWk_LjXkV<^ZRI~s#T41Gjc0(`3ajfaCJX&HEu+ACq+L0mO$tn9VP;cfa%pg Mqk=;7%h%D+p%U7S;b1RT)c9`>#Kd;Rz-U=aO9W+B1XOrwWT}OOcT=8d`>?<6$C@ F;S3|*6`1-v+nBdcqJ?FPKcnV2wbY*gGVQf%qwlfK-7{9iX4Q|L-q$GzUMp|h#f#{Gz8SzLEaTf~c{WkYggkPIjuQHS#3Ua|L6d7%qre2 -Ut&TYsZfv!yd427@;7veO2zMB=|GYU;*a%*g5NMUnmT+QYFd;Umr-dgNEFC uu*?Wk)@WS(Jw`th(K{eY_63r%HmYiwmgY;R+0h0#5^R?l+2>x*OcO&#*^E;5@PQ -20HKbE5LJk_Il(3r%HmYiwmua&K>DllNeFa6}P}rq7L!(40)FbL%msz%JU8hqvFy -oea2o4pL=vWpZ|9WI}m#WpgpuwYiq_Rlwao{(T?aUNqayF^88E^#IUpx^^~;)zDW -6RB~lyPH$vo15y0X3z7m=H4* -?DL2hGcZ*om#a%*g5LTqniYfo@;Wpq$-Z*OJ>1qpIxb7gXNWn?h|T(C5e*2&|@7Z -L8K8p|GAt|gDDdvc%!k2x;ddcL`HllNeFa6}P}rq7L!(40)FbL%msz%JU8hqvF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FYk8VVufK10Q-T=FR=Q=>S+XYD&jZRoX=DQRY!hN5_Bp3Y36tDMM#=e#tGI($UA5U3KNx<*C>jc*fi7rMzqbp}mkbZ +Bp60|E+faB^jIMrm?$bN~xM0`+VY +Vk7oBr%DNv+($;q`HHK!gIHa)*%m(-e#9sm3NgE`=!A)P#jpo4axu-4_As_7EzOC +4+`8Vyy2R;!*#QZ1X=iA3Ol4ta00jX8^=uPjBlbC`N(qzPM@Gr{imSMTSY5T*7C# +t%#3&jHU#!_}M0RemmT>wB!7L}MA7sFvK +#<=RP4S#T1Vv-hhTICs&5e05N37a&BR4P-_D9Y!hN5_Bp +3Y36tDMM#=e#tGI($UA5U3KNx<*C>jc>g@kugo@o29zwXDHA;ech!BqJAy+4@X(~ +&*rw>NkZRAF#(Wpq+$XJ~Xna$#;`Xa)idY-MJ2PH$voNMUnm0`+VYVk7oBr%DNv+ +($;q`HHK!gIHa)*%m(-e#9sm3NgE`=!A)P#jpo4axu-4_As_7EzOC4+`8Vyy2R;! +*$r}OXJ~XzZ)9aiVRL8#^=uPjBlbC`N(qzPM@Gr{imSMTSY5T*7C#t%#3&jHF}tq +lgo$^>um>@6G0l?pFt#Zz&53{9y57aQ#OZ(81yp!YbaDg&010<#bZ%vHb5wW$000 +35ba-iG00jX8^=uPjBlbC`N(qzPM@Gr{imSMTSY5T*7C#t%#3&jHqk=;7%h%D+p% +U7S;b1RT)c9`>#Kd;Rz-U=aO9W+B -----END STRICT TYPE LIB----- diff --git a/stl/BPCore@0.1.0.stl b/stl/BPCore@0.1.0.stl index d7b6992da926a6e4ffe84b95900d4923dd325926..058a9f3d47c10cedb9e3d69527ab172143ce9272 100644 GIT binary patch delta 91 zcmZoy*&w;$AtMtz!(6*Qb2&#b6G$c)K->~36eJx0XoF=W%4 x+`ybcPs_9>+p^fw&q51Ut;y$E?C5D>8oewFnY@ZwVX`orEL|+zY{*v61^^ajN!$Pc diff --git a/stl/BPCore@0.1.0.sty b/stl/BPCore@0.1.0.sty index 519b0c96..882a0776 100644 --- a/stl/BPCore@0.1.0.sty +++ b/stl/BPCore@0.1.0.sty @@ -1,5 +1,5 @@ {- - Id: urn:ubideco:stl:9pKFs7Gw7gwerYGVcPCDqiCv5fa165qC6PvFxiotJjaG#rebel-herbert-tourist + Id: urn:ubideco:stl:6skrch4mJzDzVaTYnCgCxFJLw23SSUxNhK7PKgPdSapR#roof-parent-reunion Name: BPCore Version: 0.1.0 Description: Bitcoin client-side-validation library @@ -18,7 +18,6 @@ import CommitVerify#7EpM1uymEteG4g4xmF5ntKYX1wXXpbQj5iLiDreH4jWa#protein-donald- use MerkleHash#culture-metro-modular use MerkleBlock#miracle-antenna-moral use MerkleProof#labor-hilton-magenta - use ReservedBytes1#joker-lemon-mental use TreeNode#risk-opinion-orca import Std#DzTvt9gGhPUKD8Dkkjk9PDBhkJ4gtWxXWQjxnmUYLNrs#voyage-kimono-disco @@ -35,47 +34,23 @@ import Bitcoin#HX2UBak8vPsTokug1DGMDvTpzns3xUdwZ7QJdyt4qBA9#speed-atlanta-trilog use XOnlyPk#evident-finance-promo -@mnemonic(marvin-austin-fame) -data AnchorMerkleBlockOpretProof : reserved1 CommitVerify.ReservedBytes1#joker-lemon-mental - , txid Bitcoin.Txid#cowboy-diego-betty - , reserved2 CommitVerify.ReservedBytes1#joker-lemon-mental - , mpcProof CommitVerify.MerkleBlock#miracle-antenna-moral - , dbcProof OpretProof +@mnemonic(habitat-exit-gizmo) +data AnchorMerkleBlockOpretProof : mpcProof CommitVerify.MerkleBlock#miracle-antenna-moral, dbcProof OpretProof -@mnemonic(bottle-mozart-mimosa) -data AnchorMerkleBlockTapretProof : reserved1 CommitVerify.ReservedBytes1#joker-lemon-mental - , txid Bitcoin.Txid#cowboy-diego-betty - , reserved2 CommitVerify.ReservedBytes1#joker-lemon-mental - , mpcProof CommitVerify.MerkleBlock#miracle-antenna-moral - , dbcProof TapretProof +@mnemonic(nobel-koala-mother) +data AnchorMerkleBlockTapretProof : mpcProof CommitVerify.MerkleBlock#miracle-antenna-moral, dbcProof TapretProof -@mnemonic(flag-center-weather) -data AnchorMerkleProofOpretProof : reserved1 CommitVerify.ReservedBytes1#joker-lemon-mental - , txid Bitcoin.Txid#cowboy-diego-betty - , reserved2 CommitVerify.ReservedBytes1#joker-lemon-mental - , mpcProof CommitVerify.MerkleProof#labor-hilton-magenta - , dbcProof OpretProof +@mnemonic(avalon-elastic-neon) +data AnchorMerkleProofOpretProof : mpcProof CommitVerify.MerkleProof#labor-hilton-magenta, dbcProof OpretProof -@mnemonic(camel-mentor-taboo) -data AnchorMerkleProofTapretProof : reserved1 CommitVerify.ReservedBytes1#joker-lemon-mental - , txid Bitcoin.Txid#cowboy-diego-betty - , reserved2 CommitVerify.ReservedBytes1#joker-lemon-mental - , mpcProof CommitVerify.MerkleProof#labor-hilton-magenta - , dbcProof TapretProof +@mnemonic(scorpio-fame-gram) +data AnchorMerkleProofTapretProof : mpcProof CommitVerify.MerkleProof#labor-hilton-magenta, dbcProof TapretProof -@mnemonic(clock-bazooka-cadet) -data AnchorMerkleTreeOpretProof : reserved1 CommitVerify.ReservedBytes1#joker-lemon-mental - , txid Bitcoin.Txid#cowboy-diego-betty - , reserved2 CommitVerify.ReservedBytes1#joker-lemon-mental - , mpcProof CommitVerify.MerkleTree#side-locate-bonus - , dbcProof OpretProof +@mnemonic(monica-cannon-tornado) +data AnchorMerkleTreeOpretProof : mpcProof CommitVerify.MerkleTree#side-locate-bonus, dbcProof OpretProof -@mnemonic(vacuum-fluid-acid) -data AnchorMerkleTreeTapretProof : reserved1 CommitVerify.ReservedBytes1#joker-lemon-mental - , txid Bitcoin.Txid#cowboy-diego-betty - , reserved2 CommitVerify.ReservedBytes1#joker-lemon-mental - , mpcProof CommitVerify.MerkleTree#side-locate-bonus - , dbcProof TapretProof +@mnemonic(susan-lucas-bazaar) +data AnchorMerkleTreeTapretProof : mpcProof CommitVerify.MerkleTree#side-locate-bonus, dbcProof TapretProof @mnemonic(explore-aspect-ranger) data BlindSealTxPtr : method Method From 2d1c76efa5f0a906a67ec184946b7392908ac632 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 4 Apr 2024 12:35:12 +0200 Subject: [PATCH 2/3] dbc: include closing method in anchor --- dbc/src/anchor.rs | 14 ++++++-------- src/stl.rs | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/dbc/src/anchor.rs b/dbc/src/anchor.rs index d3b248b7..fd3e2d22 100644 --- a/dbc/src/anchor.rs +++ b/dbc/src/anchor.rs @@ -25,7 +25,6 @@ //! defined by LNPBP-4. use std::error::Error; -use std::marker::PhantomData; use bc::Tx; use commit_verify::mpc::{self, Message, ProtocolId}; @@ -74,19 +73,18 @@ pub struct Anchor, M: DbcMethod = M /// Proof of the DBC commitment. pub dbc_proof: D, - #[doc(hidden)] - #[strict_type(skip)] - pub _method: PhantomData, + /// Method used by the anchor + pub method: M, } impl, M: DbcMethod> Anchor { /// Constructs anchor for a given witness transaction id, MPC and DBC /// proofs. - pub fn new(mpc_proof: L, dbc_proof: D) -> Self { + pub fn new(mpc_proof: L, dbc_proof: D, method: M) -> Self { Self { mpc_proof, dbc_proof, - _method: PhantomData, + method, } } } @@ -116,7 +114,7 @@ impl, M: DbcMethod> Anchor { Ok(Anchor { mpc_proof: lnpbp4_proof, dbc_proof: self.dbc_proof, - _method: default!(), + method: self.method, }) } @@ -175,7 +173,7 @@ impl, M: DbcMethod> Anchor { Ok(Anchor { mpc_proof: lnpbp4_proof, dbc_proof: self.dbc_proof, - _method: default!(), + method: self.method, }) } diff --git a/src/stl.rs b/src/stl.rs index bebc03bb..562cd5cf 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:6skrch4mJzDzVaTYnCgCxFJLw23SSUxNhK7PKgPdSapR#roof-parent-reunion"; + "urn:ubideco:stl:C5EbVby4rry8esHwoPrGUfhe7yqJgoyA1DBcyuBRf2rZ#granite-target-table"; fn _bp_core_stl() -> Result { LibBuilder::new(libname!(LIB_NAME_BPCORE), tiny_bset! { From 40d155151b57325ad82edf838196b52ad27af188 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 12 Apr 2024 18:11:31 +0200 Subject: [PATCH 3/3] dbc: fix Anchor::new to auto-deduce DBC method --- dbc/src/anchor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbc/src/anchor.rs b/dbc/src/anchor.rs index fd3e2d22..20d8dba9 100644 --- a/dbc/src/anchor.rs +++ b/dbc/src/anchor.rs @@ -80,11 +80,11 @@ pub struct Anchor, M: DbcMethod = M impl, M: DbcMethod> Anchor { /// Constructs anchor for a given witness transaction id, MPC and DBC /// proofs. - pub fn new(mpc_proof: L, dbc_proof: D, method: M) -> Self { + pub fn new(mpc_proof: L, dbc_proof: D) -> Self { Self { mpc_proof, dbc_proof, - method, + method: D::METHOD, } } }