I am using "@solana/web3.js": "^1.90.0". While sending versioned transactions I am getting "Invalid Arguments". I have a retry logic in place that retries failed transactions with the same arguments until the transaction lands on chain. After multiple retries it lands with the same arguments same transaction instructions. I am not sure what I am doing wrong. I have recently switched from using normal Transactions to Versioned Transactions. Is there something I have to add while converting?
Below is the code snippet of how I am converting my normal Transaction to VersionedTransaction
// tx is a signed Transaction object
latestBlockHash = await connection.getLatestBlockhash('finalized'); // Fetches the latest blockhash
tx.recentBlockhash = latestBlockHash.blockhash;
tx.lastValidBlockHeight = latestBlockHash.lastValidBlockHeight;
// Coverting tx to a signed VersionedTransaction object
const compiledTxMessage1 = tx.compileMessage();
const txMessage1 = new MessageV0(compiledTxMessage1);
tx = new VersionedTransaction(txMessage1);
tx.sign(signers);