Skip to content

Commit

Permalink
feat(proposals): stale config proposals can't be executed, vault and …
Browse files Browse the repository at this point in the history
…batch proposals - can
  • Loading branch information
vovacodes committed May 30, 2023
1 parent cf34989 commit dcc07dc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ impl BatchExecuteTransaction<'_> {
}
_ => return err!(MultisigError::InvalidProposalStatus),
};
// Stale batch transaction proposals CAN be executed if they were approved
// before becoming stale, hence no check for staleness here.

// `batch` is validated by its seeds.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ impl<'info> ConfigTransactionExecute<'info> {
}
_ => return err!(MultisigError::InvalidProposalStatus),
}
// Stale config transaction proposals CANNOT be executed even if approved.
require!(
proposal.transaction_index > multisig.stale_transaction_index,
MultisigError::StaleProposal
);

// `transaction` is validated by its seeds.

Expand Down
10 changes: 6 additions & 4 deletions programs/multisig/src/instructions/proposal_vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ impl ProposalVote<'_> {
matches!(proposal.status, ProposalStatus::Active { .. }),
MultisigError::InvalidProposalStatus
);
// CANNOT approve or reject a stale proposal
require!(
proposal.transaction_index > multisig.stale_transaction_index,
MultisigError::StaleProposal
);
}
Vote::Cancel => {
require!(
matches!(proposal.status, ProposalStatus::Approved { .. }),
MultisigError::InvalidProposalStatus
);
// CAN cancel a stale proposal.
}
}
require!(
proposal.transaction_index > multisig.stale_transaction_index,
MultisigError::StaleProposal
);

Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ impl VaultTransactionExecute<'_> {
}
_ => return err!(MultisigError::InvalidProposalStatus),
}
// Stale vault transaction proposals CAN be executed if they were approved
// before becoming stale, hence no check for staleness here.

// `transaction` is validated by its seeds.

Expand Down

0 comments on commit dcc07dc

Please sign in to comment.