Skip to content

Commit

Permalink
refactor: toml files cleaning and http mock version update
Browse files Browse the repository at this point in the history
  • Loading branch information
mohiiit committed Nov 9, 2024
1 parent a254e8a commit c2308c5
Show file tree
Hide file tree
Showing 20 changed files with 607 additions and 274 deletions.
278 changes: 48 additions & 230 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 20 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,23 @@ alloy = { version = "0.2.1", features = [
"json-rpc",
"rpc-client",
] }
alloy-primitives = { version = "0.7.7", default-features = false }
alloy-sol-types = "0.8.5"
aws-config = { version = "1.1.7", features = ["behavior-version-latest"] }
aws-sdk-s3 = { version = "1.38.0", features = ["behavior-version-latest"] }
aws-sdk-eventbridge = { version = "1.41.0", features = [
"behavior-version-latest",
] }
aws-sdk-sns = { version = "1.40.0", features = ["behavior-version-latest"] }
aws-credential-types = { version = "1.2.1", features = [
"hardcoded-credentials",
] }
assert_matches = "1.5.0"
aws-sdk-sqs = "1.36.0"
axum = { version = "0.7.4" }
axum-macros = "0.4.1"
bincode = "1.3.3"
bytes = "1.6.0"
bytes = "1.7.2"
color-eyre = "0.6.2"
chrono = "0.4.0"
c-kzg = "1.0.3"
Expand All @@ -60,6 +67,7 @@ reqwest = { version = "0.12.7", features = [
"stream",
] }
rstest = "0.22.0"
base64 = "0.22.1"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
starknet = "0.11.0"
Expand All @@ -68,15 +76,19 @@ thiserror = "1.0.57"
tokio = { version = "1.37.0" }
tokio-stream = "0.1.15"
tokio-util = "0.7.11"
dotenv = "0.15.0"
starknet-core = "0.9.0"
url = { version = "2.5.0", features = ["serde"] }
uuid = { version = "1.7.0", features = ["v4", "serde"] }
httpmock = { version = "0.7.0", features = ["remote"] }
num-bigint = { version = "0.4.4" }
httpmock = { version = "0.8.0-alpha.1", features = ["proxy", "remote"] }
num-bigint = { version = "0.4.5" }
num-traits = "0.2"
lazy_static = "1.4.0"
stark_evm_adapter = "0.1.1"
hex = "0.4"
itertools = "0.13.0"
mockall_double = "0.3.1"
hyper = { version = "0.14", features = ["full"] }
mockall = "0.13.0"
testcontainers = "0.18.0"
once_cell = "1.8"
Expand All @@ -85,6 +97,7 @@ crypto-bigint = { version = "0.5.5" }
env_logger = "0.11.5"
strum_macros = "0.26.4"
strum = "0.26.3"
async-std = { version = "1.13.0", features = ["attributes"] }


