Skip to content

Commit

Permalink
chore: move provider to the common crate (#567)
Browse files Browse the repository at this point in the history
* fix: move cache provider to common crate

* fix: update number of parallel connections

* fix: format
  • Loading branch information
atanmarko authored Aug 29, 2024
1 parent b219695 commit b20f9c4
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

29 changes: 15 additions & 14 deletions zero_bin/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@ keywords.workspace = true
categories.workspace = true

[dependencies]
directories = "5.0.1"

thiserror = { workspace = true }
trace_decoder = { workspace = true }
tracing = { workspace = true }
proof_gen = { workspace = true }
plonky2 = { workspace = true }
evm_arithmetization = { workspace = true }
clap = { workspace = true }
alloy = { workspace = true }
anyhow = { workspace = true }
async-stream = { workspace = true }
cargo_metadata = { workspace = true }
clap = { workspace = true }
evm_arithmetization = { workspace = true }
futures = { workspace = true }
lru = { workspace = true }
once_cell = { workspace = true }
plonky2 = { workspace = true }
proof_gen = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
futures = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
alloy = { workspace = true }
async-stream = { workspace = true }
cargo_metadata = { workspace = true }
trace_decoder = { workspace = true }
tracing = { workspace = true }
vergen = { workspace = true }
once_cell = { workspace = true }

directories = "5.0.1"

[build-dependencies]
cargo_metadata = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions zero_bin/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pub mod fs;
pub mod parsing;
pub mod pre_checks;
pub mod prover_state;
pub mod provider;
pub mod version;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use anyhow::Context;
use tokio::sync::{Mutex, Semaphore, SemaphorePermit};

const CACHE_SIZE: usize = 1024;
const MAX_NUMBER_OF_PARALLEL_REQUESTS: usize = 64;
const MAX_NUMBER_OF_PARALLEL_REQUESTS: usize = 128;

/// Wrapper around alloy provider to cache blocks and other
/// frequently used data.
Expand Down
2 changes: 1 addition & 1 deletion zero_bin/leader/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub(crate) async fn client_main(
) -> Result<()> {
use futures::{FutureExt, StreamExt};

let cached_provider = Arc::new(rpc::provider::CachedProvider::new(
let cached_provider = Arc::new(zero_bin_common::provider::CachedProvider::new(
build_http_retry_provider(
rpc_params.rpc_url.clone(),
rpc_params.backoff,
Expand Down
1 change: 0 additions & 1 deletion zero_bin/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ clap = { workspace = true }
evm_arithmetization = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
lru = { workspace = true }
mpt_trie = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion zero_bin/rpc/src/jerigon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use prover::BlockProverInput;
use serde::Deserialize;
use serde_json::json;
use trace_decoder::{BlockTrace, BlockTraceTriePreImages, CombinedPreImages, TxnInfo};
use zero_bin_common::provider::CachedProvider;

use super::fetch_other_block_data;
use crate::provider::CachedProvider;

/// Transaction traces retrieved from Erigon zeroTracer.
#[derive(Debug, Deserialize)]
Expand Down
3 changes: 1 addition & 2 deletions zero_bin/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ use tracing::warn;

pub mod jerigon;
pub mod native;
pub mod provider;
pub mod retry;

use crate::provider::CachedProvider;
use zero_bin_common::provider::CachedProvider;

pub(crate) type PreviousBlockHashes = [FixedBytes<32>; 256];

Expand Down
2 changes: 1 addition & 1 deletion zero_bin/rpc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ use anyhow::anyhow;
use clap::{Args, Parser, Subcommand, ValueHint};
use futures::StreamExt;
use prover::BlockProverInput;
use rpc::provider::CachedProvider;
use rpc::{retry::build_http_retry_provider, RpcParams, RpcType};
use tracing_subscriber::{prelude::*, EnvFilter};
use url::Url;
use zero_bin_common::pre_checks::check_previous_proof_and_checkpoint;
use zero_bin_common::provider::CachedProvider;
use zero_bin_common::version;
use zero_bin_common::{block_interval::BlockInterval, prover_state::persistence::CIRCUIT_VERSION};

Expand Down
3 changes: 1 addition & 2 deletions zero_bin/rpc/src/native/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ use alloy::{
use futures::try_join;
use prover::BlockProverInput;
use trace_decoder::BlockTrace;

use crate::provider::CachedProvider;
use zero_bin_common::provider::CachedProvider;

mod state;
mod txn;
Expand Down
2 changes: 1 addition & 1 deletion zero_bin/rpc/src/native/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use trace_decoder::{
BlockTraceTriePreImages, SeparateStorageTriesPreImage, SeparateTriePreImage,
SeparateTriePreImages, TxnInfo,
};
use zero_bin_common::provider::CachedProvider;

use crate::provider::CachedProvider;
use crate::Compat;

/// Processes the state witness for the given block.
Expand Down

0 comments on commit b20f9c4

Please sign in to comment.