Remove program error footgun and cleaner developer experience (#8042)

This commit is contained in:
Jack May
2020-01-31 10:58:07 -08:00
committed by GitHub
parent eff876881b
commit 0fd795a676
26 changed files with 127 additions and 160 deletions

View File

@ -8,6 +8,7 @@ use log::*;
use solana_rbpf::{memory_region::MemoryRegion, EbpfVm};
use solana_sdk::{
account::KeyedAccount,
entrypoint::SUCCESS,
instruction::InstructionError,
instruction_processor_utils::{is_executable, limited_deserialize, next_keyed_account},
loader_instruction::LoaderInstruction,
@ -145,9 +146,7 @@ pub fn process_instruction(
info!("Call BPF program");
match vm.execute_program(parameter_bytes.as_slice(), &[], &[heap_region]) {
Ok(status) => {
// ignore upper 32bits if any, programs only return lower 32bits
let status = status as u32;
if status != 0 {
if status != SUCCESS {
let error: InstructionError = status.into();
warn!("BPF program failed: {:?}", error);
return Err(error);