Skip to main content

Module pda

Module pda 

Source
Expand description

Hopper-owned PDA ergonomics on top of the native runtime boundary.

Constants§

MAX_SEED_LEN
The longest seed of an address (MAX_SEED_LEN).

Functions§

const_program_address
A program-derived address evaluated at compile time.
create_program_address
Create a program-derived address from seeds and a program ID.
create_with_seed
The address the System Program’s *WithSeed instructions derive from base, seed, and owner: sha256(base, seed, owner), the same value as Pubkey::create_with_seed. One sol_sha256 on chain.
derive
Hopper-facing alias for PDA derivation.
find_and_verify_pda
Verify that an account matches a PDA derived from the given seeds.
find_bump_for_address
Find the bump under which seeds hash to expected, searching from 255 down with one sol_sha256 per candidate and no curve check (about 150 CU per candidate instead of about 310). Returns InvalidSeeds when no bump matches. Same soundness condition as verify_pda_address: use it only when expected is bound to a program-owned or about-to-be created account; otherwise find_canonical_bump_checked.
find_canonical_bump_checked
The canonical bump for seeds, found with the curve check on every candidate, provided the canonical address equals expected.
find_program_address
Find a program-derived address and its bump seed.
find_program_address_const
The canonical program-derived address of seeds under program_id and its bump, found at compile time. The seeds may be any const expressions. See hopper_native::pda::find_program_address_const.
try_find_program_address
Find the canonical address and bump without panicking on invalid seeds.
verify_address_with_seed
Check that expected is the address create_with_seed derives from base, seed, and owner; InvalidSeeds when it is not.
verify_pda
Verify that an account’s address matches a PDA derived from the given seeds.
verify_pda_address
Verify that expected is the address the PDA hash of seeds (bump included) yields under program_id: one sol_sha256 (about 150 CU), no create_program_address syscall (1,500 CU) and no curve check.
verify_pda_address_checked
verify_pda_address with the full create_program_address syscall, so an address whose hash lands on the ed25519 curve is refused.
verify_pda_address_cold
verify_pda_address kept out of line.
verify_pda_from_stored_bump
Verify a PDA using the bump stored in account data (cheapest path).
verify_pda_strict
Verify that a raw address matches a PDA derived from the given seeds.
verify_pda_with_bump
Verify a PDA with an explicit bump seed appended to the seeds.