Skip to content

feat: implement proper block validation in BlockchainTestBase to mimic sync manager behavior#9438

Merged
LukaszRozmej merged 7 commits into
NethermindEth:masterfrom
DeVikingMark:todo-mimic-the-behaviour
Oct 17, 2025
Merged

feat: implement proper block validation in BlockchainTestBase to mimic sync manager behavior#9438
LukaszRozmej merged 7 commits into
NethermindEth:masterfrom
DeVikingMark:todo-mimic-the-behaviour

Conversation

@DeVikingMark

Copy link
Copy Markdown
Contributor

Summary

Implements proper block validation in BlockchainTestBase.RunTest() to mimic sync manager behavior, addressing TODO on line 188.

Changes

  • Add ValidateSuggestedBlock() before suggesting blocks
  • Add ValidateSeal() when seal engine is used
  • Recalculate total difficulty from parent block
  • Improve error handling for invalid blocks

Impact

Tests now follow the same validation flow as SyncServer.SyncBlock() for more accurate blockchain testing.

Comment thread src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs Outdated
Comment thread src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs Outdated
@flcl42

flcl42 commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

In case of troubles with some tests - try parentHeader = blockTree.FindHeader(correctRlp[i].Block.ParentHash); in the cycle. As some tests test reorgs

@DeVikingMark DeVikingMark requested a review from flcl42 October 15, 2025 10:02
Comment thread src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs Outdated
Comment thread src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs Outdated
@DeVikingMark DeVikingMark requested a review from flcl42 October 15, 2025 22:13
Comment thread src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs Outdated
@DeVikingMark DeVikingMark requested a review from flcl42 October 16, 2025 20:26
@LukaszRozmej LukaszRozmej merged commit 091182e into NethermindEth:master Oct 17, 2025
80 checks passed
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