Enum solana_program::loader_upgradeable_instruction::UpgradeableLoaderInstruction[][src]

#[repr(u8)]pub enum UpgradeableLoaderInstruction {
    InitializeBuffer,
    Write {
        offset: u32,
        bytes: Vec<u8>,
    },
    DeployWithMaxDataLen {
        max_data_len: usize,
    },
    Upgrade,
    SetAuthority,
}

Variants

InitializeBuffer

Initialize a Buffer account.

A Buffer account is an intermediary that once fully populated is used with the DeployWithMaxDataLen instruction to populate the program’s ProgramData account.

The InitializeBuffer instruction requires no signers and MUST be included within the same Transaction as the system program’s CreateAccount instruction that creates the account being initialized. Otherwise another party may initialize the account.

Account references

  1. [writable] source account to initialize.
  2. [] Buffer authority, optional, if omitted then the buffer will be immutable.
Write

Write program data into a Buffer account.

Account references

  1. [writable] Buffer account to write program data to.
  2. [signer] Buffer authority

Fields of Write

offset: u32

Offset at which to write the given bytes.

bytes: Vec<u8>

Serialized program data

DeployWithMaxDataLen

Deploy an executable program.

A program consists of a Program and ProgramData account pair.

The ProgramData address is derived from the Program account’s address as follows:

let (program_data_address, _) = Pubkey::find_program_address( &[program_address], &bpf_loader_upgradeable::id() );

The DeployWithMaxDataLen instruction does not require the ProgramData account be a signer and therefore MUST be included within the same Transaction as the system program’s CreateAccount instruction that creates the Program account. Otherwise another party may initialize the account.

Account references

  1. [signer] The payer account that will pay to create the ProgramData account.
  2. [writable] The uninitialized ProgramData account.
  3. [writable] The uninitialized Program account.
  4. [writable] The Buffer account where the program data has been written. The buffer account’s authority must match the program’s authority
  5. [] Rent sysvar.
  6. [] Clock sysvar.
  7. [] System program (solana_sdk::system_program::id()).
  8. [signer] The program’s authority

Fields of DeployWithMaxDataLen

max_data_len: usize

Maximum length that the program can be upgraded to.

Upgrade

Upgrade a program.

A program can be updated as long as the program’s authority has not been set to None.

The Buffer account must contain sufficient lamports to fund the ProgramData account to be rent-exempt, any additional lamports left over will be transferred to the spill account, leaving the Buffer account balance at zero.

Account references

  1. [writable] The ProgramData account.
  2. [writable] The Program account.
  3. [writable] The Buffer account where the program data has been written. The buffer account’s authority must match the program’s authority
  4. [writable] The spill account.
  5. [] Rent sysvar.
  6. [] Clock sysvar.
  7. [signer] The program’s authority.
SetAuthority

Set a new authority that is allowed to write the buffer or upgrade the program. To permanently make the buffer immutable or disable program updates omit the new authority.

Account references

  1. [writable] The Buffer or ProgramData account to change the authority of.
  2. [signer] The current authority.
  3. [] The new authority, optional, if omitted then the program will not be upgradeable.

Trait Implementations

impl Clone for UpgradeableLoaderInstruction[src]

impl Debug for UpgradeableLoaderInstruction[src]

impl<'de> Deserialize<'de> for UpgradeableLoaderInstruction[src]

impl Eq for UpgradeableLoaderInstruction[src]

impl PartialEq<UpgradeableLoaderInstruction> for UpgradeableLoaderInstruction[src]

impl Serialize for UpgradeableLoaderInstruction[src]

impl StructuralEq for UpgradeableLoaderInstruction[src]

impl StructuralPartialEq for UpgradeableLoaderInstruction[src]

Auto Trait Implementations

impl RefUnwindSafe for UpgradeableLoaderInstruction

impl Send for UpgradeableLoaderInstruction

impl Sync for UpgradeableLoaderInstruction

impl Unpin for UpgradeableLoaderInstruction

impl UnwindSafe for UpgradeableLoaderInstruction

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]