Skip to content

core: fix finalStateDB pointing to backupStateDB (block-stm)#2137

Merged
pratikspatil024 merged 1 commit intodevelopfrom
psp-parallelprocessor-fix
Mar 12, 2026
Merged

core: fix finalStateDB pointing to backupStateDB (block-stm)#2137
pratikspatil024 merged 1 commit intodevelopfrom
psp-parallelprocessor-fix

Conversation

@pratikspatil024
Copy link
Member

Description

Please provide a detailed description of what was done in this PR

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

Nodes audience

In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
    • In case link the PR here:
  • This PR requires changes to matic-cli
    • In case link the PR here:

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on amoy
  • I have created new e2e tests into express-cli

Manual tests

Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

@sonarqubecloud
Copy link

@pratikspatil024 pratikspatil024 requested review from a team, cffls and marcello33 March 11, 2026 13:18
@claude
Copy link

claude bot commented Mar 11, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

LGTM — straightforward one-line bugfix ensuring finalStateDB points to the caller-visible statedb rather than the backup copy during fee-delay retry.

Extended reasoning...

Overview

This PR changes a single line in core/parallel_state_processor.go. In the retry path triggered by shouldRerunWithoutFeeDelay, the code resets statedb content via *statedb = *backupStateDB and then re-assigns finalStateDB on each task. The bug was that finalStateDB was set to backupStateDB (the copy) instead of statedb (the original pointer). Since Settle() writes all final state mutations to finalStateDB, and the caller of Process() expects results to be reflected through the statedb parameter, this was incorrect.

Security risks

No new security risks introduced. This is a correctness fix — the previous code could cause the caller to not see the final state from a retried parallel execution, which is a consensus-critical bug. The fix restores the correct behavior matching the initial task creation where finalStateDB: statedb is set.

Level of scrutiny

While this touches consensus-critical parallel state processing code, the change is a single variable reference fix with clear intent. The same fix has already been merged to master (6b8a6cc). The correctness can be verified by tracing the data flow: tasks are initially created with finalStateDB: statedb, and this retry path should maintain the same invariant.

Other factors

No bugs were found by automated analysis. The PR description template is unfilled, but the commit message clearly describes the intent. The change is minimal and self-evidently correct from reading the surrounding code.

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 51.52%. Comparing base (5eb6b6c) to head (6b8a6cc).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
core/parallel_state_processor.go 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2137      +/-   ##
===========================================
+ Coverage    51.50%   51.52%   +0.02%     
===========================================
  Files          882      882              
  Lines       154081   154081              
===========================================
+ Hits         79352    79394      +42     
+ Misses       69552    69517      -35     
+ Partials      5177     5170       -7     
Files with missing lines Coverage Δ
core/parallel_state_processor.go 21.97% <0.00%> (ø)

... and 17 files with indirect coverage changes

Files with missing lines Coverage Δ
core/parallel_state_processor.go 21.97% <0.00%> (ø)

... and 17 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pratikspatil024 pratikspatil024 merged commit eab2a72 into develop Mar 12, 2026
21 of 22 checks passed
@pratikspatil024 pratikspatil024 deleted the psp-parallelprocessor-fix branch March 12, 2026 09:21
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.

3 participants