# Instrumentation
Expand Down Expand Up @@ -124,6 +137,10 @@ prove_block = { git = "https://github.com/Mohiiit/snos", rev = "2dcd3b0f0c6bfa36
madara-prover-common = { git = "https://github.com/Moonsong-Labs/madara-prover-api", branch = "od/use-latest-cairo-vm" }
madara-prover-rpc-client = { git = "https://github.com/Moonsong-Labs/madara-prover-api", branch = "od/use-latest-cairo-vm" }

# Majin Blob
majin-blob-core = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" }
majin-blob-types = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" }

# Project
da-client-interface = { path = "crates/da-clients/da-client-interface" }
ethereum-da-client = { path = "crates/da-clients/ethereum" }
Expand Down
3 changes: 2 additions & 1 deletion crates/da-clients/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version.workspace = true
edition.workspace = true

[dependencies]
# TODO: update this to the workspace
alloy = { git = "https://github.com/alloy-rs/alloy", rev = "68952c0", features = [
"consensus",
"providers",
Expand Down Expand Up @@ -40,7 +41,7 @@ opentelemetry-semantic-conventions = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.26.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }


Expand Down
22 changes: 11 additions & 11 deletions crates/orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ path = "src/main.rs"

[dependencies]
alloy = { workspace = true }
assert_matches = "1.5.0"
async-std = "1.12.0"
assert_matches = { workspace = true }
async-std = { workspace = true }
async-trait = { workspace = true }
atlantic-service = { workspace = true }
aws-config = { workspace = true, features = ["behavior-version-latest"] }
aws-credential-types = { version = "1.2.1", features = [
aws-credential-types = { workspace = true, features = [
"hardcoded-credentials",
] }
aws-sdk-s3 = { workspace = true, features = ["behavior-version-latest"] }
aws-sdk-sns = { version = "1.40.0", features = ["behavior-version-latest"] }
aws-sdk-sns = { workspace = true, features = ["behavior-version-latest"] }
aws-sdk-sqs = { workspace = true }
axum = { workspace = true, features = ["macros"] }
axum-macros = { workspace = true }
Expand All @@ -40,11 +40,11 @@ futures = { workspace = true }
hex = { workspace = true }
itertools = { workspace = true }
lazy_static = { workspace = true }
log = "0.4.21"
majin-blob-core = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" }
majin-blob-types = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" }
log = { workspace = true }
majin-blob-core = { workspace = true }
majin-blob-types = { workspace = true }
mockall = { workspace = true }
mockall_double = "0.3.1"
mockall_double = { workspace = true }
mongodb = { workspace = true, features = ["bson-uuid-1"], optional = true }
num = { workspace = true }
num-bigint = { workspace = true }
Expand All @@ -59,7 +59,7 @@ serde_json = { workspace = true }
settlement-client-interface = { workspace = true }
sharp-service = { workspace = true }
starknet = { workspace = true }
starknet-core = "0.9.0"
starknet-core = { workspace = true }
starknet-os = { workspace = true }
starknet-settlement-client = { workspace = true }
strum_macros = { workspace = true }
Expand All @@ -84,7 +84,7 @@ opentelemetry-stdout = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.26.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[features]
Expand All @@ -95,6 +95,6 @@ with_sqs = ["omniqueue"]
testing = []

[dev-dependencies]
hyper = { version = "0.14", features = ["full"] }
hyper = { workspace = true, features = ["full"] }
rstest = { workspace = true }
httpmock = { workspace = true, features = ["remote"] }
2 changes: 1 addition & 1 deletion crates/orchestrator/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub async fn init_config() -> color_eyre::Result<Arc<Config>> {
"Using all_cairo layout for SNOS. This is probably not provable and so it's not recommended for \
production use."
);
LayoutName::all_cairo
LayoutName::dynamic
}
"starknet_with_keccak" => LayoutName::starknet_with_keccak,
_ => panic!("Unsupported SNOS proof layout"),
Expand Down
2 changes: 1 addition & 1 deletion crates/orchestrator/src/jobs/da_job/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ pub mod test {
let hex_field_element = vec_u8_to_hex_string(&field_element);

server.mock(|when, then| {
when.path("/").body_contains("starknet_getNonce").body_contains(hex_field_element);
when.path("/").body_includes("starknet_getNonce").body_includes(hex_field_element);
then.status(200).body(serde_json::to_vec(&response).unwrap());
});
}
Expand Down
2 changes: 1 addition & 1 deletion crates/orchestrator/src/jobs/snos_job/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl Job for SnosJob {
let snos_url = snos_url.trim_end_matches('/');
tracing::debug!(job_id = %job.internal_id, "Calling prove_block function");
let (cairo_pie, snos_output) =
prove_block(COMPILED_OS, block_number, snos_url, LayoutName::all_cairo, false).await.map_err(|e| {
prove_block(COMPILED_OS, block_number, snos_url, LayoutName::dynamic, false).await.map_err(|e| {
tracing::error!(job_id = %job.internal_id, error = %e, "SNOS execution failed");
SnosError::SnosExecutionError { internal_id: job.internal_id.clone(), message: e.to_string() }
})?;
Expand Down
2 changes: 1 addition & 1 deletion crates/orchestrator/src/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl TestConfigBuilder {
queue,
storage,
alerts,
LayoutName::all_cairo,
LayoutName::dynamic,
));

let api_server_address = implement_api_server(api_server_type, config.clone()).await;
Expand Down
6 changes: 3 additions & 3 deletions crates/orchestrator/src/tests/jobs/da_job/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async fn test_da_job_process_job_failure_on_small_blob_size(
get_nonce_attached(&server, nonces_file.as_str());

let state_update_mock = server.mock(|when, then| {
when.path("/").body_contains("starknet_getStateUpdate");
when.path("/").body_includes("starknet_getStateUpdate");
then.status(200).body(serde_json::to_vec(&response).unwrap());
});

Expand Down Expand Up @@ -123,7 +123,7 @@ async fn test_da_job_process_job_failure_on_pending_block() {
let response = json!({ "id": 1,"jsonrpc":"2.0","result": pending_state_update });

let state_update_mock = server.mock(|when, then| {
when.path("/").body_contains("starknet_getStateUpdate");
when.path("/").body_includes("starknet_getStateUpdate");
then.status(200).body(serde_json::to_vec(&response).unwrap());
});

Expand Down Expand Up @@ -206,7 +206,7 @@ async fn test_da_job_process_job_success(
get_nonce_attached(&server, nonces_file.as_str());

let state_update_mock = server.mock(|when, then| {
when.path("/").body_contains("starknet_getStateUpdate");
when.path("/").body_includes("starknet_getStateUpdate");
then.status(200).body(serde_json::to_vec(&response).unwrap());
});

Expand Down
2 changes: 1 addition & 1 deletion crates/orchestrator/src/tests/workers/snos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async fn test_snos_worker(#[case] db_val: bool) -> Result<(), Box<dyn Error>> {

// mocking block call
let rpc_block_call_mock = server.mock(|when, then| {
when.path("/").body_contains("starknet_blockNumber");
when.path("/").body_includes("starknet_blockNumber");
then.status(200).body(serde_json::to_vec(&response).unwrap());
});

Expand Down
6 changes: 3 additions & 3 deletions crates/prover-clients/atlantic-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
[dependencies]
alloy.workspace = true
async-trait.workspace = true
base64 = "0.22.1"
base64.workspace = true
cairo-vm.workspace = true
chrono.workspace = true
color-eyre.workspace = true
Expand All @@ -27,8 +27,8 @@ strum = { workspace = true }
strum_macros = { workspace = true }
tempfile.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-util = { version = "0.7.12", features = ["codec"] }
tokio.workspace = true
url.workspace = true
utils.workspace = true
uuid.workspace = true
Expand All @@ -45,7 +45,7 @@ opentelemetry-semantic-conventions = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.27.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }


Expand Down
9 changes: 7 additions & 2 deletions crates/prover-clients/atlantic-service/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,15 @@ impl AtlanticClient {
pub async fn add_job(
&self,
pie_file: &Path,
_proof_layout: LayoutName,
proof_layout: LayoutName,
) -> Result<AtlanticAddJobResponse, AtlanticError> {
let api_key = get_env_var_or_panic("ATLANTIC_API_KEY");

let proof_layout = match proof_layout {
LayoutName::dynamic => "dynamic",
_ => proof_layout.to_str(),
};

let response = self
.proving_layer
.customize_request(
Expand All @@ -77,7 +82,7 @@ impl AtlanticClient {
.method(Method::POST)
.query_param("apiKey", &api_key)
.form_file("pieFile", pie_file, "pie.zip")
.form_text("layout", "dynamic"),
.form_text("layout", proof_layout),
)
.send()
.await
Expand Down
6 changes: 3 additions & 3 deletions crates/prover-clients/gps-fact-checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ cairo-vm.workspace = true
dotenvy.workspace = true
itertools.workspace = true
log.workspace = true
num-bigint = "0.4.5"
serde = { version = "1.0", features = ["derive"] }
num-bigint.workspace = true
serde.workspace = true
starknet.workspace = true
thiserror.workspace = true
tokio.workspace = true
Expand All @@ -41,5 +41,5 @@ opentelemetry-semantic-conventions = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.26.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
4 changes: 2 additions & 2 deletions crates/prover-clients/sharp-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
[dependencies]
alloy.workspace = true
async-trait.workspace = true
base64 = "0.22.1"
base64.workspace = true
cairo-vm.workspace = true
color-eyre.workspace = true
dotenvy.workspace = true
Expand Down Expand Up @@ -39,7 +39,7 @@ opentelemetry-semantic-conventions = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.26.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }


Expand Down
6 changes: 3 additions & 3 deletions crates/prover-clients/sharp-service/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ async fn prover_client_submit_task_works() {
);
let customer_id = get_env_var_or_panic("SHARP_CUSTOMER_ID");
let sharp_add_job_call = server.mock(|when, then| {
when.path_contains("/add_job").query_param("customer_id", customer_id.as_str());
when.path_includes("/add_job").query_param("customer_id", customer_id.as_str());
then.status(200).body(serde_json::to_vec(&sharp_response).unwrap());
});

let cairo_pie = Box::new(cairo_pie);
assert!(sharp_service.submit_task(Task::CairoPie(cairo_pie), LayoutName::all_cairo).await.is_ok());
assert!(sharp_service.submit_task(Task::CairoPie(cairo_pie), LayoutName::dynamic).await.is_ok());

sharp_add_job_call.assert();
}
Expand All @@ -58,7 +58,7 @@ async fn prover_client_get_task_status_works(#[case] cairo_job_status: CairoJobS
let customer_id = get_env_var_or_panic("SHARP_CUSTOMER_ID");

let sharp_add_job_call = server.mock(|when, then| {
when.path_contains("/get_status").query_param("customer_id", customer_id.as_str());
when.path_includes("/get_status").query_param("customer_id", customer_id.as_str());
then.status(200).body(serde_json::to_vec(&get_task_status_sharp_response(&cairo_job_status)).unwrap());
});

Expand Down
6 changes: 3 additions & 3 deletions crates/settlement-clients/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ version.workspace = true
edition.workspace = true

[dependencies]
alloy-primitives = { version = "0.7.7", default-features = false }
alloy-primitives = { workspace = true }

alloy = { workspace = true, features = ["full", "node-bindings"] }
async-trait = { workspace = true }
bytes = "1.7.2"
bytes = { workspace = true }
c-kzg = { workspace = true }
cairo-vm = { workspace = true }
color-eyre = { workspace = true }
Expand Down Expand Up @@ -38,7 +38,7 @@ opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
thiserror = { workspace = true }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.26.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }


Expand Down
4 changes: 2 additions & 2 deletions crates/settlement-clients/starknet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ opentelemetry-semantic-conventions = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.26.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }


[dev-dependencies]
async-std = { version = "1.13.0", features = ["attributes"] }
async-std.workspace = true
serde_json.workspace = true
tokio-test = "*"
6 changes: 5 additions & 1 deletion crates/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ serde_json.workspace = true
thiserror.workspace = true

#Instrumentation
base64 = { workspace = true }
dotenv = { workspace = true }
httpmock = { workspace = true }
opentelemetry = { workspace = true, features = ["metrics", "logs"] }
opentelemetry-appender-tracing = { workspace = true, default-features = false }
opentelemetry-otlp = { workspace = true, features = [
Expand All @@ -23,8 +26,9 @@ opentelemetry-semantic-conventions = { workspace = true }
opentelemetry-stdout = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
reqwest = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = "0.26.0"
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
url = { workspace = true }
Loading

0 comments on commit c2308c5

Please sign in to comment.