-
Notifications
You must be signed in to change notification settings - Fork 310
SIMD-0433: Loader V3: Set Program Data to ELF Length #433
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
buffalojoec
wants to merge
5
commits into
main
Choose a base branch
from
loader-v3-upgrade-resizing
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 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b3578fc
SIMD-0433: Loader V3: Set Program Data to ELF Length
buffalojoec 327c99d
Update proposals/0433-loader-v3-set-program-data-to-elf-length.md
buffalojoec 1667bca
bidirectional resizing
buffalojoec 9019def
revise lamport accounting and add simd-0430 dep
buffalojoec 43c07c4
clarify sizing specifics
buffalojoec 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
proposals/0433-loader-v3-set-program-data-to-elf-length.md
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,69 @@ | ||
| --- | ||
| simd: '0433' | ||
| title: 'Loader V3: Set Program Data to ELF Length' | ||
| authors: | ||
| - Joe Caulfield (Anza) | ||
| - Dean Little (Blueshift) | ||
| category: Standard | ||
| type: Core | ||
| status: Review | ||
| created: 2025-12-14 | ||
| feature: (fill in with feature key and github tracking issues once accepted) | ||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| This SIMD proposes changing the default behavior of program upgrades to resize | ||
| the program data account to the length of the ELF being deployed, refunding any | ||
| surplus lamports to a spill account. | ||
|
|
||
| ## Motivation | ||
|
|
||
| Currently, Loader v3 program data accounts may be extended but cannot be | ||
| retracted. As program sizes decrease due to SDK improvements such as Pinocchio, | ||
| this limitation results in program data accounts remaining larger than | ||
| necessary, with no mechanism to reclaim the rent paid for unused bytes. This | ||
| unnecessarily increases rent costs and program loading overhead. | ||
|
|
||
| ## New Terminology | ||
|
|
||
| No new terminology is introduced by this proposal. | ||
|
|
||
| ## Detailed Design | ||
|
|
||
| The `Upgrade` instruction will be updated to automatically resize the program | ||
| data account to match the length of the ELF in the buffer being deployed. | ||
|
|
||
| If the new ELF is larger than the current program data account, the upgrade will | ||
| fail. The account must first be extended to at least the required size via the | ||
| `ExtendProgram` instruction. | ||
|
|
||
| If the new ELF is smaller than the current program data account, the account | ||
| will be retracted and surplus lamports will be refunded to the spill account. | ||
|
|
||
| This change will be a feature-gated behavioral change to the existing `Upgrade` | ||
| instruction. | ||
|
|
||
| ## Alternatives Considered | ||
|
|
||
| An alternative approach would be to add a new `WithdrawExcessLamports` | ||
| instruction, similar to the instruction of the same name in the Token-2022 | ||
| program. This would allow the program's upgrade authority to claim excess | ||
| lamports after the auto-resizing from `Upgrade`. | ||
|
|
||
| ## Impact | ||
|
|
||
| This proposal results in a lower program footprint in Accounts DB, incentivizes | ||
| developers to upgrade to newer, more performant libraries and SDKs, and enables | ||
| the recovery of surplus lamports, including those accidentally sent to the | ||
| program data address. | ||
|
buffalojoec marked this conversation as resolved.
|
||
|
|
||
| ## Security Considerations | ||
|
|
||
| N/A | ||
|
|
||
| ## Backwards Compatibility | ||
|
|
||
| This change modifies an existing Loader v3 instruction and therefore requires a | ||
| feature gate for consensus safety. From an API and tooling perspective, the | ||
| change is 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.