Skip to content

Support large-account undelegation in v2 #268

Description

@snawaz

Goal

Allow v2 delegated accounts larger than one 10,240-byte runtime growth step to be undelegated safely.

Why

The v2 Undelegate temporarily copies account bytes into a DLP-owned buffer before changing ownership. Creating that full buffer in one instruction fails for larger accounts.

This must not be solved with a generic instruction that can resize arbitrary DLP-owned PDAs.

Scope

  • Add a narrowly scoped way to create and grow the canonical undelegation buffer over multiple instructions.
  • Limit every growth operation to the runtime-permitted increment.
  • Validate the delegated account, DelegationState, buffer PDA, target length, and authorized payer before every growth step.
  • Let the final Undelegate instruction require the exact buffer size, copy the current account bytes, and perform the same zero-and-assign handoff as the normal-size path.
  • Return temporary buffer rent to the account that funded it.
  • Provide a builder that returns the required preparation instructions for a target account size.
  • Allow preparation instructions and final undelegation to be placed in one transaction when transaction limits permit.
  • Keep the instruction specific to undelegation buffers; do not expose arbitrary DLP account resizing.
  • Keep all legacy behavior unchanged.

Related work

Outcome

Large delegated accounts can use the same v2 undelegation lifecycle without failing on the runtime's per-instruction allocation limit.

Activity

  1. self-assigned this
    on Oct 22, 2026
  2. added theissue type on Oct 22, 2026
  3. changed the title [-]Support large-account undelegation in the primary protocol[/-] [+]Support large-account undelegation in v2[/+] on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions