I'm porting metaplex auction-house to Flutter mobile.

When creating auction with instant sale price of 0.1 wrapped sol, I have encountered the following error at the stage of ValidateSafetyDepositBoxV2 instruction.

The error was "Supplied an invalid creator index to empty payment account" and there is only one point where this message can be printed is Rust's process_empty_payment_account().

The most weird thing is that process_empty_payment_account function is called only from EmptyPaymentAccount instruction and my program didn't call it.

any idea what's happening?

Actual error log:

I/flutter ( 2718):  {accounts: null, err: {InstructionError: [0, {Custom: 63}]}, logs: [Program p1exdMJcjVao65QdewkaZRUnU6VPSXhus9n2GzWfh98 invoke [1], Program log: Instruction: Validate Safety Deposit Box V2, Program log: Supplied an invalid creator index to empty payment account, Program p1exdMJcjVao65QdewkaZRUnU6VPSXhus9n2GzWfh98 consumed 11849 of 200000 compute units, Program p1exdMJcjVao65QdewkaZRUnU6VPSXhus9n2GzWfh98 failed: custom program error: 0x3f], unitsConsumed: 0}
1

There are 1 answers

0
peter.s On

I found the reason why that error was given after deploying a new program with some logs to the rust program. It was that I passed the wrong value for the metadata's address as the 4th account.

pub fn process_validate_safety_deposit_box_v2<'a>(
    program_id: &'a Pubkey,
    accounts: &'a [AccountInfo<'a>],
    safety_deposit_config: SafetyDepositConfig,
) -> ProgramResult {
    let account_info_iter = &mut accounts.iter();
    let safety_deposit_config_info = next_account_info(account_info_iter)?;
    let auction_token_tracker_info = next_account_info(account_info_iter)?;
    let mut auction_manager_info = next_account_info(account_info_iter)?;
    *let metadata_info = next_account_info(account_info_iter)?;*
....

So, the program failed at Metadata::try_from_slice_checked and returns error of InvalidCreatorIndex at the following code.

impl Metadata {
    pub fn from_account_info(a: &AccountInfo) -> Result<Metadata, ProgramError> {
        let md: Metadata =
            try_from_slice_checked(&a.data.borrow_mut(), Key::MetadataV1, MAX_METADATA_LEN)?;
        Ok(md)
    }
}

It's a pity that the code didn't give a more elaborate error.