metaplex-foundation / metaplex-program-library

Smart contracts maintained by the Metaplex team
Other
588 stars 513 forks source link

[Bug]: Rent Exemption Error Execute Sale through Auctioneer Program Fails on Specific NFT #896

Closed kespinola closed 1 year ago

kespinola commented 1 year ago

Which package is this bug report for?

auction-house

Which Type of Package is this bug report for?

Rust Contract

Issue description

I have an auctioneer program that has instructions for buying listing and accepting offers that result in a CPI call to auctioneer_execute_sale. In all cases except with this NFT the transactions are successful. However, in this case the transaction simulation fails with "Transaction simulation failed: Transaction results in an account (15) without insufficient funds for rent". The account in question is the auction_house but it does have enough lamports to cover the rent exemption.

    const keys = buyListingIx.keys.concat(remainingAccounts);
    const account15 = keys[15].pubkey;
    const account15Account = await connection.getAccountInfo(account15);
    const account15Rent = await connection.getMinimumBalanceForRentExemption(account15Account?.data.byteLength as number);

    const account16 = keys[16].pubkey
    const account16Account = await connection.getAccountInfo(account16)
    const account16MinRent = await connection.getMinimumBalanceForRentExemption(account16Account?.data.byteLength as number);
account15.toBase58()
'8JfAyq7iGvEEsJ1SRzFHpxSAcjt9nGD7VgjeB56vGPuK'
auctionHouse.address
'8JfAyq7iGvEEsJ1SRzFHpxSAcjt9nGD7VgjeB56vGPuK'
account16.toBase58()
'AWfV79pt5gpPHYQcc2n7NQbHr2vYtAf2e6ArsxUcf3jR'
auctionHouse.auctionHouseFeeAccount
'AWfV79pt5gpPHYQcc2n7NQbHr2vYtAf2e6ArsxUcf3jR'
account16Account.lamports
890880
account16MinRent
890880
account15Account.lamports
4085520
account15Rent
4085520

Furthermore, when I add an additional instruction for testing that transfers rent exemption amount to the auction_house account the next account which is the auction house fee account throws the same "insufficient rent error". In this case I'm not able to make the rent exemption pass by adding a transfer instruction before the accept offer or buy listing.

I have been using the NFT for testing for quite some time. It has been listed on different auction houses (which was the case when first attempting to sell the NFT). I did cancel the listing for the NFT on the other auction house I had and this persisted. I don't feel as though other auction houses are the issue as their accounts are different and the escrow payment account is unique per auction house.

Do you all have any ideas on what I should try to continue debugging the issue?

Reward Center Program

Accounts

Auction House Account House Fee Account NFT

Related Issues and Pull Requests

https://github.com/metaplex-foundation/metaplex-program-library/issues/340 https://github.com/metaplex-foundation/metaplex-program-library/pull/352 https://github.com/metaplex-foundation/metaplex-program-library/pull/412

Relevant log output

InsufficientFundsForRent: {account_index: 16}},
logs: [
  "Program ComputeBudget111111111111111111111111111111 invoke [1]",
  "Program ComputeBudget111111111111111111111111111111 success",
  "Program 11111111111111111111111111111111 invoke [1]",
  "Program 11111111111111111111111111111111 success",
  "Program 11111111111111111111111111111111 invoke [1]",
  "Program 11111111111111111111111111111111 success",
  "Program RwDDvPp7ta9qqUwxbBfShsNreBaSsKvFcHzMxfBC3Ki invoke [1]",
  "Program log: Instruction: BuyListing",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk invoke [2]",
  "Program log: Instruction: AuctioneerDeposit",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk consumed 32166 of 341330 compute units",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk success",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk invoke [2]",
  "Program log: Instruction: AuctioneerPublicBuy",
  "Program log: Transfer 897840 lamports to the new account",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program log: Allocate space for the account He4YMH8Ps43B1X5s1BGpaeo4FrAW26GLewzk5zAzBmqk",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program log: Assign the account to the owning program",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program log: Completed assignation!",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk consumed 61494 of 295913 compute units",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk success",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk invoke [2]",
  "Program log: Instruction: AuctioneerExecuteSale",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program 11111111111111111111111111111111 invoke [3]",
  "Program 11111111111111111111111111111111 success",
  "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [3]",
  "Program log: Create",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]",
  "Program log: Instruction: GetAccountDataSize",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1622 of 121066 compute units",
  "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
  "Program 11111111111111111111111111111111 invoke [4]",
  "Program 11111111111111111111111111111111 success",
  "Program log: Initialize the associated token account",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]",
  "Program log: Instruction: InitializeImmutableOwner",
  "Program log: Please upgrade to SPL Token 2022 for immutable owner support",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 114576 compute units",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]",
  "Program log: Instruction: InitializeAccount3",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4241 of 110694 compute units",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
  "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 20293 of 126463 compute units",
  "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]",
  "Program log: Instruction: Transfer",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4735 of 100398 compute units",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk consumed 108500 of 201456 compute units",
  "Program hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk success",
  "Program log: Payout operation mode: Multiple",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
  "Program log: Instruction: Transfer",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 89435 compute units",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
  "Program log: Instruction: Transfer",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 81086 compute units",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
  "Program RwDDvPp7ta9qqUwxbBfShsNreBaSsKvFcHzMxfBC3Ki consumed 326106 of 400000 compute units",
  "Program RwDDvPp7ta9qqUwxbBfShsNreBaSsKvFcHzMxfBC3Ki success"
]

Priority this issue should have

Medium (should be fixed soon)

austbot commented 1 year ago

@samuelvanderwaal @kespinola I think we solved this one.

austbot commented 1 year ago

I think this was solved by #880 or #890

kespinola commented 1 year ago

@austbot unfortunately this error is still persisting.