Skip to content

Commit

Permalink
Fixing missing lifecycle impl
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Feb 21, 2025
1 parent 1968701 commit 8a81d36
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
24 changes: 24 additions & 0 deletions programs/mpl-core/src/plugins/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ impl PluginType {
}
}

/// Check permissions for the execute lifecycle event.
pub fn check_execute(plugin_type: &PluginType) -> CheckResult {
#[allow(clippy::match_single_binding)]
match plugin_type {
_ => CheckResult::None,
}
}

/// Check permissions for the add external plugin adapter lifecycle event.
pub fn check_add_external_plugin_adapter(plugin_type: &PluginType) -> CheckResult {
#[allow(clippy::match_single_binding)]
Expand Down Expand Up @@ -390,6 +398,14 @@ impl Plugin {
plugin.inner().validate_decompress(ctx)
}

/// Validate the execute lifecycle event.
pub(crate) fn validate_execute(
plugin: &Plugin,
ctx: &PluginValidationContext,
) -> Result<ValidationResult, ProgramError> {
plugin.inner().validate_execute(ctx)
}

/// Validate the add external plugin adapter lifecycle event.
pub(crate) fn validate_add_external_plugin_adapter(
plugin: &Plugin,
Expand Down Expand Up @@ -626,6 +642,14 @@ pub(crate) trait PluginValidation {
abstain!()
}

/// Validate the execute lifecycle action.
fn validate_execute(
&self,
_ctx: &PluginValidationContext,
) -> Result<ValidationResult, ProgramError> {
abstain!()
}

/// Validate the update_plugin lifecycle action.
fn validate_update_external_plugin_adapter(
&self,
Expand Down
9 changes: 5 additions & 4 deletions programs/mpl-core/src/processor/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,11 @@ fn update<'a>(
if plugin_set.contains(&PluginType::UpdateDelegate) {
// Fetch the update delegate on the new collection.
// Do not ignore the return plugin as we need to check the additional delegates.
let (plugin_authority, fetched_plugin, _) = fetch_plugin::<CollectionV1, UpdateDelegate>(
new_collection_account,
PluginType::UpdateDelegate,
)?;
let (plugin_authority, fetched_plugin, _) =
fetch_plugin::<CollectionV1, UpdateDelegate>(
new_collection_account,
PluginType::UpdateDelegate,
)?;

if (assert_collection_authority(
&new_collection,
Expand Down

0 comments on commit 8a81d36

Please sign in to comment.