Skip to content

test: wait for the payload's commit in SendNewBlockV2 before reading its state - #13793

Open
LukaszRozmej wants to merge 2 commits into
masterfrom
fix/flaky-payload-bodies-by-hash
Open

LukaszRozmej wants to merge 2 commits into
masterfrom
fix/flaky-payload-bodies-by-hash

Conversation

@LukaszRozmej

Copy link
Copy Markdown
Member

Changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Flaky test fix

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Test-only change; all 22 getPayloadBodiesBy* tests pass locally.

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

@claude

claude Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @LukaszRozmej's task in 31s —— View job


Review: PR #13793

Verdict: good to merge. No Critical, High or Medium findings.

Correctness

  • chain.WaitForCommitted → BlockProcessingQueue.WaitUntilRemovedAsync(hash) (BlockchainProcessor.cs:160). If the block is no longer in flight, it returns a completed task right away. So the new line can't hang, and it adds no delay once the block is committed.
  • This is the same pattern already used after engine_newPayload in EngineModuleTests.V2.cs:300, EngineModuleTests.PayloadProduction.cs:141 and EngineModuleTests.V1.cs:1574/1613.
  • It fixes the race described in the PR: BuildTransactions(chain, executionPayload1.BlockHash, …) at EngineModuleTests.V2.cs:320 and :344 reads block 1's state right after SendNewBlockV2 returns.

Other helper I checked

  • BuildAndSendNewBlockV2 (:881) doesn't wait after engine_newPayloadV2 either. None of its callers read the new block's state straight away, though:
    • At :325, the next call is engine_getPayloadBodiesByHashV1, which only reads block bodies.
    • At :349 → :350, the second build starts from BlockTree.HeadHash, and BaseEngineModuleTests.cs:137 already waits for that parent's commit.
  • So it doesn't need the change.

Comment quality

  • The added comment explains why the wait is needed (VALID comes back before the commit). It doesn't just repeat the code, so it's fine.

Performance and security: the change only touches test code, so neither applies.

Comment thread src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.V2.cs Outdated

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant