Closed solanacryptodev closed 6 months ago
You're using:
seeds = [
GameData::SEED.as_bytes(),
game_id.current_game_id.clone().as_bytes(),
owner.key().as_ref()
]
but you're not accounting for game_id.current_game_id.clone().as_bytes()
client side:
let [gameAcctPDA] = web3.PublicKey.findProgramAddressSync(
[
Buffer.from(SEED),
wallet.publicKey!.toBuffer(),
],
PROGRAM_ID
);
To solve, also serialize the gameID
based on it's type.
You're also using the exact same seeds for multiple accounts, which means those accounts will have the same public key.
Closing, as this is not a bug with Anchor.
Hey all, I'm having a pretty serious problem generating dynamic game_id seeds in my client-side NextJS/TS app and passing that seed down to the program so that I can generate multiple game account instances. I've tried a multitude of fixes, but I keep getting a 2006 - Seed Constraint Error. The instruction works fine when I just pass down the constant SEED and owner key, it only wigs out when I try to pass down the dynamic seed.
Rust instruction
Client Side Hook
That's pretty much it. I've added a Buffer.from(gameID) to each of the findProgramAddressSync calls as well, same error. This is just the most recent failed build lol