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

Integration of Atlantic Service and HTTP Client Infrastructure #182

Merged
merged 49 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a1ccd2a
initialised atlantic service
byteZorvin Oct 9, 2024
1afa13b
feat: added l1 and l2 proving apis
byteZorvin Oct 10, 2024
09ac565
add header
byteZorvin Oct 10, 2024
55553f4
Merge branch 'main' into atlantic-integration
byteZorvin Oct 14, 2024
e887c73
feat:added testcases for atlantic service
byteZorvin Oct 15, 2024
e0f8781
chore: change to atlantic proving service
byteZorvin Oct 15, 2024
91cdc23
fix: change layout to 'starknet_with_keccak'
byteZorvin Oct 15, 2024
013bfe8
change layout to all_cairo for testing
byteZorvin Oct 16, 2024
0594c70
Merge branch 'main' into atlantic-integration
byteZorvin Oct 16, 2024
7a5bcaa
update gps verifier
byteZorvin Oct 16, 2024
dd53b05
chore: add program hash log
byteZorvin Oct 16, 2024
34889b7
fix: change program hash
byteZorvin Oct 16, 2024
e5b28be
ran formatter
byteZorvin Oct 16, 2024
02b0572
refactor init commit
apoorvsadana Oct 18, 2024
3a2ae80
broken http client
apoorvsadana Oct 18, 2024
287f448
refactor: http_client and prover services refactored
Nov 7, 2024
74c0c64
fix: build issue fixed with temp snos
Nov 7, 2024
da4ca88
merged: main
Nov 7, 2024
11fe253
chore: linting and formatting
Nov 7, 2024
c7fe17e
chore: todo added for later to change snos
Nov 7, 2024
76e66b2
refactor: atlantic test updated as pwe the new changes
Nov 7, 2024
185de15
chore: linting and removed print statements
Nov 7, 2024
d54ce74
refactor: prover-service renamed to prover-clients
Nov 7, 2024
4666168
changelog: updated
Nov 7, 2024
c9401cd
chore: formatting and linting
Nov 7, 2024
1a04d6e
fix: changing prover service to sharp
Nov 7, 2024
82bcef2
fix: adding proof layout to env file
Nov 7, 2024
2e72c73
fix: updated the prvoving zip
Nov 7, 2024
3bac79b
fix: program hash fixed and fact of the block registered
Nov 8, 2024
a254e8a
fix: sleep added after setting fact
Nov 8, 2024
c2308c5
refactor: toml files cleaning and http mock version update
Nov 9, 2024
135e83e
update: duplicate SNOS_PROOD_LAYOUT removed
Nov 9, 2024
30c13b3
changelog: updated
Nov 9, 2024
13af686
chore: linting
Nov 9, 2024
f227e72
fix: snos layout updated to dynamic
Nov 9, 2024
6aa726a
fix: linting and proof layout
Nov 9, 2024
639a918
refactor: added different layout name for snos and proving
Nov 9, 2024
684adab
fix: comments resolved, docker-compose deleted, request-builder updated
Nov 9, 2024
0df375d
changelog: updated
Nov 9, 2024
8fbedac
merged: main
Nov 9, 2024
606315f
resolved: comments and path updated in yaml for s3 download
Nov 9, 2024
a20ca26
refactor: replaced mock server with dummy url to create http client
Nov 9, 2024
f296a30
Merge branch 'main' into atlantic_refactor
Mohiiit Nov 12, 2024
a93afe0
fix: atlantic endpoint updated
Nov 14, 2024
751517d
refactor: atlantic test now use mock server
Nov 14, 2024
0d66cb2
refactor: main merged and refactored as per clap
Nov 20, 2024
234017b
fix: files added
Nov 20, 2024
4a6b03f
fix: env variable's name updated
Nov 20, 2024
3c7bb31
chores: removed extra print statement
Nov 20, 2024
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
52 changes: 26 additions & 26 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
##### ORCHESTRATOR #####

HOST=
PORT=
MAX_BLOCK_TO_PROCESS=
SNOS_PROOF_LAYOUT=
MADARA_ORCHESTRATOR_HOST=
MADARA_ORCHESTRATOR_PORT=
MADARA_ORCHESTRATOR_MAX_BLOCK_NO_TO_PROCESS=

##### AWS CONFIG #####

Expand All @@ -18,7 +17,7 @@ AWS_DEFAULT_REGION="localhost"
##### STORAGE #####

DATA_STORAGE=
AWS_S3_BUCKET_NAME=
MADARA_ORCHESTRATOR_AWS_S3_BUCKET_NAME=

##### QUEUE #####

Expand All @@ -31,47 +30,48 @@ SQS_WORKER_TRIGGER_QUEUE_URL=
##### SNS #####

ALERTS="sns"
AWS_SNS_ARN="arn:aws:sns:us-east-1:000000000000:madara-orchestrator-arn"
MADARA_ORCHESTRATOR_AWS_SNS_ARN="arn:aws:sns:us-east-1:000000000000:madara-orchestrator-arn"

##### DATABASE #####

DATABASE=
Mohiiit marked this conversation as resolved.
Show resolved Hide resolved
MONGODB_CONNECTION_STRING=
DATABASE_NAME=
MADARA_ORCHESTRATOR_MONGODB_CONNECTION_URL=
MADARA_ORCHESTRATOR_DATABASE_NAME=

##### PROVER #####

PROVER_SERVICE=

## if using sharp
SHARP_CUSTOMER_ID=
SHARP_URL=
SHARP_USER_CRT=
SHARP_USER_KEY=
SHARP_SERVER_CRT=
MADARA_ORCHESTRATOR_SHARP_CUSTOMER_ID=
MADARA_ORCHESTRATOR_SHARP_URL=
MADARA_ORCHESTRATOR_SHARP_USER_CRT=
MADARA_ORCHESTRATOR_SHARP_USER_KEY=
MADARA_ORCHESTRATOR_SHARP_SERVER_CRT=
MADARA_ORCHESTRATOR_SHARP_PROOF_LAYOUT=


## if using atlantic
ATLANTIC_API_KEY=
ATLANTIC_URL=
MOCK_FACT_HASH=
PROVER_TYPE=
MADARA_ORCHESTRATOR_ATLANTIC_API_KEY=
MADARA_ORCHESTRATOR_ATLANTIC_URL=
MADARA_ORCHESTRATOR_MOCK_FACT_HASH=
MADARA_ORCHESTRATOR_PROVER_TYPE=

##### ON CHAIN CONFIG #####

DA_LAYER=
SETTLEMENT_LAYER=
SETTLEMENT_RPC_URL=
MADARA_RPC_URL=
GPS_VERIFIER_CONTRACT_ADDRESS=
MADARA_ORCHESTRATOR_ETHEREUM_SETTLEMENT_RPC_URL=
MADARA_ORCHESTRATOR_MADARA_RPC_URL=
MADARA_ORCHESTRATOR_GPS_VERIFIER_CONTRACT_ADDRESS=
PRIVATE_KEY=
ETHEREUM_PRIVATE_KEY=
L1_CORE_CONTRACT_ADDRESS=
MADARA_ORCHESTRATOR_ETHEREUM_PRIVATE_KEY=
MADARA_ORCHESTRATOR_L1_CORE_CONTRACT_ADDRESS=

##### STARKNET SETTLEMENT (L3s) #####
STARKNET_PRIVATE_KEY=
STARKNET_ACCOUNT_ADDRESS=
MADARA_ORCHESTRATOR_STARKNET_PRIVATE_KEY=
MADARA_ORCHESTRATOR_STARKNET_ACCOUNT_ADDRESS=

##### Instrumentation #####
OTEL_SERVICE_NAME=
OTEL_COLLECTOR_ENDPOINT=
MADARA_ORCHESTRATOR_OTEL_SERVICE_NAME=
MADARA_ORCHESTRATOR_OTEL_COLLECTOR_ENDPOINT=
154 changes: 81 additions & 73 deletions .env.test

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
mv target/debug/madara ../madara-binary
cd ..
echo -e "
MADARA_BINARY_PATH=\"$(pwd)/madara-binary\"" >> .env.test
MADARA_ORCHESTRATOR_MADARA_BINARY_PATH=\"$(pwd)/madara-binary\"" >> .env.test
cat .env.test

- name: Getting neccesary files for testing
Expand All @@ -128,8 +128,8 @@ jobs:

- name: Run llvm-cov tests
env:
SETTLEMENT_RPC_URL: ${{ secrets.ETHEREUM_SEPOLIA_BLAST_RPC }}
RPC_FOR_SNOS: ${{ secrets.RPC_FOR_SNOS }}
MADARA_ORCHESTRATOR_ETHEREUM_SETTLEMENT_RPC_URL: ${{ secrets.ETHEREUM_SEPOLIA_BLAST_RPC }}
MADARA_ORCHESTRATOR_RPC_FOR_SNOS: ${{ secrets.RPC_FOR_SNOS }}
# the self hosted runner has a different region so we override it here
AWS_REGION: us-east-1
run: RUST_LOG=debug RUST_BACKTRACE=1 cargo llvm-cov nextest --release --features testing --lcov --output-path lcov.info --test-threads=1 --workspace --exclude=e2e-tests --no-fail-fast
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ jobs:

- name: Run e2e test
env:
SETTLEMENT_RPC_URL: ${{ secrets.ETHEREUM_SEPOLIA_BLAST_RPC }}
RPC_FOR_SNOS: ${{ secrets.RPC_FOR_SNOS }}
MADARA_ORCHESTRATOR_ETHEREUM_SETTLEMENT_RPC_URL: ${{ secrets.ETHEREUM_SEPOLIA_BLAST_RPC }}
MADARA_ORCHESTRATOR_RPC_FOR_SNOS: ${{ secrets.RPC_FOR_SNOS }}
# the self hosted runner has a different region so we override it here
AWS_REGION: us-east-1
run: |
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## Added

- tests: http_client tests added
- Added Atlantic proving service integration
- setup functions added for cloud and db
- Added cli args support for all the services
- Setup functions added for cloud and db
- panic handling in process job
- upgrade ETH L1 bridge for withdrawals to work
- added makefile and submodules
- Endpoints for triggering processing and verification jobs
- Added Atlantic proving service integration
- Add multiple queues for processing and verification based on job type
- added logs
- added MongoDB migrations using nodejs
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ lazy_static = "1.4.0"
stark_evm_adapter = "0.1.1"
hex = "0.4"
itertools = "0.13.0"
clap = { version = "4.4", features = ["derive", "env"] }
mockall_double = "0.3.1"
hyper = { version = "0.14", features = ["full"] }
mockall = "0.13.0"
Expand Down
29 changes: 0 additions & 29 deletions crates/da-clients/ethereum/src/config.rs

This file was deleted.

32 changes: 16 additions & 16 deletions crates/da-clients/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,30 @@ use da_client_interface::{DaClient, DaVerificationStatus};
use mockall::automock;
use mockall::predicate::*;
use reqwest::Client;
use serde::{Deserialize, Serialize};
use url::Url;
use utils::settings::Settings;

use crate::config::EthereumDaConfig;

pub const DA_SETTINGS_NAME: &str = "ethereum";
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct EthereumDaValidatedArgs {
pub ethereum_da_rpc_url: Url,
}

pub mod config;
pub struct EthereumDaClient {
#[allow(dead_code)]
provider: RootProvider<Ethereum, Http<Client>>,
}

impl EthereumDaClient {
pub async fn new_with_args(ethereum_da_params: &EthereumDaValidatedArgs) -> Self {
let client = RpcClient::new_http(
Url::from_str(ethereum_da_params.ethereum_da_rpc_url.as_str())
.expect("Failed to parse ethereum_da_rpc_url"),
);
let provider = ProviderBuilder::<_, Ethereum>::new().on_client(client);
Self { provider }
}
}

#[automock]
#[async_trait]
impl DaClient for EthereumDaClient {
Expand All @@ -47,14 +58,3 @@ impl DaClient for EthereumDaClient {
131072
}
}

impl EthereumDaClient {
pub fn new_with_settings(settings: &impl Settings) -> Self {
let config = EthereumDaConfig::new_with_settings(settings)
.expect("Not able to create EthereumDaClient from given settings.");
let client =
RpcClient::new_http(Url::from_str(config.rpc_url.as_str()).expect("Failed to parse SETTLEMENT_RPC_URL"));
let provider = ProviderBuilder::<_, Ethereum>::new().on_client(client);
EthereumDaClient { provider }
}
}
2 changes: 2 additions & 0 deletions crates/orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ bytes.workspace = true
c-kzg = { workspace = true }
cairo-vm = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
color-eyre = { workspace = true }
da-client-interface = { workspace = true }
dotenvy = { workspace = true }
Expand Down Expand Up @@ -63,6 +64,7 @@ starknet = { workspace = true }
starknet-core = { workspace = true }
starknet-os = { workspace = true }
starknet-settlement-client = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
tempfile = { workspace = true }
thiserror = { workspace = true }
Expand Down
19 changes: 0 additions & 19 deletions crates/orchestrator/src/alerts/aws_sns/config.rs

This file was deleted.

26 changes: 13 additions & 13 deletions crates/orchestrator/src/alerts/aws_sns/mod.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
mod config;

use std::sync::Arc;

use async_trait::async_trait;
use aws_config::SdkConfig;
use aws_sdk_sns::Client;
use utils::settings::Settings;

use crate::alerts::aws_sns::config::AWSSNSConfig;
use crate::alerts::Alerts;
use crate::config::ProviderConfig;

pub const AWS_SNS_SETTINGS_NAME: &str = "sns";
#[derive(Debug, Clone)]
pub struct AWSSNSValidatedArgs {
// TODO: convert to ARN type, and validate it
// NOTE: aws is using str to represent ARN : https://docs.aws.amazon.com/sdk-for-rust/latest/dg/rust_sns_code_examples.html
pub topic_arn: String,
}

pub struct AWSSNS {
client: Client,
topic_arn: String,
}

impl AWSSNS {
pub async fn new_with_settings(settings: &impl Settings, provider_config: Arc<ProviderConfig>) -> Self {
let sns_config =
AWSSNSConfig::new_with_settings(settings).expect("Not able to get Aws sns config from provided settings");
let config = provider_config.get_aws_client_or_panic();
Self { client: Client::new(config), topic_arn: sns_config.sns_arn }
pub async fn new_with_args(aws_sns_params: &AWSSNSValidatedArgs, aws_config: &SdkConfig) -> Self {
Self { client: Client::new(aws_config), topic_arn: aws_sns_params.topic_arn.clone() }
}
}

Expand All @@ -39,4 +35,8 @@ impl Alerts for AWSSNS {
log::info!("SNS topic created. Topic ARN: {}", topic_arn);
Ok(())
}

async fn get_topic_name(&self) -> String {
self.topic_arn.split(":").last().expect("Failed to get last part of topic ARN").to_string()
}
}
8 changes: 4 additions & 4 deletions crates/orchestrator/src/alerts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use async_trait::async_trait;
use mockall::automock;
use utils::settings::Settings;

pub mod aws_sns;

Expand All @@ -9,10 +8,11 @@ pub mod aws_sns;
pub trait Alerts: Send + Sync {
/// To send an alert message to our alert service
async fn send_alert_message(&self, message_body: String) -> color_eyre::Result<()>;
async fn get_topic_name(&self) -> String;
async fn create_alert(&self, topic_name: &str) -> color_eyre::Result<()>;
async fn setup(&self, settings_provider: Box<dyn Settings>) -> color_eyre::Result<()> {
let sns_topic_name = settings_provider.get_settings_or_panic("ALERT_TOPIC_NAME");
self.create_alert(&sns_topic_name).await?;
async fn setup(&self) -> color_eyre::Result<()> {
let topic_name = self.get_topic_name().await;
self.create_alert(&topic_name).await?;
Ok(())
}
}
14 changes: 14 additions & 0 deletions crates/orchestrator/src/cli/alert/aws_sns.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use clap::Args;

/// Parameters used to config AWS SNS.
#[derive(Debug, Clone, Args)]
#[group()]
pub struct AWSSNSCliArgs {
/// Use the AWS SNS client
#[arg(long)]
pub aws_sns: bool,

/// The ARN of the SNS topic.
#[arg(env = "MADARA_ORCHESTRATOR_AWS_SNS_ARN", long, default_value = Some("arn:aws:sns:us-east-1:000000000000:madara-orchestrator-arn"))]
pub sns_arn: Option<String>,
}
8 changes: 8 additions & 0 deletions crates/orchestrator/src/cli/alert/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use crate::alerts::aws_sns::AWSSNSValidatedArgs;

pub mod aws_sns;

#[derive(Clone, Debug)]
pub enum AlertValidatedArgs {
AWSSNS(AWSSNSValidatedArgs),
}
Loading
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.