Skip to content

Commit 9c97fe2

Browse files
onspeedhpclaude
andcommitted
chore(instruction): sync Shank IDL declarations from upstream (strip fee ix)
instruction.rs's ProgramIx enum declarations (account metadata: writable modifiers, positions, descriptions) had drifted from lazorkit-protocol. Runtime not affected — sdk-legacy uses hand-written instruction builders, not the generated IDL. Resync now to keep IDL output (program/idl.json) faithful to actual on-chain account expectations. Strip 5 protocol-mgmt instruction variants (disc 10-14): InitializeProtocol, UpdateProtocol, RegisterPayer, WithdrawTreasury, InitializeTreasuryShard. program-v2 keeps disc 0-9 only (matches entrypoint dispatch). Verification: - cargo build --features devnet → clean - bash scripts/check-no-fee.sh → clean Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 44f6bf8 commit 9c97fe2

2 files changed

Lines changed: 58 additions & 63 deletions

File tree

program/idl.json

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@
9292
"accounts": [
9393
{
9494
"name": "payer",
95-
"isMut": false,
95+
"isMut": true,
9696
"isSigner": true,
9797
"docs": [
98-
"Transaction payer"
98+
"Payer and rent contributor"
9999
]
100100
},
101101
{
@@ -108,10 +108,10 @@
108108
},
109109
{
110110
"name": "adminAuthority",
111-
"isMut": false,
112-
"isSigner": true,
111+
"isMut": true,
112+
"isSigner": false,
113113
"docs": [
114-
"Admin authority PDA authorizing this action"
114+
"Admin authority PDA authorizing this action (counter incremented)"
115115
]
116116
},
117117
{
@@ -186,7 +186,7 @@
186186
"accounts": [
187187
{
188188
"name": "payer",
189-
"isMut": false,
189+
"isMut": true,
190190
"isSigner": true,
191191
"docs": [
192192
"Transaction payer"
@@ -202,10 +202,10 @@
202202
},
203203
{
204204
"name": "adminAuthority",
205-
"isMut": false,
206-
"isSigner": true,
205+
"isMut": true,
206+
"isSigner": false,
207207
"docs": [
208-
"Admin authority PDA authorizing this action"
208+
"Admin authority PDA authorizing this action (counter incremented)"
209209
]
210210
},
211211
{
@@ -245,10 +245,10 @@
245245
"accounts": [
246246
{
247247
"name": "payer",
248-
"isMut": false,
248+
"isMut": true,
249249
"isSigner": true,
250250
"docs": [
251-
"Transaction payer"
251+
"Payer and rent contributor"
252252
]
253253
},
254254
{
@@ -275,6 +275,14 @@
275275
"New owner authority PDA to be created"
276276
]
277277
},
278+
{
279+
"name": "refundDestination",
280+
"isMut": true,
281+
"isSigner": false,
282+
"docs": [
283+
"Account to receive rent refund from closed current owner"
284+
]
285+
},
278286
{
279287
"name": "systemProgram",
280288
"isMut": false,
@@ -335,7 +343,7 @@
335343
"accounts": [
336344
{
337345
"name": "payer",
338-
"isMut": false,
346+
"isMut": true,
339347
"isSigner": true,
340348
"docs": [
341349
"Transaction payer"
@@ -351,18 +359,18 @@
351359
},
352360
{
353361
"name": "authority",
354-
"isMut": false,
362+
"isMut": true,
355363
"isSigner": false,
356364
"docs": [
357-
"Authority or Session PDA authorizing execution"
365+
"Authority or Session PDA authorizing execution (counter incremented)"
358366
]
359367
},
360368
{
361369
"name": "vault",
362-
"isMut": false,
370+
"isMut": true,
363371
"isSigner": false,
364372
"docs": [
365-
"Vault PDA"
373+
"Vault PDA (signer for CPI, lamports debited)"
366374
]
367375
},
368376
{
@@ -407,10 +415,10 @@
407415
},
408416
{
409417
"name": "adminAuthority",
410-
"isMut": false,
411-
"isSigner": true,
418+
"isMut": true,
419+
"isSigner": false,
412420
"docs": [
413-
"Admin/Owner authority PDA authorizing logic"
421+
"Admin/Owner authority PDA authorizing logic (counter incremented)"
414422
]
415423
},
416424
{
@@ -650,7 +658,7 @@
650658
"accounts": [
651659
{
652660
"name": "payer",
653-
"isMut": false,
661+
"isMut": true,
654662
"isSigner": true,
655663
"docs": [
656664
"Transaction payer"

program/src/instruction.rs

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ pub enum ProgramIx {
2626
},
2727

2828
/// Add a new authority to the wallet
29-
#[account(0, signer, name = "payer", desc = "Transaction payer")]
29+
#[account(0, signer, writable, name = "payer", desc = "Payer and rent contributor")]
3030
#[account(1, name = "wallet", desc = "Wallet PDA")]
3131
#[account(
3232
2,
33-
signer,
33+
writable,
3434
name = "admin_authority",
35-
desc = "Admin authority PDA authorizing this action"
35+
desc = "Admin authority PDA authorizing this action (counter incremented)"
3636
)]
3737
#[account(
3838
3,
@@ -57,13 +57,13 @@ pub enum ProgramIx {
5757
},
5858

5959
/// Remove an authority from the wallet
60-
#[account(0, signer, name = "payer", desc = "Transaction payer")]
60+
#[account(0, signer, writable, name = "payer", desc = "Transaction payer")]
6161
#[account(1, name = "wallet", desc = "Wallet PDA")]
6262
#[account(
6363
2,
64-
signer,
64+
writable,
6565
name = "admin_authority",
66-
desc = "Admin authority PDA authorizing this action"
66+
desc = "Admin authority PDA authorizing this action (counter incremented)"
6767
)]
6868
#[account(
6969
3,
@@ -86,7 +86,7 @@ pub enum ProgramIx {
8686
RemoveAuthority,
8787

8888
/// Transfer ownership (atomic swap of Owner role)
89-
#[account(0, signer, name = "payer", desc = "Transaction payer")]
89+
#[account(0, signer, writable, name = "payer", desc = "Payer and rent contributor")]
9090
#[account(1, name = "wallet", desc = "Wallet PDA")]
9191
#[account(
9292
2,
@@ -100,10 +100,16 @@ pub enum ProgramIx {
100100
name = "new_owner_authority",
101101
desc = "New owner authority PDA to be created"
102102
)]
103-
#[account(4, name = "system_program", desc = "System Program")]
104-
#[account(5, name = "rent_sysvar", desc = "Rent Sysvar")]
105103
#[account(
106-
6,
104+
4,
105+
writable,
106+
name = "refund_destination",
107+
desc = "Account to receive rent refund from closed current owner"
108+
)]
109+
#[account(5, name = "system_program", desc = "System Program")]
110+
#[account(6, name = "rent_sysvar", desc = "Rent Sysvar")]
111+
#[account(
112+
7,
107113
signer,
108114
optional,
109115
name = "authorizer_signer",
@@ -116,14 +122,15 @@ pub enum ProgramIx {
116122
},
117123

118124
/// Execute transactions
119-
#[account(0, signer, name = "payer", desc = "Transaction payer")]
125+
#[account(0, signer, writable, name = "payer", desc = "Transaction payer")]
120126
#[account(1, name = "wallet", desc = "Wallet PDA")]
121127
#[account(
122128
2,
129+
writable,
123130
name = "authority",
124-
desc = "Authority or Session PDA authorizing execution"
131+
desc = "Authority or Session PDA authorizing execution (counter incremented)"
125132
)]
126-
#[account(3, name = "vault", desc = "Vault PDA")]
133+
#[account(3, writable, name = "vault", desc = "Vault PDA (signer for CPI, lamports debited)")]
127134
#[account(
128135
4,
129136
optional,
@@ -142,9 +149,9 @@ pub enum ProgramIx {
142149
#[account(1, name = "wallet", desc = "Wallet PDA")]
143150
#[account(
144151
2,
145-
signer,
152+
writable,
146153
name = "admin_authority",
147-
desc = "Admin/Owner authority PDA authorizing logic"
154+
desc = "Admin/Owner authority PDA authorizing logic (counter incremented)"
148155
)]
149156
#[account(3, writable, name = "session", desc = "New session PDA to be created")]
150157
#[account(4, name = "system_program", desc = "System Program")]
@@ -202,13 +209,7 @@ pub enum ProgramIx {
202209
///
203210
/// Verifies compact instructions against stored hashes, executes via CPI
204211
/// with vault PDA signing, then closes the DeferredExec account.
205-
#[account(
206-
0,
207-
signer,
208-
writable,
209-
name = "payer",
210-
desc = "Transaction payer"
211-
)]
212+
#[account(0, signer, writable, name = "payer", desc = "Transaction payer")]
212213
#[account(1, name = "wallet", desc = "Wallet PDA")]
213214
#[account(2, writable, name = "vault", desc = "Vault PDA (signer for CPI)")]
214215
#[account(
@@ -223,9 +224,7 @@ pub enum ProgramIx {
223224
name = "refund_destination",
224225
desc = "Account to receive rent refund from closed DeferredExec"
225226
)]
226-
ExecuteDeferred {
227-
instructions: Vec<u8>,
228-
},
227+
ExecuteDeferred { instructions: Vec<u8> },
229228

230229
/// Reclaim an expired DeferredExec account and refund rent
231230
///
@@ -253,29 +252,15 @@ pub enum ProgramIx {
253252
/// Revoke a session key early (before expiry)
254253
///
255254
/// Only Owner or Admin can revoke. Closes the session account and refunds rent.
256-
#[account(
257-
0,
258-
signer,
259-
name = "payer",
260-
desc = "Transaction payer"
261-
)]
262-
#[account(
263-
1,
264-
name = "wallet",
265-
desc = "Wallet PDA"
266-
)]
255+
#[account(0, signer, writable, name = "payer", desc = "Transaction payer")]
256+
#[account(1, name = "wallet", desc = "Wallet PDA")]
267257
#[account(
268258
2,
269259
writable,
270260
name = "admin_authority",
271261
desc = "Owner/Admin authority PDA (counter incremented for Secp256r1)"
272262
)]
273-
#[account(
274-
3,
275-
writable,
276-
name = "session",
277-
desc = "Session PDA to revoke"
278-
)]
263+
#[account(3, writable, name = "session", desc = "Session PDA to revoke")]
279264
#[account(
280265
4,
281266
writable,
@@ -341,7 +326,9 @@ pub enum LazorKitInstruction {
341326
/// 2. `[]` Wallet PDA
342327
/// 3. `[writable]` Current Owner Authority PDA
343328
/// 4. `[writable]` New Owner Authority PDA
344-
/// 5. `[]` System Program
329+
/// 5. `[writable]` Refund Destination
330+
/// 6. `[]` System Program
331+
/// 7. `[]` Rent Sysvar
345332
TransferOwnership {
346333
new_type: u8,
347334
new_pubkey: [u8; 33],

0 commit comments

Comments
 (0)