Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(utils): update block data range #334

Merged
merged 5 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 7 additions & 2 deletions utils/host/src/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,16 @@ impl OPSuccinctDataFetcher {
Ok(fee_data)
}

/// Get the aggregate block statistics for a range of blocks.
/// Get the aggregate block statistics for a range of blocks exclusive of the start block.
///
/// When proving a range in OP Succinct, we are proving the transition from the block hash
/// of the start block to the block hash of the end block. This means that we don't expend resources
/// to "prove" the start block. This is why the start block is not included in the range for which
/// we fetch block data.
pub async fn get_l2_block_data_range(&self, start: u64, end: u64) -> Result<Vec<BlockInfo>> {
use futures::stream::{self, StreamExt};

let block_data = stream::iter(start..=end)
let block_data = stream::iter(start + 1..=end)
.map(|block_number| async move {
let block = self
.l2_provider
Expand Down
3 changes: 2 additions & 1 deletion utils/host/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ impl ExecutionStats {
let total_gas_used: u64 = block_data.iter().map(|b| b.gas_used).sum();

Self {
batch_start: block_data[0].block_number,
// The first block is not included in the cycles, or in the gas used.
batch_start: block_data[0].block_number + 1,
fakedev9999 marked this conversation as resolved.
Show resolved Hide resolved
batch_end: block_data[block_data.len() - 1].block_number,
total_instruction_count: report.total_instruction_count(),
total_sp1_gas: 0,
Expand Down
Loading