Skip to content

execution/stagedsync: fix parallel-exec "limit" log underflow - #21953

Merged
AskAlexSharov merged 1 commit into
mainfrom
alex/parallel_exec_limit_underflow_35
Jun 25, 2026
Merged

AskAlexSharov merged 1 commit into
mainfrom
alex/parallel_exec_limit_underflow_35

Conversation

@AskAlexSharov

Copy link
Copy Markdown
Collaborator

Problem

The parallel starting log line prints a garbage limit:

[6/8 Execution] parallel starting from=0 to=21715999 limit=18446744073709551615 ...

18446744073709551615 is math.MaxUint64: the log computed limit as startBlockNum+blockLimit-1, which underflows when blockLimit == 0 (the "no per-cycle limit" case — e.g. integration stage_exec from block 0, where LoopBlockLimit is 0).

Fix

Log the effective last block of the cycle:

  • maxBlockNum when there's no per-cycle limit (blockLimit == 0),
  • otherwise min(startBlockNum+blockLimit-1, maxBlockNum).

This mirrors how the serial path already computes toBlockNum (exec3_serial.go). Log-only change — execution behavior is unaffected.

Now logs:

[6/8 Execution] parallel starting from=0 to=21715999 limit=21715999 ...

The "parallel starting" log computed limit as startBlockNum+blockLimit-1.
When blockLimit == 0 (no per-cycle limit, e.g. integration stage_exec from 0)
this underflows to 18446744073709551615 (max uint64) in the log. Log the
effective last block instead: maxBlockNum when unlimited, else
min(startBlockNum+blockLimit-1, maxBlockNum). Log-only; execution unaffected.

@Giulio2002 Giulio2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — log-only fix for an obvious blockLimit==0 underflow in the reported limit value.

@Giulio2002 Giulio2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — trivial logging fix for the computed limit upper bound in parallel exec.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an underflow in the parallel execution “parallel starting” log line when blockLimit == 0 (the “no per-cycle limit” case), which previously produced math.MaxUint64 as a garbage limit value.

Changes:

  • Compute a lastBlock value for logging that equals maxBlockNum when blockLimit == 0.
  • When blockLimit > 0, log lastBlock = min(startBlockNum+blockLimit-1, maxBlockNum) to avoid underflow and reflect the effective cycle end.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AskAlexSharov
AskAlexSharov added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit 5da12f5 Jun 25, 2026
95 checks passed
@AskAlexSharov
AskAlexSharov deleted the alex/parallel_exec_limit_underflow_35 branch June 25, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants