Skip to content

Commit

Permalink
Move the dsl primitives here and bump up the toolchain version (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
weikengchen authored Dec 15, 2024
1 parent 0cc94c2 commit 3db4f97
Show file tree
Hide file tree
Showing 44 changed files with 2,929 additions and 141 deletions.
83 changes: 37 additions & 46 deletions Cargo.lock

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

18 changes: 11 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ version = "0.1.0"
edition = "2021"

[dependencies]
rust-bitcoin-m31 = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-m31", tag = "1.0.0" }
bitcoin-script = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-script", tag = "1.0.0" }
rust-bitcoin-m31 = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-m31" }
bitcoin-script = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-script" }
bitcoin = "0.32.0"
bitcoin-scriptexec = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-scriptexec", tag = "1.0.0", features = ["debug"] }
bitcoin-scriptexec = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-scriptexec", features = ["debug"] }
sha2 = "0.10.8"
rand = "0.8.5"
rand_chacha = "0.3.1"
stwo-prover = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/stwo", tag = "for-fibonacci" }
stwo-prover = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/stwo" }
num-traits = "0.2.0"
lazy_static = "1.4.0"
ctor = "0.2.9"
itertools = "0.13.0"
hex = "0.4.3"
anyhow = "1.0.86"
bitcoin-script-dsl = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/dsl" }
covenants-gadgets = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/covenants-gadgets", tag = "1.0.0" }
bitcoin-script-dsl = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/dsl", tag = "0.2.0" }
covenants-gadgets = { git = "https://github.com/Bitcoin-Wildlife-Sanctuary/covenants-gadgets" }
clap = { version = "4.5.23", features = ["derive"] }
colored = "2.1.0"

Expand All @@ -29,11 +29,15 @@ version = "1"
default-features = false
features = ["user-hooks"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }

[profile.dev]
opt-level = 3

[profile.release]
lto = true

[features]
profiler = ["bitcoin-scriptexec/profiler"]
profiler = ["bitcoin-scriptexec/profiler"]
assume-op-cat = []
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2024-01-04"
channel = "nightly-2024-11-06"
8 changes: 4 additions & 4 deletions src/algorithms/column_line_coeffs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::dsl::primitives::cm31::CM31Var;
use crate::dsl::primitives::qm31::QM31Var;
use crate::dsl::primitives::table::TableVar;
use anyhow::Result;
use bitcoin_script_dsl::builtins::cm31::CM31Var;
use bitcoin_script_dsl::builtins::qm31::QM31Var;
use bitcoin_script_dsl::builtins::table::TableVar;

/// Compute the parameters of `column_line_coeffs` without applying alpha.
///
Expand All @@ -11,7 +11,7 @@ use bitcoin_script_dsl::builtins::table::TableVar;
///
/// Output:
/// - `(a1, b1), (a2, b2), (a3, b3), ..., (an, bn)`
/// where all of them are cm31.
/// where all of them are cm31.
/// - `ai = Im(f(P)) / Im(p.y)`
/// - `bi = Im(f(P)) / Im(p.y) Re(p.y) - Re(f(P))`
///
Expand Down
8 changes: 4 additions & 4 deletions src/algorithms/folding.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::dsl::primitives::m31::M31Var;
use crate::dsl::primitives::qm31::QM31Var;
use crate::dsl::primitives::table::TableVar;
use crate::treepp::*;
use anyhow::Result;
use bitcoin_script_dsl::builtins::m31::M31Var;
use bitcoin_script_dsl::builtins::qm31::QM31Var;
use bitcoin_script_dsl::builtins::table::TableVar;
use bitcoin_script_dsl::bvar::{AllocVar, BVar};
use bitcoin_script_dsl::options::Options;
use bitcoin_script_dsl::stack::Stack;
Expand Down Expand Up @@ -150,8 +150,8 @@ fn check_0_or_1() -> Script {
#[cfg(test)]
mod test {
use crate::algorithms::folding::{decompose_positions, skip_one_and_extract_bits};
use crate::dsl::primitives::m31::M31Var;
use crate::treepp::*;
use bitcoin_script_dsl::builtins::m31::M31Var;
use bitcoin_script_dsl::bvar::AllocVar;
use bitcoin_script_dsl::constraint_system::ConstraintSystem;
use bitcoin_script_dsl::test_program;
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/pair_vanishing.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::algorithms::point::SecureCirclePointVar;
use bitcoin_script_dsl::builtins::cm31::CM31Var;
use bitcoin_script_dsl::builtins::table::TableVar;
use crate::dsl::primitives::cm31::CM31Var;
use crate::dsl::primitives::table::TableVar;

pub fn prepare_pair_vanishing(
point: &SecureCirclePointVar,
Expand Down
7 changes: 4 additions & 3 deletions src/algorithms/point.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::dsl::primitives::channel::HashVarWithChannel;
use crate::dsl::primitives::m31::M31Var;
use crate::dsl::primitives::qm31::QM31Var;
use crate::dsl::primitives::table::TableVar;
use bitcoin_script_dsl::builtins::hash::HashVar;
use bitcoin_script_dsl::builtins::m31::M31Var;
use bitcoin_script_dsl::builtins::qm31::QM31Var;
use bitcoin_script_dsl::builtins::table::TableVar;
use bitcoin_script_dsl::bvar::{AllocVar, BVar};
use stwo_prover::core::circle::CirclePoint;
use stwo_prover::core::fields::m31::M31;
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/precomputed_tree.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::dsl::primitives::m31::M31Var;
use crate::precomputed_merkle_tree::{PrecomputedMerkleTree, PrecomputedMerkleTreeProof};
use crate::treepp::*;
use crate::utils::{hash, limb_to_be_bits_toaltstack_except_lowest_1bit};
use anyhow::{Error, Result};
use bitcoin_script_dsl::builtins::hash::HashVar;
use bitcoin_script_dsl::builtins::m31::M31Var;
use bitcoin_script_dsl::bvar::{AllocVar, BVar};
use bitcoin_script_dsl::options::Options;
use bitcoin_script_dsl::stack::Stack;
Expand Down
6 changes: 3 additions & 3 deletions src/algorithms/quotient.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bitcoin_script_dsl::builtins::cm31::CM31Var;
use bitcoin_script_dsl::builtins::m31::M31Var;
use bitcoin_script_dsl::builtins::table::TableVar;
use crate::dsl::primitives::cm31::CM31Var;
use crate::dsl::primitives::m31::M31Var;
use crate::dsl::primitives::table::TableVar;

pub fn apply_twin(
table: &TableVar,
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/twin_tree.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::dsl::primitives::m31::M31Var;
use crate::merkle_tree::MerkleTreeTwinProof;
use crate::treepp::*;
use crate::utils::{hash, limb_to_be_bits_toaltstack_except_lowest_1bit};
use anyhow::Error;
use anyhow::Result;
use bitcoin_script_dsl::builtins::hash::HashVar;
use bitcoin_script_dsl::builtins::m31::M31Var;
use bitcoin_script_dsl::bvar::{AllocVar, BVar};
use bitcoin_script_dsl::options::Options;
use bitcoin_script_dsl::stack::Stack;
Expand Down
2 changes: 2 additions & 0 deletions src/dsl/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pub mod plonk;

pub mod primitives;
2 changes: 1 addition & 1 deletion src/dsl/plonk/covenant.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::dsl::plonk::hints::Hints;
use crate::treepp::*;
use crate::utils::hash;
use crate::OP_HINT;
use anyhow::Result;
use bitcoin::script::write_scriptint;
use bitcoin_script_dsl::builtins::table::utils::OP_HINT;
use bitcoin_script_dsl::compiler::Compiler;
use bitcoin_script_dsl::constraint_system::Element;
use bitcoin_script_dsl::ldm::LDM;
Expand Down
Loading

0 comments on commit 3db4f97

Please sign in to comment.