Merge InstructionError and ProgramError
From the user's perspective, it's just an instruction error. For program-specific errors, we still have InstructionError::CustomError.
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
use bincode::deserialize;
|
||||
use log::*;
|
||||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::solana_entrypoint;
|
||||
use solana_sdk::transaction::InstructionError;
|
||||
use solana_vote_api::vote_instruction::VoteInstruction;
|
||||
use solana_vote_api::vote_state;
|
||||
|
||||
@@ -16,13 +16,13 @@ fn entrypoint(
|
||||
keyed_accounts: &mut [KeyedAccount],
|
||||
data: &[u8],
|
||||
_tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
) -> Result<(), InstructionError> {
|
||||
solana_logger::setup();
|
||||
|
||||
trace!("process_instruction: {:?}", data);
|
||||
trace!("keyed_accounts: {:?}", keyed_accounts);
|
||||
|
||||
match deserialize(data).map_err(|_| ProgramError::InvalidInstructionData)? {
|
||||
match deserialize(data).map_err(|_| InstructionError::InvalidInstructionData)? {
|
||||
VoteInstruction::InitializeAccount => vote_state::initialize_account(keyed_accounts),
|
||||
VoteInstruction::DelegateStake(delegate_id) => {
|
||||
vote_state::delegate_stake(keyed_accounts, &delegate_id)
|
||||
|
@@ -1,7 +1,6 @@
|
||||
use solana_runtime::bank::{Bank, Result};
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::hash::hash;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::system_instruction::SystemInstruction;
|
||||
@@ -134,7 +133,7 @@ fn test_vote_via_bank_with_no_signature() {
|
||||
result,
|
||||
Err(TransactionError::InstructionError(
|
||||
1,
|
||||
InstructionError::ProgramError(ProgramError::InvalidArgument)
|
||||
InstructionError::InvalidArgument
|
||||
))
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user