Skip to content

fix(tx-submitter): finalize lastFinalized+1 instead of skipping via p… - #1065

Merged
Kukoomomo merged 1 commit into
mainfrom
fix/submitter_finalize_skip
Sep 10, 2026
Merged

Kukoomomo merged 1 commit into
mainfrom
fix/submitter_finalize_skip

Conversation

@Kukoomomo

@Kukoomomo Kukoomomo commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

…finalize

A dropped finalize tx left pfinalize ahead of the chain, so the next loop targeted lastFinalized+2 and eth_estimateGas reverted with incorrect previous state root. Only skip when that exact finalize is still pending.

AI-Developer: Cursor Grok 4.6
AI-Agent: Cursor
AI-Reviewer: Cursor Grok 4.6
Harness-Skill: ai-commit

Summary by CodeRabbit

  • Bug Fixes

    • Prevented batch finalization from skipping the next required batch after a failed or dropped transaction.
    • Suppressed duplicate finalization transactions when the target batch is already pending.
    • Added warnings when pending finalization state is ahead of the latest finalized batch.
  • Tests

    • Added coverage for correct batch selection and duplicate-finalization prevention.

…finalize

A dropped finalize tx left pfinalize ahead of the chain, so the next loop
targeted lastFinalized+2 and eth_estimateGas reverted with incorrect
previous state root. Only skip when that exact finalize is still pending.

AI-Developer: Cursor Grok 4.6
AI-Agent: Cursor
AI-Reviewer: Cursor Grok 4.6
Harness-Skill: ai-commit
Co-authored-by: Cursor <cursoragent@cursor.com>
@Kukoomomo
Kukoomomo requested a review from a team as a code owner September 10, 2026 12:19
@Kukoomomo
Kukoomomo requested review from twcctop and removed request for a team September 10, 2026 12:19
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a6896670-803e-4fce-8276-fa9ffb46e397

📥 Commits

Reviewing files that changed from the base of the PR and between c4085b4 and 10a64a3.

📒 Files selected for processing (3)
  • tx-submitter/services/pendingtx.go
  • tx-submitter/services/rollup.go
  • tx-submitter/services/rollup_submitter_activity_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The submitter now detects pending finalizeBatch transactions by index. Finalization targets lastFinalized + 1, warns about stale pending markers, and avoids duplicate submissions. Regression tests verify both behaviors.

Changes

Finalize index handling

Layer / File(s) Summary
Pending finalize detection
tx-submitter/services/pendingtx.go
Documents ExistedIndex and adds ExistedFinalizeIndex for matching pending finalizeBatch transactions by batch index.
Finalize submission guard
tx-submitter/services/rollup.go, tx-submitter/services/rollup_submitter_activity_test.go
Updates finalize() to use lastFinalized + 1, log stale pending state, and suppress duplicate finalization. Tests verify the target index and duplicate guard.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Rollup
  participant PendingTxs
  participant TransactionSubmitter
  Rollup->>Rollup: calculate lastFinalized + 1
  Rollup->>PendingTxs: check target finalizeBatch
  PendingTxs-->>Rollup: return pending status
  Rollup->>TransactionSubmitter: submit finalizeBatch when target is not pending
  TransactionSubmitter-->>Rollup: retain submitted transaction as pending
Loading

Merge Risk: ⚪ Minimal · up to 10a64

Finalization now targets the next required batch and avoids duplicate pending submissions. The supplied regression coverage addresses the reported skip behavior, with no concrete merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main fix: finalize using lastFinalized+1 instead of skipping ahead through pfinalize.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/submitter_finalize_skip

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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.

@Kukoomomo
Kukoomomo merged commit 4a388bd into main Sep 10, 2026
9 checks passed
@Kukoomomo
Kukoomomo deleted the fix/submitter_finalize_skip branch September 10, 2026 13:25
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