Skip to content

feat: solo sequencer, testapp max blob size ldflags#3235

Merged
julienrbrt merged 14 commits intomainfrom
julien/speedup
Apr 14, 2026
Merged

feat: solo sequencer, testapp max blob size ldflags#3235
julienrbrt merged 14 commits intomainfrom
julien/speedup

Conversation

@julienrbrt
Copy link
Copy Markdown
Member

@julienrbrt julienrbrt commented Apr 9, 2026

  • Create simple solo sequencer
  • Wire solo sequencer in testapp
  • Make DefaultMaxBlobSize overwritable via ldflags

Summary by CodeRabbit

  • New Features

    • Introduced a lightweight solo sequencer mode and a CLI flag to enable it.
  • Documentation

    • Added solo sequencer documentation with design overview and flows.
  • Chores

    • Made default blob size configurable via build-time flags.
  • Bug Fixes / Improvements

    • Improved blob-size handling and batching logic to use unsigned sizes for safer comparisons.
  • Tests

    • Updated and added unit tests covering solo sequencer and batching behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

Warning

Rate limit exceeded

@julienrbrt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 58 minutes and 20 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 58 minutes and 20 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 138dc387-9fab-4b0f-9ff5-e03662a93bb9

📥 Commits

Reviewing files that changed from the base of the PR and between 989f43d and 1220b20.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • apps/testapp/cmd/init.go
📝 Walkthrough

Walkthrough

Introduces a Solo Sequencer (in-memory, single-leader) and makes DefaultMaxBlobSize overridable via ldflags; standardizes size-related types from int to uint64 across blob handling and batching logic; adds Dockerfile ldflags and CLI flag to enable solo sequencer; includes tests and documentation.

Changes

Cohort / File(s) Summary
CLI & Build config
CHANGELOG.md, apps/testapp/Dockerfile, apps/testapp/cmd/root.go, apps/testapp/cmd/run.go
Added solo-sequencer CLI flag, updated Dockerfile to set defaultMaxBlobSizeStr via ldflags (120 MB), and changed createSequencer signature to accept *cobra.Command and conditionally instantiate the solo sequencer.
Blob size constants
block/internal/common/consts.go, block/internal/da/client.go
Replaced compile-time DefaultMaxBlobSize const with runtime uint64 variable settable via -ldflags -X; updated blob size comparisons to use uint64.
Batching & submission (core)
block/internal/submitting/batching_strategy.go, block/internal/submitting/da_submitter.go, block/internal/submitting/submitter.go
Changed size-related APIs and fields from int to uint64 (interface signatures, retryPolicy.MaxBlobBytes, batching limits and accumulators) and adjusted internal calculations to use uint64.
Batching tests & syncing tests
block/internal/submitting/batching_strategy_test.go, block/internal/syncing/syncer_forced_inclusion_test.go
Updated tests to use uint64 sizes and adjusted test helpers/values accordingly.
Solo sequencer pkg
pkg/sequencers/solo/sequencer.go, pkg/sequencers/solo/sequencer_test.go, pkg/sequencers/solo/README.md
Added new SoloSequencer implementation (in-memory FIFO queue, SubmitBatchTxs/GetNextBatch/VerifyBatch, DA height getters/setters), comprehensive unit tests, and README documentation.
Cleanup
test/e2e/failover_e2e_test.go
Removed unused local defaultMaxBlobSize constant.
Changelog
CHANGELOG.md
Documented ldflags override for DefaultMaxBlobSize and addition of solo sequencer under Unreleased changes.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Solo as SoloSequencer
    participant Exec as Executor

    Client->>Solo: SubmitBatchTxs(batchID, txs)
    Solo->>Solo: Validate batchID
    Solo->>Solo: Append txs to in-memory queue
    Solo-->>Client: SubmitBatchTxsResponse

    Client->>Solo: GetNextBatch(batchID)
    Solo->>Solo: Drain queue (atomic)
    Solo->>Exec: GetExecutionInfo / MaxGas
    Exec-->>Solo: ExecutionInfo
    Solo->>Exec: FilterTxs(candidate txs)
    Exec-->>Solo: validTxs + postponedTxs
    Solo->>Solo: Re-queue postponedTxs (front)
    Solo-->>Client: GetNextBatchResponse(validTxs, timestamp)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • test: testapp bench #3214: Modifies apps/testapp/cmd/run.go's createSequencer call/signature and may conflict with this PR's changes.

Suggested labels

T:testing

Suggested reviewers

  • chatton
  • alpe
  • tac0turtle

Poem

🐰 A tiny sequencer hops in line,
In-memory queues and timestamps fine,
Sizes set by ldflags, no compile-time fight,
Types made tidy, queues take flight,
Hooray — one hop, everything's right!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description provides three bullet points matching the PR objectives but lacks background context, rationale, and any issue reference as specified in the template. Expand the description to include overview/context explaining why these changes are needed, the problem being solved, and any related issue links (e.g., 'Closes #').
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the two main features added: a solo sequencer and making DefaultMaxBlobSize configurable via ldflags, matching the actual changeset.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch julien/speedup

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedApr 14, 2026, 1:27 PM

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 9, 2026

Claude finished @julienrbrt's task in 2m 57s —— View job


Code Review

  • Gather context and read changed files
  • Review solo sequencer implementation (pkg/sequencers/solo/)
  • Review blob size / ldflags changes (block/internal/common/consts.go, block/internal/da/client.go)
  • Review batching & submitter changes (type intuint64)
  • Review testapp CLI/Dockerfile wiring
  • Review tests
  • Post comprehensive review

Overall the PR is clean and well-scoped. Two issues warrant attention before merge; the rest are minor.


🔴 Major Issues

1. Missing FilterTxs length guard — pkg/sequencers/solo/sequencer.go:94-113

If executor.FilterTxs returns a slice whose length diverges from len(txs) (a contract violation, but defensible against), the txs[i] access at line 108/110 will panic or produce silently wrong output. The fallback already does the right thing (make([]FilterStatus, len(txs))), but there's no guard on the happy path.

filterStatuses, err := s.executor.FilterTxs(ctx, txs, req.MaxBytes, maxGas, false)
if err != nil {
    // ... fallback is fine
} else if len(filterStatuses) != len(txs) {
    // executor violated its contract — fail loudly rather than panic later
    return nil, fmt.Errorf("executor returned %d filter statuses for %d txs",
        len(filterStatuses), len(txs))
}

Fix this →

2. Silent ldflags fallback — block/internal/common/consts.go:16-18

if err != nil || v == 0 {
    DefaultMaxBlobSize = 5 * 1024 * 1024 // 5 MB fallback
    return
}

A misconfigured ldflags override (e.g. -X ...defaultMaxBlobSizeStr=abc or an accidental =0) silently reverts to 5 MiB. The testapp Dockerfile now hardcodes 120 MiB at build time — if that string is ever malformed, the operator gets silent 5 MiB limits in production with no indication anything went wrong. Should panic or log.Fatal with the offending value:

if err != nil || v == 0 {
    panic(fmt.Sprintf("invalid defaultMaxBlobSizeStr %q: expected a non-zero base-10 uint64, err=%v",
        defaultMaxBlobSizeStr, err))
}

Fix this →


🟡 Minor Issues

3. CHANGELOG copy — CHANGELOG.md:14-15

Two small issues in the current text:

  • Line 14: "by ldflags""via ldflags"
  • Line 15: "in memory""in-memory" (compound adjective before noun)

Fix this →

4. Missing doc comment on NewSoloSequencerpkg/sequencers/solo/sequencer.go:35

Per repo guidelines ("Document exported types and functions in Go"), the constructor needs a doc comment. The type already has one; the function doesn't. A one-liner is sufficient:

// NewSoloSequencer creates a SoloSequencer with an empty in-memory transaction queue.

5. Block time default change in init.go

