2

When I add "mpl-token-metadata" by Cargo then the transaction response with error

Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete

Before adding, the transaction is still running normally

File Cargo.toml

[dependencies]
anchor-lang = "0.28.0"
anchor-spl = { version = "0.28.0", features = ["metadata"] }

File lib.rs

#[derive(Accounts)]
#[instruction(bump_auth: u8)]
pub struct InitPool<'info> {
    #[account(init, payer = payer, space = 8 + 10 * std::mem::size_of::<Pool>())]
    pub pool: Box<Account<'info, Pool>>,
    #[account(mut)]
    pub admin: Signer<'info>,
    #[account(mut)]
    pub payer: Signer<'info>,
    /// CHECK:
    #[account(mut, seeds = [pool.key().as_ref()], bump = bump_auth)]
    pub pool_authority: AccountInfo<'info>,

    // #[account(mut, seeds = [treasury.key().as_ref()], bump = bump_treasury)]
    // pub treasury_authority: AccountInfo<'info>,

    // #[account(mut)]
    // pub treasury: AccountInfo<'info>,
    pub rent: Sysvar<'info, Rent>,
    pub system_program: Program<'info, System>,
}

#[program]
pub mod helloword {

    use super::*;

    pub fn init_pool(
        ctx: Context<InitPool>,
        bump_auth: u8,
        pool_config: PoolConfig,
        pool_treasury: Pubkey,
    ) -> Result<()> {
        msg!("Init Pool");
        instructions::init_pool::handler(ctx, bump_auth, pool_config, pool_treasury)
    }
}

File test.ts

const tx = await program.methods
      .initPool(
        bumpAuth,
        {
          minStakingPeriodSec: new anchor.BN(100),
          // collection: new PublicKey("A9GvXJeWVHvuvqBvUsUtJtHQVdrYsFFFGaW6BbM8Y6Eh"),
        },
        treasury
      )
      .accounts({
        poolAuthority,
        pool: poolKeypair.publicKey,
        admin: adminKeypair.publicKey,
        systemProgram: SystemProgram.programId,
        payer: provider.wallet.publicKey,
        rent: anchor.web3.SYSVAR_RENT_PUBKEY,
      })
      .signers([poolKeypair, adminKeypair])
      .rpc();

Help me, Please Thanks

1
  • As @JonasH. already mentioned, the issue above is with the >= 1.16.0 solana version and downgrading should fix it. Here's the relevant gh issue. Can you specify your anchor version? Also, try deleting cargo.lock and building again
    – Ademola
    Commented Jun 27, 2023 at 21:02

1 Answer 1

2

can you please send the command with

.rpc({
      skipPreflight: true,
    });

and the paste the signature into https://explorer.solana.com/

This should show you the proper on chain error.

I guess since it was working before that you updated the cli tools to 1.16.1 which has a problem with too big transaction data currently.

If so downgrading your cli version could fix it.

sh -c "$(curl -sSfL https://release.solana.com/v1.14.18/install)"
4
  • Thanks for answering, I tried using "skipPreflight":true, and i tried on devnet but still error here is my transaction explorer.solana.com/tx/…
    – Richard
    Commented Jun 26, 2023 at 16:06
  • Yeah this is axactly the error happening when using the newest cli version, please try downgrade to 1.14.18 with the command i posted above, then build and deploy again, that should fix it.
    – Jonas H.
    Commented Jun 26, 2023 at 21:46
  • 1
    I got it, but when I downgrade to 1.14.18 then I have new error when I call comand "anchor build", with error "package hashbrown v0.14.0 cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc version is 1.62.0-dev" while I installed Rustc version "rustc 1.68.2 (9eb3afe9e 2023-03-27)"
    – Richard
    Commented Jun 27, 2023 at 14:36
  • Oh then maybe mpl-token-metadata needs an update. Currently don't know the solution. :-/ Is using anchor and spl 27 an option?
    – Jonas H.
    Commented Jun 28, 2023 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.