magicblock-labs / magicblock-labs/delegation-program
Support allocation-free PDA seed handling in MagicBlock Protocol v2
@snawaz is already working on this.
Since Oct 15, 2025.
- Dominant language
- Rust
- Stars
- 30
- Forks
- 21
- Avg merge
- 20m
- Merged PRs (30d)
- 1
Description
Goal
Allow MagicBlock Protocol v2 to delegate PDAs using the full runtime-supported seed count without heap allocation for on-chain seed decoding or validation.
Why
The current delegation processor accepts only 1–8 seeds, and its instruction arguments use Vec<Vec<u8>>. Delegation with actions repeats the same limit. The experimental v2 delegation path uses an empty seed slice as a placeholder, not a completed replacement.
The runtime allows 16 seeds total, including the bump. For the usual bump-appending derivation, that means up to 15 caller-provided seeds, each no longer than 32 bytes—not 16 caller-provided seeds plus a bump. See Solana's PDA derivation rules.
Scope
- Remove the artificial eight-seed limit from v2 delegation, including delegation with actions, while preserving PDA and owning-program authorization checks.
- Use one allocation-free on-chain seed-handling implementation rather than separate seed-count match tables. A macro is optional, not a requirement.
- Handle the supported seed-count and length boundaries explicitly, including more than eight caller-provided seeds; reject inputs exceeding the runtime limits without panicking.
- Coordinate with #203's removal of unnecessary stored seeds. Do not retain seed storage solely to implement this issue. Update the v2 instruction interface and SDK callers together if their seed representation changes.
This is v2 work under #132. Keep v1 instruction encoding and account layouts unchanged.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.