Skip to content

chore: remove duplicate package import#3331

Merged
julienrbrt merged 1 commit into
evstack:mainfrom
caltechustc:main
May 24, 2026
Merged

chore: remove duplicate package import#3331
julienrbrt merged 1 commit into
evstack:mainfrom
caltechustc:main

Conversation

@caltechustc
Copy link
Copy Markdown
Contributor

@caltechustc caltechustc commented May 21, 2026

Overview

remove duplicate package import

Summary by CodeRabbit

  • New Features
    • Improved RPC server HTTP/2 support and more robust HTTP server configuration during node startup and failover.
  • Refactor
    • Internal cleanup of RPC client handling and initialization for consistency. No user-facing changes.
  • Documentation
    • Numerous formatting, wording, and example-fence updates across README, RELEASE notes, guides, ADRs, and various docs.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

Adds an HTTP/2 configuration helper and applies it across RPC server/service handlers, examples, tests, and node startup; consolidates an RPC client import in an E2E test to use client.Client directly; applies a set of docs/markdown formatting fixes; and makes small preallocation tweaks in a few packages.

Changes

RPC HTTP/2 configuration and callers

Layer / File(s) Summary
Add ConfigureHTTPServer and protocols helper
pkg/rpc/server/http.go
Introduce RPCServerProtocols and ConfigureHTTPServer to set http.Server protocols and HTTP/2 settings and apply http2.ConfigureServer.
Adjust NewServiceHandler and imports
pkg/rpc/server/server.go
Remove h2c/http2 wrapping from NewServiceHandler and update imports to use connectrpc packages.
Apply ConfigureHTTPServer in examples and tests
pkg/rpc/example/example.go, pkg/rpc/client/client_test.go
Configure example and test HTTP servers via ConfigureHTTPServer and start unstarted httptest servers where applicable.
Call ConfigureHTTPServer in node startup
node/failover.go, node/light.go
Call rpcserver.ConfigureHTTPServer after constructing RPC http.Server and return an error if configuration fails.

RPC client import consolidation

Layer / File(s) Summary
RPC client import alias removal
test/e2e/failover_e2e_test.go
Dropped the rpcclient import alias. Updated nodeDetails.xRPCClient to atomic.Pointer[client.Client], changed nodeDetails.rpcClient(t) to return *client.Client, and used client.NewClient(d.rpcAddr) in initExtClients before storing it.

Docs, markdownlint, and formatting updates

