anchor
anchor copied to clipboard
Anchor program mainnet: InvalidRentPayingAccount
I deployed a program that works fine on tests and Devnet, but on Solana Mainnet, I get an error which I haven't found info by Googling it:
Raw transaction 5SJvH8NPKLPumNWmbB6nscwdtr1LpGsF48kPGiBTy4vkFi4k78L6Q36gaCbqzCbvck4jRu42M64Y72a7DtwNNiKT failed ({"err":"InvalidRentPayingAccount"})
In the Mainnet explorer, the transaction is this one.
Interesting enough is that the same transaction for the same programId
on Mainnet has 1 "System Program: Create Account" additional transaction that Devnet has not.
The place where I get the above error is in this logic:
const provider = getProvider();
const { program, gameAccount, houseWallet, clientWallet } = getProgramByClient(provider, client, amount);
solana.createPDA(solanaWallet.wallet.publicKey!, program.programId).then(async (playerAccount) => {
try {
const accounts = {
game: gameAccount,
player: solanaWallet.wallet.publicKey!,
playerData: playerAccount,
houseWallet,
clientWallet,
};
const result = await program.methods.flip().accounts(accounts).rpc(); <== HERE
As I mentioned, this one won't fail on Devnet with a Phantom Wallet.
How can I solve the InvalidRentPayingAccount
error on Mainnet?
@paul-schaaf you faced a similar error on this github issue: https://github.com/solana-labs/solana/issues/23670 I think my issue is related and can't find much info on the internet, do you have a clue?
Rent paying accounts are no longer allowed(https://github.com/solana-labs/solana/issues/24049):
The change adds a failure case for transactions: if the transaction leaves an account in a newly rent-paying state (ie. the account started as uninitialized or rent-exempt), the runtime now fails the transaction with
TransactionError::InvalidRentPayingAccount
.