Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

feat(node/test): improve connection drop tests#2787

Merged
theochap merged 6 commits intomainfrom
theo/improve-conn-drop-tests
Sep 4, 2025
Merged

feat(node/test): improve connection drop tests#2787
theochap merged 6 commits intomainfrom
theo/improve-conn-drop-tests

Conversation

@theochap
Copy link
Member

Description

Simple PR that improves the connection drop tests by ensuring that the unsafe head doesn't advance before consolidation

@claude
Copy link
Contributor

claude bot commented Aug 28, 2025

Claude finished @theochap's task —— View job


PR Review: Connection Drop Test Improvements

I'm reviewing the changes to improve connection drop tests. Here's my progress:

Todo List:

  • Read and analyze all changed files
  • Review the connection drop test improvements
  • Analyze code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Review security concerns
  • Assess test coverage improvements
  • Provide comprehensive feedback

@codecov
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.0%. Comparing base (b68d533) to head (2b64d34).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@theochap theochap self-assigned this Aug 28, 2025
Copilot AI review requested due to automatic review settings September 2, 2025 14:49
Copy link
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 improves the connection drop tests by refactoring WebSocket utilities and enhancing test reliability. The changes focus on ensuring proper test timing by preventing unsafe head advancement before consolidation during connection drop scenarios.

  • Moves WebSocket utilities from tests/node/common/ws.go to a more centralized location with enhanced functionality
  • Improves connection drop test logic to verify that unsafe heads don't advance during disconnection periods
  • Refactors test functions to use the new WebSocket utility location

Reviewed Changes

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

Show a summary per file
File Description
tests/node/utils/ws.go New centralized WebSocket utilities with async support and improved error handling
tests/node/restart/restart_test.go Simplifies sequencer head advancement check logic
tests/node/restart/conn_drop_test.go Enhanced connection drop tests with unsafe head monitoring and improved sync verification
tests/node/common/ws.go Removed old WebSocket utilities (moved to utils)
tests/node/common/sync_ws_test.go Updated imports to use new WebSocket utility location
tests/node/common/engine_test.go Updated imports to use new WebSocket utility location

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

logger.Info("Node safe and unsafe heads matched", "ref", ref.Number, "base", base.Number)
base = baseNode.ChainSyncStatus(chainID, lvl)
ref = refNode.ChainSyncStatus(chainID, lvl)
if ref.Number <= base.Number+delta || ref.Number >= base.Number-delta {
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

The logic for checking if numbers are within delta range is incorrect. The condition should use >= for the lower bound and <= for the upper bound. Currently, it will always be true since any number is either <= (base + delta) OR >= (base - delta).

Suggested change
if ref.Number <= base.Number+delta || ref.Number >= base.Number-delta {
if ref.Number >= base.Number-delta && ref.Number <= base.Number+delta {

Copilot uses AI. Check for mistakes.
Comment on lines +133 to +138
block, err := refNode.Escape().RollupAPI().OutputAtBlock(t.Ctx(), ref.Number)
if err != nil {
return err
}
t.Require().Equal(block.BlockRef.Hash, base.Hash, "expected block hash to match")
t.Require().Equal(block.BlockRef.Number, base.Number, "expected block number to match")
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

The assertions compare block.BlockRef properties with base properties, but block is fetched using ref.Number while the assertions expect it to match base. This will fail when ref.Number != base.Number, which is the expected case when checking if nodes are within delta range.

Copilot uses AI. Check for mistakes.
@theochap theochap force-pushed the theo/improve-conn-drop-tests branch from b295562 to 5277c10 Compare September 2, 2025 15:50
@theochap theochap force-pushed the theo/improve-conn-drop-tests branch from 5277c10 to c1199ad Compare September 3, 2025 10:18
@theochap theochap force-pushed the theo/improve-conn-drop-tests branch from c69d020 to bbb9761 Compare September 3, 2025 11:20
@theochap theochap enabled auto-merge September 3, 2025 11:20
@theochap theochap force-pushed the theo/improve-conn-drop-tests branch from e6edb93 to a935016 Compare September 3, 2025 14:10
@theochap theochap added this pull request to the merge queue Sep 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 3, 2025
@theochap theochap added this pull request to the merge queue Sep 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 4, 2025
@theochap theochap force-pushed the theo/improve-conn-drop-tests branch 4 times, most recently from bbf8814 to 1c6bb01 Compare September 4, 2025 08:36
@theochap theochap force-pushed the theo/improve-conn-drop-tests branch 4 times, most recently from a4f8924 to 99e4ed2 Compare September 4, 2025 08:47
@theochap theochap force-pushed the theo/improve-conn-drop-tests branch from 99e4ed2 to 2b64d34 Compare September 4, 2025 08:50
@theochap theochap added this pull request to the merge queue Sep 4, 2025
Merged via the queue into main with commit 6887336 Sep 4, 2025
34 checks passed
@theochap theochap deleted the theo/improve-conn-drop-tests branch September 4, 2025 09:28
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
## Description

Simple PR that improves the connection drop tests by ensuring that the
unsafe head doesn't advance before consolidation
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
## Description

Simple PR that improves the connection drop tests by ensuring that the
unsafe head doesn't advance before consolidation
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants