Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewamp workflows on generating commitment ids #152

Merged
merged 26 commits into from
Feb 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c12e46e
commit: refactor commitment ids and commit-encode
dr-orlovsky Feb 1, 2024
49173a4
commit: merge encode into id module
dr-orlovsky Feb 1, 2024
ec9b66e
commit: refactor CommitmentId trait system and tags
dr-orlovsky Feb 1, 2024
bce2b34
commit: fix merkle tree commit id generation
dr-orlovsky Feb 1, 2024
7f2e245
chore: update to new STL
dr-orlovsky Feb 3, 2024
ca68662
merkle: fix doc typo
dr-orlovsky Feb 3, 2024
eb290ae
Merge remote-tracking branch 'origin/master' into v0.11
dr-orlovsky Feb 10, 2024
969571b
chore: update dependencies
dr-orlovsky Feb 4, 2024
a98ed20
merkle: support 8--bit-sized collections
dr-orlovsky Feb 10, 2024
9f90575
id: add StrictHash type
dr-orlovsky Feb 10, 2024
ce4d602
stl: add merklization types into library
dr-orlovsky Feb 11, 2024
9562563
chore: update to new strict encode APIs
dr-orlovsky Feb 12, 2024
a129ce9
update commitment tag URNs
dr-orlovsky Feb 12, 2024
e78b28e
chore: update dependencies
dr-orlovsky Feb 15, 2024
7549e50
commit: derive Debug for CommitEngine
dr-orlovsky Feb 16, 2024
5359d84
stl: update
dr-orlovsky Feb 16, 2024
75d5979
commit: add specialized commit methods to CommitEngine
dr-orlovsky Feb 17, 2024
ec95f74
commit: add vesper translator
dr-orlovsky Feb 18, 2024
2b822b9
commit: refactor CommitLayout
dr-orlovsky Feb 18, 2024
49345a1
commit: improve vesper syntax
dr-orlovsky Feb 18, 2024
d81288a
commit: support committing to optionals
dr-orlovsky Feb 18, 2024
b2c5128
merkle: ensure proper large int conversion. Make var names better
dr-orlovsky Feb 19, 2024
0353648
merkle: ensure collection size match
dr-orlovsky Feb 20, 2024
588e97a
merkle: improve test for large trees
dr-orlovsky Feb 25, 2024
3a157c1
Merge pull request #156 from LNP-BP/fix/merklize
dr-orlovsky Feb 26, 2024
b7df64a
Merge pull request #154 from LNP-BP/layouts
dr-orlovsky Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update to new STL
dr-orlovsky committed Feb 3, 2024
commit 7f2e2458d239ccf1c087218625fea145c28135ef
82 changes: 46 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -56,3 +56,7 @@ serde = ["serde_crate", "commit_verify/serde"]

[package.metadata.docs.rs]
features = [ "all" ]

[patch.crates-io]
strict_encoding = { git = "https://github.com/strict-types/strict-encoding", branch = "ident" }
strict_types = { git = "https://github.com/strict-types/strict-types", branch = "vesper" }
6 changes: 3 additions & 3 deletions commit_verify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -22,9 +22,9 @@ name = "commit-stl"
required-features = ["stl"]

[dependencies]
amplify = { version = "4.5.0", features = ["hex", "apfloat"] }
amplify = { version = "4.5.1", features = ["hex", "apfloat"] }
commit_encoding_derive = { version = "0.11.0-beta.3", path = "derive" }
strict_encoding = "2.6.1"
strict_encoding = "2.6.2"
strict_types = { version = "1.6.3" }
sha2 = "0.10.8"
ripemd = "0.1.3"
@@ -38,7 +38,7 @@ rand = "0.8.5"
default = ["derive"]
all = ["rand", "serde", "stl", "derive"]
serde = ["serde_crate", "amplify/serde"]
stl = ["strict_types/base64"]
stl = ["strict_types/base85"]
derive = []

[package.metadata.docs.rs]
2 changes: 1 addition & 1 deletion commit_verify/src/stl.rs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ use strict_types::{CompileError, LibBuilder, TypeLib};
use crate::{mpc, LIB_NAME_COMMIT_VERIFY};

pub const LIB_ID_COMMIT_VERIFY: &str =
"urn:ubideco:stl:Ewz3JJVGUDfT1KkcBpJ1tYHUpVfvwNpQBWdvPqKMEZfY#capitan-bonjour-whiskey";
"urn:ubideco:stl:4SZ2EgWWtC5LsNXmNpAzogNHZoaZNTCwU3SQhAYwDX6A#citizen-fiction-corner";

