magicblock-labs / magicblock-labs/delegation-program

Streamline the MagicBlock Protocol v2 delegation account lifecycle

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

@snawaz is already working on this.

Since Aug 17, 2026.

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

Description

Goal

Streamline delegation and undelegation account lifecycle for MagicBlock Protocol v2 under #132.

Why

Reduce account churn and redundant delegation state, retain surplus lamports in a global vault while delegated, and charge the delegation fee at entry.

Scope
  • On delegation, leave the rent-exempt minimum on the delegated account, move surplus lamports to a global vault, and account for their return.
  • On undelegation, restore the vaulted lamports, zero account data, and assign the account back to the expected owner without closing and recreating it.
  • Combine delegation record and metadata into one PDA; remove stored seeds only when the v2 flow no longer needs them.
  • Charge the delegation fee exactly once during delegation, with no delegation-fee charge during undelegation.
  • Cover lamport round trips, zero-and-assign behavior, the unified PDA layout, and fee timing in tests.
  • Keep unrelated delegation behavior unchanged. Related: #59 tracks the existing zero-out-and-assign improvement.

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.