Skip to content

refactor(committor): remove legacy Commit and Finalize tasks - #1764

Open
snawaz wants to merge 2 commits into
fix/committor-commit-finalize-pathsfrom
refactor/committor-remove-legacy-tasks
Open

snawaz wants to merge 2 commits into
fix/committor-commit-finalize-pathsfrom
refactor/committor-remove-legacy-tasks

Conversation

@snawaz

@snawaz snawaz commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Remove the unused separate Commit and Finalize tasks and their recovery code now that all commit paths use CommitFinalize*.

Closes #1765.
Refs #1739.

Breaking Changes

  • None
  • Yes — migration path described below

The Rust task API removes CommitTask, FinalizeTask, and their enum variants. Use CommitFinalizeTask; CommitDelivery moves to tasks::commit_delivery.

Test Plan

36 targeted unit tests and the buffer lifecycle integration test passed. Clippy, formatting, and integration compilation passed.

@snawaz
snawaz added this pull request to stack #1746 October 5, 2026 07:41
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: magicblock-labs/magicblock-validator/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f70f8837-853a-4450-8680-91c5234cb9d9
📥 Commits

Reviewing files that changed from the base of the PR and between bf05e9c and ca34fdd.

📒 Files selected for processing (25)
  • magicblock-committor-service/src/committor_processor.rs
  • magicblock-committor-service/src/intent_executor/error.rs
  • magicblock-committor-service/src/intent_executor/mod.rs
  • magicblock-committor-service/src/intent_executor/single_stage_executor.rs
  • magicblock-committor-service/src/intent_executor/two_stage_executor.rs
  • magicblock-committor-service/src/intent_executor/utils.rs
  • magicblock-committor-service/src/persist/error.rs
  • magicblock-committor-service/src/persist/types/commit_status.rs
  • magicblock-committor-service/src/persist/types/commit_strategy.rs
  • magicblock-committor-service/src/tasks/commit_delivery.rs
  • magicblock-committor-service/src/tasks/commit_finalize_task.rs
  • magicblock-committor-service/src/tasks/commit_stage_task.rs
  • magicblock-committor-service/src/tasks/commit_task.rs
  • magicblock-committor-service/src/tasks/intent_size_validator.rs
  • magicblock-committor-service/src/tasks/mod.rs
  • magicblock-committor-service/src/tasks/task_builder.rs
  • magicblock-committor-service/src/tasks/task_strategist.rs
  • magicblock-committor-service/src/tasks/utils.rs
  • magicblock-committor-service/src/transaction_preparator/delivery_preparator.rs
  • magicblock-committor-service/src/transaction_preparator/mod.rs
  • test-integration/test-committor-service/tests/common.rs
  • test-integration/test-committor-service/tests/test_delivery_preparator.rs
  • test-integration/test-committor-service/tests/test_intent_executor.rs
  • test-integration/test-committor-service/tests/test_transaction_preparator.rs
  • test-integration/test-committor-service/tests/utils/transactions.rs
💤 Files with no reviewable changes (7)
  • test-integration/test-committor-service/tests/utils/transactions.rs
  • magicblock-committor-service/src/persist/types/commit_strategy.rs
  • magicblock-committor-service/src/persist/error.rs
  • magicblock-committor-service/src/persist/types/commit_status.rs
  • magicblock-committor-service/src/transaction_preparator/delivery_preparator.rs
  • magicblock-committor-service/src/tasks/commit_task.rs
  • magicblock-committor-service/src/transaction_preparator/mod.rs

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


📝 Walkthrough

Walkthrough

The committor service replaces separate Commit and Finalize task variants with combined CommitFinalize tasks. Task construction, delivery planning, execution, error handling, buffer preparation, and integration tests now use the combined task model.

Changes

Combined commit-finalize task flow

Layer / File(s) Summary
Define and build combined tasks
magicblock-committor-service/src/tasks/commit_delivery.rs, magicblock-committor-service/src/tasks/commit_finalize_task.rs, magicblock-committor-service/src/tasks/commit_stage_task.rs, magicblock-committor-service/src/tasks/commit_task.rs, magicblock-committor-service/src/tasks/mod.rs, magicblock-committor-service/src/tasks/task_builder.rs, magicblock-committor-service/src/tasks/intent_size_validator.rs, magicblock-committor-service/src/tasks/utils.rs
The task API removes separate commit and finalize task types. CommitDelivery moves to its own module, and TaskBuilderImpl builds combined tasks through shared construction logic. Size validation and account-budget calculations are updated for the combined task model.
Plan delivery and transaction stages
magicblock-committor-service/src/tasks/task_strategist.rs
Task strategy construction and tests use combined tasks. They cover inline and buffered state or diff delivery, lookup-table cases, and splitting stages when combined compute usage exceeds the limit.
Update execution and recovery paths
magicblock-committor-service/src/intent_executor/*, magicblock-committor-service/src/transaction_preparator/*, magicblock-committor-service/src/committor_processor.rs, magicblock-committor-service/src/persist/error.rs, magicblock-committor-service/src/persist/types/*
Execution and recovery paths no longer perform separate-finalization recovery for unfinalized-account errors. Commit-ID recovery and buffer preparation now select combined tasks. The changes also remove related error variants, status helpers, strategy helpers, and the commit-signature query method.
Migrate integration fixtures and coverage
test-integration/test-committor-service/tests/common.rs, test-integration/test-committor-service/tests/test_delivery_preparator.rs, test-integration/test-committor-service/tests/test_intent_executor.rs, test-integration/test-committor-service/tests/test_transaction_preparator.rs, test-integration/test-committor-service/tests/utils/transactions.rs
Integration fixtures and tests use combined tasks in place of separate commit and finalize tasks. Delivery preparation, cleanup, transaction preparation, and nonce checks are updated; obsolete fixture helpers are removed.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant TaskBuilderImpl
  participant TaskStrategist
  participant DeliveryPreparator
  participant SingleStageExecutor
  TaskBuilderImpl->>TaskStrategist: provide combined commit-finalize tasks
  TaskStrategist->>DeliveryPreparator: provide planned task delivery
  DeliveryPreparator->>SingleStageExecutor: provide prepared tasks
Loading

Suggested reviewers: taco-paco

Merge Risk: ⚪ Minimal · up to ca34f

No confirmed issue remains to resolve before merging; proceed with normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to ca34f

Existing authority and ordering controls appear preserved. The main residual risk is compatibility during upgrade and rollback, which is not fully established. No introduced security vulnerability was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The sensitive outcomes remain base-layer updates to the selected accounts' data and lamports, followed where requested by undelegation. The inspected construction and instruction paths preserve account targets and executor-supplied validator authority; they do not establish an expansion to additional accounts, credentials, or environments.

Trust Boundaries and Controls

  • observed — Combined instructions bind the account pubkey, commit ID, and undelegation flag to the supplied validator; buffer addresses derive from validator, account, and commit ID. Failed-intent replay separately checks delegation-session continuity and persisted nonce eligibility, rejecting verification errors. Pending bundles follow a distinct existing rescheduling path.

Resilience and Maintainability Implications

  • inferred — Local retry and cleanup ownership remain consistent with the current task universe. Cross-worker atomicity between recovery validation and scheduling is not established, but that recovery code is unchanged, so the uncertainty is not evidence of a regression introduced here.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 59.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 87 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing the legacy separate Commit and Finalize tasks.
Description check ✅ Passed The description explains the task removal, the replacement API, the breaking change, and the reported test results. It is directly related to the changeset.
Linked Issues check ✅ Passed [#1765] The change removes CommitTask, FinalizeTask, their enum variants, and the separate-finalization recovery paths. Builders, preparation, cleanup, and fixtures now use CommitFinalizeTask wh…
Out of Scope Changes check ✅ Passed The API and helper removals concern legacy task handling, its recovery flow, or abstractions made redundant by combined tasks. The replacement CommitDelivery module and fixture and test updates supp…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@snawaz snawaz self-assigned this Oct 5, 2026
@snawaz
snawaz force-pushed the refactor/committor-remove-legacy-tasks branch 2 times, most recently from 9049fc4 to 73be1d7 Compare October 5, 2026 18:00
All fresh and restart-recovered commit intents now build CommitFinalize
instructions. Remove the separate Commit and Finalize implementation,
along with branches that only supported those obsolete tasks.

- Delete CommitTask, FinalizeTask, their task variants, instruction builders,
  compute/account budgets, and metric labels.
- Move CommitDelivery to its own module, retaining full-state and diff
  delivery through inline arguments or commit-scoped buffers.
- Remove legacy preparation, cleanup, strategy persistence, nonce reset,
  and transaction-splitting branches while keeping their combined-commit
  counterparts.
- Delete UnfinalizedAccountError and the unreachable recovery handlers
  that submitted standalone Finalize transactions, including helpers and
  preparator parameters used only by those handlers.
- Share the combined-commit admission estimator and migrate unit and
  integration fixtures to CommitFinalize. Preserve buffer preparation,
  cleanup/re-preparation, nonce uniqueness, action ordering, and ALT
  coverage. Update legacy size assumptions to exercise the combined
  instruction's oversized-payload and static-key limits.

Keep the public scheduled intent variants, persistence formats, and
single-stage/two-stage execution behavior unchanged. Stage simplification
will follow separately. The existing parent-branch pending-legacy-commit
undelegation recovery limitation is unchanged; its integration test is
neither weakened nor removed by this cleanup.

Validation:
- Nightly formatting checks and git diff --check passed.
- Clippy for magicblock-committor-service with all targets and warnings
  denied passed.
- Integration package cargo check --tests passed.
- 33 targeted task unit tests and three executor regression tests passed.
- test_prepare_cleanup_and_reprepare_mixed_tasks passed against Agave
  4.2.0 with only the devnet validator running; the validator was stopped
  afterward.

Ref: #1739
@snawaz
snawaz force-pushed the refactor/committor-remove-legacy-tasks branch from 73be1d7 to 4572775 Compare October 5, 2026 18:03
@snawaz
snawaz marked this pull request as ready for review October 5, 2026 18:10
All commit paths now construct CommitFinalize tasks. Remove the remaining
unused abstractions and duplicate construction code without changing how
intents select transactions or execute their actions.

- Replace four nearly identical commit builders with one helper that takes
  the undelegation flag. Preserve intent ordering, nonce consumption, base
  account lookup, and the existing placement of actions in each stage.
- Remove the single-implementation TasksBuilder trait and expose its two
  methods directly on TaskBuilderImpl.
- Delete unused TaskType and TaskStrategy metadata. Have strategy tests
  inspect the actual CommitDelivery variants and task ordering instead.
- Remove task program-ID getters and count the shared DLP program budget
  once across all tasks, preserving the empty case and existing headroom.
- Delete unused preparation helpers and the nonce-free transaction wrapper,
  reuse action argument/meta construction, and merge identical inline
  account-budget calculations.
- Construct the two-stage result directly from the existing signatures,
  removing the terminal Finalized wrapper and its no-op transition.
- Remove unused persistence helpers, error variants, integration fixtures,
  and the unused transaction-log compatibility helper.
- Delete serialization-only tests that provided no layout assertions.
  Replace the artificial action-only two-stage fixture with six commits
  plus six undelegations that exceed the combined compute budget but fit
  separately. Keep nonce-error coverage for both instruction layouts and
  verify that unrelated errors propagate unchanged.

Keep executor loops, delivery preparation and cleanup, callbacks, authority
checks, RPC work, transaction formats, and persisted values unchanged.
Broader stage and executor simplification remains separate work.

Validation:
- make fmt and make ci-fmt passed in the root and integration workspaces.
- test_all_commit_intents_use_combined_tasks passed with cargo test.
- The integration package schedulecommit-committor-service passed
  cargo check --offline --locked --tests.
- git diff --check passed. Broader test execution remains for CI.
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