Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
zk-steve committed Aug 21, 2024
1 parent f116fa2 commit 18a4c87
Show file tree
Hide file tree
Showing 38 changed files with 481 additions and 405 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
6 changes: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "daily"
43 changes: 41 additions & 2 deletions Cargo.lock

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

39 changes: 20 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,37 @@ authors = ["Apoorv Sadana <@apoorvsadana>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace.dependencies]
num = { version = "0.4.1" }
async-trait = { version = "0.1.77" }
alloy = { version = "0.2.1", features = ["full"] }
arc-swap = { version = "1.7.1" }
async-trait = { version = "0.1.77" }
axum = { version = "0.7.4" }
axum-macros = "0.4.1"
bincode = "1.3.3"
color-eyre = "0.6.2"
c-kzg = "1.0.0"
color-eyre = "0.6.2"
dotenvy = "0.15.7"
futures = "0.3.30"
hex = "0.4.3"
httpmock = { version = "0.7.0" }
itertools = "0.13.0"
lazy_static = "1.4.0"
log = "0.4.21"
mockall = "0.13.0"
mongodb = { version = "2.8.2" }
num = { version = "0.4.1" }
num-bigint = { version = "0.4.4" }
num-traits = "0.2"
omniqueue = { version = "0.2.0" }
once_cell = "1.19.0"
reqwest = { version = "0.12.5" }
rstest = "0.22.0"
serde = { version = "1.0.197" }
serde_json = "1.0.114"
stark_evm_adapter = "0.1.1"
starknet = "0.11.0"
tempfile = "3.8.1"
testcontainers = "0.21.1"
test-log = "0.2.16"
thiserror = "1.0.57"
tokio = { version = "1.37.0" }
tokio-stream = "0.1.15"
Expand All @@ -49,18 +62,6 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18" }
url = { version = "2.5.0", features = ["serde"] }
uuid = { version = "1.7.0", features = ["v4", "serde"] }
httpmock = { version = "0.7.0" }
num-bigint = { version = "0.4.4" }
arc-swap = { version = "1.7.1" }
num-traits = "0.2"
lazy_static = "1.4.0"
stark_evm_adapter = "0.1.1"
hex = "0.4.3"
itertools = "0.13.0"
mockall = "0.13.0"
testcontainers = "0.21.1"
once_cell = "1.19.0"

# Cairo VM
cairo-vm = { version = "1.0.0-rc5", features = [
"extensive_hints",
Expand All @@ -81,15 +82,15 @@ madara-prover-rpc-client = { git = "https://github.com/Moonsong-Labs/madara-prov
da-client-interface = { path = "crates/da-clients/da-client-interface" }
ethereum-da-client = { path = "crates/da-clients/ethereum" }

settlement-client-interface = { path = "crates/settlement-clients/settlement-client-interface" }
ethereum-settlement-client = { path = "crates/settlement-clients/ethereum" }
settlement-client-interface = { path = "crates/settlement-clients/settlement-client-interface" }
starknet-settlement-client = { path = "crates/settlement-clients/starknet" }

utils = { path = "crates/utils" }
prover-client-interface = { path = "crates/prover-services/prover-client-interface" }
gps-fact-checker = { path = "crates/prover-services/gps-fact-checker" }
sharp-service = { path = "crates/prover-services/sharp-service" }
orchestrator = { path = "crates/orchestrator" }
prover-client-interface = { path = "crates/prover-services/prover-client-interface" }
sharp-service = { path = "crates/prover-services/sharp-service" }
utils = { path = "crates/utils" }

aptos-sdk = { git = "https://github.com/aptos-labs/aptos-core" }
aptos-testcontainer = { git = "https://github.com/sota-zk-labs/aptos-testcontainer", branch = "master", features = [
Expand Down
4 changes: 3 additions & 1 deletion crates/da-clients/ethereum/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::str::FromStr;

use alloy::{network::Ethereum, providers::ProviderBuilder, rpc::client::RpcClient};
use alloy::network::Ethereum;
use alloy::providers::ProviderBuilder;
use alloy::rpc::client::RpcClient;
use async_trait::async_trait;
use da_client_interface::DaConfig;
use url::Url;
Expand Down
4 changes: 2 additions & 2 deletions crates/da-clients/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub struct EthereumDaClient {
#[async_trait]
impl DaClient for EthereumDaClient {
async fn publish_state_diff(&self, _state_diff: Vec<Vec<u8>>, _to: &[u8; 32]) -> Result<String> {
// Here in case of ethereum we are not publishing the state diff because we are doing it all together in update_state job.
// So we don't need to send the blob here.
// Here in case of ethereum we are not publishing the state diff because we are doing it all
// together in update_state job. So we don't need to send the blob here.
Ok("NA".to_string())
}

Expand Down
4 changes: 2 additions & 2 deletions crates/orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ethereum-settlement-client = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
lazy_static = { workspace = true }
log = "0.4.21"
log = { workspace = true }
majin-blob-core = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" }
majin-blob-types = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" }
mockall = { version = "0.13.0" }
Expand Down Expand Up @@ -70,6 +70,6 @@ with_sqs = ["omniqueue"]

[dev-dependencies]
assert_matches = "1.5.0"
httpmock = { workspace = true, features = ["remote"] }
hyper = { version = "0.14", features = ["full"] }
rstest = { workspace = true }
httpmock = { workspace = true, features = ["remote"] }
6 changes: 3 additions & 3 deletions crates/orchestrator/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::sync::Arc;

use crate::data_storage::aws_s3::config::{AWSS3Config, AWSS3ConfigType};
use crate::data_storage::aws_s3::AWSS3;
use crate::data_storage::{DataStorage, DataStorageConfig};
use arc_swap::{ArcSwap, Guard};
use da_client_interface::{DaClient, DaConfig};
use dotenvy::dotenv;
Expand All @@ -19,6 +16,9 @@ use utils::env_utils::get_env_var_or_panic;
use utils::settings::default::DefaultSettingsProvider;
use utils::settings::SettingsProvider;

use crate::data_storage::aws_s3::config::{AWSS3Config, AWSS3ConfigType};
use crate::data_storage::aws_s3::AWSS3;
use crate::data_storage::{DataStorage, DataStorageConfig};
use crate::database::mongodb::config::MongoDbConfig;
use crate::database::mongodb::MongoDb;
use crate::database::{Database, DatabaseConfig};
Expand Down
5 changes: 3 additions & 2 deletions crates/orchestrator/src/data_storage/aws_s3/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::data_storage::aws_s3::config::AWSS3ConfigType;
use crate::data_storage::DataStorage;
use async_trait::async_trait;
use aws_sdk_s3::config::{Builder, Credentials, Region};
use aws_sdk_s3::primitives::ByteStream;
use aws_sdk_s3::Client;
use bytes::Bytes;
use color_eyre::Result;

use crate::data_storage::aws_s3::config::AWSS3ConfigType;
use crate::data_storage::DataStorage;

/// Module for AWS S3 config structs and implementations
pub mod config;

Expand Down
3 changes: 2 additions & 1 deletion crates/orchestrator/src/data_storage/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashMap;

use cairo_vm::Felt252;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// This struct represents the contract changes that will be in `StarknetOsOutput`
/// as a vector.
Expand Down
15 changes: 5 additions & 10 deletions crates/orchestrator/src/database/mongodb/mod.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
use async_std::stream::StreamExt;
use futures::TryStreamExt;
use std::collections::HashMap;

use async_std::stream::StreamExt;
use async_trait::async_trait;
use color_eyre::eyre::eyre;
use color_eyre::Result;
use mongodb::bson::{Bson, Document};
use mongodb::options::{FindOneOptions, FindOptions, UpdateOptions};
use mongodb::{
bson,
bson::doc,
options::{ClientOptions, ServerApi, ServerApiVersion},
Client, Collection,
};
use futures::TryStreamExt;
use mongodb::bson::{doc, Bson, Document};
use mongodb::options::{ClientOptions, FindOneOptions, FindOptions, ServerApi, ServerApiVersion, UpdateOptions};
use mongodb::{bson, Client, Collection};
use uuid::Uuid;

use crate::database::mongodb::config::MongoDbConfig;
Expand Down
Loading

0 comments on commit 18a4c87

Please sign in to comment.