Skip to content

Fix endId calculation logic#16044

Merged
mh0lt merged 1 commit intorelease/3.0from
fix/endId-calculation
Jul 11, 2025
Merged

Fix endId calculation logic#16044
mh0lt merged 1 commit intorelease/3.0from
fix/endId-calculation

Conversation

@antonis19
Copy link
Copy Markdown
Member

@antonis19 antonis19 commented Jul 10, 2025

This will make the TestService_ProcessNewBlocksWithOverride test pass.

@antonis19 antonis19 changed the base branch from main to release/3.0 July 10, 2025 22:46
@antonis19 antonis19 requested review from Copilot and mh0lt July 10, 2025 22:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an off-by-one error in the calculation of endId when clamping by eventLimit.

  • Changed the boundary check from > to >= to correctly handle cases where the range size equals the limit.
  • Ensured that when the difference matches the limit, endId is reduced by one as intended.
Comments suppressed due to low confidence (1)

polygon/bridge/service.go:393

  • Add a unit test for the boundary case where endId - startId == *eventLimit to ensure this off-by-one fix behaves as expected and prevent future regressions.
				if endId > startId && endId-startId >= *eventLimit {

@mh0lt mh0lt enabled auto-merge (squash) July 10, 2025 22:49
@mh0lt mh0lt merged commit cd2fbed into release/3.0 Jul 11, 2025
6 checks passed
@mh0lt mh0lt deleted the fix/endId-calculation branch July 11, 2025 09:15
antonis19 added a commit that referenced this pull request Jul 11, 2025
This will make the `TestService_ProcessNewBlocksWithOverride` test pass.

Co-authored-by: antonis19 <antonis19@users.noreply.github.com>
antonis19 added a commit that referenced this pull request Jul 11, 2025
The test has been fixed as of
#16044, so there is no need to
skip it anymore.

Co-authored-by: antonis19 <antonis19@users.noreply.github.com>
mh0lt added a commit that referenced this pull request Jul 12, 2025
Cherry-pick #16044 and
#16043

---------

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: antonis19 <antonis19@users.noreply.github.com>
@VBulikov VBulikov added this to the 3.0.15 milestone Jul 25, 2025
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