Skip to content

Commit

Permalink
fix(execution): persist Proposal status before CPI
Browse files Browse the repository at this point in the history
  • Loading branch information
vovacodes committed Jul 3, 2023
1 parent e115a40 commit c2e81e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ impl BatchExecuteTransaction<'_> {
let current_status = proposal.status.clone();
// Set the proposal state to Executing to prevent reentrancy attacks (e.g. cancelling proposal) in the middle of execution.
proposal.status = ProposalStatus::Executing;
let proposal_account_info = proposal.to_account_info();
proposal.try_serialize(&mut &mut proposal_account_info.data.borrow_mut()[..])?;

// Execute the transaction message instructions one-by-one.
executable_message.execute_message(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ impl VaultTransactionExecute<'_> {

// Set the proposal state to Executing to prevent reentrancy attacks (e.g. cancelling proposal) in the middle of execution.
proposal.status = ProposalStatus::Executing;
let proposal_account_info = proposal.to_account_info();
proposal.try_serialize(&mut &mut proposal_account_info.data.borrow_mut()[..])?;

// Execute the transaction message instructions one-by-one.
executable_message.execute_message(
Expand Down

0 comments on commit c2e81e1

Please sign in to comment.