diff --git a/commit_verify/src/id.rs b/commit_verify/src/id.rs index dde6bcfa..aa398640 100644 --- a/commit_verify/src/id.rs +++ b/commit_verify/src/id.rs @@ -94,7 +94,12 @@ pub trait CommitmentId: Copy + Ord + From + StrictType { /// concealment with [`crate::Conceal`], merklization, strict encoding, /// wrapped into [`CommitEncode`], followed by the actual commitment to its /// output. +/// +/// The trait is separate from the `CommitEncode` to prevent custom +/// implementation of its methods, since `CommitId` can't be manually +/// implemented for any type since it has a generic blanket implementation. pub trait CommitId: CommitEncode { + #[doc = hidden] fn commit(&self) -> CommitEngine; fn commitment_layout(&self) -> CommitmentLayout; diff --git a/commit_verify/src/stl.rs b/commit_verify/src/stl.rs index 66000f25..985ad02a 100644 --- a/commit_verify/src/stl.rs +++ b/commit_verify/src/stl.rs @@ -21,10 +21,10 @@ use strict_types::{CompileError, LibBuilder, TypeLib}; -use crate::{mpc, LIB_NAME_COMMIT_VERIFY}; +use crate::{mpc, MerkleHash, MerkleNode, StrictHash, LIB_NAME_COMMIT_VERIFY}; pub const LIB_ID_COMMIT_VERIFY: &str = - "urn:ubideco:stl:4SZ2EgWWtC5LsNXmNpAzogNHZoaZNTCwU3SQhAYwDX6A#citizen-fiction-corner"; + "urn:ubideco:stl:DYafq9UACuYbTpduhcqywBGH97wHYtSUNPiXh5v2Zub9#drama-imagine-extreme"; fn _commit_verify_stl() -> Result { LibBuilder::new(libname!(LIB_NAME_COMMIT_VERIFY), tiny_bset! { @@ -34,6 +34,9 @@ fn _commit_verify_stl() -> Result { .transpile::() .transpile::() .transpile::() + .transpile::() + .transpile::() + .transpile::() .compile() } diff --git a/stl/CommitVerify@0.1.0.sta b/stl/CommitVerify@0.1.0.sta index 471eb799..2557f57b 100644 --- a/stl/CommitVerify@0.1.0.sta +++ b/stl/CommitVerify@0.1.0.sta @@ -1,29 +1,33 @@ -----BEGIN STRICT TYPE LIB----- -Id: 4SZ2EgWWtC5LsNXmNpAzogNHZoaZNTCwU3SQhAYwDX6A#citizen-fiction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LzSfImTncuED0}GM_Xkl|`0XUvRh9?yTI7S;;e;>sZfv! -yd427@;7veO2zMB=|GXV}`Z*6U9bZupBbWCMoW&j2P3UG37bZ=vCY)NDRFqMAh9b -q(Cy9Eg3;jcYvA-~r9`yDZYr+MW?bl_I82W@3@b75y?0W~+NQ5DGQh1^p2tAX-yW -l;qtQClv)aMjKgwAH@`bu1x<7g|G$};xvA~n-$_S1#WL-WikOco0|Rhxa{vGY2xD(%VPkY}asU7V +1aM(=XaEQSIG#g>Clv)aMjKgwAH@`bu1x<7g|G$};xvA~n-$_S0000000000AOHX +W000003Qc8lYiwmya%E)(1qEbfaCB$_JfJU>zJB;=bhBCKPB)LHON@H8JZNt%NvJ +Pm-=hp1W>|38j$F|Rkm*bpSUudIqf?xQ3WPbltNdpi4*91)SI!>0000000000|Ns9000000 +18re&015yA1ONpB0Wg(*<{e=)S-S-YmzVsZkZ +k>V@1=_p5>Oab-~jCR3C`SFec^=zG+gvC{wm0000000960{{R30000L~Wpi_3XJr +Ke00#g7Kp+4OPH$voLULhlV`yn^X9EKSc5i8900whuZf9&|0S01nVQyn+0t!%aZ* +*^CZ){0q1pxpD002NB018uda%p39NMUnm1pxpD002NB00>laWo1rpWMu>b01abrZ +ewL(Y-MClZ)9Zv1_A|SWpH$80z9BEl)irWX>_w$=T0||rb~=^wLEBVElH>^WZ$C< +9A;Q>*p6J$36SYb7g#;qpQBTpwL(~+!(f@;t~vt?k_2dBb7%oLopt-$m)gMQu +nKY@^NKR1twFJLRYVe6X<)?o3Ya -----END STRICT TYPE LIB----- diff --git a/stl/CommitVerify@0.1.0.stl b/stl/CommitVerify@0.1.0.stl index f371b6bf..64ce2f74 100644 Binary files a/stl/CommitVerify@0.1.0.stl and b/stl/CommitVerify@0.1.0.stl differ diff --git a/stl/CommitVerify@0.1.0.sty b/stl/CommitVerify@0.1.0.sty index 2fc80c8e..616e1242 100644 --- a/stl/CommitVerify@0.1.0.sty +++ b/stl/CommitVerify@0.1.0.sty @@ -1,5 +1,5 @@ {- - Id: urn:ubideco:stl:4SZ2EgWWtC5LsNXmNpAzogNHZoaZNTCwU3SQhAYwDX6A#citizen-fiction-corner + Id: urn:ubideco:stl:DYafq9UACuYbTpduhcqywBGH97wHYtSUNPiXh5v2Zub9#drama-imagine-extreme Name: CommitVerify Version: 0.1.0 Description: Client-side-validation deterministic commitments @@ -27,6 +27,13 @@ data MerkleBlock : depth Std.U5#nitro-george-nebula @mnemonic(culture-metro-modular) data MerkleHash : [Byte ^ 32] +@mnemonic(input-mouse-amber) +data MerkleNode : branching NodeBranching + , depth U8 + , width U16 + , node1 MerkleHash + , node2 MerkleHash + @mnemonic(father-adios-common) data MerkleProof : pos U32 , cofactor U16 @@ -42,9 +49,16 @@ data MerkleTree : depth Std.U5#nitro-george-nebula @mnemonic(shampoo-bishop-morgan) data Message : [Byte ^ 32] +@mnemonic(food-amanda-burger) +data NodeBranching : void | single | branch + + @mnemonic(gamma-banjo-corona) data ProtocolId : [Byte ^ 32] +@mnemonic(cheese-final-locate) +data StrictHash : [Byte ^ 32] + @mnemonic(empty-active-truck) data TreeNode : concealedNode (depth Std.U5#nitro-george-nebula, hash MerkleHash) | commitmentLeaf (protocolId ProtocolId, message Message)