pub fn assert_pda(
account: &AccountView,
seeds: &[&[u8]],
program_id: &Address,
) -> Result<u8, ProgramError>Expand description
Derive a PDA from the given seeds and program id, verify it matches the account’s address, and return the bump.
Uses find_program_address under the hood (syscall on-chain). Returns
the canonical bump if the derived address matches. Errors with
InvalidSeeds if no bump produces a match.
This is the pinocchio equivalent of Anchor’s seeds + bump constraint
but you get the bump back for storage or CPI signing.
ⓘ
let bump = assert_pda(vault, &[b"vault", authority.as_ref()], program_id)?;