Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending multiple equal transactions results into a strange error Unknown action 'undefined' #28

Open
Woody4618 opened this issue Aug 9, 2024 · 0 comments

Comments

@Woody4618
Copy link

Problem:
Sending multiple equal transactions results into a strange error:

Unknown action 'undefined'

My guess is that this is because the transactions result into the same transaction hash because during the bankrun tests all tests use the same blockhash? Not sure though

This code throws this error during execution:

for (let i = 0; i < 11; i++) {
      console.log(`Chop instruction ${i}`);

      let tx = await program.methods
        .chopTree(gameDataSeed, 0)
        .accountsStrict({
          player: playerPDA,
          sessionToken: null,
          signer: payer.publicKey,
          gameData: gameDataPDA,
          systemProgram: anchor.web3.SystemProgram.programId,
        })
        .rpc();

      await console.log("Chop instruction", tx);
    }

This code does not throw an error when making the transactions unique by adding the look counter as a parameter in the transactions:

for (let i = 0; i < 11; i++) {
      console.log(`Chop instruction ${i}`);

      let tx = await program.methods
        .chopTree(gameDataSeed, i)
        .accountsStrict({
          player: playerPDA,
          sessionToken: null,
          signer: payer.publicKey,
          gameData: gameDataPDA,
          systemProgram: anchor.web3.SystemProgram.programId,
        })
        .rpc();

      await console.log("Chop instruction", tx);
    }

You can find the whole source code to reproduce here:
https://github.com/solana-developers/solana-game-preset/blob/main/program/jesttests/energy-refill-time.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant