Skip to content

feat(direct): Implement CommitFinalizeFromBuffer - #263

Open
snawaz wants to merge 2 commits into
snawaz/commit-finalizefrom
snawaz/commit-finalize-from-buffer
Open

snawaz wants to merge 2 commits into
snawaz/commit-finalizefrom
snawaz/commit-finalize-from-buffer

Conversation

@snawaz

@snawaz snawaz commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Implements the primary CommitFinalizeFromBuffer instruction for Direct clusters. It validates and applies finalized StateBuffer payloads, with preparation instructions for account growth beyond one realloc step. Legacy finalization remains unchanged.

Closes #258

@snawaz
snawaz added this pull request to stack #264 October 21, 2026 20:39
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: magicblock-labs/delegation-program/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 594c2d01-d6da-41d5-8ff9-fc8e7222fe27
📥 Commits

Reviewing files that changed from the base of the PR and between 83880fe and 5771b62.

📒 Files selected for processing: 16
  • interface/src/args/commit_finalize_from_buffer.rs
  • interface/src/args/mod.rs
  • interface/src/instruction.rs
  • interface/src/instruction_builder/commit_finalize_from_buffer.rs
  • interface/src/instruction_builder/mod.rs
  • interface/src/instruction_builder/write_state_buffer.rs
  • interface/src/state/state_buffer.rs
  • program/src/processor/direct/commit_finalize.rs
  • program/src/processor/direct/commit_finalize_from_buffer.rs
  • program/src/processor/direct/mod.rs
  • program/src/processor/direct/prepare_commit_finalize.rs
  • program/src/processor/fraud_proofs/write_state_buffer.rs
  • program/src/processor/internal/commit_finalize.rs
  • program/src/processor/internal/mod.rs
  • program/src/processor/mod.rs
  • program/tests/test_primary_commit_finalize_from_buffer.rs
  • Autofix · 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 marked this pull request as ready for review October 21, 2026 20:40
Add the direct-cluster path for committing and applying a finalized StateBuffer payload. Validate the buffer PDA, authority, commit identity, finalized length, and payload hash before reusing the CommitFinalize state transition for full-data and diff payloads.

Store the canonical StateBuffer bump and align its payload for zero-copy diff decoding. Add PrepareCommitFinalize and a client helper so delegated accounts can grow across multiple runtime-limited realloc steps in the same transaction before finalization.

Cover large chunked payloads, aligned diffs, and invalid finalized hashes with SBF tests.
Avoid reaching into the already-reviewed fraud-proof processor for shared hashing. Each instruction now computes the same domain-separated payload hash locally, while only the commit/finalize transition shared by this stack remains under processor/internal.
@snawaz
snawaz force-pushed the snawaz/commit-finalize-from-buffer branch from 5f19fc0 to 5771b62 Compare October 21, 2026 20:50

This branch has not been deployed

No deployments
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.

Implement CommitFinalizeFromBuffer for Direct clusters

2 participants