From b4f048ee3ddca4e6329279655545f6cd4d084d4c Mon Sep 17 00:00:00 2001 From: mooncitydev Date: Sat, 23 May 2026 12:12:10 -0700 Subject: [PATCH] require owner signature for shutdown and strategy execution close permissionless paths on stable and weighted shutdown, and lock stable strategy execution to the pool owner so third parties cannot trigger sensitive state changes. --- packages/sdk/src/programs/stable-swap.ts | 1 + programs/stable-swap/src/instructions/shutdown.rs | 3 +-- programs/stable-swap/src/instructions/strategy.rs | 4 +++- programs/weighted-swap/src/instructions/shutdown.rs | 3 +-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/sdk/src/programs/stable-swap.ts b/packages/sdk/src/programs/stable-swap.ts index d278a3c..b6c6c8e 100644 --- a/packages/sdk/src/programs/stable-swap.ts +++ b/packages/sdk/src/programs/stable-swap.ts @@ -819,6 +819,7 @@ export class StableSwapContext extends WalletCont .execStrategy(rampStep, rampDuration) .accountsStrict({ strategy: address, + owner: pool.ownerAddress, pool: pool.address, }) .instruction(); diff --git a/programs/stable-swap/src/instructions/shutdown.rs b/programs/stable-swap/src/instructions/shutdown.rs index b63e43d..f5d8963 100644 --- a/programs/stable-swap/src/instructions/shutdown.rs +++ b/programs/stable-swap/src/instructions/shutdown.rs @@ -48,9 +48,8 @@ pub fn process_shutdown<'a, 'b, 'c, 'info>(ctx: Context<'_, '_, 'info, 'info, Sh #[derive(Accounts)] pub struct Shutdown<'info> { - /// CHECK: OK #[account(mut)] - pub owner: UncheckedAccount<'info>, + pub owner: Signer<'info>, #[account(mut, close = owner, has_one = owner)] pub pool: Account<'info, Pool>, diff --git a/programs/stable-swap/src/instructions/strategy.rs b/programs/stable-swap/src/instructions/strategy.rs index b5378df..c4834e4 100644 --- a/programs/stable-swap/src/instructions/strategy.rs +++ b/programs/stable-swap/src/instructions/strategy.rs @@ -108,6 +108,8 @@ pub struct ExecStrategy<'info> { #[account(has_one = pool)] pub strategy: Account<'info, Strategy>, - #[account(mut)] + pub owner: Signer<'info>, + + #[account(mut, has_one = owner)] pub pool: Account<'info, Pool>, } diff --git a/programs/weighted-swap/src/instructions/shutdown.rs b/programs/weighted-swap/src/instructions/shutdown.rs index dbb2229..3d74ba4 100644 --- a/programs/weighted-swap/src/instructions/shutdown.rs +++ b/programs/weighted-swap/src/instructions/shutdown.rs @@ -47,9 +47,8 @@ pub fn process_shutdown<'a, 'b, 'c, 'info>(ctx: Context<'_, '_, 'info, 'info, Sh #[derive(Accounts)] pub struct Shutdown<'info> { - /// CHECK: OK #[account(mut)] - pub owner: UncheckedAccount<'info>, + pub owner: Signer<'info>, #[account(mut, close = owner, has_one = owner)] pub pool: Account<'info, Pool>,