Skip to main content

program_address_const

Function program_address_const 

Source
pub const fn program_address_const(
    seeds: &[&[u8]],
    bump: u8,
    program_id: &Address,
) -> Address
Expand description

The program-derived address for seeds and bump under program_id, computed with the const SHA-256 so it can be evaluated at compile time.

This is the hash half of create_program_address (seeds, bump, program id, the ProgramDerivedAddress marker) without the curve rejection, so callers must pass the canonical bump their client obtained from find_program_address; a bump the runtime would skip because its hash lands on the ed25519 curve is not detected here. Static seeds hashed once at compile time turn a runtime PDA check into a 32-byte compare. Panics on 16 or more base seeds or a seed longer than 32 bytes. The bump occupies one of the runtime’s 16 seed slots. In a const expression the refusal is a compilation error.