diff --git a/programs/drift/src/instructions/user.rs b/programs/drift/src/instructions/user.rs index 7811fa2d1..a80e51ac1 100644 --- a/programs/drift/src/instructions/user.rs +++ b/programs/drift/src/instructions/user.rs @@ -239,6 +239,14 @@ pub fn handle_initialize_user<'c: 'info, 'info>( )?; } + if ctx.accounts.authority.key() != ctx.accounts.payer.key() { + validate!( + WHITELISTED_EXTERNAL_DEPOSITORS.contains(&ctx.accounts.payer.key()), + ErrorCode::DefaultError, + "Authority is not the payer" + )?; + } + Ok(()) } @@ -274,6 +282,14 @@ pub fn handle_initialize_user_stats<'c: 'info, 'info>( ErrorCode::MaxNumberOfUsers )?; + if ctx.accounts.authority.key() != ctx.accounts.payer.key() { + validate!( + WHITELISTED_EXTERNAL_DEPOSITORS.contains(&ctx.accounts.payer.key()), + ErrorCode::DefaultError, + "Authority is not the payer" + )?; + } + Ok(()) } @@ -4179,7 +4195,8 @@ pub struct InitializeUser<'info> { pub user_stats: AccountLoader<'info, UserStats>, #[account(mut)] pub state: Box>, - pub authority: Signer<'info>, + /// CHECK: Just a normal authority account + pub authority: AccountInfo<'info>, #[account(mut)] pub payer: Signer<'info>, pub rent: Sysvar<'info, Rent>, @@ -4198,7 +4215,8 @@ pub struct InitializeUserStats<'info> { pub user_stats: AccountLoader<'info, UserStats>, #[account(mut)] pub state: Box>, - pub authority: Signer<'info>, + /// CHECK: Just a normal authority account + pub authority: AccountInfo<'info>, #[account(mut)] pub payer: Signer<'info>, pub rent: Sysvar<'info, Rent>, diff --git a/sdk/src/idl/drift.json b/sdk/src/idl/drift.json index fcd488872..71f928598 100644 --- a/sdk/src/idl/drift.json +++ b/sdk/src/idl/drift.json @@ -1,5 +1,5 @@ { - "version": "2.150.0", + "version": "2.152.0", "name": "drift", "instructions": [ { @@ -23,7 +23,7 @@ { "name": "authority", "isMut": false, - "isSigner": true + "isSigner": false }, { "name": "payer", @@ -73,7 +73,7 @@ { "name": "authority", "isMut": false, - "isSigner": true + "isSigner": false }, { "name": "payer", @@ -11584,7 +11584,7 @@ }, { "name": "disableUpdatePerpBidAskTwap", - "type": "bool" + "type": "u8" }, { "name": "pausedOperations", @@ -16903,6 +16903,11 @@ "defined": "SpotBankruptcyRecord" }, "index": false + }, + { + "name": "bitFlags", + "type": "u8", + "index": false } ] },