Timeline for Why we need to pass all that accounts into functions in native solana?
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 27, 2023 at 19:19 | comment | added | Ademola | This is a security check that the account we're loading our accountinfo from is valid. We know the seeds of the mint account and so we can always derive its key on-chain. We check that the key of the account passed in as the mint matches that derived key, to guard against a client passing in the wrong account and compromising the program | |
Apr 26, 2023 at 20:33 | comment | added | Gilsson |
Need to clarify yet one moment with PDA. What happens here let (mint_pda, _mint_bump) = Pubkey::find_program_address(&[b"token_mint"], program_id); let (mint_auth_pda, mint_auth_bump) = Pubkey::find_program_address(&[b"token_auth"], program_id); if *token_mint.key != mint_pda { return Err(StudentIntroError::InvalidPDA.into()); } if *mint_auth.key != mint_auth_pda { return Err(StudentIntroError::InvalidPDA.into()); } . We find PDA off the eliptic curve, but then we can compare it with another account.
|
|
Apr 26, 2023 at 20:23 | vote | accept | Gilsson | ||
Apr 26, 2023 at 19:48 | history | answered | Ademola | CC BY-SA 4.0 |