Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Observe max block in execution #239

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions bin/akula.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ fn main() -> anyhow::Result<()> {
);
staged_sync.push(
Execution {
max_block: opt.max_block,
batch_size: opt.execution_batch_size.saturating_mul(1_000_000_000_u64),
history_batch_size: opt
.execution_history_batch_size
Expand Down
5 changes: 3 additions & 2 deletions src/stages/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use tracing::*;
/// Execution of blocks through EVM
#[derive(Debug)]
pub struct Execution {
pub max_block: Option<BlockNumber>,
pub batch_size: u64,
pub history_batch_size: u64,
pub exit_after_batch: bool,
Expand Down Expand Up @@ -208,8 +209,8 @@ where

let prev_progress = input.stage_progress.unwrap_or_default();
let starting_block = prev_progress + 1;
let max_block = input
.previous_stage.ok_or_else(|| format_err!("Execution stage cannot be executed first, but no previous stage progress specified"))?.1;
let max_block = std::cmp::min(input
.previous_stage.ok_or_else(|| format_err!("Execution stage cannot be executed first, but no previous stage progress specified"))?.1, self.max_block.unwrap_or(BlockNumber(u64::MAX)));

Ok(if max_block >= starting_block {
let result = execute_batch_of_blocks(
Expand Down