coral-xyz / sealevel-attacks

☠️ Common Security Exploits and Protections on Solana
518 stars 99 forks source link

7 datawithbump never used in example #12

Closed yourarj closed 2 years ago

yourarj commented 2 years ago

removed unused account

Also removed bump passed as seed while getting program address. Which was produced while getting the PDA on client side.

So technically what we are expecting to happen

let (address, expected_bump) = 
    Pubkey::find_program_address(&[key.to_le_bytes().as_ref()], ctx.program_id);

and

 let (address, expected_bump) = 
    Pubkey::find_program_address(&[key.to_le_bytes().as_ref(), &[bump_from_client_side]], ctx.program_id);

the bump returned by both should be the same. Which would not be the case.