diff --git a/clients/js/test/revokeAuthority.test.ts b/clients/js/test/revokeAuthority.test.ts index 0324c082..c7810f66 100644 --- a/clients/js/test/revokeAuthority.test.ts +++ b/clients/js/test/revokeAuthority.test.ts @@ -170,9 +170,12 @@ test('it can remove the default authority from a plugin to make it immutable', a }, }).sendAndConfirm(umi); - await revokePluginAuthority(umi, { + await approvePluginAuthority(umi, { asset: assetAddress.publicKey, pluginType: PluginType.Freeze, + newAuthority: { + __kind: 'None' + } }).sendAndConfirm(umi); const asset1 = await fetchAssetWithPlugins(umi, assetAddress.publicKey); @@ -354,7 +357,7 @@ test('it can remove a owner authority from a plugin with other authority', async plugins: [ { authority: - { __kind: 'Pubkey', address: pubkeyAuth.publicKey }, + { __kind: 'Owner' }, plugin: { __kind: 'Freeze', fields: [{ frozen: false }], @@ -383,11 +386,14 @@ test('it cannot remove a none authority from a plugin', async (t) => { plugin: plugin('Freeze', [{ frozen: false }]), }).sendAndConfirm(umi); - await revokePluginAuthority(umi, { + await approvePluginAuthority(umi, { payer: umi.identity, asset: assetAddress.publicKey, authority: umi.identity, pluginType: PluginType.Freeze, + newAuthority: { + __kind: 'None' + } }).sendAndConfirm(umi); const err = await t.throwsAsync(() => revokePluginAuthority(umi, { diff --git a/programs/mpl-core/src/plugins/utils.rs b/programs/mpl-core/src/plugins/utils.rs index 506f56bd..a56f9609 100644 --- a/programs/mpl-core/src/plugins/utils.rs +++ b/programs/mpl-core/src/plugins/utils.rs @@ -365,10 +365,15 @@ pub fn revoke_authority_on_plugin<'a>( .find(|record| record.plugin_type == *plugin_type) .ok_or(MplCoreError::PluginNotFound)?; + solana_program::msg!("authority_type: {:?}", authority_type); + solana_program::msg!("registry_record.authority: {:?}", registry_record.authority); + // TODO inspect this logic - if *authority_type != registry_record.plugin_type.default_authority() && + if (*authority_type != registry_record.plugin_type.default_authority() && // pubkey authorities can remove themselves if they are a signer - authority_type != ®istry_record.authority + authority_type != ®istry_record.authority) || + // Unable to revoke a None authority + registry_record.authority == Authority::None { return Err(MplCoreError::InvalidAuthority.into()); }