From f088080853807eaf03869991fbcdf0ecdf02e160 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Mon, 11 Mar 2024 21:50:36 -0700 Subject: [PATCH] Add comment for approval order of operations --- programs/mpl-core/src/utils.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/programs/mpl-core/src/utils.rs b/programs/mpl-core/src/utils.rs index 7b4b76dc..f0871fe7 100644 --- a/programs/mpl-core/src/utils.rs +++ b/programs/mpl-core/src/utils.rs @@ -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, @@ -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,