Skip to content
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 aggregation_mode/src/backend/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
},
backend::s3::get_aligned_batch_from_s3,
};
use aligned_sdk::core::types::ProvingSystemId;
use aligned_sdk::common::types::ProvingSystemId;
use alloy::{
primitives::Address,
providers::{Provider, ProviderBuilder},
Expand Down
2 changes: 1 addition & 1 deletion aggregation_mode/src/backend/s3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use aligned_sdk::core::types::VerificationData;
use aligned_sdk::common::types::VerificationData;

#[derive(Debug)]
#[allow(dead_code)]
Expand Down
4 changes: 2 additions & 2 deletions batcher/aligned-batcher/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ impl ContractDeploymentOutput {
}

fn default_aggregator_fee_percentage_multiplier() -> u128 {
aligned_sdk::core::constants::DEFAULT_AGGREGATOR_FEE_PERCENTAGE_MULTIPLIER
aligned_sdk::common::constants::DEFAULT_AGGREGATOR_FEE_PERCENTAGE_MULTIPLIER
}

fn default_aggregator_gas_cost() -> u128 {
aligned_sdk::core::constants::DEFAULT_AGGREGATOR_GAS_COST
aligned_sdk::common::constants::DEFAULT_AGGREGATOR_GAS_COST
}
2 changes: 1 addition & 1 deletion batcher/aligned-batcher/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::sync::Arc;

use crate::types::{batch_queue::BatchQueueEntry, errors::BatcherError};
use aligned_sdk::{
common::types::{BatchInclusionData, SubmitProofResponseMessage, VerificationCommitmentBatch},
communication::serialization::cbor_serialize,
core::types::{BatchInclusionData, SubmitProofResponseMessage, VerificationCommitmentBatch},
};
use futures_util::{stream::SplitSink, SinkExt};
use lambdaworks_crypto::merkle_tree::merkle::MerkleTree;
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-batcher/src/eth/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
retry_function,
},
};
use aligned_sdk::core::constants::{
use aligned_sdk::common::constants::{
ETHEREUM_CALL_BACKOFF_FACTOR, ETHEREUM_CALL_MAX_RETRIES, ETHEREUM_CALL_MAX_RETRY_DELAY,
ETHEREUM_CALL_MIN_RETRY_DELAY, GAS_PRICE_INCREMENT_PERCENTAGE_PER_ITERATION,
OVERRIDE_GAS_PRICE_PERCENTAGE_MULTIPLIER, PERCENTAGE_DIVIDER,
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-batcher/src/gnark/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use aligned_sdk::core::types::ProvingSystemId;
use aligned_sdk::common::types::ProvingSystemId;

#[derive(Copy, Clone, Debug)]
#[repr(C)]
Expand Down
4 changes: 2 additions & 2 deletions batcher/aligned-batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;

use aligned_sdk::core::constants::{
use aligned_sdk::common::constants::{
ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF, BATCHER_SUBMISSION_BASE_GAS_COST,
BUMP_BACKOFF_FACTOR, BUMP_MAX_RETRIES, BUMP_MAX_RETRY_DELAY, BUMP_MIN_RETRY_DELAY,
CBOR_ARRAY_MAX_OVERHEAD, CONNECTION_TIMEOUT, DEFAULT_MAX_FEE_PER_PROOF,
ETHEREUM_CALL_BACKOFF_FACTOR, ETHEREUM_CALL_MAX_RETRIES, ETHEREUM_CALL_MAX_RETRY_DELAY,
ETHEREUM_CALL_MIN_RETRY_DELAY, GAS_PRICE_PERCENTAGE_MULTIPLIER, PERCENTAGE_DIVIDER,
RESPOND_TO_TASK_FEE_LIMIT_PERCENTAGE_MULTIPLIER,
};
use aligned_sdk::core::types::{
use aligned_sdk::common::types::{
ClientMessage, GetNonceResponseMessage, NoncedVerificationData, ProofInvalidReason,
ProvingSystemId, SubmitProofMessage, SubmitProofResponseMessage, VerificationCommitmentBatch,
VerificationData, VerificationDataCommitment,
Expand Down
10 changes: 5 additions & 5 deletions batcher/aligned-batcher/src/types/batch_queue.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use aligned_sdk::{
communication::serialization::cbor_serialize,
core::{
common::{
constants::CBOR_ARRAY_MAX_OVERHEAD,
types::{NoncedVerificationData, VerificationDataCommitment},
},
communication::serialization::cbor_serialize,
};
use ethers::types::{Address, Signature, U256};
use priority_queue::PriorityQueue;
Expand Down Expand Up @@ -214,9 +214,9 @@ fn calculate_fee_per_proof(batch_len: usize, gas_price: U256, constant_gas_cost:

#[cfg(test)]
mod test {
use aligned_sdk::core::constants::DEFAULT_CONSTANT_GAS_COST;
use aligned_sdk::core::types::ProvingSystemId;
use aligned_sdk::core::types::VerificationData;
use aligned_sdk::common::constants::DEFAULT_CONSTANT_GAS_COST;
use aligned_sdk::common::types::ProvingSystemId;
use aligned_sdk::common::types::VerificationData;
use ethers::types::Address;

use super::*;
Expand Down
4 changes: 2 additions & 2 deletions batcher/aligned-batcher/src/zk_utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::gnark::verify_gnark;
use crate::risc_zero::verify_risc_zero_proof;
use crate::sp1::verify_sp1_proof;
use aligned_sdk::core::types::{ProvingSystemId, VerificationData};
use aligned_sdk::common::types::{ProvingSystemId, VerificationData};
use ethers::types::U256;
use log::{debug, warn};

Expand Down Expand Up @@ -72,7 +72,7 @@ pub(crate) fn is_verifier_disabled(
#[cfg(test)]
mod test {
use super::is_verifier_disabled;
use aligned_sdk::core::types::{ProvingSystemId, VerificationData};
use aligned_sdk::common::types::{ProvingSystemId, VerificationData};
use ethers::types::Address;

fn get_all_verifiers() -> Vec<ProvingSystemId> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
beacon::{BeaconClient, BeaconClientError},
core::types::Network,
common::types::Network,
};
use ethers::{
providers::{Http, Middleware, Provider},
Expand Down
3 changes: 3 additions & 0 deletions batcher/aligned-sdk/src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod constants;
pub mod errors;
pub mod types;
4 changes: 2 additions & 2 deletions batcher/aligned-sdk/src/communication/batch.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use log::debug;

use crate::{
core::{
common::{
errors,
types::{
AlignedVerificationData, BatchInclusionData, Network, VerificationCommitmentBatch,
VerificationDataCommitment,
},
},
sdk::is_proof_verified,
verification_layer::is_proof_verified,
};

const RETRIES: u64 = 10;
Expand Down
6 changes: 3 additions & 3 deletions batcher/aligned-sdk/src/communication/messaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ use futures_util::future::Ready;
use futures_util::stream::{SplitSink, TryFilter};
use tokio_tungstenite::{tungstenite::Message, MaybeTlsStream, WebSocketStream};

use crate::common::types::{BatchInclusionData, SubmitProofMessage};
use crate::communication::serialization::{cbor_deserialize, cbor_serialize};
use crate::core::types::{BatchInclusionData, SubmitProofMessage};
use crate::{
communication::batch::process_batcher_response,
core::{
common::{
errors::SubmitError,
types::{
AlignedVerificationData, ClientMessage, NoncedVerificationData,
SubmitProofResponseMessage, VerificationData, VerificationDataCommitment,
},
},
communication::batch::process_batcher_response,
};

pub type ResponseStream = TryFilter<
Expand Down
4 changes: 4 additions & 0 deletions batcher/aligned-sdk/src/communication/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod batch;
pub mod messaging;
pub mod protocol;
pub mod serialization;
2 changes: 1 addition & 1 deletion batcher/aligned-sdk/src/communication/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use futures_util::{stream::SplitStream, StreamExt};
use tokio::net::TcpStream;
use tokio_tungstenite::{MaybeTlsStream, WebSocketStream};

use crate::core::{errors::SubmitError, types::SubmitProofResponseMessage};
use crate::common::{errors::SubmitError, types::SubmitProofResponseMessage};

use super::serialization::cbor_deserialize;

Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-sdk/src/eth/aligned_proof_agg_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use ethers::prelude::*;

use crate::core::errors::VerificationError;
use crate::common::errors::VerificationError;

abigen!(
ProofAggregationServiceContract,
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-sdk/src/eth/aligned_service_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use ethers::prelude::*;

use crate::core::errors::VerificationError;
use crate::common::errors::VerificationError;

abigen!(
AlignedLayerServiceManagerContract,
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-sdk/src/eth/batcher_payment_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use ethers::prelude::*;

use crate::core::errors::VerificationError;
use crate::common::errors::VerificationError;

abigen!(
BatcherPaymentServiceContract,
Expand Down
3 changes: 3 additions & 0 deletions batcher/aligned-sdk/src/eth/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod aligned_proof_agg_service;
pub mod aligned_service_manager;
pub mod batcher_payment_service;
29 changes: 11 additions & 18 deletions batcher/aligned-sdk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
pub mod core {
pub mod constants;
pub mod errors;
pub mod types;
}
pub mod aggregation_layer;
pub mod verification_layer;

pub mod communication {
pub(crate) mod batch;
pub(crate) mod messaging;
pub mod protocol;
pub mod serialization;
}
/// Common types used across the Aggregation Layer and the Verification Layer AVS
pub mod common;

pub mod eth {
pub mod aligned_proof_agg_service;
pub mod aligned_service_manager;
pub mod batcher_payment_service;
}
// Eth and Communication modules should be outside the SDK in the future
/// Communication module is mostly for internal use
/// It contains code for communication protocols
pub mod communication;
/// Eth module is mostly for internal use
pub mod eth;

mod beacon;
pub mod sdk;
pub(crate) mod beacon;
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
pub mod aggregation;

use crate::{
communication::{
batch::await_batch_verification,
messaging::{receive, send_messages, ResponseStream},
protocol::check_protocol_version,
serialization::{cbor_deserialize, cbor_serialize},
},
core::{
common::{
constants::{
ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF, DEFAULT_CONSTANT_GAS_COST,
DEFAULT_MAX_FEE_BATCH_SIZE, GAS_PRICE_PERCENTAGE_MULTIPLIER,
Expand All @@ -19,6 +11,12 @@ use crate::{
Network, ProvingSystemId, VerificationData,
},
},
communication::{
batch::await_batch_verification,
messaging::{receive, send_messages, ResponseStream},
protocol::check_protocol_version,
serialization::{cbor_deserialize, cbor_serialize},
},
eth::{
aligned_service_manager::aligned_service_manager,
batcher_payment_service::batcher_payment_service,
Expand Down
6 changes: 4 additions & 2 deletions batcher/aligned-task-sender/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use aligned_sdk::core::types::{Network, ProvingSystemId, VerificationData};
use aligned_sdk::sdk::{deposit_to_aligned, get_nonce_from_batcher, submit_multiple};
use aligned_sdk::common::types::{Network, ProvingSystemId, VerificationData};
use aligned_sdk::verification_layer::{
deposit_to_aligned, get_nonce_from_batcher, submit_multiple,
};
use ethers::prelude::*;
use ethers::utils::parse_ether;
use k256::ecdsa::SigningKey;
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-task-sender/src/structs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use aligned_sdk::core::types::Network;
use aligned_sdk::common::types::Network;
use clap::Parser;
use clap::Subcommand;
use clap::ValueEnum;
Expand Down
36 changes: 19 additions & 17 deletions batcher/aligned/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ use std::io::Write;
use std::path::PathBuf;
use std::str::FromStr;

use aligned_sdk::communication::serialization::cbor_deserialize;
use aligned_sdk::core::types::FeeEstimationType;
use aligned_sdk::core::{
use aligned_sdk::aggregation_layer::is_proof_verified_in_aggregation_mode;
use aligned_sdk::aggregation_layer::AggregationModeVerificationData;
use aligned_sdk::common::types::FeeEstimationType;
use aligned_sdk::common::{
errors::{AlignedError, FeeEstimateError, SubmitError},
types::{AlignedVerificationData, Network, ProvingSystemId, VerificationData},
};
use aligned_sdk::sdk::aggregation::is_proof_verified_in_aggregation_mode;
use aligned_sdk::sdk::aggregation::AggregationModeVerificationData;
use aligned_sdk::sdk::estimate_fee;
use aligned_sdk::sdk::get_chain_id;
use aligned_sdk::sdk::get_nonce_from_batcher;
use aligned_sdk::sdk::get_nonce_from_ethereum;
use aligned_sdk::sdk::{deposit_to_aligned, get_balance_in_aligned};
use aligned_sdk::sdk::{get_vk_commitment, is_proof_verified, save_response, submit_multiple};
use aligned_sdk::communication::serialization::cbor_deserialize;
use aligned_sdk::verification_layer::estimate_fee;
use aligned_sdk::verification_layer::get_chain_id;
use aligned_sdk::verification_layer::get_nonce_from_batcher;
use aligned_sdk::verification_layer::get_nonce_from_ethereum;
use aligned_sdk::verification_layer::{deposit_to_aligned, get_balance_in_aligned};
use aligned_sdk::verification_layer::{
get_vk_commitment, is_proof_verified, save_response, submit_multiple,
};
use clap::Args;
use clap::Parser;
use clap::Subcommand;
Expand Down Expand Up @@ -542,23 +544,23 @@ async fn main() -> Result<(), AlignedError> {
get_nonce_from_batcher(submit_args.network.clone().into(), wallet.address())
.await
.map_err(|e| match e {
aligned_sdk::core::errors::GetNonceError::EthRpcError(e) => {
aligned_sdk::common::errors::GetNonceError::EthRpcError(e) => {
SubmitError::GetNonceError(e)
}
aligned_sdk::core::errors::GetNonceError::ConnectionFailed(e) => {
aligned_sdk::common::errors::GetNonceError::ConnectionFailed(e) => {
SubmitError::GenericError(e)
}
aligned_sdk::core::errors::GetNonceError::InvalidRequest(e) => {
aligned_sdk::common::errors::GetNonceError::InvalidRequest(e) => {
SubmitError::GenericError(e)
}
aligned_sdk::core::errors::GetNonceError::SerializationError(e) => {
aligned_sdk::common::errors::GetNonceError::SerializationError(e) => {
SubmitError::GenericError(e)
}
aligned_sdk::core::errors::GetNonceError::ProtocolMismatch {
aligned_sdk::common::errors::GetNonceError::ProtocolMismatch {
current,
expected,
} => SubmitError::ProtocolVersionMismatch { current, expected },
aligned_sdk::core::errors::GetNonceError::UnexpectedResponse(e) => {
aligned_sdk::common::errors::GetNonceError::UnexpectedResponse(e) => {
SubmitError::UnexpectedBatcherResponse(e)
}
})?
Expand Down
2 changes: 1 addition & 1 deletion docs/3_guides/1_SDK_how_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ version of the release that has the `latest` badge.
To get the SDK up and running in your project, you must first import it

```rust
use aligned_sdk::core::types::{PriceEstimate, AlignedVerificationData, Network, ProvingSystemId, VerificationData};
use aligned_sdk::common::types::{PriceEstimate, AlignedVerificationData, Network, ProvingSystemId, VerificationData};
use aligned_sdk::sdk::{estimate_fee, submit_and_wait, get_nonce_from_ethereum};
```

Expand Down
Loading
Loading