Skip to content

Commit

Permalink
Add comment for approval order of operations
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Mar 12, 2024
1 parent 7a34481 commit f088080
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions programs/mpl-core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ pub fn validate_asset_permissions<'a>(
};
solana_program::msg!("approved: {:#?}", approved);

// Validations by plugins can both approve and deny an action (e.g. the Freeze plugin can reject
// a transfer because the token is frozen) so we always want to evaluate. That is why existing
// `approved` value is second in the OR statement.
approved = validate_plugin_checks(
Key::Collection,
&checks,
Expand All @@ -296,6 +299,7 @@ pub fn validate_asset_permissions<'a>(

solana_program::msg!("approved: {:#?}", approved);

// Again we always want to evaluate the plugin checks so order of operations is important.
approved = validate_plugin_checks(
Key::Asset,
&checks,
Expand Down

0 comments on commit f088080

Please sign in to comment.