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

Unify single-use seals #110

Merged
merged 2 commits into from
Jan 15, 2025
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
3 changes: 0 additions & 3 deletions dbc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,3 @@ pub mod keytweak;
pub mod opret;
pub mod sigtweak;
pub mod tapret;
mod proof;

pub use proof::{Method, MethodParseError, Proof};
15 changes: 5 additions & 10 deletions dbc/src/opret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
use commit_verify::{CommitmentProtocol, EmbedCommitVerify, EmbedVerifyError};
use strict_encoding::{StrictDeserialize, StrictSerialize};

use crate::proof::Method;
use crate::{Proof, LIB_NAME_BPCORE};
use crate::LIB_NAME_BPCORE;

/// Marker non-instantiable enum defining LNPBP-12 taproot OP_RETURN (`tapret`)
/// protocol.
/// Marker non-instantiable enum defining LNPBP-12 taproot OP_RETURN (`opret`) protocol.
pub enum OpretFirst {}

impl CommitmentProtocol for OpretFirst {}
Expand Down Expand Up @@ -62,12 +60,9 @@
impl StrictSerialize for OpretProof {}
impl StrictDeserialize for OpretProof {}

impl Proof for OpretProof {
type Error = EmbedVerifyError<OpretError>;

const METHOD: Method = Method::OpretFirst;

fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), EmbedVerifyError<OpretError>> {
impl OpretProof {
/// Verifies opret commitment againsy the proof.
pub fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), EmbedVerifyError<OpretError>> {

Check warning on line 65 in dbc/src/opret/mod.rs

View check run for this annotation

Codecov / codecov/patch

dbc/src/opret/mod.rs#L65

Added line #L65 was not covered by tests
tx.verify(msg, self)
}
}
83 changes: 0 additions & 83 deletions dbc/src/proof.rs

This file was deleted.

15 changes: 4 additions & 11 deletions dbc/src/tapret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@
pub use tx::TapretError;
pub use xonlypk::TapretKeyError;

use crate::proof::Method;
use crate::{Proof, LIB_NAME_BPCORE};
use crate::LIB_NAME_BPCORE;

/// Marker non-instantiable enum defining LNPBP-12 taproot OP_RETURN (`tapret`)
/// protocol.
/// Marker non-instantiable enum defining LNPBP-12 taproot OP_RETURN (`tapret`) protocol.
pub enum TapretFirst {}

impl CommitmentProtocol for TapretFirst {}
Expand Down Expand Up @@ -357,14 +355,9 @@
let merkle_root = self.path_proof.original_merkle_root();
ScriptPubkey::p2tr(self.internal_pk, merkle_root)
}
}

impl Proof for TapretProof {
type Error = ConvolveVerifyError;

const METHOD: Method = Method::TapretFirst;

fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), ConvolveVerifyError> {
/// Verifies tapret commitment agains the proof.
pub fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), ConvolveVerifyError> {

Check warning on line 360 in dbc/src/tapret/mod.rs

View check run for this annotation

Codecov / codecov/patch

dbc/src/tapret/mod.rs#L360

Added line #L360 was not covered by tests
ConvolveCommitProof::<_, Tx, _>::verify(self, msg, tx)
}
}
2 changes: 1 addition & 1 deletion seals/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ extern crate serde;
mod txout;

pub use txout::{
mmb, mpc, Anchor, AnchorError, AnchorMergeError, Noise, TxoSeal, TxoSealDef, TxoSealExt,
mmb, mpc, Anchor, AnchorError, AnchorMergeError, Noise, TxoSeal, TxoSealError, TxoSealExt,
};
Loading
Loading