Module utils

Source
Expand description

Utilities for the program

Functions§

assert_derivation
Verify the derivation of the seeds against the given account.
assert_owned_by
Assert that the given account is owned by the given pubkey.
cmp_pubkeys
Convenience function for comparing two Pubkeys.
compute_merkle_root
Compute the root of a Merkle tree given a leaf and a proof. Uses a constant value of 0x01 as an input to the hashing function along with the values to be hashed.
create_or_allocate_account_raw
Create account almost from scratch, lifted from https://github.com/solana-labs/solana-program-library/tree/master/associated-token-account/program/src/processor.rs#L51-L98
get_existing_revision_map
Get a revision map by looking at the header, finding its location, and deserializing it.
get_latest_revision
Get the latest revision number stored on the revision map.
is_on_curve
Return whether the pubkey is on the Edwards 25519 curve.
is_zeroed
See if a slice contains all zeroes. Useful for checking an account’s data.
resize_or_reallocate_account_raw
Resize an account using realloc, lifted from Solana Cookbook.