Skip to content

Commit

Permalink
♻️ Binary into examples
Browse files Browse the repository at this point in the history
  • Loading branch information
taskooh committed May 22, 2024
1 parent 7e33c83 commit 1b92c8d
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 55 deletions.
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ name = "main"
path = "src/main.rs"


[[bin]]
[[example]]
name = "bin-test-marlin"
path = "src/bin_test_marlin.rs"
path = "examples/bin_test_marlin.rs"

[[bin]]
[[example]]
name = "bin-test-groth16"
path = "src/bin_test_groth16.rs"
path = "examples/bin_test_groth16.rs"

[[bin]]
[[example]]
name = "online"
path = "src/online.rs"
path = "examples/online.rs"

[[bin]]
[[example]]
name = "bin-werewolf"
path = "src/bin_werewolf.rs"
path = "examples/bin_werewolf.rs"
4 changes: 0 additions & 4 deletions src/bin_test_groth16.rs → examples/bin_test_groth16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ use mpc_net::{MpcMultiNet as Net, MpcNet};
use std::path::PathBuf;
use structopt::StructOpt;

mod circuits;
mod groth16;
mod input;

#[derive(Debug, StructOpt)]
#[structopt(name = "example", about = "An example of StructOpt usage.")]
struct Opt {
Expand Down
4 changes: 1 addition & 3 deletions src/bin_test_marlin.rs → examples/bin_test_marlin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use mpc_net::{MpcMultiNet as Net, MpcNet};
use std::path::PathBuf;
use structopt::StructOpt;

mod circuits;
mod input;
mod marlin;
use zk_mpc::marlin;

#[derive(Debug, StructOpt)]
#[structopt(name = "example", about = "An example of StructOpt usage.")]
Expand Down
32 changes: 11 additions & 21 deletions src/bin_werewolf.rs → examples/bin_werewolf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,28 @@ use ark_bls12_377::{Fr, FrParameters};
use ark_crypto_primitives::encryption::AsymmetricEncryptionScheme;
use ark_ec::twisted_edwards_extended::GroupAffine;
use ark_ec::AffineCurve;

use ark_ff::FpParameters;
use ark_marlin::IndexProverKey;
use ark_mnt4_753::FqParameters;
use ark_serialize::{CanonicalDeserialize, Read};
use ark_std::test_rng;
use ark_std::UniformRand;

use circuits::{DivinationCircuit, ElGamalLocalOrMPC, KeyPublicizeCircuit};
use core::panic;

use mpc_algebra::malicious_majority::*;
use mpc_algebra::Reveal;
use mpc_net::{MpcMultiNet as Net, MpcNet};
use serde::Deserialize;
use serialize::{write_r, write_to_file};
use std::{fs::File, path::PathBuf};
use structopt::StructOpt;

use mpc_net::{MpcMultiNet as Net, MpcNet};

mod marlin;
use marlin::*;

use crate::input::MpcInputTrait;
use crate::input::WerewolfKeyInput;
use crate::input::WerewolfMpcInput;

mod circuits;
mod input;
mod preprocessing;
mod serialize;
mod she;
use zk_mpc::circuits::{DivinationCircuit, ElGamalLocalOrMPC, KeyPublicizeCircuit};
use zk_mpc::input::MpcInputTrait;
use zk_mpc::input::WerewolfKeyInput;
use zk_mpc::input::WerewolfMpcInput;
use zk_mpc::marlin::LocalMarlin;
use zk_mpc::marlin::MFr;
use zk_mpc::marlin::MpcMarlin;
use zk_mpc::preprocessing;
use zk_mpc::serialize::{write_r, write_to_file};
use zk_mpc::she;

#[derive(Debug, StructOpt)]
struct Opt {
Expand Down
16 changes: 5 additions & 11 deletions src/online.rs → examples/online.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@ use ark_ff::{BigInteger, FpParameters, PrimeField};
use ark_marlin::IndexProverKey;
use ark_serialize::{CanonicalDeserialize, Read};
use ark_std::test_rng;

use mpc_algebra::Reveal;
use mpc_net::{MpcMultiNet as Net, MpcNet};

use serde::Deserialize;
use std::{fs::File, path::PathBuf, vec};
use structopt::StructOpt;

mod circuits;
use circuits::LocalOrMPC;
mod input;
use input::*;
mod marlin;
use marlin::*;

use crate::circuits::circuit::MyCircuit;
use zk_mpc::{
circuits::{circuit::MyCircuit, LocalOrMPC},
input::{MpcInputTrait, SampleMpcInput},
marlin::{pf_publicize, LocalMarlin, MFr, MpcMarlin},
};

#[derive(Debug, StructOpt)]
#[structopt(name = "example", about = "An example of StructOpt usage.")]
Expand Down
4 changes: 2 additions & 2 deletions run_groth16.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ set -ex
trap "exit" INT TERM
trap "kill 0" EXIT

cargo build --bin bin-test-groth16 --release
BIN=./target/release/bin-test-groth16
cargo build --example bin-test-groth16 --release
BIN=./target/release/examples/bin-test-groth16


PROCS=()
Expand Down
4 changes: 2 additions & 2 deletions run_marlin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ set -ex
trap "exit" INT TERM
trap "kill 0" EXIT

cargo build --bin bin-test-marlin --release
BIN=./target/release/bin-test-marlin
cargo build --example bin-test-marlin --release
BIN=./target/release/examples/bin-test-marlin


PROCS=()
Expand Down
4 changes: 2 additions & 2 deletions run_online.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ set -ex
trap "exit" INT TERM
trap "kill 0" EXIT

cargo build --bin online --release
BIN=./target/release/online
cargo build --example online --release
BIN=./target/release/examples/online


PROCS=()
Expand Down
4 changes: 2 additions & 2 deletions run_werewolf.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ set -ex
trap "exit" INT TERM
trap "kill 0" EXIT

cargo build --bin bin-werewolf --release
BIN=./target/release/bin-werewolf
cargo build --example bin-werewolf --release
BIN=./target/release/examples/bin-werewolf

PROCS=()

Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
pub mod circuits;
pub mod groth16;
pub mod input;
pub mod marlin;
pub mod preprocessing;
pub mod serialize;
pub mod she;

0 comments on commit 1b92c8d

Please sign in to comment.