Skip to content

Commit

Permalink
dbc: convert method information for DBC proofs from const to fn
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Oct 13, 2024
1 parent 32f9a14 commit ec9b612
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dbc/src/opret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ impl StrictDeserialize for OpretProof {}

impl Proof<Method> for OpretProof {
type Error = EmbedVerifyError<OpretError>;
const METHOD: Method = Method::OpretFirst;

fn method(&self) -> Method { Method::OpretFirst }

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

View check run for this annotation

Codecov / codecov/patch

dbc/src/opret/mod.rs#L76

Added line #L76 was not covered by tests

fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), EmbedVerifyError<OpretError>> {
tx.verify(msg, self)
Expand Down
4 changes: 2 additions & 2 deletions dbc/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ pub trait Proof<M: DbcMethod = Method>:
/// Verification error.
type Error: Error;

/// Returns DBC method used by the proof.
const METHOD: M;
/// Returns a single-use seal closing method used by the DBC proof.
fn method(&self) -> M;

/// Verifies DBC proof against the provided transaction.
fn verify(&self, msg: &mpc::Commitment, tx: &Tx) -> Result<(), Self::Error>;
Expand Down
3 changes: 2 additions & 1 deletion dbc/src/tapret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ impl TapretProof {

impl Proof<Method> for TapretProof {
type Error = ConvolveVerifyError;
const METHOD: Method = Method::TapretFirst;

fn method(&self) -> Method { Method::TapretFirst }

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

View check run for this annotation

Codecov / codecov/patch

dbc/src/tapret/mod.rs#L381

Added line #L381 was not covered by tests

fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), ConvolveVerifyError> {
ConvolveCommitProof::<_, Tx, _>::verify(self, msg, tx)
Expand Down

0 comments on commit ec9b612

Please sign in to comment.