Skip to content

Commit

Permalink
fix(executed-flag): remove executed flag in MsIx logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ogmedia committed Jan 27, 2023
1 parent 5c79001 commit 6094b1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 0 additions & 7 deletions programs/squads-mpl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,6 @@ pub mod squads_mpl {
invoke_signed(&ix, &ix_account_infos, &[&authority_seeds])?;
}
};
// set this instruction as executed
ms_ix.set_executed()?;
// write the new struct back to the data slice
ms_ix.serialize(&mut &mut ms_ix_account.try_borrow_mut_data()?[8..])?;
Ok(())
})?;

Expand Down Expand Up @@ -585,8 +581,6 @@ pub mod squads_mpl {

invoke_signed(&ix, &ix_account_infos, &[&authority_seeds])?;

// set the instruction as executed
ms_ix.set_executed()?;
// set the executed index to match
tx.executed_index = ms_ix.instruction_index;
// this is the last instruction - set the transaction as executed
Expand Down Expand Up @@ -860,7 +854,6 @@ pub struct ExecuteInstruction<'info> {
&transaction.executed_index.checked_add(1).unwrap().to_le_bytes(),
b"instruction"
], bump = instruction.bump,
constraint = !instruction.executed @MsError::InvalidInstructionAccount,
// it should be the next expected instruction account to be executed
constraint = instruction.instruction_index == transaction.executed_index.checked_add(1).unwrap() @MsError::InvalidInstructionAccount,
)]
Expand Down
3 changes: 2 additions & 1 deletion programs/squads-mpl/src/state/ms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub struct MsInstruction {
pub data: Vec<u8>,
pub instruction_index: u8,
pub bump: u8,
pub executed: bool,
pub executed: bool, // deprecated in favor for executed index in the MsTransaction
}

// map the incoming instruction to internal instruction schema
Expand All @@ -260,6 +260,7 @@ impl MsInstruction {
Ok(())
}

// deprecated in favor for using the executed_index in the MsTransaction
pub fn set_executed(&mut self) -> Result<()> {
self.executed = true;
Ok(())
Expand Down

0 comments on commit 6094b1d

Please sign in to comment.