diff --git a/programs/mmm/src/ata.rs b/programs/mmm/src/ata.rs index 2e43be5..873a690 100644 --- a/programs/mmm/src/ata.rs +++ b/programs/mmm/src/ata.rs @@ -68,7 +68,6 @@ pub fn init_if_needed_ata<'a>( associated_token: AccountInfo<'a>, token_program: AccountInfo<'a>, system_program: AccountInfo<'a>, - rent: AccountInfo<'a>, ) -> Result { let token_program_id = token_program.key(); @@ -87,7 +86,6 @@ pub fn init_if_needed_ata<'a>( mint.to_account_info(), associated_token, system_program, - rent, token_program, ], )?; diff --git a/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs b/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs index 8410d55..52d932d 100644 --- a/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs +++ b/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs @@ -127,18 +127,17 @@ pub struct SolMip1FulfillBuy<'info> { /// CHECK: checked by address and in CPI #[account(address = mpl_token_metadata::ID)] pub token_metadata_program: UncheckedAccount<'info>, - /// CHECK: checked by address and in cpi - #[account(address = MPL_TOKEN_AUTH_RULES)] + /// CHECK: checked by address in handler and in cpi + /// Address constraint not used here because of stack issues. pub authorization_rules_program: UncheckedAccount<'info>, /// CHECK: will be checked in cpi pub authorization_rules: UncheckedAccount<'info>, - /// CHECK: will be checked in cpi - #[account(address = sysvar::instructions::id())] + /// CHECK: checked by address in handler and in cpi + /// Address constraint not used here because of stack issues. pub instructions: UncheckedAccount<'info>, pub system_program: Program<'info, System>, pub token_program: Interface<'info, TokenInterface>, pub associated_token_program: Program<'info, AssociatedToken>, - pub rent: Sysvar<'info, Rent>, // Remaining accounts // Branch: using shared escrow accounts // 0: m2_program @@ -171,13 +170,24 @@ pub fn handler<'info>( let pool_token_record = &ctx.accounts.pool_token_record; let pool_owner_token_record = &ctx.accounts.pool_owner_token_record; let instructions = &ctx.accounts.instructions; + + // Check moved here to avoid stack frame limit issues. + if *instructions.key != sysvar::instructions::id() { + return Err(ProgramError::IncorrectProgramId.into()); + } + let associated_token_program = &ctx.accounts.associated_token_program; let authorization_rules = &ctx.accounts.authorization_rules; let authorization_rules_program = &ctx.accounts.authorization_rules_program; + + // Check moved here to avoid stack frame limit issues. + if *authorization_rules_program.key != MPL_TOKEN_AUTH_RULES { + return Err(ProgramError::IncorrectProgramId.into()); + } + let token_metadata_program_ai = &ctx.accounts.token_metadata_program.to_account_info(); let remaining_accounts = ctx.remaining_accounts; - let rent = &ctx.accounts.rent; let pool_key = pool.key(); let pool_uuid = pool.uuid; let buyside_sol_escrow_account_seeds: &[&[&[u8]]] = &[&[ @@ -309,7 +319,6 @@ pub fn handler<'info>( associated_token_program.to_account_info(), token_program.to_account_info(), system_program.to_account_info(), - rent.to_account_info(), )?; let payload = Payload { diff --git a/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs b/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs index cc3cc17..4d0fc2f 100644 --- a/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs +++ b/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs @@ -127,7 +127,6 @@ pub fn handler<'info>( let token_program = &ctx.accounts.token_program; let system_program = &ctx.accounts.system_program; let associated_token_program = &ctx.accounts.associated_token_program; - let rent = &ctx.accounts.rent; let pool = &mut ctx.accounts.pool; let sell_state = &mut ctx.accounts.sell_state; let owner = &ctx.accounts.owner; @@ -217,7 +216,6 @@ pub fn handler<'info>( associated_token_program.to_account_info(), token_program.to_account_info(), system_program.to_account_info(), - rent.to_account_info(), )?; let sellside_escrow_token_account = ctx.accounts.sellside_escrow_token_account.to_account_info(); @@ -256,7 +254,6 @@ pub fn handler<'info>( associated_token_program.to_account_info(), token_program.to_account_info(), system_program.to_account_info(), - rent.to_account_info(), )?; #[allow(deprecated)] diff --git a/sdk/src/idl/mmm.ts b/sdk/src/idl/mmm.ts index 475bd30..18d54a8 100644 --- a/sdk/src/idl/mmm.ts +++ b/sdk/src/idl/mmm.ts @@ -1646,7 +1646,10 @@ export type Mmm = { { "name": "authorizationRulesProgram", "isMut": false, - "isSigner": false + "isSigner": false, + "docs": [ + "Address constraint not used here because of stack issues." + ] }, { "name": "authorizationRules", @@ -1656,7 +1659,10 @@ export type Mmm = { { "name": "instructions", "isMut": false, - "isSigner": false + "isSigner": false, + "docs": [ + "Address constraint not used here because of stack issues." + ] }, { "name": "systemProgram", @@ -1673,11 +1679,6 @@ export type Mmm = { "isMut": false, "isSigner": false }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, { "name": "eventAuthority", "isMut": false, @@ -4089,7 +4090,10 @@ export const IDL: Mmm = { { "name": "authorizationRulesProgram", "isMut": false, - "isSigner": false + "isSigner": false, + "docs": [ + "Address constraint not used here because of stack issues." + ] }, { "name": "authorizationRules", @@ -4099,7 +4103,10 @@ export const IDL: Mmm = { { "name": "instructions", "isMut": false, - "isSigner": false + "isSigner": false, + "docs": [ + "Address constraint not used here because of stack issues." + ] }, { "name": "systemProgram", @@ -4116,11 +4123,6 @@ export const IDL: Mmm = { "isMut": false, "isSigner": false }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, { "name": "eventAuthority", "isMut": false, diff --git a/sdk/src/mmmClient.ts b/sdk/src/mmmClient.ts index 5f5483b..2ec3aa3 100644 --- a/sdk/src/mmmClient.ts +++ b/sdk/src/mmmClient.ts @@ -343,7 +343,6 @@ export class MMMClient { associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, systemProgram: SystemProgram.programId, tokenProgram: tokenProgramId, - rent: SYSVAR_RENT_PUBKEY, tokenOwnerTokenRecord, poolOwnerTokenRecord, poolTokenRecord, diff --git a/tests/mmm-fulfill-shared-escrow.ts b/tests/mmm-fulfill-shared-escrow.spec.ts similarity index 100% rename from tests/mmm-fulfill-shared-escrow.ts rename to tests/mmm-fulfill-shared-escrow.spec.ts