Skip to content

Commit aa9ddc5

Browse files
Remove unnecessary rpc provider param from Proof aggregator
1 parent 62cb33b commit aa9ddc5

File tree

1 file changed

+8
-10
lines changed
  • aggregation_mode/proof_aggregator/src/backend

1 file changed

+8
-10
lines changed

aggregation_mode/proof_aggregator/src/backend/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use sqlx::types::Uuid;
2727
use std::thread::sleep;
2828
use std::{str::FromStr, time::Duration};
2929
use tracing::{error, info, warn};
30-
use types::{AlignedProofAggregationService, AlignedProofAggregationServiceContract, RPCProvider};
30+
use types::{AlignedProofAggregationService, AlignedProofAggregationServiceContract};
3131

3232
#[derive(Debug)]
3333
pub enum AggregatedProofSubmissionError {
@@ -50,7 +50,6 @@ pub struct ProofAggregator {
5050
proof_aggregation_service: AlignedProofAggregationServiceContract,
5151
fetcher: ProofsFetcher,
5252
config: Config,
53-
rpc_provider: RPCProvider,
5453
sp1_chunk_aggregator_vk_hash_bytes: [u8; 32],
5554
risc0_chunk_aggregator_image_id_bytes: [u8; 32],
5655
db: Db,
@@ -72,8 +71,6 @@ impl ProofAggregator {
7271

7372
info!("Monthly budget set to {} eth", config.monthly_budget_eth);
7473

75-
let rpc_provider = ProviderBuilder::new().connect_http(rpc_url.clone());
76-
7774
let signed_rpc_provider = ProviderBuilder::new().wallet(wallet).connect_http(rpc_url);
7875

7976
let proof_aggregation_service = AlignedProofAggregationService::new(
@@ -108,7 +105,6 @@ impl ProofAggregator {
108105
proof_aggregation_service,
109106
fetcher,
110107
config,
111-
rpc_provider,
112108
sp1_chunk_aggregator_vk_hash_bytes,
113109
risc0_chunk_aggregator_image_id_bytes,
114110
db,
@@ -226,7 +222,6 @@ impl ProofAggregator {
226222
self.proof_aggregation_service.clone(),
227223
self.sp1_chunk_aggregator_vk_hash_bytes,
228224
self.risc0_chunk_aggregator_image_id_bytes,
229-
self.rpc_provider.clone(),
230225
self.config.monthly_budget_eth,
231226
)
232227
},
@@ -322,7 +317,6 @@ async fn bump_and_send_proof_to_verify_on_chain(
322317
proof_aggregation_service: AlignedProofAggregationServiceContract,
323318
sp1_chunk_aggregator_vk_hash_bytes: [u8; 32],
324319
risc0_chunk_aggregator_image_id_bytes: [u8; 32],
325-
rpc_provider: RPCProvider,
326320
monthly_budget_eth: f64,
327321
) -> Result<TransactionReceipt, RetryError<AggregatedProofSubmissionError>> {
328322
// We start on 24 hours because the proof aggregator runs once a day, so the time elapsed
@@ -332,9 +326,13 @@ async fn bump_and_send_proof_to_verify_on_chain(
332326
// Iterate until we can send the proof on-chain
333327
loop {
334328
// Fetch gas price from network
335-
let gas_price = rpc_provider.get_gas_price().await.map_err(|e| {
336-
RetryError::Transient(AggregatedProofSubmissionError::GasPriceError(e.to_string()))
337-
})?;
329+
let gas_price = proof_aggregation_service
330+
.provider()
331+
.get_gas_price()
332+
.await
333+
.map_err(|e| {
334+
RetryError::Transient(AggregatedProofSubmissionError::GasPriceError(e.to_string()))
335+
})?;
338336

339337
if should_send_proof_to_verify_on_chain(
340338
time_elapsed,

0 commit comments

Comments
 (0)