Skip to content

Commit

Permalink
Merge pull request #149 from LNP-BP/v0.11
Browse files Browse the repository at this point in the history
Support commit-encoding for PhantomData types
  • Loading branch information
dr-orlovsky authored Dec 30, 2023
2 parents 9a05f5c + c049cbc commit a348b77
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ default-members = [
]

[workspace.package]
version = "0.11.0-beta.2"
version = "0.11.0-beta.3"
authors = ["Dr Maxim Orlovsky <[email protected]>"]
homepage = "https://github.com/LNP-BP"
repository = "https://github.com/LNP-BP/client_side_validation"
Expand Down Expand Up @@ -41,8 +41,8 @@ name = "client_side_validation"
path = "src/lib.rs"

[dependencies]
commit_verify = { version = "0.11.0-beta.2", path = "./commit_verify", default-features = false }
single_use_seals = { version = "0.11.0-beta.2", path = "./single_use_seals" }
commit_verify = { version = "0.11.0-beta.3", path = "./commit_verify", default-features = false }
single_use_seals = { version = "0.11.0-beta.3", path = "./single_use_seals" }
serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true }

[features]
Expand Down
6 changes: 6 additions & 0 deletions commit_verify/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
//! [LNPBP-9]: https://github.com/LNP-BP/LNPBPs/blob/master/lnpbp-0009.md
use std::io;
use std::marker::PhantomData;

use crate::id::CommitmentId;
use crate::Conceal;
Expand Down Expand Up @@ -336,3 +337,8 @@ pub mod strategies {
impl CommitEncode for [u8; 32] {
fn commit_encode(&self, e: &mut impl io::Write) { e.write_all(self).ok(); }
}

impl<T> CommitEncode for PhantomData<T> {
fn commit_encode(&self, _: &mut impl io::Write) { /* nothing to do */
}
}
2 changes: 1 addition & 1 deletion commit_verify/src/mpc/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ mod test {

let (pid, msg) = msgs.first_key_value().unwrap();
let leaf = Leaf::inhabited(*pid, *msg);
let cid1 = block.cross_section.get(0).unwrap().to_merkle_node();
let cid1 = block.cross_section.first().unwrap().to_merkle_node();
let cid2 = leaf.commitment_id();
assert_eq!(cid1, cid2);

Expand Down

0 comments on commit a348b77

Please sign in to comment.