Skip to content

Trying to use Burn Authority to burn asset owned by random wallet yields errors #118

@daoplays

Description

@daoplays

Hi, I created an asset with the below code via CPI:


CreateV1CpiBuilder::new(ctx.accounts.core_program)
            .authority(Some(ctx.accounts.program_pda))
            .asset(ctx.accounts.asset_account)
            .collection(Some(ctx.accounts.collection_account))
            .payer(ctx.accounts.user)
            .owner(Some(ctx.accounts.program_pda))
            .data_state(mpl_core::types::DataState::AccountState)
            .name(args.name.to_string())
            .uri(args.uri.to_string())
            .plugins(vec![
                mpl_core::types::PluginAuthorityPair {
                    plugin: mpl_core::types::Plugin::PermanentBurnDelegate(
                        mpl_core::types::PermanentBurnDelegate {},
                    ),
                    authority: Some(mpl_core::types::PluginAuthority::Address {
                        address: *ctx.accounts.program_pda.key,
                    }),
                },
                mpl_core::types::PluginAuthorityPair {
                    plugin: mpl_core::types::Plugin::PermanentTransferDelegate(
                        mpl_core::types::PermanentTransferDelegate {},
                    ),
                    authority: Some(mpl_core::types::PluginAuthority::Address {
                        address: *ctx.accounts.program_pda.key,
                    }),
                },
            ])
            .system_program(ctx.accounts.system_program)
            .invoke_signed(&[&[b"pda", &[pda_bump_seed]]])
            .unwrap();

This asset was then transferred to a random wallet. In a separate interaction with the program i tried to burn it using the program_pda account that was set as the permanent burn authority:

mpl_core::instructions::BurnV1CpiBuilder::new(ctx.accounts.core_program)
            .asset(ctx.accounts.asset_account)
            .collection(Some(ctx.accounts.collection_account))
            .authority(Some(ctx.accounts.program_pda))
            .payer(ctx.accounts.user)
            .system_program(Some(ctx.accounts.system_program))
            .invoke_signed(&[&[b"pda", &[pda_bump_seed]]])
            .unwrap();

This yielded the following error:
Program invoked: Unknown Program (CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d)
Program logged: "Instruction: Burn"
Program logged: "PermanentBurnDelegate: ForceApproved"
Program consumed: 13654 of 164453 compute units
Program returned error: "instruction changed the balance of a read-only account"

which i don't understand because all the accounts are writable.

I thought it might be because the burn deposits sol in the owners account, but that isn't passed in the above burn instruction, so i tried adding the owner as an extra account, but that gave a different error, that the owner wasn't a signer.

My expectation is that the program, designated as the burn authority, should be able to burn any asset, but i'm not sure how.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions