-
Notifications
You must be signed in to change notification settings - Fork 284
SIMD-0430: Loader V3: Relax Program Buffer Constraints #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
deanmlittle
wants to merge
8
commits into
solana-foundation:main
Choose a base branch
from
blueshift-gg:relax-program-buffer-constraints
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d045f37
Relax program buffer constraints
deanmlittle 7df1445
Update SIMD number
deanmlittle 5f5a46f
Update proposals/0430-relax-program-buffer-constraints.md
deanmlittle 7971a42
fix lints
buffalojoec 228006a
further specify control flow
buffalojoec 99f8feb
add `close_buffer` arg
buffalojoec 4130ad3
add buffer layout requirement
buffalojoec fcbf334
Merge pull request #1 from buffalojoec/relax-program-buffer-constraints
deanmlittle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| --- | ||
| simd: '0430' | ||
| title: Relax Program Buffer Constraints | ||
| authors: | ||
| - Dean Little (Blueshift) | ||
| - Joe Caulfield (Anza) | ||
| category: Standard | ||
| type: Core | ||
| status: Review | ||
| created: 2025-12-18 | ||
| feature: (fill in with feature key and github tracking issues once accepted) | ||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| This SIMD proposes relaxing current constraints on program buffers used by the | ||
| `DeployWithMaxDataLen` (initial deployment) and `Upgrade` (redeployment) | ||
| instructions, currently requiring them to: | ||
|
|
||
| - Be owned by `BPFLoaderUpgradeab1e11111111111111111111111`, and | ||
| - Share an upgrade authority with the program being deployed or upgraded | ||
|
|
||
| ## Motivation | ||
|
|
||
| Currently, it is not feasible to support several advanced use cases for | ||
| program buffers, including: | ||
|
|
||
| - Sponsored deployments | ||
| - Permissionless buffer reuse | ||
| - Retracting erroneous upgrades using a common buffer | ||
| - On-chain recompilation | ||
|
|
||
| By removing these constraints, the loader can support a broader range of | ||
| advanced and flexible deployment workflows. | ||
|
|
||
| ## New Terminology | ||
|
|
||
| No new terminology is introduced by this proposal. | ||
|
|
||
| ## Detailed Design | ||
|
|
||
| The `DeployWithMaxDataLen` and `Upgrade` instructions will be updated to include | ||
| an optional boolean input. If not provided, the default will be `true`. | ||
|
|
||
| ``` | ||
| DeployWithMaxDataLen { | ||
| max_data_len: u32, | ||
| close_buffer: bool, // New | ||
| } | ||
| Upgrade { | ||
| close_buffer: bool, // New | ||
| } | ||
| ``` | ||
|
|
||
| The accounts required by the instructions are unchanged, but the signer | ||
| requirements differ based on the value of the `close_buffer` option. | ||
|
|
||
| For a value of `true`, existing behavior is preserved. The buffer account will | ||
| be closed (lamports transferred to a designated recipient and account data | ||
| zeroed). | ||
|
|
||
| For a value of `false`, the buffer account is not modified, enabling reuse for | ||
| future deployments. Additionally, constraints on the buffer are relaxed: | ||
|
|
||
| - No buffer authority signature is required. | ||
| - No buffer ownership check is required. | ||
| - The `IncorrectAuthority` check is removed: | ||
| - `DeployWithMaxDataLen`: The buffer's authority no longer must match the | ||
| authority that will be set on the deployed program. | ||
| - `Upgrade`: The buffer's authority no longer must match the upgrade | ||
| authority stored on the program account. | ||
|
|
||
| Note that the program's authority account must still be provided in the same | ||
| position for both instructions and must still sign the transaction. Only the | ||
| buffer-related checks are relaxed for `close_buffer=false`; the | ||
| `MissingRequiredSignature` check for the program's authority remains enforced. | ||
|
|
||
| ``` | ||
| DeployWithMaxDataLen / Upgrade { close_buffer } | ||
| | | ||
| +-----------+-----------+ | ||
| | | | ||
| close_buffer=true close_buffer=false | ||
| (default) | | ||
| | Relaxed buffer checks | ||
| Existing checks Buffer not modified | ||
| Buffer closed (reusable) | ||
| ``` | ||
|
|
||
| ### Buffer Layout Requirement | ||
|
|
||
| Regardless of the buffer's owner, the buffer account must still conform to the | ||
| expected layout for Loader V3 buffer accounts. Specifically, the account data | ||
| must deserialize to `UpgradeableLoaderState::Buffer` (discriminant `1` as a | ||
| little-endian u32), and the ELF data must begin at the expected offset within | ||
| the account data (after the header). | ||
|
|
||
| ``` | ||
| | discriminant (4 bytes) | authority_address (33 bytes) | ELF data ... | | ||
| | 0x01000000 | option byte + pubkey | | | ||
| | | | | | ||
| |<--------------- 37-byte header ---------------------->| | ||
| ``` | ||
|
|
||
| ## Alternatives Considered | ||
|
|
||
| - Introduce a new loader that enables these behaviors by default | ||
| - Only relax the authority constraint (similar outcome, but requires CPI) | ||
| - Retain existing constraints and make no changes | ||
|
|
||
| ## Impact | ||
|
|
||
| This change enables more flexible program deployment workflows, unlocking new | ||
| use cases for developers. | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| This proposal introduces two new, strictly opt-in potential attack vectors: | ||
|
|
||
| 1. In multisig deployment flows (e.g., Squads), if a quorum authorizes an | ||
| upgrade using a buffer it does not own, the buffer could be modified by a | ||
| third party prior to deployment. This introduces additional security | ||
| considerations beyond those enforced by the multisig quorum itself. | ||
| 2. If a buffer is owned by a third-party program, that program may retain | ||
| write access to the buffer account irrespective of its upgrade authority. | ||
| This creates a potential supply chain attack vector if the security | ||
| assumptions of the owner program are not carefully evaluated. | ||
|
|
||
| ## Backwards Compatibility | ||
|
|
||
| This feature relaxes existing Loader V3 constraints and is therefore not | ||
| backwards compatible for consensus, necessitating a feature gate. For CLI and | ||
| tooling, the change is fully backwards compatible. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.