Skip to content

fix(evm): don't create single sequencer for non-aggregator nodes#3389

Merged
tac0turtle merged 3 commits into
mainfrom
marko/fix-p2p-only-sequencer-panic
Jul 16, 2026
Merged

fix(evm): don't create single sequencer for non-aggregator nodes#3389
tac0turtle merged 3 commits into
mainfrom
marko/fix-p2p-only-sequencer-panic

Conversation

@tac0turtle

@tac0turtle tac0turtle commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Overview

P2P-only followers (no DA address configured) crash on startup with a nil pointer dereference:

panic: runtime error: invalid memory address or nil pointer dereference
github.com/evstack/ev-node/block/internal/da.NewForcedInclusionRetriever
        block/internal/da/forced_inclusion_retriever.go:57

#3386 made the DA client nil when no DA address is set and guarded block/components.go and testapp's createSequencer, but the EVM app's createSequencer was missed: it unconditionally builds a single sequencer, whose forced-inclusion retriever constructor calls GetForcedInclusionNamespace() on the nil client.

While verifying the follower paths, a second gap surfaced: the sequencer is only consumed via leaderFactorynewAggregatorMode, but promotable nodes start as followers (Aggregator=false) and are handed to the aggregator components on promotion. A plain !Aggregator guard (as added to testapp in #3386) leaves promotable nodes with a nil sequencer and breaks promotion.

Changes

  • apps/evm/cmd/run.go: skip sequencer creation for nodes that are neither aggregator nor promotable. Plain followers run newSyncMode, which never touches the sequencer.
  • apps/testapp/cmd/run.go: extend the feat: support p2p-only followers without DA #3386 guard to keep the sequencer for promotable followers, fixing the promotion path there too.
  • pkg/cmd/run_node.go: require a DA address for promotable mode in ParseStartConfig, same as aggregator mode — a promoted proposer needs DA, so fail at config validation instead of later.
  • pkg/sequencers/single/sequencer.go: fail fast with a clear error when NewSequencer receives a nil DA client — the sequencer dereferences it in several paths, so any future regression surfaces as an error instead of a SIGSEGV.
  • Regression tests for the nil-client guard and the promotable DA-address validation.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Prevented sequencer creation for nodes that are neither aggregators nor promotable.
    • Added clearer startup validation when required data-availability configuration is missing (DA address and DA client).
  • Tests
    • Added a test to ensure sequencer creation errors when the DA client is nil.
    • Expanded tests to confirm DA address requirements for both aggregator and promotable modes.

P2P-only followers (no DA address) crashed on startup with a nil
pointer dereference: the EVM app's createSequencer unconditionally
built a single sequencer, whose forced-inclusion retriever calls
GetForcedInclusionNamespace on the nil DA client.

Mirror the testapp guard from #3386 by skipping sequencer creation
for non-aggregators, and fail fast in single.NewSequencer when the
DA client is nil so future regressions surface as a clean error
instead of a SIGSEGV.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Sequencer creation now supports aggregator and promotable nodes while skipping followers. Startup validation requires a DA address for either mode, and single sequencer construction rejects nil DA clients with test coverage.

Changes

Sequencer guard behavior

Layer / File(s) Summary
Aggregator and promotable DA validation
pkg/cmd/run_node.go, pkg/cmd/run_node_test.go
Startup configuration requires a DA address when aggregator or promotable mode is enabled, with tests covering both flags.
Promotable sequencer creation and DA client validation
apps/evm/cmd/run.go, apps/testapp/cmd/run.go, pkg/sequencers/single/sequencer.go, pkg/sequencers/single/sequencer_test.go
Sequencer creation is enabled for aggregators and promotable nodes, while NewSequencer rejects nil DA clients and returns a nil sequencer on error.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • evstack/ev-node#3214: Changes the single.NewSequencer invocation in the same test application sequencer-creation path.
  • evstack/ev-node#3386: Changes DA and sequencer initialization behavior around DA availability and aggregator-like modes.

Suggested reviewers: tzdybal, auricom, gupadhyaya

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title matches the main EVM sequencer startup fix, though it omits the promotable-node nuance.
Description check ✅ Passed The description includes the required Overview and clearly explains the context, rationale, and changes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch marko/fix-p2p-only-sequencer-panic

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.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed⏩ skippedJul 16, 2026, 2:34 PM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/sequencers/single/sequencer_test.go (1)

117-122: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the descriptive error message.

require.Error verifies only that some error occurred; it would still pass if the clear DA-client error were replaced by an unrelated generic failure. Assert the expected message with require.EqualError (or require.ErrorContains) to protect the new contract.

🤖 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 `@pkg/sequencers/single/sequencer_test.go` around lines 117 - 122, Update
TestNewSequencer_NilDAClient to assert the descriptive error returned by
NewSequencer using require.EqualError or require.ErrorContains, while preserving
the existing nil sequencer assertion. Match the expected DA-client validation
message to protect the intended error contract.
🤖 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.

Inline comments:
In `@apps/evm/cmd/run.go`:
- Around line 163-165: Update the early-return logic in the node setup flow so
the BasedSequencer-and-non-Aggregator combination is validated before the
ordinary non-aggregator return. Preserve the existing configuration error from
the check near the BasedSequencer validation, while still returning nil for
valid non-aggregator nodes.

---

Nitpick comments:
In `@pkg/sequencers/single/sequencer_test.go`:
- Around line 117-122: Update TestNewSequencer_NilDAClient to assert the
descriptive error returned by NewSequencer using require.EqualError or
require.ErrorContains, while preserving the existing nil sequencer assertion.
Match the expected DA-client validation message to protect the intended error
contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4db8d811-7e4f-4521-8f7e-f1fc52594f67

📥 Commits

Reviewing files that changed from the base of the PR and between b4b895b and 5960890.

📒 Files selected for processing (3)
  • apps/evm/cmd/run.go
  • pkg/sequencers/single/sequencer.go
  • pkg/sequencers/single/sequencer_test.go

Comment thread apps/evm/cmd/run.go Outdated
…table mode

Promotable nodes start as followers but can be promoted to proposer at
runtime, which hands the sequencer to the aggregator components. The
non-aggregator guard (added to testapp in #3386 and mirrored here for
the EVM app) would leave promotable nodes with a nil sequencer and
break promotion. Create the sequencer for promotable nodes too, and
require a DA address for promotable mode at config validation, same as
aggregator mode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.32%. Comparing base (8e8cdde) to head (6d941ab).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3389      +/-   ##
==========================================
+ Coverage   62.31%   62.32%   +0.01%     
==========================================
  Files         120      120              
  Lines       13452    13454       +2     
==========================================
+ Hits         8382     8385       +3     
+ Misses       4128     4127       -1     
  Partials      942      942              
Flag Coverage Δ
combined 62.32% <100.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@tac0turtle tac0turtle merged commit f59b331 into main Jul 16, 2026
27 checks passed
@tac0turtle tac0turtle deleted the marko/fix-p2p-only-sequencer-panic branch July 16, 2026 14:58
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.

1 participant