The default block time silently changed from 10 ms → 100 ms. If this is intentional (seems like it's a separate/unrelated fix for the testapp), a changelog entry or PR comment explaining why would help reviewers.

6. Solo sequencer in non-aggregator mode

createSequencer correctly guards against solo + based, but doesn't log a warning when solo is enabled on a non-aggregator node. In that configuration the node won't submit blocks to DA (no signer), so the solo sequencer's queue will just accumulate silently. A logger.Warn() would help operators.


✅ Positive Observations

  • Interface conformance check (var _ coresequencer.Sequencer = (*SoloSequencer)(nil)) — good practice, catches drift at compile time.
  • Lock-minimal queue drain: txs := s.queue; s.queue = nil under a single lock, then processing outside the lock — well-designed for low contention.
  • Postponed-tx re-queuing: s.queue = append(postponedTxs, s.queue...) correctly prepends postponed txs before any new arrivals — ordering is preserved.
  • intuint64 migration: Clean and complete across the BatchingStrategy interface, retryPolicy, and limitBatchBySize. Removes the implicit cast the old code needed.
  • atomic.Uint64 for daHeight: Consistent with how single and based sequencers implement this.
  • SetDAHeight/GetDAHeight: These are part of the core Sequencer interface (core/sequencer/sequencing.go:31-36) and are called by the executor layer — correctly implemented here.
  • README with comparison table: The Solo vs Single vs Based table is a nice addition for onboarding.
  • Dockerfile ldflags comment: # 125829120 = 120 MB saves the reader from mental math.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 81.52174% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.91%. Comparing base (50a73fb) to head (1220b20).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/sequencers/solo/sequencer.go 83.82% 7 Missing and 4 partials ⚠️
block/internal/common/consts.go 50.00% 2 Missing and 1 partial ⚠️
block/internal/submitting/da_submitter.go 60.00% 2 Missing ⚠️
block/internal/da/client.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3235      +/-   ##
==========================================
+ Coverage   61.79%   61.91%   +0.11%     
==========================================
  Files         120      122       +2     
  Lines       12670    12744      +74     
==========================================
+ Hits         7830     7890      +60     
- Misses       3962     3971       +9     
- Partials      878      883       +5     
Flag Coverage Δ
combined 61.91% <81.52%> (+0.11%) ⬆️

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 julienrbrt marked this pull request as ready for review April 10, 2026 07:50
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.

Actionable comments posted: 3

🧹 Nitpick comments (2)
pkg/sequencers/solo/sequencer.go (1)

35-46: Add a doc comment for exported constructor NewSoloSequencer.

The exported constructor should be documented for lint/readability consistency.

As per coding guidelines "Document exported types and functions in Go".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/sequencers/solo/sequencer.go` around lines 35 - 46, Add a doc comment
above the exported constructor NewSoloSequencer describing what it returns and
the purpose of its parameters (logger zerolog.Logger, id []byte, executor
execution.Executor) and any important behavior (e.g., initializes an empty
queue). Mention that it constructs and returns a *SoloSequencer. Place the
comment directly above the NewSoloSequencer function so it satisfies Go doc/lint
rules.
pkg/sequencers/solo/sequencer_test.go (1)

49-219: Refactor repetitive cases into table-driven tests.

The validation-path tests are currently split into many near-identical functions; table-driven form would reduce duplication and align with repo test conventions.

As per coding guidelines "Use table-driven tests in Go unit tests".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/sequencers/solo/sequencer_test.go` around lines 49 - 219, Several test
functions (e.g., TestSoloSequencer_SubmitBatchTxs_InvalidID,
TestSoloSequencer_SubmitBatchTxs_EmptyBatch,
TestSoloSequencer_GetNextBatch_EmptyQueue,
TestSoloSequencer_GetNextBatch_InvalidID) are repetitive; convert them into
table-driven tests. Create one or more table-driven test functions that iterate
cases (name, setup using newTestSequencer, inputs for
SubmitBatchTxs/GetNextBatch/VerifyBatch, expected error or result) and run
subtests with t.Run; keep existing helpers and unique symbols (newTestSequencer,
SubmitBatchTxs, GetNextBatch, VerifyBatch, GetDAHeight, SetDAHeight) to locate
behavior, and assert expected outcomes per case to remove duplicated test bodies
while preserving assertions and mocks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@block/internal/common/consts.go`:
- Around line 14-20: The init function currently swallows ParseUint errors and
zero values for defaultMaxBlobSizeStr and silently falls back to 5MiB; change it
to fail-fast by replacing the silent fallback with a startup failure that
includes the offending value and parse error: in init(), after calling
strconv.ParseUint(defaultMaxBlobSizeStr, 10, 64), if err != nil or v == 0, call
log.Fatalf or panic with a clear message (e.g., include defaultMaxBlobSizeStr
and err) instead of setting DefaultMaxBlobSize to 5*1024*1024 so malformed or
zero ldflags overrides immediately stop startup; keep setting DefaultMaxBlobSize
= v on success.

In `@CHANGELOG.md`:
- Line 15: Update the changelog line that reads "Add solo sequencer (simple in
memory single sequencer without force inclusion) [`#3235`]" to use the hyphenated
compound adjective "in-memory" (e.g., "Add solo sequencer (simple in-memory
single sequencer without force inclusion) [`#3235`]") to match project style and
consistency.

In `@pkg/sequencers/solo/sequencer.go`:
- Around line 94-113: The code assumes s.executor.FilterTxs returned a
filterStatuses slice matching len(txs); add a strict length check after calling
s.executor.FilterTxs to guard against mismatches: if len(filterStatuses) !=
len(txs) log an error via s.logger and fail early by returning an error (or the
enclosing function's appropriate error response) instead of proceeding to index
into filterStatuses; update any fallback branch that previously created a
default filterStatuses to use the same length check/early-return behavior so you
never iterate with mismatched lengths (refer to s.executor.FilterTxs,
filterStatuses, txs, and the switch on
execution.FilterOK/FilterPostpone/FilterRemove).

---

Nitpick comments:
In `@pkg/sequencers/solo/sequencer_test.go`:
- Around line 49-219: Several test functions (e.g.,
TestSoloSequencer_SubmitBatchTxs_InvalidID,
TestSoloSequencer_SubmitBatchTxs_EmptyBatch,
TestSoloSequencer_GetNextBatch_EmptyQueue,
TestSoloSequencer_GetNextBatch_InvalidID) are repetitive; convert them into
table-driven tests. Create one or more table-driven test functions that iterate
cases (name, setup using newTestSequencer, inputs for
SubmitBatchTxs/GetNextBatch/VerifyBatch, expected error or result) and run
subtests with t.Run; keep existing helpers and unique symbols (newTestSequencer,
SubmitBatchTxs, GetNextBatch, VerifyBatch, GetDAHeight, SetDAHeight) to locate
behavior, and assert expected outcomes per case to remove duplicated test bodies
while preserving assertions and mocks.

In `@pkg/sequencers/solo/sequencer.go`:
- Around line 35-46: Add a doc comment above the exported constructor
NewSoloSequencer describing what it returns and the purpose of its parameters
(logger zerolog.Logger, id []byte, executor execution.Executor) and any
important behavior (e.g., initializes an empty queue). Mention that it
constructs and returns a *SoloSequencer. Place the comment directly above the
NewSoloSequencer function so it satisfies Go doc/lint rules.
🪄 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: b1495280-da0b-4921-aaf1-4261263baed5

📥 Commits

Reviewing files that changed from the base of the PR and between 3abebca and 076f094.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • apps/testapp/Dockerfile
  • apps/testapp/cmd/root.go
  • apps/testapp/cmd/run.go
  • block/internal/common/consts.go
  • block/internal/da/client.go
  • block/internal/submitting/batching_strategy.go
  • block/internal/submitting/batching_strategy_test.go
  • block/internal/submitting/da_submitter.go
  • block/internal/submitting/submitter.go
  • block/internal/syncing/syncer_forced_inclusion_test.go
  • pkg/sequencers/solo/README.md
  • pkg/sequencers/solo/sequencer.go
  • pkg/sequencers/solo/sequencer_test.go
  • test/e2e/failover_e2e_test.go
💤 Files with no reviewable changes (1)
  • test/e2e/failover_e2e_test.go

@julienrbrt julienrbrt requested a review from tac0turtle April 10, 2026 14:38
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.

Actionable comments posted: 1

♻️ Duplicate comments (1)
CHANGELOG.md (1)

15-15: ⚠️ Potential issue | 🟡 Minor

Use hyphenated compound adjective: in-memory.

The compound adjective "in memory" should be hyphenated when it modifies a noun.

📝 Suggested wording fix
-- Add solo sequencer (simple in memory single sequencer without force inclusion) [`#3235`](https://github.com/evstack/ev-node/pull/3235)
+- Add solo sequencer (simple in-memory single sequencer without force inclusion) [`#3235`](https://github.com/evstack/ev-node/pull/3235)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CHANGELOG.md` at line 15, Update the changelog entry text to use the
hyphenated compound adjective "in-memory": replace the phrase "simple in memory
single sequencer without force inclusion" with "simple in-memory single
sequencer without force inclusion" in the line that starts with "Add solo
sequencer (simple in memory single sequencer without force inclusion) [`#3235`]".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Line 14: Update the changelog entry to include the missing pronoun and clarify
preposition: change the line referencing DefaultMaxBlobSize to read something
like "Make it easier to override `DefaultMaxBlobSize` via ldflags" (ensure
`DefaultMaxBlobSize` and "ldflags" remain intact).

---

Duplicate comments:
In `@CHANGELOG.md`:
- Line 15: Update the changelog entry text to use the hyphenated compound
adjective "in-memory": replace the phrase "simple in memory single sequencer
without force inclusion" with "simple in-memory single sequencer without force
inclusion" in the line that starts with "Add solo sequencer (simple in memory
single sequencer without force inclusion) [`#3235`]".
🪄 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: 010beb3b-7b0a-4e64-af5e-17c3a87ecbd7

📥 Commits

Reviewing files that changed from the base of the PR and between 076f094 and 989f43d.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • block/internal/submitting/submitter.go
✅ Files skipped from review due to trivial changes (1)
  • block/internal/submitting/submitter.go

@julienrbrt julienrbrt enabled auto-merge April 14, 2026 07:45
@julienrbrt julienrbrt added this pull request to the merge queue Apr 14, 2026
@julienrbrt julienrbrt removed this pull request from the merge queue due to a manual request Apr 14, 2026
@julienrbrt julienrbrt enabled auto-merge April 14, 2026 13:23
@julienrbrt julienrbrt added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit 554a195 Apr 14, 2026
28 of 30 checks passed
@julienrbrt julienrbrt deleted the julien/speedup branch April 14, 2026 13: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.

2 participants