Layer / File(s) Summary
markdownlint config adjustments
.markdownlint.yaml
Set MD025.front_matter_title, retain MD024.siblings_only, and add MD033.allowed_elements.
Top-level docs and release/badge tweaks
CLAUDE.md, README.md, RELEASE.md, apps/evm/README.md
Add CLAUDE title; remove markdownlint badge wrappers; reformat RELEASE troubleshooting headings; adjust a code-fence language.
ADR formatting and ASCII diagram fences
docs/adr/*
Fix and add fenced text blocks for multiple ADR ASCII diagrams and examples.
Guides, quick-start, and deployment docs edits
docs/guides/*, docs/learn/config.md
Small wording, link, heading, checklist, and whitespace fixes; add quick-start YAML frontmatter.
Tooling README tweaks
tools/blob-decoder/README.md
Change an example code-fence language to text.

Preallocation and slice initialization tweaks

Layer / File(s) Summary
Preallocate slices in DA retriever, p2p, and sync
block/internal/syncing/da_retriever.go, pkg/p2p/client.go, pkg/sync/sync_service.go
Initialize events slice with capacity, preallocate peers slice, and return nil / preallocate peerIDs based on seed count.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Possibly related PRs:

  • Suggested reviewers:

    • julienrbrt
    • tac0turtle
    • tuxcanfly

"I'm a rabbit in a patch of code,
nibbling aliases into mode.
HTTP/2 set, docs made neat,
client.NewClient hops in to meet.
🐇✨"

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains the template boilerplate without filling in the required Overview section with actual context, background, or rationale for the changes. Fill in the Overview section with a clear explanation of the changes, their purpose, and any relevant issue links or technical rationale.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title describes removing duplicate package imports, which aligns with several changes across the codebase, but does not reflect the full scope of changes including Markdown linting, documentation updates, and HTTP/2 configuration. The title is overly narrow for the changeset scope. Consider a broader title like 'chore: lint fixes and formatting updates' or clarify if this PR should focus solely on the import change.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/failover_e2e_test.go (1)

881-889: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: variable client shadows the client package, breaking the build.

On line 882, the local variable client (an *ethclient.Client) shadows the imported github.com/evstack/ev-node/pkg/rpc/client package. Line 886 then calls client.NewClient(d.rpcAddr) which resolves to a method call on the local *ethclient.Client variable rather than the package — *ethclient.Client has no NewClient method, so this will fail to compile. The previous rpcclient alias is exactly what avoided this collision.

🛠️ Proposed fix: rename the local variable to avoid the shadow
 	d.extClientOnce.Do(func() {
-		client, err := ethclient.Dial(d.ethAddr)
+		ethClient, err := ethclient.Dial(d.ethAddr)
 		require.NoError(t, err)
-		d.xEthClient.Store(client)
-		t.Cleanup(client.Close)
+		d.xEthClient.Store(ethClient)
+		t.Cleanup(ethClient.Close)
 		rpcClient := client.NewClient(d.rpcAddr)
 		require.NotNil(t, rpcClient)
 		d.xRPCClient.Store(rpcClient)
 	})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/failover_e2e_test.go` around lines 881 - 889, The local variable
named `client` in the extClientOnce.Do closure shadows the imported `client`
package and causes the call to `client.NewClient(d.rpcAddr)` to resolve
incorrectly; rename the local variable (e.g., to `ethClient`) returned by
`ethclient.Dial(d.ethAddr)` and update subsequent uses (`d.xEthClient.Store`,
`t.Cleanup(ethClient.Close)`) so the package call uses the imported package name
(e.g., `rpcclient.NewClient(d.rpcAddr)`) instead of the shadowed identifier;
ensure `rpcClient` stays the result stored by `d.xRPCClient.Store`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@test/e2e/failover_e2e_test.go`:
- Around line 881-889: The local variable named `client` in the extClientOnce.Do
closure shadows the imported `client` package and causes the call to
`client.NewClient(d.rpcAddr)` to resolve incorrectly; rename the local variable
(e.g., to `ethClient`) returned by `ethclient.Dial(d.ethAddr)` and update
subsequent uses (`d.xEthClient.Store`, `t.Cleanup(ethClient.Close)`) so the
package call uses the imported package name (e.g.,
`rpcclient.NewClient(d.rpcAddr)`) instead of the shadowed identifier; ensure
`rpcClient` stays the result stored by `d.xRPCClient.Store`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2c464f7-2a6b-4a06-afd3-513e26570081

📥 Commits

Reviewing files that changed from the base of the PR and between 53c5669 and 65262cc.

📒 Files selected for processing (1)
  • test/e2e/failover_e2e_test.go

@julienrbrt julienrbrt enabled auto-merge May 22, 2026 09:30
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 13.33333% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.72%. Comparing base (53c5669) to head (a6d7e06).

Files with missing lines Patch % Lines
pkg/rpc/server/http.go 0.00% 21 Missing ⚠️
node/failover.go 0.00% 1 Missing and 1 partial ⚠️
node/light.go 0.00% 1 Missing and 1 partial ⚠️
pkg/sync/sync_service.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3331      +/-   ##
==========================================
- Coverage   60.86%   60.72%   -0.14%     
==========================================
  Files         127      127              
  Lines       13762    13781      +19     
==========================================
- Hits         8376     8369       -7     
- Misses       4474     4498      +24     
- Partials      912      914       +2     
Flag Coverage Δ
combined 60.72% <13.33%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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

@julienrbrt
Copy link
Copy Markdown
Member

could you fix the lint errors?

auto-merge was automatically disabled May 23, 2026 07:56

Head branch was pushed to by a user without write access

@caltechustc
Copy link
Copy Markdown
Contributor Author

could you fix the lint errors?

@julienrbrt Modified. Please review it again. Thanks!

@julienrbrt
Copy link
Copy Markdown
Member

It is still failing. Can you run make lint-fix and resolve the errors

Signed-off-by: caltechustc <caltechustc@outlook.com>
@caltechustc
Copy link
Copy Markdown
Contributor Author

caltechustc commented May 24, 2026

It is still failing. Can you run make lint-fix and resolve the errors

In fact, the CI failure isn’t related to my initial changes. However, in this PR I also fixed it, and after running just lint-fix, there are no errors.

image

@julienrbrt Please review it again. Thanks!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
docs/guides/ha/cluster-setup.md (2)

454-454: ⚡ Quick win

Remove unnecessary blank line after list introduction.

Standard markdown formatting does not include a blank line between a list introduction ("Causes:") and its items. This is inconsistent with markdown conventions and may violate markdownlint rules.

📝 Proposed fix
 Causes:
-
 - `heartbeat_timeout` is too short for your network RTT — increase it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/guides/ha/cluster-setup.md` at line 454, Remove the extraneous blank
line immediately after the list introduction line "Causes:" so the bullet items
follow directly on the next line (i.e., change the pattern "Causes:" + blank
line + "- item" to "Causes:" + "- item"); update the section in cluster-setup.md
where the "Causes:" heading appears to comply with standard markdown/list
formatting.

433-433: ⚡ Quick win

Remove unnecessary blank line after list introduction.

Standard markdown formatting does not include a blank line between a list introduction ("Check that:") and its items. This may violate markdownlint rules (MD032) and is inconsistent with markdown conventions.

📝 Proposed fix
 Check that:
-
 - At least 3 out of 5 nodes are running and can reach each other on port 5001.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/guides/ha/cluster-setup.md` at line 433, Remove the extra blank line
that follows the list introduction "Check that:" in
docs/guides/ha/cluster-setup.md so the list items immediately follow that line
(i.e., change the block where "Check that:" is followed by a blank line and then
list items to have no blank line between the introduction and the first list
item) to satisfy markdownlint MD032 and standard markdown list formatting.
docs/learn/config.md (1)

1361-1361: 💤 Low value

Consider improving adverb placement for better flow.

Moving "already" closer to the verb ("has already persisted" instead of "already has persisted") creates more natural English flow, though the current phrasing is grammatically correct.

📝 Suggested refinement
-- If the node already has persisted raft configuration in `raft.raft_dir`, it starts in rejoin mode.
+- If the node has already persisted raft configuration in `raft.raft_dir`, it starts in rejoin mode.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/learn/config.md` at line 1361, Update the sentence that reads "If the
node already has persisted raft configuration in `raft.raft_dir`, it starts in
rejoin mode." to move "already" next to the verb for smoother flow; change it to
"If the node has already persisted raft configuration in `raft.raft_dir`, it
starts in rejoin mode." Ensure the exact identifier `raft.raft_dir` remains
unchanged and only reposition the adverb.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/guides/ha/cluster-setup.md`:
- Line 454: Remove the extraneous blank line immediately after the list
introduction line "Causes:" so the bullet items follow directly on the next line
(i.e., change the pattern "Causes:" + blank line + "- item" to "Causes:" + "-
item"); update the section in cluster-setup.md where the "Causes:" heading
appears to comply with standard markdown/list formatting.
- Line 433: Remove the extra blank line that follows the list introduction
"Check that:" in docs/guides/ha/cluster-setup.md so the list items immediately
follow that line (i.e., change the block where "Check that:" is followed by a
blank line and then list items to have no blank line between the introduction
and the first list item) to satisfy markdownlint MD032 and standard markdown
list formatting.

In `@docs/learn/config.md`:
- Line 1361: Update the sentence that reads "If the node already has persisted
raft configuration in `raft.raft_dir`, it starts in rejoin mode." to move
"already" next to the verb for smoother flow; change it to "If the node has
already persisted raft configuration in `raft.raft_dir`, it starts in rejoin
mode." Ensure the exact identifier `raft.raft_dir` remains unchanged and only
reposition the adverb.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74f6e280-c41f-42c0-947c-5f22dd6a5767

📥 Commits

Reviewing files that changed from the base of the PR and between 5bd4960 and a6d7e06.

📒 Files selected for processing (27)
  • .markdownlint.yaml
  • CLAUDE.md
  • README.md
  • RELEASE.md
  • apps/evm/README.md
  • block/internal/syncing/da_retriever.go
  • docs/adr/adr-009-state-fraud-proofs.md
  • docs/adr/adr-012-based-sequencing.md
  • docs/adr/adr-019-forced-inclusion-mechanism.md
  • docs/guides/da/visualizer.md
  • docs/guides/deploy/mainnet.md
  • docs/guides/deploy/overview.md
  • docs/guides/deploy/testnet.md
  • docs/guides/ha/cluster-setup.md
  • docs/guides/ha/overview.md
  • docs/guides/quick-start.md
  • docs/learn/config.md
  • node/failover.go
  • node/light.go
  • pkg/p2p/client.go
  • pkg/rpc/client/client_test.go
  • pkg/rpc/example/example.go
  • pkg/rpc/server/http.go
  • pkg/rpc/server/server.go
  • pkg/sync/sync_service.go
  • test/e2e/failover_e2e_test.go
  • tools/blob-decoder/README.md
💤 Files with no reviewable changes (1)
  • README.md
✅ Files skipped from review due to trivial changes (14)
  • docs/guides/deploy/overview.md
  • docs/guides/deploy/testnet.md
  • docs/guides/quick-start.md
  • tools/blob-decoder/README.md
  • CLAUDE.md
  • docs/guides/da/visualizer.md
  • docs/guides/deploy/mainnet.md
  • docs/adr/adr-012-based-sequencing.md
  • docs/adr/adr-009-state-fraud-proofs.md
  • pkg/p2p/client.go
  • docs/guides/ha/overview.md
  • apps/evm/README.md
  • RELEASE.md
  • docs/adr/adr-019-forced-inclusion-mechanism.md

@julienrbrt julienrbrt enabled auto-merge May 24, 2026 17:49
@julienrbrt julienrbrt added this pull request to the merge queue May 24, 2026
Merged via the queue into evstack:main with commit 5ee6483 May 24, 2026
23 of 29 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.

2 participants