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

Comments

test(node): connection drop test#2554

Closed
theochap wants to merge 6 commits intomainfrom
theo/conn-drop-test
Closed

test(node): connection drop test#2554
theochap wants to merge 6 commits intomainfrom
theo/conn-drop-test

Conversation

@theochap
Copy link
Member

Description

Test what happens when the connection to the other nodes of the network drops (or gets cut off from blacklisting)

@theochap theochap self-assigned this Jul 24, 2025
@theochap theochap added M-tests Meta: Testing related A-node Area: cl node (eq. Go op-node) handles single-chain consensus labels Jul 24, 2025
@theochap theochap moved this to In Review in Project Tracking Jul 24, 2025
@theochap theochap added this to the [kona-node] Phase 5: Alpha milestone Jul 24, 2025
@codecov
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.4%. Comparing base (56d95cf) to head (146c137).
⚠️ Report is 38 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.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@theochap theochap force-pushed the theo/restart-test branch from e085998 to adf8e72 Compare July 25, 2025 17:27
@theochap theochap force-pushed the theo/conn-drop-test branch from 456cdb7 to 70bb69a Compare July 25, 2025 17:27
@theochap theochap force-pushed the theo/restart-test branch 2 times, most recently from 15d28cf to efbb929 Compare July 25, 2025 18:36
@theochap theochap force-pushed the theo/conn-drop-test branch from 70bb69a to 6fe1f53 Compare July 25, 2025 18:37
Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

These are nice

@theochap theochap force-pushed the theo/restart-test branch from 76e2fa6 to 3542838 Compare July 25, 2025 19:36
@theochap theochap changed the base branch from theo/restart-test to main July 25, 2025 20:04
Copilot AI review requested due to automatic review settings July 25, 2025 20:04
@theochap theochap force-pushed the theo/conn-drop-test branch from c4d9de7 to 33b85c5 Compare July 25, 2025 20:04
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 adds comprehensive connection drop tests to verify network behavior when nodes lose connectivity to their peers. The tests simulate connection drops by blacklisting peers and validate synchronization behavior for different node types (sequencers vs non-sequencers).

  • Adds three new test functions to validate connection drop scenarios
  • Implements utility functions for stopping/starting Kurtosis services
  • Fixes function naming inconsistencies in WebSocket helpers

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
tests/node/conn_drops_test.go New test file implementing connection drop test scenarios
tests/node/mod.go Adds service start/stop utilities and fixes WebSocket function naming
tests/node/sync_ws_test.go Updates function calls to use corrected WebSocket helper naming
tests/node/engine_test.go Removes unused parameter from supportsDevRPC function call

}

// Stop the service
if err := exec.Command("kurtosis", "service", "stop",
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

Using exec.Command with hardcoded command paths can be a security risk. Consider validating that the 'kurtosis' command exists in PATH and is the expected binary to prevent command injection.

Suggested change
if err := exec.Command("kurtosis", "service", "stop",
kurtosisPath, err := exec.LookPath("kurtosis")
if err != nil {
return fmt.Errorf("kurtosis binary not found in PATH: %w", err)
}
if err := exec.Command(kurtosisPath, "service", "stop",

Copilot uses AI. Check for mistakes.
continue
}

if err := exec.Command("kurtosis", "service", "start",
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

Using exec.Command with hardcoded command paths can be a security risk. Consider validating that the 'kurtosis' command exists in PATH and is the expected binary to prevent command injection.

Copilot uses AI. Check for mistakes.
continue
}

t.Log("testing conn drops for node %s", node.Escape().ID().Key())
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

The log statement uses printf-style formatting with %s but calls t.Log which doesn't support format specifiers. Use t.Logf instead or remove the format specifier.

Suggested change
t.Log("testing conn drops for node %s", node.Escape().ID().Key())
t.Logf("testing conn drops for node %s", node.Escape().ID().Key())

Copilot uses AI. Check for mistakes.
continue
}

t.Log("testing conn drops for node %s", node.Escape().ID().Key())
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

The log statement uses printf-style formatting with %s but calls t.Log which doesn't support format specifiers. Use t.Logf instead or remove the format specifier.

Suggested change
t.Log("testing conn drops for node %s", node.Escape().ID().Key())
t.Logf("testing conn drops for node %s", node.Escape().ID().Key())

Copilot uses AI. Check for mistakes.

// Check that the engine task count is correct
clRPC, err := GetNodeRPCEndpoint(t.Ctx(), &node)
t.Require().NoError(err, "failed to get RPC endpoint for node %s", node.Escape().ID().Key())
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

The error message uses printf-style formatting with %s but the NoError method may not support format specifiers in this context. Consider using fmt.Sprintf to format the message properly.

Suggested change
t.Require().NoError(err, "failed to get RPC endpoint for node %s", node.Escape().ID().Key())
t.Require().NoError(err, fmt.Sprintf("failed to get RPC endpoint for node %s", node.Escape().ID().Key()))

Copilot uses AI. Check for mistakes.
}

// StopNode stops a specific l2cl node.
func StopNode(ctx context.Context, node *dsl.L2CLNode) error {
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

StopNode and StartNode functions have identical logic for service lookup. Consider extracting the common service lookup logic into a helper function to reduce code duplication.

Copilot uses AI. Check for mistakes.
Comment on lines 132 to 133
// StopKurtosisService stops a specific service in a Kurtosis enclave
func StopKurtosisService(ctx context.Context, serviceName string) error {
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

StopKurtosisService and StartKurtosisService have nearly identical implementations with only the command differing. Consider creating a generic function that accepts the action as a parameter to reduce code duplication.

Suggested change
// StopKurtosisService stops a specific service in a Kurtosis enclave
func StopKurtosisService(ctx context.Context, serviceName string) error {
// ManageKurtosisService performs the specified action on a service in a Kurtosis enclave
func ManageKurtosisService(ctx context.Context, serviceName string, action string) error {

Copilot uses AI. Check for mistakes.
@theochap theochap force-pushed the theo/conn-drop-test branch 3 times, most recently from 7884e28 to 454551f Compare July 25, 2025 20:58
@theochap theochap force-pushed the theo/conn-drop-test branch from 454551f to 1c2fc01 Compare July 25, 2025 21:09
@theochap
Copy link
Member Author

theochap commented Aug 1, 2025

#2620

@theochap theochap closed this Aug 1, 2025
@github-project-automation github-project-automation bot moved this from In Review to Done in Project Tracking Aug 1, 2025
github-merge-queue bot pushed a commit that referenced this pull request Aug 22, 2025
## Description

This PR adds back the connection drop test and the restart test inside
our e2e testing suite

See #2554 and #2553
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
## Description

This PR adds back the connection drop test and the restart test inside
our e2e testing suite

See op-rs/kona#2554 and op-rs/kona#2553
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-node Area: cl node (eq. Go op-node) handles single-chain consensus M-tests Meta: Testing related

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants