Add InstructionError for runtime instruction errors
This commit is contained in:
@ -208,8 +208,8 @@ impl BankingStage {
|
||||
.zip(txs.iter())
|
||||
.filter_map(|(r, x)| match r {
|
||||
Ok(_) => Some(x.clone()),
|
||||
Err(BankError::ProgramError(index, err)) => {
|
||||
info!("program error {:?}, {:?}", index, err);
|
||||
Err(BankError::InstructionError(index, err)) => {
|
||||
info!("instruction error {:?}, {:?}", index, err);
|
||||
Some(x.clone())
|
||||
}
|
||||
Err(ref e) => {
|
||||
@ -445,6 +445,7 @@ mod tests {
|
||||
use crate::entry::EntrySlice;
|
||||
use crate::packet::to_packets;
|
||||
use crate::poh_recorder::WorkingBank;
|
||||
use solana_runtime::runtime::InstructionError;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
@ -682,9 +683,9 @@ mod tests {
|
||||
assert_eq!(entries[0].0.transactions.len(), transactions.len());
|
||||
|
||||
// ProgramErrors should still be recorded
|
||||
results[0] = Err(BankError::ProgramError(
|
||||
results[0] = Err(BankError::InstructionError(
|
||||
1,
|
||||
ProgramError::ResultWithNegativeLamports,
|
||||
InstructionError::ProgramError(ProgramError::ResultWithNegativeLamports),
|
||||
));
|
||||
BankingStage::record_transactions(&transactions, &results, &poh_recorder).unwrap();
|
||||
let (_, entries) = entry_receiver.recv().unwrap();
|
||||
|
@ -263,7 +263,9 @@ impl RpcSol for RpcSolImpl {
|
||||
Ok(_) => RpcSignatureStatus::Confirmed,
|
||||
Err(BankError::AccountInUse) => RpcSignatureStatus::AccountInUse,
|
||||
Err(BankError::AccountLoadedTwice) => RpcSignatureStatus::AccountLoadedTwice,
|
||||
Err(BankError::ProgramError(_, _)) => RpcSignatureStatus::ProgramRuntimeError,
|
||||
Err(BankError::InstructionError(_, _)) => {
|
||||
RpcSignatureStatus::ProgramRuntimeError
|
||||
}
|
||||
Err(err) => {
|
||||
trace!("mapping {:?} to GenericFailure", err);
|
||||
RpcSignatureStatus::GenericFailure
|
||||
|
@ -99,7 +99,7 @@ impl RpcSubscriptions {
|
||||
let status = match bank_error {
|
||||
Ok(_) => RpcSignatureStatus::Confirmed,
|
||||
Err(BankError::AccountInUse) => RpcSignatureStatus::AccountInUse,
|
||||
Err(BankError::ProgramError(_, _)) => RpcSignatureStatus::ProgramRuntimeError,
|
||||
Err(BankError::InstructionError(_, _)) => RpcSignatureStatus::ProgramRuntimeError,
|
||||
Err(_) => RpcSignatureStatus::GenericFailure,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user