From 80a19e14906187e6cdd1c4f501b68ffecb39ef2b Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Thu, 9 May 2024 21:36:14 -0700 Subject: [PATCH 1/5] Format fix --- clients/js/test/externalPlugins/oracle.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/js/test/externalPlugins/oracle.test.ts b/clients/js/test/externalPlugins/oracle.test.ts index ead3287e..a77d90fb 100644 --- a/clients/js/test/externalPlugins/oracle.test.ts +++ b/clients/js/test/externalPlugins/oracle.test.ts @@ -1955,7 +1955,7 @@ test('it can use custom pda (with custom program ID) oracle to deny transfer', a bytes: Buffer.from('additional-bytes-seed-bytes', 'utf8'), }, ], - customProgramId: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID + customProgramId: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, }, }; @@ -2057,7 +2057,7 @@ test('it can use custom pda (with custom program ID) oracle to deny transfer', a ), }, ], - customProgramId: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID + customProgramId: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, }, }, ], From 876e6f0d0923cbb45096c3423a13bf1097274395 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Thu, 9 May 2024 21:36:42 -0700 Subject: [PATCH 2/5] Rename oracle pda to base_address_config in program --- programs/mpl-core/src/plugins/oracle.rs | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/programs/mpl-core/src/plugins/oracle.rs b/programs/mpl-core/src/plugins/oracle.rs index d7f5b13d..9564330d 100644 --- a/programs/mpl-core/src/plugins/oracle.rs +++ b/programs/mpl-core/src/plugins/oracle.rs @@ -16,8 +16,10 @@ pub struct Oracle { /// The address of the oracle, or if using the `pda` option, a program ID from which /// to derive a PDA. pub base_address: Pubkey, - /// Optional PDA (derived from Pubkey attached to `PluginAdapterKey`). - pub pda: Option, + /// Optional account specification (PDA derived from `base_address` or other available account + /// specifications). Note that even when this configuration is used there is still only one + /// Oracle account specified by the adapter. + pub base_address_config: Option, /// Validation results offset in the Oracle account. Default is `ValidationResultsOffset::NoOffset`. pub results_offset: ValidationResultsOffset, } @@ -25,8 +27,8 @@ pub struct Oracle { impl Oracle { /// Updates the oracle with the new info. pub fn update(&mut self, info: &OracleUpdateInfo) { - if let Some(pda) = &info.pda { - self.pda = Some(pda.clone()); + if let Some(base_address_config) = &info.base_address_config { + self.base_address_config = Some(base_address_config.clone()); } if let Some(results_offset) = &info.results_offset { self.results_offset = *results_offset; @@ -77,7 +79,7 @@ impl Oracle { ctx: &PluginValidationContext, event: HookableLifecycleEvent, ) -> Result { - let oracle_account = match &self.pda { + let oracle_account = match &self.base_address_config { None => self.base_address, Some(extra_account) => extra_account.derive(&self.base_address, ctx)?, }; @@ -123,7 +125,7 @@ impl From<&OracleInitInfo> for Oracle { fn from(init_info: &OracleInitInfo) -> Self { Self { base_address: init_info.base_address, - pda: init_info.pda.clone(), + base_address_config: init_info.base_address_config.clone(), results_offset: init_info .results_offset .unwrap_or(ValidationResultsOffset::NoOffset), @@ -141,8 +143,10 @@ pub struct OracleInitInfo { pub init_plugin_authority: Option, /// The lifecyle events for which the the plugin adapter is active. pub lifecycle_checks: Vec<(HookableLifecycleEvent, AdapterCheckResult)>, - /// Optional PDA (derived from Pubkey attached to `PluginAdapterKey`). - pub pda: Option, + /// Optional account specification (PDA derived from `base_address` or other available account + /// specifications). Note that even when this configuration is used there is still only one + /// Oracle account specified by the adapter. + pub base_address_config: Option, /// Optional offset for validation results struct used in Oracle account. Default /// is `ValidationResultsOffset::NoOffset`. pub results_offset: Option, @@ -153,8 +157,10 @@ pub struct OracleInitInfo { pub struct OracleUpdateInfo { /// The lifecyle events for which the the plugin adapter is active. pub lifecycle_checks: Option>, - /// Optional PDA (derived from Pubkey attached to `PluginAdapterKey`). - pub pda: Option, + /// Optional account specification (PDA derived from `base_address` or other available account + /// specifications). Note that even when this configuration is used there is still only one + /// Oracle account specified by the adapter. + pub base_address_config: Option, /// Optional offset for validation results struct used in Oracle account. Default /// is `ValidationResultsOffset::NoOffset`. pub results_offset: Option, From c15d00d69b07918c6e3bcf8569ebd48e01f6ce86 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Thu, 9 May 2024 21:37:26 -0700 Subject: [PATCH 3/5] Regenerate IDL and clients --- clients/js/src/generated/types/baseOracle.ts | 6 +++--- clients/js/src/generated/types/baseOracleInitInfo.ts | 6 +++--- clients/js/src/generated/types/baseOracleUpdateInfo.ts | 6 +++--- clients/rust/src/generated/types/oracle.rs | 2 +- clients/rust/src/generated/types/oracle_init_info.rs | 2 +- clients/rust/src/generated/types/oracle_update_info.rs | 2 +- idls/mpl_core.json | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/clients/js/src/generated/types/baseOracle.ts b/clients/js/src/generated/types/baseOracle.ts index 933c4df4..7b73d53f 100644 --- a/clients/js/src/generated/types/baseOracle.ts +++ b/clients/js/src/generated/types/baseOracle.ts @@ -24,13 +24,13 @@ import { export type BaseOracle = { baseAddress: PublicKey; - pda: Option; + baseAddressConfig: Option; resultsOffset: BaseValidationResultsOffset; }; export type BaseOracleArgs = { baseAddress: PublicKey; - pda: OptionOrNullable; + baseAddressConfig: OptionOrNullable; resultsOffset: BaseValidationResultsOffsetArgs; }; @@ -41,7 +41,7 @@ export function getBaseOracleSerializer(): Serializer< return struct( [ ['baseAddress', publicKeySerializer()], - ['pda', option(getBaseExtraAccountSerializer())], + ['baseAddressConfig', option(getBaseExtraAccountSerializer())], ['resultsOffset', getBaseValidationResultsOffsetSerializer()], ], { description: 'BaseOracle' } diff --git a/clients/js/src/generated/types/baseOracleInitInfo.ts b/clients/js/src/generated/types/baseOracleInitInfo.ts index 57a58b3c..c56ca199 100644 --- a/clients/js/src/generated/types/baseOracleInitInfo.ts +++ b/clients/js/src/generated/types/baseOracleInitInfo.ts @@ -37,7 +37,7 @@ export type BaseOracleInitInfo = { baseAddress: PublicKey; initPluginAuthority: Option; lifecycleChecks: Array<[HookableLifecycleEvent, AdapterCheckResult]>; - pda: Option; + baseAddressConfig: Option; resultsOffset: Option; }; @@ -45,7 +45,7 @@ export type BaseOracleInitInfoArgs = { baseAddress: PublicKey; initPluginAuthority: OptionOrNullable; lifecycleChecks: Array<[HookableLifecycleEventArgs, AdapterCheckResultArgs]>; - pda: OptionOrNullable; + baseAddressConfig: OptionOrNullable; resultsOffset: OptionOrNullable; }; @@ -66,7 +66,7 @@ export function getBaseOracleInitInfoSerializer(): Serializer< ]) ), ], - ['pda', option(getBaseExtraAccountSerializer())], + ['baseAddressConfig', option(getBaseExtraAccountSerializer())], ['resultsOffset', option(getBaseValidationResultsOffsetSerializer())], ], { description: 'BaseOracleInitInfo' } diff --git a/clients/js/src/generated/types/baseOracleUpdateInfo.ts b/clients/js/src/generated/types/baseOracleUpdateInfo.ts index a7da8ce9..9bc2962b 100644 --- a/clients/js/src/generated/types/baseOracleUpdateInfo.ts +++ b/clients/js/src/generated/types/baseOracleUpdateInfo.ts @@ -31,7 +31,7 @@ import { export type BaseOracleUpdateInfo = { lifecycleChecks: Option>; - pda: Option; + baseAddressConfig: Option; resultsOffset: Option; }; @@ -39,7 +39,7 @@ export type BaseOracleUpdateInfoArgs = { lifecycleChecks: OptionOrNullable< Array<[HookableLifecycleEventArgs, AdapterCheckResultArgs]> >; - pda: OptionOrNullable; + baseAddressConfig: OptionOrNullable; resultsOffset: OptionOrNullable; }; @@ -60,7 +60,7 @@ export function getBaseOracleUpdateInfoSerializer(): Serializer< ) ), ], - ['pda', option(getBaseExtraAccountSerializer())], + ['baseAddressConfig', option(getBaseExtraAccountSerializer())], ['resultsOffset', option(getBaseValidationResultsOffsetSerializer())], ], { description: 'BaseOracleUpdateInfo' } diff --git a/clients/rust/src/generated/types/oracle.rs b/clients/rust/src/generated/types/oracle.rs index cd004210..f4b7e829 100644 --- a/clients/rust/src/generated/types/oracle.rs +++ b/clients/rust/src/generated/types/oracle.rs @@ -23,6 +23,6 @@ pub struct Oracle { serde(with = "serde_with::As::") )] pub base_address: Pubkey, - pub pda: Option, + pub base_address_config: Option, pub results_offset: ValidationResultsOffset, } diff --git a/clients/rust/src/generated/types/oracle_init_info.rs b/clients/rust/src/generated/types/oracle_init_info.rs index 352574b4..b2caf7f9 100644 --- a/clients/rust/src/generated/types/oracle_init_info.rs +++ b/clients/rust/src/generated/types/oracle_init_info.rs @@ -28,6 +28,6 @@ pub struct OracleInitInfo { pub base_address: Pubkey, pub init_plugin_authority: Option, pub lifecycle_checks: Vec<(HookableLifecycleEvent, AdapterCheckResult)>, - pub pda: Option, + pub base_address_config: Option, pub results_offset: Option, } diff --git a/clients/rust/src/generated/types/oracle_update_info.rs b/clients/rust/src/generated/types/oracle_update_info.rs index e489a667..979b1293 100644 --- a/clients/rust/src/generated/types/oracle_update_info.rs +++ b/clients/rust/src/generated/types/oracle_update_info.rs @@ -20,6 +20,6 @@ use borsh::{BorshDeserialize, BorshSerialize}; #[derive(Clone, Debug, Eq, PartialEq)] pub struct OracleUpdateInfo { pub lifecycle_checks: Option>, - pub pda: Option, + pub base_address_config: Option, pub results_offset: Option, } diff --git a/idls/mpl_core.json b/idls/mpl_core.json index b20a9621..2253ec9e 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -2412,7 +2412,7 @@ "type": "publicKey" }, { - "name": "pda", + "name": "baseAddressConfig", "type": { "option": { "defined": "ExtraAccount" @@ -2461,7 +2461,7 @@ } }, { - "name": "pda", + "name": "baseAddressConfig", "type": { "option": { "defined": "ExtraAccount" @@ -2502,7 +2502,7 @@ } }, { - "name": "pda", + "name": "baseAddressConfig", "type": { "option": { "defined": "ExtraAccount" From 7cd3a788902bdce52b4e3c3b36749f60d5d8cff3 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Thu, 9 May 2024 21:40:24 -0700 Subject: [PATCH 4/5] Update oracle SDK functions --- clients/js/src/plugins/oracle.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/clients/js/src/plugins/oracle.ts b/clients/js/src/plugins/oracle.ts index 82b52d51..aa93cc3d 100644 --- a/clients/js/src/plugins/oracle.ts +++ b/clients/js/src/plugins/oracle.ts @@ -24,8 +24,8 @@ import { validationResultsOffsetToBase, } from './validationResultsOffset'; -export type Oracle = Omit & { - pda?: ExtraAccount; +export type Oracle = Omit & { + baseAddressConfig?: ExtraAccount; resultsOffset: ValidationResultsOffset; }; @@ -36,22 +36,22 @@ export type OraclePlugin = BasePluginAdapter & export type OracleInitInfoArgs = Omit< BaseOracleInitInfoArgs, - 'initPluginAuthority' | 'lifecycleChecks' | 'pda' | 'resultsOffset' + 'initPluginAuthority' | 'lifecycleChecks' | 'baseAddressConfig' | 'resultsOffset' > & { type: 'Oracle'; initPluginAuthority?: PluginAuthority; lifecycleChecks: LifecycleChecks; - pda?: ExtraAccount; + baseAddressConfig?: ExtraAccount; resultsOffset?: ValidationResultsOffset; }; export type OracleUpdateInfoArgs = Omit< BaseOracleUpdateInfoArgs, - 'lifecycleChecks' | 'pda' | 'resultsOffset' + 'lifecycleChecks' | 'baseAddressConfig' | 'resultsOffset' > & { key: PluginAdapterKey; lifecycleChecks?: LifecycleChecks; - pda?: ExtraAccount; + baseAddressConfig?: ExtraAccount; resultsOffset?: ValidationResultsOffset; }; @@ -60,7 +60,7 @@ export function oracleInitInfoArgsToBase( ): BaseOracleInitInfoArgs { return { baseAddress: o.baseAddress, - pda: o.pda ? extraAccountToBase(o.pda) : null, + baseAddressConfig: o.baseAddressConfig ? extraAccountToBase(o.baseAddressConfig) : null, lifecycleChecks: lifecycleChecksToBase(o.lifecycleChecks), initPluginAuthority: o.initPluginAuthority ? pluginAuthorityToBase(o.initPluginAuthority) @@ -75,7 +75,7 @@ export function oracleUpdateInfoArgsToBase( o: OracleUpdateInfoArgs ): BaseOracleUpdateInfoArgs { return { - pda: o.pda ? extraAccountToBase(o.pda) : null, + baseAddressConfig: o.baseAddressConfig ? extraAccountToBase(o.baseAddressConfig) : null, lifecycleChecks: o.lifecycleChecks ? lifecycleChecksToBase(o.lifecycleChecks) : null, @@ -92,15 +92,15 @@ export function oracleFromBase( ): Oracle { return { ...s, - pda: - s.pda.__option === 'Some' ? extraAccountFromBase(s.pda.value) : undefined, + baseAddressConfig: + s.baseAddressConfig.__option === 'Some' ? extraAccountFromBase(s.baseAddressConfig.value) : undefined, resultsOffset: validationResultsOffsetFromBase(s.resultsOffset), }; } export function findOracleAccount( context: Pick, - oracle: Pick, + oracle: Pick, inputs: { asset?: PublicKey; collection?: PublicKey; @@ -108,11 +108,11 @@ export function findOracleAccount( owner?: PublicKey; } ): PublicKey { - if (!oracle.pda) { + if (!oracle.baseAddressConfig) { return oracle.baseAddress; } - return extraAccountToAccountMeta(context, oracle.pda, { + return extraAccountToAccountMeta(context, oracle.baseAddressConfig, { ...inputs, program: oracle.baseAddress, }).pubkey; From 4d39daac272fb1829dd6471ee7176a4e083a43ab Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Thu, 9 May 2024 21:52:28 -0700 Subject: [PATCH 5/5] Format JS and fix all tests --- clients/js/src/helpers/lifecycle.ts | 8 +- clients/js/src/plugins/oracle.ts | 17 ++++- clients/js/src/plugins/pluginAdapters.ts | 4 +- .../js/test/externalPlugins/oracle.test.ts | 74 +++++++++---------- clients/js/test/helps/lifecycle.test.ts | 4 +- clients/rust/tests/add_external_plugins.rs | 10 +-- .../tests/create_with_external_plugins.rs | 6 +- clients/rust/tests/remove_external_plugins.rs | 4 +- clients/rust/tests/update_external_plugins.rs | 14 ++-- 9 files changed, 77 insertions(+), 64 deletions(-) diff --git a/clients/js/src/helpers/lifecycle.ts b/clients/js/src/helpers/lifecycle.ts index 9b6f821b..e57426a7 100644 --- a/clients/js/src/helpers/lifecycle.ts +++ b/clients/js/src/helpers/lifecycle.ts @@ -106,7 +106,7 @@ export async function validateTransfer( ) .filter((o) => { // there's no PDA to derive, we can check the oracle account - if (!o.pda) { + if (!o.baseAddressConfig) { return true; } // If there's a recipient in the inputs, we can try to check the oracle account @@ -114,7 +114,11 @@ export async function validateTransfer( return true; } - if (!getExtraAccountRequiredInputs(o.pda).includes('recipient')) { + if ( + !getExtraAccountRequiredInputs(o.baseAddressConfig).includes( + 'recipient' + ) + ) { return true; } // we skip the check if there's a recipient required but no recipient provided diff --git a/clients/js/src/plugins/oracle.ts b/clients/js/src/plugins/oracle.ts index aa93cc3d..3e9f7383 100644 --- a/clients/js/src/plugins/oracle.ts +++ b/clients/js/src/plugins/oracle.ts @@ -36,7 +36,10 @@ export type OraclePlugin = BasePluginAdapter & export type OracleInitInfoArgs = Omit< BaseOracleInitInfoArgs, - 'initPluginAuthority' | 'lifecycleChecks' | 'baseAddressConfig' | 'resultsOffset' + | 'initPluginAuthority' + | 'lifecycleChecks' + | 'baseAddressConfig' + | 'resultsOffset' > & { type: 'Oracle'; initPluginAuthority?: PluginAuthority; @@ -60,7 +63,9 @@ export function oracleInitInfoArgsToBase( ): BaseOracleInitInfoArgs { return { baseAddress: o.baseAddress, - baseAddressConfig: o.baseAddressConfig ? extraAccountToBase(o.baseAddressConfig) : null, + baseAddressConfig: o.baseAddressConfig + ? extraAccountToBase(o.baseAddressConfig) + : null, lifecycleChecks: lifecycleChecksToBase(o.lifecycleChecks), initPluginAuthority: o.initPluginAuthority ? pluginAuthorityToBase(o.initPluginAuthority) @@ -75,7 +80,9 @@ export function oracleUpdateInfoArgsToBase( o: OracleUpdateInfoArgs ): BaseOracleUpdateInfoArgs { return { - baseAddressConfig: o.baseAddressConfig ? extraAccountToBase(o.baseAddressConfig) : null, + baseAddressConfig: o.baseAddressConfig + ? extraAccountToBase(o.baseAddressConfig) + : null, lifecycleChecks: o.lifecycleChecks ? lifecycleChecksToBase(o.lifecycleChecks) : null, @@ -93,7 +100,9 @@ export function oracleFromBase( return { ...s, baseAddressConfig: - s.baseAddressConfig.__option === 'Some' ? extraAccountFromBase(s.baseAddressConfig.value) : undefined, + s.baseAddressConfig.__option === 'Some' + ? extraAccountFromBase(s.baseAddressConfig.value) + : undefined, resultsOffset: validationResultsOffsetFromBase(s.resultsOffset), }; } diff --git a/clients/js/src/plugins/pluginAdapters.ts b/clients/js/src/plugins/pluginAdapters.ts index 138c9251..ebdd75ad 100644 --- a/clients/js/src/plugins/pluginAdapters.ts +++ b/clients/js/src/plugins/pluginAdapters.ts @@ -187,9 +187,9 @@ export const findExtraAccounts = ( pluginAdapters.oracles?.forEach((oracle) => { if (oracle.lifecycleChecks?.[lifecycle]) { - if (oracle.pda) { + if (oracle.baseAddressConfig) { accounts.push( - extraAccountToAccountMeta(context, oracle.pda, { + extraAccountToAccountMeta(context, oracle.baseAddressConfig, { ...inputs, program: oracle.baseAddress, }) diff --git a/clients/js/test/externalPlugins/oracle.test.ts b/clients/js/test/externalPlugins/oracle.test.ts index a77d90fb..7887b790 100644 --- a/clients/js/test/externalPlugins/oracle.test.ts +++ b/clients/js/test/externalPlugins/oracle.test.ts @@ -130,7 +130,7 @@ test('it can use fixed address oracle to deny update', async (t) => { lifecycleChecks: { update: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -227,7 +227,7 @@ test('it can use fixed address oracle to deny update via collection', async (t) lifecycleChecks: { update: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -314,7 +314,7 @@ test('it can use fixed address oracle to deny transfer', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -419,7 +419,7 @@ test('it cannot update oracle to have no lifecycle checks', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -460,7 +460,7 @@ test('it cannot update oracle to have no lifecycle checks', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -636,7 +636,7 @@ test('it cannot update oracle to approve', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -678,7 +678,7 @@ test('it cannot update oracle to approve', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -722,7 +722,7 @@ test('it cannot update oracle to approve in addition to reject', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -764,7 +764,7 @@ test('it cannot update oracle to approve in addition to reject', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -874,7 +874,7 @@ test('it cannot update oracle to listen', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -916,7 +916,7 @@ test('it cannot update oracle to listen', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -985,7 +985,7 @@ test('it cannot use fixed address oracle to deny transfer if not registered for lifecycleChecks: { create: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -1079,7 +1079,7 @@ test('it can use fixed address oracle to deny create', async (t) => { lifecycleChecks: { create: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -1160,7 +1160,7 @@ test('it can use preconfigured program pda oracle to deny update', async (t) => update: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'PreconfiguredProgram', }, }; @@ -1247,7 +1247,7 @@ test('it can use preconfigured program pda oracle to deny update', async (t) => lifecycleChecks: { update: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'PreconfiguredProgram', }, }, @@ -1267,7 +1267,7 @@ test('it can use preconfigured collection pda oracle to deny update', async (t) update: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'PreconfiguredCollection', }, }; @@ -1350,7 +1350,7 @@ test('it can use preconfigured collection pda oracle to deny update', async (t) lifecycleChecks: { update: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'PreconfiguredCollection', }, }, @@ -1370,7 +1370,7 @@ test('it can use preconfigured owner pda oracle to deny burn', async (t) => { burn: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'PreconfiguredOwner', }, }; @@ -1426,7 +1426,7 @@ test('it can use preconfigured owner pda oracle to deny burn', async (t) => { lifecycleChecks: { burn: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'PreconfiguredOwner', }, }, @@ -1469,7 +1469,7 @@ test('it can use preconfigured recipient pda oracle to deny transfer', async (t) transfer: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'PreconfiguredRecipient', }, }; @@ -1544,7 +1544,7 @@ test('it can use preconfigured recipient pda oracle to deny transfer', async (t) lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'PreconfiguredRecipient', }, }, @@ -1564,7 +1564,7 @@ test('it can use preconfigured asset pda oracle to deny update', async (t) => { update: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'PreconfiguredAsset', }, }; @@ -1640,7 +1640,7 @@ test('it can use preconfigured asset pda oracle to deny update', async (t) => { lifecycleChecks: { update: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'PreconfiguredAsset', }, }, @@ -1663,7 +1663,7 @@ test('it can use custom pda (all seeds) oracle to deny transfer', async (t) => { transfer: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { type: 'Collection' }, @@ -1771,7 +1771,7 @@ test('it can use custom pda (all seeds) oracle to deny transfer', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { type: 'Collection' }, @@ -1804,7 +1804,7 @@ test('it can use custom pda (typical) oracle to deny transfer', async (t) => { transfer: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { @@ -1903,7 +1903,7 @@ test('it can use custom pda (typical) oracle to deny transfer', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { @@ -1942,7 +1942,7 @@ test('it can use custom pda (with custom program ID) oracle to deny transfer', a transfer: [CheckResult.CAN_REJECT], }, baseAddress: randomProgramId, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { @@ -2042,7 +2042,7 @@ test('it can use custom pda (with custom program ID) oracle to deny transfer', a lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { @@ -2089,7 +2089,7 @@ test('it can use preconfigured asset pda custom offset oracle to deny update', a update: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'PreconfiguredAsset', }, }; @@ -2208,7 +2208,7 @@ test('it can use preconfigured asset pda custom offset oracle to deny update', a lifecycleChecks: { update: [CheckResult.CAN_REJECT], }, - pda: { + baseAddressConfig: { type: 'PreconfiguredAsset', }, }, @@ -2417,7 +2417,7 @@ test('it can update asset to different size name with oracle', async (t) => { update: [CheckResult.CAN_REJECT], }, baseAddress: oracleSigner.publicKey, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -2483,7 +2483,7 @@ test('it can update oracle to different size plugin adapter', async (t) => { burn: [CheckResult.CAN_REJECT], }, baseAddress: oracleSigner.publicKey, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -2524,7 +2524,7 @@ test('it can update oracle to different size plugin adapter', async (t) => { transfer: [CheckResult.CAN_REJECT], }, baseAddress: oracleSigner.publicKey, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -2595,7 +2595,7 @@ test('it transfer fails but does not panic when oracle account does not exist', lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -2653,7 +2653,7 @@ test('it transfer fails but does not panic when oracle account is too small', as lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); @@ -2711,7 +2711,7 @@ test('it empty account does not default to valid oracle', async (t) => { lifecycleChecks: { transfer: [CheckResult.CAN_REJECT], }, - pda: undefined, + baseAddressConfig: undefined, }, ], }); diff --git a/clients/js/test/helps/lifecycle.test.ts b/clients/js/test/helps/lifecycle.test.ts index b9edf681..11067e34 100644 --- a/clients/js/test/helps/lifecycle.test.ts +++ b/clients/js/test/helps/lifecycle.test.ts @@ -461,7 +461,7 @@ test('it can validate non-transferrable asset with oracle with recipient seed', transfer: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { type: 'Collection' }, @@ -544,7 +544,7 @@ test('it can validate and skip transferrable asset with oracle with recipient se transfer: [CheckResult.CAN_REJECT], }, baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, - pda: { + baseAddressConfig: { type: 'CustomPda', seeds: [ { diff --git a/clients/rust/tests/add_external_plugins.rs b/clients/rust/tests/add_external_plugins.rs index 04fa5850..9adb02c9 100644 --- a/clients/rust/tests/add_external_plugins.rs +++ b/clients/rust/tests/add_external_plugins.rs @@ -407,7 +407,7 @@ async fn test_add_oracle() { HookableLifecycleEvent::Transfer, AdapterCheckResult { flags: 4 }, )], - pda: None, + base_address_config: None, results_offset: None, })) .instruction(); @@ -432,7 +432,7 @@ async fn test_add_oracle() { plugins: vec![], plugin_adapters: vec![PluginAdapter::Oracle(Oracle { base_address: Pubkey::default(), - pda: None, + base_address_config: None, results_offset: ValidationResultsOffset::NoOffset, })], }, @@ -496,7 +496,7 @@ async fn test_cannot_add_oracle_with_duplicate_lifecycle_checks() { AdapterCheckResult { flags: 4 }, ), ], - pda: None, + base_address_config: None, results_offset: None, })) .instruction(); @@ -802,7 +802,7 @@ async fn test_cannot_add_duplicate_plugin_adapter() { HookableLifecycleEvent::Transfer, AdapterCheckResult { flags: 4 }, )], - pda: None, + base_address_config: None, results_offset: None, })) .instruction(); @@ -817,7 +817,7 @@ async fn test_cannot_add_duplicate_plugin_adapter() { HookableLifecycleEvent::Transfer, AdapterCheckResult { flags: 4 }, )], - pda: None, + base_address_config: None, results_offset: None, })) .instruction(); diff --git a/clients/rust/tests/create_with_external_plugins.rs b/clients/rust/tests/create_with_external_plugins.rs index 79d56900..488a2b01 100644 --- a/clients/rust/tests/create_with_external_plugins.rs +++ b/clients/rust/tests/create_with_external_plugins.rs @@ -218,7 +218,7 @@ async fn test_create_oracle() { HookableLifecycleEvent::Transfer, AdapterCheckResult { flags: 4 }, )], - pda: None, + base_address_config: None, results_offset: None, })], }, @@ -239,7 +239,7 @@ async fn test_create_oracle() { plugins: vec![], plugin_adapters: vec![PluginAdapter::Oracle(Oracle { base_address: Pubkey::default(), - pda: None, + base_address_config: None, results_offset: ValidationResultsOffset::NoOffset, })], }, @@ -278,7 +278,7 @@ async fn test_cannot_create_oracle_with_duplicate_lifecycle_checks() { AdapterCheckResult { flags: 4 }, ), ], - pda: None, + base_address_config: None, results_offset: None, })], }, diff --git a/clients/rust/tests/remove_external_plugins.rs b/clients/rust/tests/remove_external_plugins.rs index 95a810d3..4c4d6bc6 100644 --- a/clients/rust/tests/remove_external_plugins.rs +++ b/clients/rust/tests/remove_external_plugins.rs @@ -130,7 +130,7 @@ async fn test_remove_oracle() { HookableLifecycleEvent::Transfer, AdapterCheckResult { flags: 4 }, )], - pda: None, + base_address_config: None, results_offset: None, })], }, @@ -151,7 +151,7 @@ async fn test_remove_oracle() { plugins: vec![], plugin_adapters: vec![PluginAdapter::Oracle(Oracle { base_address: Pubkey::default(), - pda: None, + base_address_config: None, results_offset: ValidationResultsOffset::NoOffset, })], }, diff --git a/clients/rust/tests/update_external_plugins.rs b/clients/rust/tests/update_external_plugins.rs index e9263234..7d95f05d 100644 --- a/clients/rust/tests/update_external_plugins.rs +++ b/clients/rust/tests/update_external_plugins.rs @@ -244,7 +244,7 @@ async fn test_update_oracle() { HookableLifecycleEvent::Transfer, AdapterCheckResult { flags: 4 }, )], - pda: None, + base_address_config: None, results_offset: None, })], }, @@ -265,7 +265,7 @@ async fn test_update_oracle() { plugins: vec![], plugin_adapters: vec![PluginAdapter::Oracle(Oracle { base_address: Pubkey::default(), - pda: None, + base_address_config: None, results_offset: ValidationResultsOffset::NoOffset, })], }, @@ -278,7 +278,7 @@ async fn test_update_oracle() { .key(PluginAdapterKey::Oracle(Pubkey::default())) .update_info(PluginAdapterUpdateInfo::Oracle(OracleUpdateInfo { lifecycle_checks: None, - pda: None, + base_address_config: None, results_offset: Some(ValidationResultsOffset::Custom(10)), })) .instruction(); @@ -303,7 +303,7 @@ async fn test_update_oracle() { plugins: vec![], plugin_adapters: vec![PluginAdapter::Oracle(Oracle { base_address: Pubkey::default(), - pda: None, + base_address_config: None, results_offset: ValidationResultsOffset::Custom(10), })], }, @@ -336,7 +336,7 @@ async fn test_cannot_update_oracle_to_have_duplicate_lifecycle_checks() { HookableLifecycleEvent::Transfer, AdapterCheckResult { flags: 4 }, )], - pda: None, + base_address_config: None, results_offset: None, })], }, @@ -357,7 +357,7 @@ async fn test_cannot_update_oracle_to_have_duplicate_lifecycle_checks() { plugins: vec![], plugin_adapters: vec![PluginAdapter::Oracle(Oracle { base_address: Pubkey::default(), - pda: None, + base_address_config: None, results_offset: ValidationResultsOffset::NoOffset, })], }, @@ -379,7 +379,7 @@ async fn test_cannot_update_oracle_to_have_duplicate_lifecycle_checks() { AdapterCheckResult { flags: 4 }, ), ]), - pda: None, + base_address_config: None, results_offset: Some(ValidationResultsOffset::Custom(10)), })) .instruction();