-
Notifications
You must be signed in to change notification settings - Fork 818
Description
Problem
SystemInstruction::CreateAccount checks the lamports of new_account and aborts if they are > 0.
This was originally intended to prevent developers from accidentally supplying an existing wallet address as new_account – re‑initializing a live account and freezing existing funds.
However, this check hinders legitimate advanced workflows. By today’s rules, such workflows need three expensive CPIs (Transfer → Allocate → Assign).
In addition, using CreateAccountAllowPrefund avoids a security concern with using CreateAccount in cases where the address of the account to be created is knowable in advance.
Proposed Solution
The feature-gated CreateAccountAllowPrefund skips the lamport check, preventing these workflows (notably including some Associated Token Account program workflows) from incurring 3x more CPI overhead than necessary.
This solution is a stop-gap, not permanent interface sprawl. If a broader CPI-cost redesign lands, CreateAccount and CreateAccountAllowPrefund can be deprecated.