Add BPF program entrypoint return type (#8111)

This commit is contained in:
Jack May
2020-02-04 12:25:42 -08:00
committed by GitHub
parent 78f6ddc5b7
commit b6d09f1901
6 changed files with 21 additions and 19 deletions

View File

@ -7,19 +7,20 @@ use std::{
cell::RefCell,
mem::size_of,
rc::Rc,
// Hide Result from bindgen gets confused about generics in non-generic type declarations
result::Result as ResultGeneric,
slice::{from_raw_parts, from_raw_parts_mut},
};
pub type ProgramResult = ResultGeneric<(), ProgramError>;
/// User implemented function to process an instruction
///
/// program_id: Program ID of the currently executing program
/// accounts: Accounts passed as part of the instruction
/// instruction_data: Instruction data
pub type ProcessInstruction = fn(
program_id: &Pubkey,
accounts: &[AccountInfo],
instruction_data: &[u8],
) -> Result<(), ProgramError>;
pub type ProcessInstruction =
fn(program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8]) -> ProgramResult;
/// Programs indicate success with a return value of 0
pub const SUCCESS: u64 = 0;