Skip to content

Commit

Permalink
dbc: remove Anchor type, which is now TxOut seal-specific
Browse files Browse the repository at this point in the history
Signed-off-by: Dr Maxim Orlovsky <[email protected]>
  • Loading branch information
dr-orlovsky committed Nov 18, 2024
1 parent 43e92a9 commit 5f23087
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 383 deletions.
199 changes: 0 additions & 199 deletions dbc/src/anchor.rs

This file was deleted.

2 changes: 0 additions & 2 deletions dbc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ extern crate commit_verify;
/// Name of the strict type library generated from the data types in this crate.
pub const LIB_NAME_BPCORE: &str = "BPCore";

pub mod anchor;
pub mod keytweak;
pub mod opret;
pub mod sigtweak;
pub mod tapret;
mod proof;

pub use anchor::Anchor;
pub use proof::{Method, MethodParseError, Proof};
3 changes: 3 additions & 0 deletions seals/src/txout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ pub mod mmb {
}
}

/// Anchor is a set of data required for the client-side validation of a Bitcoin Txout single-use
/// seal, which can't be recovered from the transaction and other public information itself.
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)]

Check warning on line 106 in seals/src/txout.rs

View check run for this annotation

Codecov / codecov/patch

seals/src/txout.rs#L106

Added line #L106 was not covered by tests
#[strict_type(lib = dbc::LIB_NAME_BPCORE)]
Expand All @@ -118,6 +120,7 @@ pub struct Anchor<D: dbc::Proof> {
pub fallback_proof: ReservedBytes<1>,
}

/// Proof data for verification of deterministic bitcoin commitment produced from anchor.
pub struct Proof<D: dbc::Proof> {
pub mpc_commit: mpc::Commitment,
pub dbc_proof: D,
Expand Down
14 changes: 4 additions & 10 deletions src/bin/bpcore-stl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,9 @@ Seals vesper lexicon=types+commitments
let tt = sys.type_tree("BPCore.TxoSealOpretProof").unwrap();

Check warning on line 121 in src/bin/bpcore-stl.rs

View check run for this annotation

Codecov / codecov/patch

src/bin/bpcore-stl.rs#L121

Added line #L121 was not covered by tests
writeln!(file, "{tt}").unwrap();

let tt = sys.type_tree("BPCore.AnchorMerkleTreeTapretProof").unwrap();
fs::write(format!("{dir}/Anchor.MerkleTree.Tapret.vesper"), format!("{tt}")).unwrap();
let tt = sys.type_tree("BPCore.AnchorTapretProof").unwrap();
fs::write(format!("{dir}/Anchor.Tapret.vesper"), format!("{tt}")).unwrap();

Check warning on line 125 in src/bin/bpcore-stl.rs

View check run for this annotation

Codecov / codecov/patch

src/bin/bpcore-stl.rs#L124-L125

Added lines #L124 - L125 were not covered by tests

let tt = sys.type_tree("BPCore.AnchorMerkleTreeOpretProof").unwrap();
fs::write(format!("{dir}/Anchor.MerkleTree.Opret.vesper"), format!("{tt}")).unwrap();

let tt = sys.type_tree("BPCore.AnchorMerkleBlockTapretProof").unwrap();
fs::write(format!("{dir}/Anchor.MerkleBlock.Tapret.vesper"), format!("{tt}")).unwrap();

let tt = sys.type_tree("BPCore.AnchorMerkleProofTapretProof").unwrap();
fs::write(format!("{dir}/Anchor.MerkleProof.Tapret.vesper"), format!("{tt}")).unwrap();
let tt = sys.type_tree("BPCore.AnchorOpretProof").unwrap();
fs::write(format!("{dir}/Anchor.Opret.vesper"), format!("{tt}")).unwrap();

Check warning on line 128 in src/bin/bpcore-stl.rs

View check run for this annotation

Codecov / codecov/patch

src/bin/bpcore-stl.rs#L127-L128

Added lines #L127 - L128 were not covered by tests
}
9 changes: 1 addition & 8 deletions src/stl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

//! Strict types library generator methods.
use commit_verify::mpc;
use dbc::opret::OpretProof;
use dbc::tapret::TapretProof;
use dbc::LIB_NAME_BPCORE;
Expand All @@ -30,20 +29,14 @@ use strict_types::{CompileError, LibBuilder, TypeLib};
/// Strict types id for the library providing data types from [`dbc`] and
/// [`seals`] crates.
pub const LIB_ID_BPCORE: &str =
"stl:shT3puxD-pguyIQF-lMwkHEo-oASAiSm-s6zQH6s-AqbOAOg#bruno-belgium-shelf";
"stl:3xUSwL0a-VuYPFl2-Cdk3L21-yX8c1Kg-~wRzG1T-B2FgGWg#pastel-voice-binary";

fn _bp_core_stl() -> Result<TypeLib, CompileError> {
LibBuilder::new(libname!(LIB_NAME_BPCORE), tiny_bset! {
strict_types::stl::std_stl().to_dependency(),
bc::stl::bp_tx_stl().to_dependency(),
commit_verify::stl::commit_verify_stl().to_dependency()
})
.transpile::<dbc::Anchor<mpc::MerkleTree, TapretProof>>()
.transpile::<dbc::Anchor<mpc::MerkleBlock, TapretProof>>()
.transpile::<dbc::Anchor<mpc::MerkleProof, TapretProof>>()
.transpile::<dbc::Anchor<mpc::MerkleTree, OpretProof>>()
.transpile::<dbc::Anchor<mpc::MerkleBlock, OpretProof>>()
.transpile::<dbc::Anchor<mpc::MerkleProof, OpretProof>>()
.transpile::<seals::TxoSeal<OpretProof>>()
.transpile::<seals::TxoSeal<TapretProof>>()
.transpile::<seals::Anchor<OpretProof>>()
Expand Down
31 changes: 0 additions & 31 deletions stl/Anchor.MerkleBlock.Tapret.vesper

This file was deleted.

21 changes: 0 additions & 21 deletions stl/Anchor.MerkleTree.Opret.vesper

This file was deleted.

25 changes: 0 additions & 25 deletions stl/Anchor.MerkleTree.Tapret.vesper

This file was deleted.

14 changes: 14 additions & 0 deletions stl/Anchor.Opret.vesper
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
rec AnchorOpretProof
rec mmbProof, BundleProof
map map, len 0..MAX8
is key, U32
bytes value, len 32
bytes mpcProtocol, len 32, aka ProtocolId
rec mpcProof, MerkleProof
enum method, Method, sha256t 0
is pos, U32
is cofactor, U16
list path, len 0..32
bytes element, len 32, aka MerkleHash
is dbcProof, Unit, aka OpretProof
bytes fallbackProof, len 1, aka ReservedBytes1
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
rec AnchorMerkleProofTapretProof
rec AnchorTapretProof
rec mmbProof, BundleProof
map map, len 0..MAX8
is key, U32
bytes value, len 32
bytes mpcProtocol, len 32, aka ProtocolId
rec mpcProof, MerkleProof
enum method, Method, sha256t 0
is pos, U32
Expand All @@ -10,3 +15,4 @@ rec AnchorMerkleProofTapretProof
union some, TapretNodePartner, option, wrapped, tag 1
rec rightBranch, TapretRightBranch, wrapped, tag 2
is nonce, U8
bytes fallbackProof, len 1, aka ReservedBytes1
Loading

0 comments on commit 5f23087

Please sign in to comment.