Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal: reorganize workspace #11

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"

members = ["madara-prover-rpc-client", "madara-prover-rpc-server", "stone-prover", "test-toolkit"]
members = ["madara-prover-common", "madara-prover-rpc-client", "madara-prover-rpc-server", "stone-prover", "test-cases"]

[workspace.dependencies]
cairo-vm = { version = "0.9.0", features = ["lambdaworks-felt"] }
Expand Down
15 changes: 15 additions & 0 deletions madara-prover-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "madara-prover-common"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cairo-vm = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }

[dev-dependencies]
rstest = { workspace = true }
test-cases = { path = "../test-cases" }
2 changes: 2 additions & 0 deletions madara-prover-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod models;
pub mod toolkit;
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub struct Proof {
#[cfg(test)]
mod tests {
use std::path::Path;
use test_toolkit::load_fixture;
use test_cases::load_fixture;

use super::*;

Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions madara-prover-rpc-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ edition = "2021"

[dependencies]
cairo-vm = { version = "0.9.0", features = ["lambdaworks-felt"] }
madara-prover-common = { path = "../madara-prover-common" }
prost = { workspace = true }
stone-prover = { path = "../stone-prover" }
thiserror = {workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tonic = { workspace = true }
serde_json = { workspace = true }
Expand All @@ -20,5 +21,5 @@ bincode = "2.0.0-rc.3"
tonic-build = { workspace = true }

[dev-dependencies]
test-toolkit = { path = "../test-toolkit" }
test-cases = { path = "../test-cases" }

2 changes: 1 addition & 1 deletion madara-prover-rpc-server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use tokio_stream::wrappers::ReceiverStream;
use tonic::{transport::Server, Request, Response, Status};

use madara_prover_common::models::{Proof, ProverConfig, ProverParameters, PublicInput};
use prover::ProverRequest;
use stone_prover::error::ProverError;
use stone_prover::models::{Proof, ProverConfig, ProverParameters, PublicInput};
use stone_prover::prover::run_prover_async;

use crate::cairo::{extract_run_artifacts, run_in_proof_mode};
Expand Down
4 changes: 2 additions & 2 deletions stone-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
description = "A Rust wrapper around StarkWare's Stone Prover."

[dependencies]
cairo-vm = { workspace = true }
madara-prover-common = { path = "../madara-prover-common" }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tempfile = "3.8.1"
Expand All @@ -14,4 +14,4 @@ tokio = { workspace = true }

[dev-dependencies]
rstest = { workspace = true }
test-toolkit = { path = "../test-toolkit" }
test-cases = { path = "../test-cases" }
2 changes: 0 additions & 2 deletions stone-prover/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
pub mod error;
pub mod models;
pub mod prover;
pub mod toolkit;
12 changes: 7 additions & 5 deletions stone-prover/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ use std::path::{Path, PathBuf};
use tempfile::tempdir;

use crate::error::ProverError;
use crate::models::{PrivateInput, Proof, ProverConfig, ProverParameters, PublicInput};
use crate::toolkit::{read_json_from_file, write_json_to_file};
use madara_prover_common::models::{
PrivateInput, Proof, ProverConfig, ProverParameters, PublicInput,
};
use madara_prover_common::toolkit::{read_json_from_file, write_json_to_file};

/// Call the Stone Prover from the command line.
///
Expand Down Expand Up @@ -226,10 +228,10 @@ mod test {
use rstest::{fixture, rstest};
use tempfile::NamedTempFile;

use test_toolkit::get_fixture_path;
use test_cases::get_fixture_path;

use crate::models::{PrivateInput, Proof};
use crate::toolkit::read_json_from_file;
use madara_prover_common::models::{PrivateInput, Proof};
use madara_prover_common::toolkit::read_json_from_file;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion test-toolkit/Cargo.toml → test-cases/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "test-toolkit"
name = "test-cases"
version = "0.1.0"
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion test-toolkit/src/lib.rs → test-cases/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};

pub fn get_fixture_path(filename: &str) -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../stone-prover/tests/fixtures")
.join("cases")
.join(filename)
}

Expand Down
Loading