fn _commit_verify_stl() -> Result<TypeLib, CompileError> {
LibBuilder::new(libname!(LIB_NAME_COMMIT_VERIFY), tiny_bset! {
45 changes: 22 additions & 23 deletions stl/[email protected]
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
-----BEGIN STRICT TYPE LIB-----
Id: urn:ubideco:stl:ZtHaBzu9ojbDahaGKEXe5v9DfSDxLERbLkEB23R6Q6V
Id: 4SZ2EgWWtC5LsNXmNpAzogNHZoaZNTCwU3SQhAYwDX6A#citizen-fiction-corner
Name: CommitVerify
Dependencies:
urn:ubideco:stl:9KALDYR8Nyjq4FdMW6kYoL7vdkWnqPqNuFnmE9qHpNjZ
55f8bsTvyh7zAeYAiNwL9G1DxgwXzDvE8edcTFJz3Q9H#milan-poncho-gray

DENvbW1pdFZlcmlmeQF7hIA8nvriESWnfCw5vHDS/ej5Q64N/Zz05oLtx2bKcANT
dGQBA1N0ZAEAIuTglum9fVyG9eHfXXcBav45xzzZNIVQlECJjKijeV4CVTUIAApD
b21taXRtZW50BQEABwAAQCAAC01lcmtsZUJsb2NrBgQFZGVwdGgCe4SAPJ764hEl
p3wsObxw0v3o+UOuDf2c9OaC7cdmynAi5OCW6b19XIb14d9ddwFq/jnHPNk0hVCU
QImMqKN5Xghjb2ZhY3RvcgAAAgxjcm9zc1NlY3Rpb24ACAFTQ5UPRDMqI//ogM9Q
588IBqEEzeBIaxPhDPwYg0Ow1wAAAAAAAAAA/////wAAAAAHZW50cm9weQAEAgAE
bm9uZQAAAAEEc29tZQAFAQAACApNZXJrbGVOb2RlBQEABwAAQCAAC01lcmtsZVBy
b29mBgMDcG9zAAAECGNvZmF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8^mT+s=T=}Z?`J=~w8Q=GLzSfImTncuED0}GM}V{c|*V
{~tF0006EV{&hEb5mtwbZKvH00;rtwYiq_Rlwao{(T?aUNqayF^88E^#IUpx^^~;
)zDV}0000000030|Ns9000007Wo~qGZ*X}41OfmAZf|a7000011aog~WdH>M000O
IO=WUxY-LDcb7%zt00#g7Kp+4MO=WUxY-Lb#Z*OJ>0|Rhxa{vGY2xD(%VPkY}asU
7V1aM(=XaEQSIG#g>Clv)aMjKgwAH@`bu1x<7g|G$};xvA~n-$_S0000000000AO
HXW000003Qc8lYiwmya%E)(1qEbfaCB$_JfJU>zJB;=bhBCKPB)LHON@H8JZNt%N
vJPm-=hp1W>|38j$F|Rkm*bpSUudIqf?x<LRg@~V42^pIs*%m2W4(_a&K^X000OG
V{c|*V{~tF0006AZDn(FVP|D?015#xm44<OVKiC01qkHfuRUrZzt;Qv9WjEZdF4f
P;8w8#H8-hI70Bv^+*0?ef%0)>Q3WPbltNdpi4*91)SI!>0000000000|Ns90000
0018re&015yA1ONpB0Wg(*<{e=)S-S-Y<l(P9Y9YVY`}-X+f~R@qMRed+u>mzVsZ
kZk>V@1=_p5>Oab-~jCR3C`SFec^=zG+gvC{wm0000000960{{R30000L~Wpi_3X
JrKe00#g7Kp+4LP;zf{Z)0z4Nn`~900#g7Kp+4JRB~lyPH$vo1OfmJV{dL_WnpY(
WKM5nWdH^O1!QG#bZ7!Rpf8lZe)ws0vsvd(H;<-EjC!>^Xm2e^s4rySqYNBoSa8^
mT+s=T=}Z?`J=~w8Q=GLzSfImTncuED0}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;qtQ<OqiuZa`rd(@k;(*

-----END STRICT TYPE LIB-----

Binary file modified stl/[email protected]
Binary file not shown.
49 changes: 28 additions & 21 deletions stl/[email protected]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-
Id: urn:ubideco:stl:ZtHaBzu9ojbDahaGKEXe5v9DfSDxLERbLkEB23R6Q6V#rhino-cover-frog
Id: urn:ubideco:stl:4SZ2EgWWtC5LsNXmNpAzogNHZoaZNTCwU3SQhAYwDX6A#citizen-fiction-corner
Name: CommitVerify
Version: 0.1.0
Description: Client-side-validation deterministic commitments
@@ -8,38 +8,45 @@
License: Apache-2.0
-}

@context
typelib CommitVerify

import urn:ubideco:stl:9KALDYR8Nyjq4FdMW6kYoL7vdkWnqPqNuFnmE9qHpNjZ#justice-rocket-type as Std
-- Imports:
-- U5 := urn:ubideco:semid:3MDHMYsJt8d1gUiyx5vGCWcNLQ7biek6UTjHg3ksW4Bf#ground-volume-singer
import Std#55f8bsTvyh7zAeYAiNwL9G1DxgwXzDvE8edcTFJz3Q9H#milan-poncho-gray
use U5#nitro-george-nebula


@mnemonic(ventura-equal-think)
data Commitment : [Byte ^ 32]

-- urn:ubideco:semid:F8mU5NPc8Z5CMnkSFGdF5UxrPsdcBS6B5DCyP5kJPgWc#ventura-equal-think
data Commitment :: [Byte ^ 32]
-- urn:ubideco:semid:qp6pMjMCcukxxZdkM2PtfNWfJjXKoVHXtXSBCsYjQwY#transit-bogart-nissan
data MerkleBlock :: depth Std.U5 {- urn:ubideco:semid:3MDHMYsJt8d1gUiyx5vGCWcNLQ7biek6UTjHg3ksW4Bf#ground-volume-singer -}
@mnemonic(iris-explore-script)
data MerkleBlock : depth Std.U5#nitro-george-nebula
, cofactor U16
, crossSection [TreeNode ^ ..0xffffffff]
, entropy U64?
-- urn:ubideco:semid:6kxYeCatpncbA9UiTdsFbxbxJdU56x6MdmTRkEeGAv6R#iceberg-rocket-velvet
data MerkleNode :: [Byte ^ 32]
-- urn:ubideco:semid:9FbrjZLnMDfbrN9gEbWij5HNkxqAVaZBkoW2UvKdYw4B#canyon-exhibit-ravioli
data MerkleProof :: pos U32

@mnemonic(culture-metro-modular)
data MerkleHash : [Byte ^ 32]

@mnemonic(father-adios-common)
data MerkleProof : pos U32
, cofactor U16
, path [MerkleNode ^ ..0x20]
-- urn:ubideco:semid:57jCv2LWrdn89GzuSYaH17f21N3su76uM2tEaG1dwwoT#russian-wedding-florida
data MerkleTree :: depth Std.U5 {- urn:ubideco:semid:3MDHMYsJt8d1gUiyx5vGCWcNLQ7biek6UTjHg3ksW4Bf#ground-volume-singer -}
, path [MerkleHash ^ ..0x20]

@mnemonic(civil-left-nova)
data MerkleTree : depth Std.U5#nitro-george-nebula
, entropy U64
, cofactor U16
, messages {ProtocolId -> ^ ..0xffffff Message}
, map {U32 -> ^ ..0xffffff ProtocolId, Message}
-- urn:ubideco:semid:4ajqScXjJ6wQ5af2zgBFzzP7k1qzD6DXXU28taQidCcA#shampoo-bishop-morgan
data Message :: [Byte ^ 32]
-- urn:ubideco:semid:4GenVCt5Xq6xtnJDjT98FehgCS8rTmwEzbjwGkaUVjHz#gamma-banjo-corona
data ProtocolId :: [Byte ^ 32]
-- urn:ubideco:semid:D7Q2eTnYyjN6gMZnZYrMG6gmRwmtnxyGLeqBbki8DFLv#greek-decimal-quiz
data TreeNode :: concealedNode (depth Std.U5 {- urn:ubideco:semid:3MDHMYsJt8d1gUiyx5vGCWcNLQ7biek6UTjHg3ksW4Bf#ground-volume-singer -}, hash MerkleNode)

@mnemonic(shampoo-bishop-morgan)
data Message : [Byte ^ 32]

@mnemonic(gamma-banjo-corona)
data ProtocolId : [Byte ^ 32]

@mnemonic(empty-active-truck)
data TreeNode : concealedNode (depth Std.U5#nitro-george-nebula, hash MerkleHash)
| commitmentLeaf (protocolId ProtocolId, message Message)


Loading