diff --git a/clients/js/src/generated/errors/mplCore.ts b/clients/js/src/generated/errors/mplCore.ts index 2d47f2e6..1c22df20 100644 --- a/clients/js/src/generated/errors/mplCore.ts +++ b/clients/js/src/generated/errors/mplCore.ts @@ -492,21 +492,22 @@ export class MissingExternalAccountError extends ProgramError { codeToErrorMap.set(0x22, MissingExternalAccountError); nameToErrorMap.set('MissingExternalAccount', MissingExternalAccountError); -/** InvalidExternalPluginSetting: Invalid setting for external plugin */ -export class InvalidExternalPluginSettingError extends ProgramError { - override readonly name: string = 'InvalidExternalPluginSetting'; +/** OracleCanDenyOnly: Oracle external plugin can only be configured to deny */ +export class OracleCanDenyOnlyError extends ProgramError { + override readonly name: string = 'OracleCanDenyOnly'; readonly code: number = 0x23; // 35 constructor(program: Program, cause?: Error) { - super('Invalid setting for external plugin', program, cause); + super( + 'Oracle external plugin can only be configured to deny', + program, + cause + ); } } -codeToErrorMap.set(0x23, InvalidExternalPluginSettingError); -nameToErrorMap.set( - 'InvalidExternalPluginSetting', - InvalidExternalPluginSettingError -); +codeToErrorMap.set(0x23, OracleCanDenyOnlyError); +nameToErrorMap.set('OracleCanDenyOnly', OracleCanDenyOnlyError); /** * Attempts to resolve a custom program error from the provided error code. diff --git a/clients/rust/src/generated/errors/mpl_core.rs b/clients/rust/src/generated/errors/mpl_core.rs index 4dde2210..07d39ad3 100644 --- a/clients/rust/src/generated/errors/mpl_core.rs +++ b/clients/rust/src/generated/errors/mpl_core.rs @@ -115,9 +115,9 @@ pub enum MplCoreError { /// 34 (0x22) - Missing account needed for external plugin #[error("Missing account needed for external plugin")] MissingExternalAccount, - /// 35 (0x23) - Invalid setting for external plugin - #[error("Invalid setting for external plugin")] - InvalidExternalPluginSetting, + /// 35 (0x23) - Oracle external plugin can only be configured to deny + #[error("Oracle external plugin can only be configured to deny")] + OracleCanDenyOnly, } impl solana_program::program_error::PrintProgramError for MplCoreError { diff --git a/clients/rust/tests/add_external_plugins.rs b/clients/rust/tests/add_external_plugins.rs index 06f0a154..c3c8e5a9 100644 --- a/clients/rust/tests/add_external_plugins.rs +++ b/clients/rust/tests/add_external_plugins.rs @@ -150,7 +150,7 @@ async fn test_add_oracle() { init_plugin_authority: Some(PluginAuthority::UpdateAuthority), lifecycle_checks: Some(vec![( HookableLifecycleEvent::Transfer, - ExternalCheckResult { flags: 1 }, + ExternalCheckResult { flags: 2 }, )]), pda: None, results_offset: None, diff --git a/clients/rust/tests/create_with_external_plugins.rs b/clients/rust/tests/create_with_external_plugins.rs index d3cbf194..44b98048 100644 --- a/clients/rust/tests/create_with_external_plugins.rs +++ b/clients/rust/tests/create_with_external_plugins.rs @@ -92,7 +92,7 @@ async fn test_create_oracle() { init_plugin_authority: Some(PluginAuthority::UpdateAuthority), lifecycle_checks: Some(vec![( HookableLifecycleEvent::Transfer, - ExternalCheckResult { flags: 1 }, + ExternalCheckResult { flags: 2 }, )]), pda: None, results_offset: None, diff --git a/clients/rust/tests/remove_external_plugins.rs b/clients/rust/tests/remove_external_plugins.rs index cdd9412e..85461cd0 100644 --- a/clients/rust/tests/remove_external_plugins.rs +++ b/clients/rust/tests/remove_external_plugins.rs @@ -127,7 +127,7 @@ async fn test_remove_oracle() { init_plugin_authority: Some(PluginAuthority::UpdateAuthority), lifecycle_checks: Some(vec![( HookableLifecycleEvent::Transfer, - ExternalCheckResult { flags: 1 }, + ExternalCheckResult { flags: 2 }, )]), pda: None, results_offset: None, diff --git a/clients/rust/tests/update_external_plugins.rs b/clients/rust/tests/update_external_plugins.rs index fa63f401..dd546743 100644 --- a/clients/rust/tests/update_external_plugins.rs +++ b/clients/rust/tests/update_external_plugins.rs @@ -140,7 +140,7 @@ async fn test_update_oracle() { init_plugin_authority: Some(PluginAuthority::UpdateAuthority), lifecycle_checks: Some(vec![( HookableLifecycleEvent::Transfer, - ExternalCheckResult { flags: 1 }, + ExternalCheckResult { flags: 2 }, )]), pda: None, results_offset: None, diff --git a/idls/mpl_core.json b/idls/mpl_core.json index 7cc36358..5d5e903b 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -4166,8 +4166,8 @@ }, { "code": 35, - "name": "InvalidExternalPluginSetting", - "msg": "Invalid setting for external plugin" + "name": "OracleCanDenyOnly", + "msg": "Oracle external plugin can only be configured to deny" } ], "metadata": { diff --git a/programs/mpl-core/src/plugins/utils.rs b/programs/mpl-core/src/plugins/utils.rs index 53c3e201..8f2801ca 100644 --- a/programs/mpl-core/src/plugins/utils.rs +++ b/programs/mpl-core/src/plugins/utils.rs @@ -11,9 +11,8 @@ use crate::{ }; use super::{ - ExternalCheckResultBits, ExternalPlugin, ExternalPluginInitInfo, ExternalPluginKey, - ExternalPluginType, ExternalRegistryRecord, Plugin, PluginHeaderV1, PluginRegistryV1, - PluginType, RegistryRecord, + ExternalPlugin, ExternalPluginInitInfo, ExternalPluginKey, ExternalPluginType, + ExternalRegistryRecord, Plugin, PluginHeaderV1, PluginRegistryV1, PluginType, RegistryRecord, }; /// Create plugin header and registry if it doesn't exist @@ -334,8 +333,8 @@ pub fn initialize_external_plugin<'a, T: DataBlob + SolanaAccount>( // You cannot configure an Oracle plugin to approve lifecycle events. if let Some(lifecycle_checks) = &init_info.lifecycle_checks { for (_, result) in lifecycle_checks { - let result_bits = ExternalCheckResultBits::from(*result); - if result_bits.can_listen() || result_bits.can_approve() { + // Deny is bit 2. + if result.flags != 0x2 { return Err(MplCoreError::OracleCanDenyOnly.into()); } }