Skip to content

Streamline the MagicBlock Protocol v2 delegation account lifecycle #203

Description

@GabrielePicco

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: improvement: assign instead of close account when undelegating #59 tracks the existing zero-out-and-assign improvement.

Activity

  1. changed the title [-]feat: streamline delegation account lifecycle for DLP v2[/-] [+]Streamline the DLP v2 delegation account lifecycle[/+] on Sep 17, 2026
  2. added
    enhancementNew feature or request
    and removed on Sep 17, 2026
  3. changed the title [-]Streamline the DLP v2 delegation account lifecycle[/-] [+]Streamline the MagicBlock Protocol v2 delegation account lifecycle[/+] on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions