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

Support commit-encoding for PhantomData types #149

Merged
merged 3 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading