magicblock-labs / magicblock-labs/delegation-program

Delegate accounts larger than 10 KiB in MagicBlock Protocol v2

Open
#80 0 comments 0 reactions 1 assignee View on GitHub

@snawaz is already working on this.

Since Sep 14, 2026.

enhancement
Dominant language
Rust
Stars
30
Forks
21
Avg merge
20m
Merged PRs (30d)
1

Description

### Goal

Allow an owning program to delegate an existing account larger than 10 KiB (10,240 bytes) through MagicBlock Protocol v2 without losing its data.

### Why

The [SDK delegation helper](https://github.com/magicblock-labs/ephemeral-rollups-sdk/blob/958c5a1ff4fd25eea0017f90c6ef05ad14e979f0/rust/sdk/src/cpi.rs#L97) creates a temporary buffer matching the account's full size in one CPI. That allocation prevents the normal flow from handling large accounts. The experimental v2 delegation path still expects a prepared buffer; it does not by itself resolve the SDK-side allocation.

### Scope

- Support large-account delegation through the v2 program and owning-program SDK helpers, including delegation with actions. Account for temporary-buffer setup as well as the delegation instruction itself.
- Preserve account bytes and the expected ownership, lamport, and delegation-state transitions. Support accounts just above 10 KiB and accounts requiring more than one allocation increment.
- Coordinate the lifecycle changes with #203. Keep large commit/finalize handling in #191 rather than duplicating that work here.

This is v2 work under #132. Keep v1 interfaces unchanged.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.