Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
zk-steve committed Aug 16, 2024
1 parent 69ba0d3 commit 5285959
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 52 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"]
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.

69 changes: 35 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[workspace]
resolver = "2"
members = [
"crates/orchestrator",
"crates/da-clients/da-client-interface",
"crates/da-clients/ethereum",
"crates/prover-services/prover-client-interface",
"crates/prover-services/gps-fact-checker",
"crates/prover-services/sharp-service",
"crates/utils",
"crates/settlement-clients/settlement-client-interface",
"crates/settlement-clients/ethereum",
"crates/settlement-clients/starknet",
"crates/settlement-clients/aptos",
"e2e-tests",
"crates/orchestrator",
"crates/da-clients/da-client-interface",
"crates/da-clients/ethereum",
"crates/prover-services/prover-client-interface",
"crates/prover-services/gps-fact-checker",
"crates/prover-services/sharp-service",
"crates/utils",
"crates/settlement-clients/settlement-client-interface",
"crates/settlement-clients/ethereum",
"crates/settlement-clients/starknet",
"crates/settlement-clients/aptos",
"e2e-tests",
]

[workspace.package]
Expand All @@ -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,22 +62,10 @@ 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",
"cairo-1-hints",
"extensive_hints",
"cairo-1-hints",
] }

# TODO: we currently use the Moonsong fork & the os-output-serde branch so we
Expand All @@ -81,19 +82,19 @@ 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 = [
"testing",
"testing",
] }

[patch.crates-io]
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"] }
4 changes: 4 additions & 0 deletions crates/settlement-clients/aptos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ async-trait = { workspace = true }
color-eyre = { workspace = true }
dotenvy = { workspace = true }
hex = { workspace = true }
log = { workspace = true }
mockall = { workspace = true }
once_cell = { workspace = true }
settlement-client-interface = { workspace = true }
tokio = { workspace = true }
utils = { workspace = true }

[dev-dependencies]
test-log = { workspace = true }
51 changes: 37 additions & 14 deletions crates/settlement-clients/aptos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ use aptos_sdk::move_types::account_address::AccountAddress;
use aptos_sdk::move_types::identifier::Identifier;
use aptos_sdk::move_types::language_storage::ModuleId;
use aptos_sdk::move_types::u256::U256;
use aptos_sdk::move_types::value::{MoveValue, serialize_values};
use aptos_sdk::move_types::value::{serialize_values, MoveValue};
use aptos_sdk::rest_client::aptos_api_types::{EntryFunctionId, ViewRequest};
use aptos_sdk::rest_client::Client;
use aptos_sdk::types::chain_id::ChainId;
use aptos_sdk::types::LocalAccount;
use aptos_sdk::types::transaction::{EntryFunction, TransactionPayload};
use aptos_sdk::types::LocalAccount;
use async_trait::async_trait;
use color_eyre::eyre;
use mockall::automock;

use settlement_client_interface::{SettlementClient, SettlementVerificationStatus};

use crate::config::AptosSettlementConfig;
Expand Down Expand Up @@ -103,8 +102,14 @@ impl SettlementClient for AptosSettlementClient {
.await
.expect("Failed to submit update state transaction")
.into_inner();

Ok(tx.transaction_info().unwrap().hash.to_string())
let transaction_info = tx.transaction_info().unwrap();
log::info!(
"update_state_calldata finished: hash={}; gas={}",
transaction_info.hash.to_string(),
transaction_info.gas_used
);

Ok(transaction_info.hash.to_string())
}

async fn update_state_blobs(
Expand Down Expand Up @@ -136,7 +141,14 @@ impl SettlementClient for AptosSettlementClient {
.expect("Failed to submit update state transaction")
.into_inner();

Ok(tx.transaction_info().unwrap().hash.to_string())
let transaction_info = tx.transaction_info().unwrap();
log::info!(
"update_state_blobs finished: hash={}; gas={}",
transaction_info.hash.to_string(),
transaction_info.gas_used
);

Ok(transaction_info.hash.to_string())
}

async fn verify_tx_inclusion(&self, tx_hash: &str) -> eyre::Result<SettlementVerificationStatus> {
Expand Down Expand Up @@ -183,14 +195,13 @@ mod test {
use aptos_sdk::move_types::u256;
use aptos_sdk::types::chain_id::NamedChain::TESTING;
use aptos_testcontainer::test_utils::aptos_container_test_utils::{lazy_aptos_container, run};

use settlement_client_interface::{SettlementClient, SettlementVerificationStatus};
use test_log::test;

use crate::{AptosSettlementClient, STARKNET_VALIDITY};
use super::*;
use crate::config::AptosSettlementConfig;
use crate::helper::build_transaction;

use super::*;
use crate::{AptosSettlementClient, STARKNET_VALIDITY};

const REGISTER_FACT: &'static str = "register_fact";
const FACT_REGISTRY: &'static str = "fact_registry";
Expand All @@ -214,7 +225,13 @@ mod test {
),
));
let tx = build_transaction(payload, &settlement_client.account, settlement_client.chain_id);
settlement_client.client.submit_and_wait(&tx).await.expect("Failed to init state!");
let tx = settlement_client.client.submit_and_wait(&tx).await.expect("Failed to init state!").into_inner();
let transaction_info = tx.transaction_info().unwrap();
log::info!(
"update_state_blobs finished: hash={}; gas={}",
transaction_info.hash.to_string(),
transaction_info.gas_used
);
}

async fn aptos_fact_registry(settlement_client: &AptosSettlementClient, fact: &str) {
Expand All @@ -225,10 +242,16 @@ mod test {
serialize_values(vec![&MoveValue::vector_u8(hex::decode(fact).unwrap())].into_iter()),
));
let tx = build_transaction(payload, &settlement_client.account, settlement_client.chain_id);
settlement_client.client.submit_and_wait(&tx).await.expect("Failed to registry fact!");
let tx = settlement_client.client.submit_and_wait(&tx).await.expect("Failed to registry fact!").into_inner();
let transaction_info = tx.transaction_info().unwrap();
log::info!(
"update_state_blobs finished: hash={}; gas={}",
transaction_info.hash.to_string(),
transaction_info.gas_used
);
}

#[tokio::test]
#[test(tokio::test)]
async fn test_update_state_calldata() -> anyhow::Result<()> {
run(1, |accounts| {
Box::pin(async move {
Expand Down Expand Up @@ -297,7 +320,7 @@ mod test {
eprintln!("verify_inclusion = {:#?}", verify_inclusion);
assert_eq!(verify_inclusion, SettlementVerificationStatus::Verified);

let block_number = settlement_client.get_last_settled_block().await?;
let block_number = settlement_client.get_last_settled_block().await.unwrap();
eprintln!("block_number = {:#?}", block_number);
Ok(())
})
Expand Down

0 comments on commit 5285959

Please sign in to comment.