Skip to content

Commit ce454dd

Browse files
authored
fix: reduce RPC concurrency to prevent rate limit errors (#608)
* chore: remove unused code * fix: reduce RPC concurrency to prevent rate limit errors
1 parent f12f296 commit ce454dd

File tree

1 file changed

+1
-38
lines changed

1 file changed

+1
-38
lines changed

utils/host/src/fetcher.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -163,43 +163,6 @@ impl OPSuccinctDataFetcher {
163163
}
164164
}
165165

166-
/// Get the fee data for a range of blocks. Extracts the l1 fee data from the receipts.
167-
pub async fn get_l2_fee_data_range(&self, start: u64, end: u64) -> Result<Vec<FeeData>> {
168-
let l2_provider = self.l2_provider.clone();
169-
170-
use futures::stream::{self, StreamExt};
171-
172-
// Only fetch 100 receipts at a time to better use system resources. Increases stability.
173-
let fee_data = stream::iter(start..=end)
174-
.map(|block_number| {
175-
let l2_provider = l2_provider.clone();
176-
async move {
177-
let receipt =
178-
l2_provider.get_block_receipts(block_number.into()).await.unwrap();
179-
let transactions = receipt.unwrap();
180-
let block_fee_data: Vec<FeeData> = transactions
181-
.iter()
182-
.enumerate()
183-
.map(|(tx_index, tx)| FeeData {
184-
block_number,
185-
tx_index: tx_index as u64,
186-
tx_hash: tx.inner.transaction_hash,
187-
l1_gas_cost: U256::from(tx.l1_block_info.l1_fee.unwrap_or(0)),
188-
tx_fee: tx.inner.effective_gas_price * tx.inner.gas_used as u128,
189-
})
190-
.collect();
191-
block_fee_data
192-
}
193-
})
194-
.buffered(100)
195-
.collect::<Vec<_>>()
196-
.await
197-
.into_iter()
198-
.flatten()
199-
.collect();
200-
Ok(fee_data)
201-
}
202-
203166
/// Get the aggregate block statistics for a range of blocks exclusive of the start block.
204167
///
205168
/// When proving a range in OP Succinct, we are proving the transition from the block hash
@@ -236,7 +199,7 @@ impl OPSuccinctDataFetcher {
236199
total_tx_fees,
237200
})
238201
})
239-
.buffered(100)
202+
.buffered(10)
240203
.collect::<Vec<Result<BlockInfo>>>()
241204
.await;
242205

0 commit comments

Comments
 (0)