solana_loader_v3_interface/
lib.rs

1#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
2#![cfg_attr(docsrs, feature(doc_auto_cfg))]
3//! An upgradeable BPF loader native program.
4//!
5//! The upgradeable BPF loader is responsible for deploying, upgrading, and
6//! executing BPF programs. The upgradeable loader allows a program's authority
7//! to update the program at any time. This ability breaks the "code is law"
8//! contract that once a program is on-chain it is immutable. Because of this,
9//! care should be taken before executing upgradeable programs which still have
10//! a functioning authority. For more information refer to the
11//! [`instruction`] module.
12//!
13//! The `solana program deploy` CLI command uses the
14//! upgradeable BPF loader. Calling `solana program deploy --final` deploys a
15//! program that cannot be upgraded, but it does so by revoking the authority to
16//! upgrade, not by using the non-upgradeable loader.
17//!
18//! [`instruction`]: crate::instruction
19
20use solana_pubkey::Pubkey;
21
22pub mod instruction;
23pub mod state;
24
25/// Returns the program data address for a program ID
26pub fn get_program_data_address(program_address: &Pubkey) -> Pubkey {
27    Pubkey::find_program_address(
28        &[program_address.as_ref()],
29        &solana_sdk_ids::bpf_loader_upgradeable::id(),
30    )
31    .0
32}