Repository navigation
Description
Goal
Implement CommitFinalizeFromBuffer for Direct clusters in v2.
The instruction commits and applies an account update from a completed StateBuffer without starting the fraud-proof flow.
Why
CommitFinalize can carry small updates in its instruction data, but large payloads must be uploaded over one or more WriteStateBuffer calls. Direct clusters need a finalization instruction that consumes that shared buffer format without creating a pending commitment or challenge window.
Scope
- Add the v2
CommitFinalizeFromBufferinstruction, builder, processor, and focused tests. - Place the processor under
program/src/processor/direct/after Reorganize the repository around program and interface crates #255 and Move v1 code under legacy and promote v2 modules to the root #256 reorganize the repository. - Reuse the shared
WriteStateBufferandStateBuffercontract; the buffer is not specific to fraud proofs. - Require the delegated account to belong to a Direct
DelegationClusterand authorize the cluster's current validator. - Use the wheels-based
DelegationStatefrom Replace legacy delegation PDAs with a wheels-based DelegationState #249 and the same commit-ordering and undelegation rules as Implement CommitFinalize for Direct clusters #191. - Validate the buffer authority, delegated account, commit ID, finalized flag, payload length, and finalized payload hash before applying it.
- Apply a complete account-data payload or an encoded diff without copying large buffers unnecessarily.
- Apply the owner and lamport changes atomically with the buffered data, then advance the commit state.
- Support payloads that require multiple writes or account growth beyond one Solana realloc step.
- Keep terminal buffer cleanup in the existing
CloseTerminalAccountslifecycle. - Keep the legacy instruction and account layouts unchanged.
- Follow the compute-unit and allocation constraints in Implement MagicBlock Protocol v2 #132.
Reference
PR #141 explored an earlier buffer-based implementation. Its useful validation and zero-copy ideas can be reused, but its legacy account model and unfinished variants are not the required design.
Outcome
A Direct cluster can upload a large account update in chunks and then commit and apply it through one v2 finalization instruction.
Activity