1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::pubkey::Pubkey;
crate::declare_id!("BpfLoader1111111111111111111111111111111111");
/// This is native loader
/// used for invoking native programs, this doesn't have a an account on it's own,
/// but native programs use this address in their owner's field.
/// Backwards-compatible alias for the BPF loader program ID.
pub const BPF_LOADER_ID: Pubkey = ID;
#[repr(u64)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum LoaderStatus {
/// Program is in maintenance
Retracted,
/// Program is ready to be executed
Deployed,
/// Same as `Deployed`, but can not be retracted anymore
Finalized,
}
/// LoaderV4 account states
#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct LoaderState {
/// Address of signer which can send program management instructions.
/// Otherwise a forwarding to the next version of the finalized program.
pub authority_address_or_next_version: Pubkey,
/// Deployment status.
pub status: LoaderStatus,
}
impl LoaderState {
/// Size of a serialized program account.
pub const fn program_data_offset() -> usize {
std::mem::size_of::<Self>()
}
}