I've noticed many programs on Solana written with Anchor asks for the bump
in the instruction data, then checks it inside the #account
macro with bump = bump
.
I've tried omitting the caller-supplied bump
parameter, using just #[account(seeds = [...], bump)]
and passing a non-canonical PDA address, and Anchor correctly throws an error Cross-program invocation with unauthorized signer or writable account
.
So it seems like having the caller-supplied bump
makes no difference to checking if the PDA is canonical. Furthermore you can always retrieve the canonical bump via ctx.bumps.get("<account>")
.
Am I missing something here?