Skip to content

Commit cc1c7c8

Browse files
committed
SIMD-XXXX: Loader V3: Reclaim Closed Program
1 parent d7be661 commit cc1c7c8

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
simd: 'XXXX'
3+
title: 'Loader V3: Reclaim Closed Program'
4+
authors:
5+
- Joe Caulfield (Anza)
6+
- Dean Little (Blueshift)
7+
category: Standard
8+
type: Core
9+
status: Review
10+
created: 2025-12-14
11+
feature: (fill in with feature key and github tracking issues once accepted)
12+
---
13+
14+
## Summary
15+
16+
This SIMD proposes changing the default behavior when closing upgradeable
17+
programs so that program accounts are fully reclaimed and their addresses
18+
become reusable. Tombstoning program accounts would remain supported, but only
19+
when explicitly requested.
20+
21+
## Motivation
22+
23+
Today, closing an upgradeable program permanently tombstones its program
24+
account, preventing reuse of the program ID. This behavior has led to several
25+
issues:
26+
27+
- Loss of funds: Users frequently confuse close program with close buffer in the
28+
Solana CLI, unintentionally irreversibly disabling programs.
29+
- Permanent account bloat: Tombstoned program accounts cannot be reclaimed and
30+
accumulate indefinitely in the accounts database.
31+
- RPC performance degradation: getProgramAccounts against the loader v3 program
32+
must return all program accounts, including closed ones, increasing response
33+
size and latency.
34+
35+
These drawbacks outweigh the benefits of mandatory tombstoning. A more flexible
36+
model allows safe address reuse by default while preserving explicit
37+
tombstoning for users who require it.
38+
39+
## New Terminology
40+
41+
No new terminology is introduced by this proposal.
42+
43+
## Detailed Design
44+
45+
The `Close` instruction will be updated to include an optional boolean input. If
46+
not provided, the default will be `false`.
47+
48+
```
49+
Close { tombstone: bool }
50+
```
51+
52+
```
53+
| 4-byte discriminator | 1-byte boolean |
54+
```
55+
56+
For a value of `false`, the program will clear the program account's data,
57+
resize it to zero, and withdraw all lamports. This will render the account no
58+
longer rent-exempt and subject to garbage collection by the runtime at the end
59+
of the transaction. As such, the program address can be reclaimed after the
60+
account has been garbage collected.
61+
62+
For a value of `true`, the program will clear the program account's data, resize
63+
it to zero, but retain the rent-exempt minimum lamports for the base account
64+
metadata. The program account will then be assigned to itself, creating a
65+
permanent tombstone for the program.
66+
67+
```
68+
Close { tombstone }
69+
|
70+
+-----------+-----------+
71+
| |
72+
tombstone=false tombstone=true
73+
| |
74+
Clear data & resize Clear data & resize
75+
Withdraw all lamports Retain rent-exempt min
76+
| |
77+
Account → GC'd Owner → self (tombstone)
78+
Address reclaimable Address permanently locked
79+
```
80+
81+
In both workflows, the programdata account (or any adjacent accounts under
82+
Loader v3) will be completely deallocated, defunded, and reassigned to System.
83+
84+
This change will be a feature-gated behavioral change to the existing Close
85+
instruction. After the feature is activated, the boolean value can be included
86+
to utilize the new functionality.
87+
88+
## Alternatives Considered
89+
90+
N/A
91+
92+
## Impact
93+
94+
This proposal removes a harmful default behavior that has caused repeated loss
95+
of funds and persistent state bloat, while preserving security guarantees for
96+
users who explicitly wish to permanently disable a program ID.
97+
98+
## Security Considerations
99+
100+
When closing a program, the program account must not be reassigned to the
101+
system program. Doing so would allow redeployment within the same slot,
102+
potentially corrupting the program cache. When tombstoning, assigning the
103+
account to itself ensures the address is permanently unusable, as self-owned
104+
accounts cannot be modified by any program.
105+
106+
## Backwards Compatibility
107+
108+
This change modifies the semantics of an existing Loader v3 instruction and
109+
therefore requires a feature gate for consensus safety.
110+
111+
From a tooling perspective, the change is backwards compatible, though tooling
112+
updates are required to access the new explicit tombstoning behavior.

0 commit comments

Comments
 (0)