Add PubkeyError for ProgramError (#10748)
This commit is contained in:
@ -35,6 +35,9 @@ extern uint64_t entrypoint(const uint8_t *input) {
|
||||
case(6):
|
||||
sol_log("return unknown builtin");
|
||||
return TO_BUILTIN(50);
|
||||
case(9):
|
||||
sol_log("return pubkey error");
|
||||
return MAX_SEED_LENGTH_EXCEEDED;
|
||||
default:
|
||||
sol_log("Unrecognized command");
|
||||
return ERROR_INVALID_INSTRUCTION_DATA;
|
||||
|
@ -10,7 +10,7 @@ use solana_sdk::{
|
||||
entrypoint::ProgramResult,
|
||||
info,
|
||||
program_error::{PrintProgramError, ProgramError},
|
||||
pubkey::Pubkey,
|
||||
pubkey::{Pubkey, PubkeyError},
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
@ -73,6 +73,10 @@ fn process_instruction(
|
||||
assert_eq!(*data, *data2);
|
||||
Ok(())
|
||||
}
|
||||
9 => {
|
||||
info!("return pubkey error");
|
||||
Err(PubkeyError::MaxSeedLengthExceeded.into())
|
||||
}
|
||||
_ => {
|
||||
info!("Unsupported");
|
||||
Err(ProgramError::InvalidInstructionData)
|
||||
|
@ -301,6 +301,14 @@ mod bpf {
|
||||
result.unwrap_err().unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::InvalidInstructionData)
|
||||
);
|
||||
|
||||
let instruction = Instruction::new(program_id, &9u8, account_metas.clone());
|
||||
let result = bank_client.send_instruction(&mint_keypair, instruction);
|
||||
assert_eq!(
|
||||
result.unwrap_err().unwrap(),
|
||||
TransactionError::InstructionError(0, InstructionError::MaxSeedLengthExceeded)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user