Skip to content

feat: Reorg updates validator state#826

Merged
hudem1 merged 10 commits intomainfrom
hudem1/feat/reorg-update-validator-state
Apr 16, 2026
Merged

feat: Reorg updates validator state#826
hudem1 merged 10 commits intomainfrom
hudem1/feat/reorg-update-validator-state

Conversation

@hudem1
Copy link
Copy Markdown
Collaborator

@hudem1 hudem1 commented Apr 14, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 14, 2026 10:55
Comment thread src/Nethermind.Arbitrum/Execution/Stateless/StateReconstructor.cs
Copy link
Copy Markdown

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 ensures validator state tracking in StateReconstructor is properly updated during chain reorgs, so MemDb-pinned reconstructed state is released when it becomes invalid after a reorg.

Changes:

  • Add StateReconstructor.ReorgTo(BlockHeader) and trim prepared/pinned state beyond the reorg target.
  • Switch prepared-queue entries from Hash256 state roots to BlockHeader so trimming can be based on block numbers.
  • Extend tests to cover reorg interactions with _validHeader, _validHeaderCandidate, and MemDb pinning behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Nethermind.Arbitrum/Execution/Stateless/StateReconstructor.cs Adds ReorgTo + prepared-queue trimming; changes prepared-queue element type to BlockHeader.
src/Nethermind.Arbitrum/Execution/ArbitrumExecutionEngine.cs Updates PrepareForRecord to pass headers (not roots) into PreparedAddTrim.
src/Nethermind.Arbitrum/Execution/ArbitrumBlockFactory.cs Calls stateReconstructor.ReorgTo(...) on reorg when validation is enabled.
src/Nethermind.Arbitrum.Test/Execution/Stateless/StateReconstructorTests.cs Exposes/primes a reusable pruning simulation helper for new reorg tests.
src/Nethermind.Arbitrum.Test/Execution/Stateless/MarkValidTests.cs Adds reorg-focused tests verifying validator state is cleared/preserved appropriately and MemDb pins are released.

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

Comment thread src/Nethermind.Arbitrum/Execution/ArbitrumBlockFactory.cs
Comment thread src/Nethermind.Arbitrum.Test/Execution/Stateless/MarkValidTests.cs
Comment thread src/Nethermind.Arbitrum/Execution/Stateless/StateReconstructor.cs Outdated
Comment thread src/Nethermind.Arbitrum/Execution/Stateless/StateReconstructor.cs Outdated
Comment thread src/Nethermind.Arbitrum/Execution/Stateless/StateReconstructor.cs Outdated
Comment thread src/Nethermind.Arbitrum/Execution/ArbitrumExecutionEngine.cs
Comment thread src/Nethermind.Arbitrum/Execution/Stateless/StateReconstructor.cs Outdated
Comment thread src/Nethermind.Arbitrum/Execution/ArbitrumExecutionEngine.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Execution/Stateless/MarkValidTests.cs
Comment thread src/Nethermind.Arbitrum/Execution/Stateless/StateReconstructor.cs Outdated
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 70.43478% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.52%. Comparing base (83a3d65) to head (12b9a72).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...Arbitrum/Execution/Stateless/StateReconstructor.cs 68.80% 21 Missing and 13 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #826      +/-   ##
==========================================
+ Coverage   76.39%   76.52%   +0.13%     
==========================================
  Files         227      227              
  Lines       14151    14188      +37     
  Branches     2107     2119      +12     
==========================================
+ Hits        10810    10857      +47     
+ Misses       2584     2572      -12     
- Partials      757      759       +2     
Files with missing lines Coverage Δ
...hermind.Arbitrum/Execution/ArbitrumBlockFactory.cs 40.84% <100.00%> (+1.27%) ⬆️
...mind.Arbitrum/Execution/ArbitrumExecutionEngine.cs 50.00% <100.00%> (ø)
...Arbitrum/Execution/Stateless/StateReconstructor.cs 60.83% <68.80%> (+3.73%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hudem1 hudem1 merged commit 28bccf7 into main Apr 16, 2026
12 checks passed
@hudem1 hudem1 deleted the hudem1/feat/reorg-update-validator-state branch April 16, 2026 04:25
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.

5 participants