-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
917 additions
and
146 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use std::time::Duration; | ||
|
||
use alloy::network::Ethereum; | ||
use alloy::providers::fillers::{ | ||
BlobGasFiller, ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, | ||
}; | ||
use alloy::providers::Identity; | ||
use alloy::transports::http::reqwest; | ||
use alloy::transports::layers::RetryBackoffLayer; | ||
use alloy::{ | ||
providers::{ProviderBuilder, RootProvider}, | ||
rpc::client::ClientBuilder, | ||
}; | ||
|
||
const HTTP_CLIENT_CONNECTION_POOL_IDLE_TIMEOUT: u64 = 90; | ||
const HTTP_CLIENT_MAX_IDLE_CONNECTIONS_PER_HOST: usize = 64; | ||
|
||
pub type AlloyProvider = FillProvider< | ||
JoinFill< | ||
Identity, | ||
JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>, | ||
>, | ||
RootProvider, | ||
Ethereum, | ||
>; | ||
|
||
pub fn build_http_retry_provider( | ||
rpc_url: &url::Url, | ||
backoff: u64, | ||
max_retries: u32, | ||
) -> Result<AlloyProvider, anyhow::Error> { | ||
let retry_policy = RetryBackoffLayer::new(max_retries, backoff, 5); | ||
let reqwest_client = reqwest::ClientBuilder::new() | ||
.pool_max_idle_per_host(HTTP_CLIENT_MAX_IDLE_CONNECTIONS_PER_HOST) | ||
.pool_idle_timeout(Duration::from_secs( | ||
HTTP_CLIENT_CONNECTION_POOL_IDLE_TIMEOUT, | ||
)) | ||
.build()?; | ||
|
||
let http = alloy::transports::http::Http::with_client(reqwest_client, rpc_url.clone()); | ||
let is_local = http.guess_local(); | ||
let client = ClientBuilder::default() | ||
.layer(retry_policy) | ||
.transport(http, is_local); | ||
Ok(ProviderBuilder::new().on_client(client)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub(crate) mod json_rpc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mod digest; | ||
mod error; | ||
pub mod error; | ||
mod full_execution_proof; | ||
pub mod proof; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::str::FromStr; | ||
|
||
use jsonrpsee::core::Serialize; | ||
use serde::Deserialize; | ||
use url::Url; | ||
|
||
/// The Aggchain proof builder configuration | ||
#[derive(Serialize, Deserialize, Clone, Debug)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub struct AggchainProofBuilderConfig { | ||
/// Json rpc endpoint of the l1 node. | ||
pub l1_rpc_endpoint: Url, | ||
|
||
/// Json rpc endpoint of the l2 rollup node. | ||
pub l2_rpc_endpoint: Url, | ||
|
||
/// Id of the rollup chain | ||
pub rollup_id: u32, | ||
} | ||
|
||
impl Default for AggchainProofBuilderConfig { | ||
fn default() -> Self { | ||
AggchainProofBuilderConfig { | ||
l1_rpc_endpoint: default_l1_url(), | ||
l2_rpc_endpoint: default_l2_url(), | ||
rollup_id: 0, | ||
} | ||
} | ||
} | ||
|
||
fn default_l1_url() -> Url { | ||
Url::from_str("127.0.0.1::8545").unwrap() | ||
} | ||
|
||
fn default_l2_url() -> Url { | ||
Url::from_str("127.0.0.1::8546").unwrap() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use std::fmt::Debug; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::aggchain_proof_builder::AggchainProofBuilderConfig; | ||
use crate::proposer_service::ProposerServiceConfig; | ||
|
||
/// The initial blockchain node backoff in milliseconds | ||
pub const HTTP_RPC_NODE_INITIAL_BACKOFF_MS: u64 = 5000; | ||
|
||
/// The blockchain node backoff number of retries | ||
pub const HTTP_RPC_NODE_BACKOFF_MAX_RETRIES: u32 = 64; | ||
|
||
/// The Aggchain proof service configuration | ||
#[derive(Serialize, Deserialize, Clone, Debug, Default)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub struct AggchainProofServiceConfig { | ||
pub aggchain_proof_builder_config: AggchainProofBuilderConfig, | ||
pub proposer_service_config: ProposerServiceConfig, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
crates/proposer-client/src/config.rs → ...kit-prover-config/src/proposer_service.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.