Skip to content

Commit

Permalink
Refactor: Convert project to Cargo workspace (BitVM#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrembal authored Jan 7, 2025
1 parent 8e9bd29 commit 834199a
Show file tree
Hide file tree
Showing 242 changed files with 373 additions and 272 deletions.
70 changes: 41 additions & 29 deletions Cargo.lock

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

39 changes: 11 additions & 28 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
[package]
name = "bitvm"
version = "0.1.0"
edition = "2021"
exclude = ["tests"]
[workspace]
resolver = "2"
members = [
"bitvm",
"bridge"
]

[dependencies]
#bitcoin-script = { path = "../rust-bitcoin-script"}
#bitcoin-scriptexec = { path = "../rust-bitcoin-scriptexec"}
[workspace.dependencies]
bitcoin-script = { git = "https://github.com/BitVM/rust-bitcoin-script", branch = "StructuredScript" }
bitcoin = { version = "0.32.5", features = ["rand-std"] }
strum = "0.26"
strum_macros = "0.26"
hex = "0.4.3"
bitcoin-scriptexec = { git = "https://github.com/BitVM/rust-bitcoin-scriptexec" }
serde = { version = "1.0.197", features = ["derive"] }
num-bigint = "0.4.4"
# num-bigint = "0.4.4"
num-traits = "0.2.18"
ark-bn254 = { git = "https://github.com/chainwayxyz/algebra/", branch = "new-ate-loop", features = ["curve"], default-features = false }
ark-ff = { git = "https://github.com/chainwayxyz/algebra/", branch = "new-ate-loop" }
Expand Down Expand Up @@ -45,16 +44,9 @@ toml = "0.5.11"
colored = "2.0.0"
itertools = "0.13.0"
serde-big-array = "0.5.1"

[dev-dependencies]
num-bigint = { version = "0.4.4", features = ["rand"] }
ark-std = { version = "0.4.0", default-features = false, features = [
"print-trace",
] }
ark-crypto-primitives = { git = "https://github.com/arkworks-rs/crypto-primitives", features = [
"snark",
"sponge",
] }
ark-std = { version = "0.4.0", default-features = false, features = ["print-trace"] }
ark-crypto-primitives = { git = "https://github.com/arkworks-rs/crypto-primitives", features = ["snark", "sponge"] }
ark-relations = { git = "https://github.com/arkworks-rs/snark/" }
serial_test = "*"
tqdm = "0.7"
Expand All @@ -71,17 +63,8 @@ ark-ec = { git = "https://github.com/chainwayxyz/algebra/", branch = "new-ate-lo
ark-poly = { git = "https://github.com/chainwayxyz/algebra/", branch = "new-ate-loop" }
ark-serialize = { git = "https://github.com/chainwayxyz/algebra/", branch = "new-ate-loop" }
ark-bn254 = { git = "https://github.com/chainwayxyz/algebra/", branch = "new-ate-loop", features = ["curve"], default-features = false }

ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std/" }
ark-crypto-primitives = { git = "https://github.com/arkworks-rs/crypto-primitives/" }

ark-relations = { git = "https://github.com/arkworks-rs/snark/" }
ark-snark = { git = "https://github.com/arkworks-rs/snark/" }
ark-groth16 = { git = "https://github.com/arkworks-rs/groth16" }

[[bin]]
name = "cli"

[[bin]]
name = "cli-query"
path = "src/bin/cli_query/main.rs"
ark-groth16 = { git = "https://github.com/arkworks-rs/groth16" }
39 changes: 39 additions & 0 deletions bitvm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "bitvm"
version = "0.1.0"
edition = "2021"
exclude = ["tests"]


[dependencies]
bitcoin-script.workspace = true
bitcoin.workspace = true
hex.workspace = true
bitcoin-scriptexec.workspace = true
serde.workspace = true
num-traits.workspace = true
ark-bn254.workspace = true
ark-ff.workspace = true
ark-ec.workspace = true
ark-groth16.workspace = true
ark-serialize.workspace = true
sha2.workspace = true
bitcoin-script-stack.workspace = true
rand.workspace = true
rand_chacha.workspace = true
blake3.workspace = true
paste.workspace = true
colored.workspace = true
itertools.workspace = true
num-bigint.workspace = true
ark-std.workspace = true
ark-crypto-primitives.workspace = true
ark-relations.workspace = true
tqdm.workspace = true
regex.workspace = true

[profile.dev]
opt-level = 3

[profile.release]
lto = true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 5 additions & 8 deletions src/chunker/assigner.rs → bitvm/src/chunker/assigner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ use super::{
elements::{ElementTrait, G2PointType},
};
use crate::{
bridge::{
graphs::peg_out::CommitmentMessageId,
transactions::signing_winternitz::{
generate_winternitz_checksig_leave_hash, generate_winternitz_checksig_leave_variable,
generate_winternitz_witness, WinternitzPublicKey, WinternitzSecret,
WinternitzSigningInputs,
},
signatures::signing_winternitz::{
generate_winternitz_checksig_leave_hash, generate_winternitz_checksig_leave_variable,
generate_winternitz_witness, WinternitzPublicKey, WinternitzSecret,
WinternitzSigningInputs,
},
execute_script_with_inputs,
treepp::*,
Expand Down Expand Up @@ -302,7 +299,7 @@ mod tests {
use crate::execute_script_with_inputs;
use crate::treepp::{script, Script};
use crate::{
bridge::transactions::signing_winternitz::{
signatures::signing_winternitz::{
generate_winternitz_witness, winternitz_message_checksig, WinternitzPublicKey,
WinternitzSecret, WinternitzSigningInputs, LOG_D,
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/chunker/common.rs → bitvm/src/chunker/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub use crate::hash::blake3_u32::blake3_var_length;
use super::disprove_execution::RawProof;

/// The depth of a blake3 hash, depending on the defination of `N_DIGEST_U32_LIMBS`
pub(crate) const BLAKE3_HASH_LENGTH: usize =
pub const BLAKE3_HASH_LENGTH: usize =
crate::hash::blake3_u32::N_DIGEST_U32_LIMBS as usize * 4;
pub type BLAKE3HASH = [u8; BLAKE3_HASH_LENGTH];

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/lib.rs → bitvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use bitcoin_scriptexec::{Exec, ExecCtx, ExecError, ExecStats, Options, Stack, Tx

pub mod bigint;
pub mod bn254;
pub mod bridge;
pub mod chunker;
pub mod groth16;
pub mod hash;
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/signatures/mod.rs → bitvm/src/signatures/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod winternitz;
pub mod winternitz_hash;
pub mod utils;
pub mod signing_winternitz;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 58 additions & 0 deletions bridge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[package]
name = "bridge"
version = "0.1.0"
edition = "2021"
exclude = ["tests"]

[dependencies]
bitvm = { path = "../bitvm" }
bitcoin-script.workspace = true
bitcoin.workspace = true
strum.workspace = true
strum_macros.workspace = true
hex.workspace = true
bitcoin-scriptexec.workspace = true
serde.workspace = true
num-traits.workspace = true
sha2.workspace = true
tokio.workspace = true
esplora-client.workspace = true
serde_json.workspace = true
rand.workspace = true
dotenv.workspace = true
aws-sdk-s3.workspace = true
regex.workspace = true
musig2.workspace = true
futures.workspace = true
async-trait.workspace = true
suppaftp.workspace = true
openssh-sftp-client.workspace = true
openssh.workspace = true
alloy.workspace = true
clap.workspace = true
toml.workspace = true
colored.workspace = true
itertools.workspace = true
serial_test.workspace = true
ark-bn254.workspace = true
ark-groth16.workspace = true
ark-ff.workspace = true
ark-std.workspace = true


[profile.dev]
opt-level = 3

[profile.release]
lto = true

[profile.profiling]
inherits = "release"
debug = true

[[bin]]
name = "cli"

[[bin]]
name = "cli-query"
path = "src/bin/cli_query/main.rs"
4 changes: 2 additions & 2 deletions src/bin/cli/main.rs → bridge/src/bin/cli/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bitcoin::PublicKey;
use bitvm::bridge::client::cli::client_command::{ClientCommand, CommonArgs};
use bitvm::bridge::client::cli::key_command::KeysCommand;
use bridge::client::cli::client_command::{ClientCommand, CommonArgs};
use bridge::client::cli::key_command::KeysCommand;
use clap::{arg, command};
use std::error::Error;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bitcoin::Network;
use bitvm::bridge::{client::cli::query_command::QueryCommand, constants::DestinationNetwork};
use bridge::{client::cli::query_command::QueryCommand, constants::DestinationNetwork};
use clap::{arg, command};
use std::error::Error;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::key_command::KeysCommand;
use crate::bridge::client::client::BitVMClient;
use crate::bridge::constants::DestinationNetwork;
use crate::bridge::contexts::base::generate_keys_from_secret;
use crate::bridge::graphs::base::{VERIFIER_0_SECRET, VERIFIER_1_SECRET};
use crate::bridge::transactions::base::Input;
use crate::client::client::BitVMClient;
use crate::constants::DestinationNetwork;
use crate::contexts::base::generate_keys_from_secret;
use crate::graphs::base::{VERIFIER_0_SECRET, VERIFIER_1_SECRET};
use crate::transactions::base::Input;
use bitcoin::PublicKey;
use bitcoin::{Network, OutPoint};
use clap::{arg, ArgMatches, Command};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::io::{self, Read, Write};
use std::path::PathBuf;
use toml;

use crate::bridge::contexts::base::generate_keys_from_secret;
use crate::contexts::base::generate_keys_from_secret;

#[derive(Serialize, Deserialize, Default)]
pub struct Config {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{
query_response::{Response, ResponseStatus},
validation::{validate, ArgType},
};
use crate::bridge::{
use crate::{
client::{
client::BitVMClient,
sdk::{query::ClientCliQuery, query_contexts::depositor_signatures::DepositorSignatures},
Expand Down
File renamed without changes.
Loading

0 comments on commit 834199a

Please sign in to comment.