Refactor - Minor fixes in the error handling of executing tombstones (#33145)
Minor fixes in the error handling of executing tombstones.
This commit is contained in:
parent
efb6846fe7
commit
05622c17da
|
@ -498,12 +498,10 @@ fn process_instruction_inner(
|
|||
let mut get_or_create_executor_time = Measure::start("get_or_create_executor_time");
|
||||
let executor = invoke_context
|
||||
.find_program_in_cache(program_account.get_key())
|
||||
.ok_or(InstructionError::InvalidAccountData)?;
|
||||
|
||||
if executor.is_tombstone() {
|
||||
return Err(Box::new(InstructionError::InvalidAccountData));
|
||||
}
|
||||
|
||||
.ok_or_else(|| {
|
||||
ic_logger_msg!(log_collector, "Program is not cached");
|
||||
InstructionError::InvalidAccountData
|
||||
})?;
|
||||
drop(program_account);
|
||||
get_or_create_executor_time.stop();
|
||||
saturating_add_assign!(
|
||||
|
@ -516,6 +514,7 @@ fn process_instruction_inner(
|
|||
LoadedProgramType::FailedVerification(_)
|
||||
| LoadedProgramType::Closed
|
||||
| LoadedProgramType::DelayVisibility => {
|
||||
ic_logger_msg!(log_collector, "Program is not deployed");
|
||||
Err(Box::new(InstructionError::InvalidAccountData) as Box<dyn std::error::Error>)
|
||||
}
|
||||
LoadedProgramType::LegacyV0(executable) => execute(executable, invoke_context),
|
||||
|
|
|
@ -595,11 +595,10 @@ pub fn process_instruction_inner(
|
|||
let mut get_or_create_executor_time = Measure::start("get_or_create_executor_time");
|
||||
let loaded_program = invoke_context
|
||||
.find_program_in_cache(program.get_key())
|
||||
.ok_or(InstructionError::InvalidAccountData)?;
|
||||
|
||||
if loaded_program.is_tombstone() {
|
||||
return Err(Box::new(InstructionError::InvalidAccountData));
|
||||
}
|
||||
.ok_or_else(|| {
|
||||
ic_logger_msg!(log_collector, "Program is not cached");
|
||||
InstructionError::InvalidAccountData
|
||||
})?;
|
||||
get_or_create_executor_time.stop();
|
||||
saturating_add_assign!(
|
||||
invoke_context.timings.get_or_create_executor_us,
|
||||
|
@ -613,6 +612,7 @@ pub fn process_instruction_inner(
|
|||
LoadedProgramType::FailedVerification(_)
|
||||
| LoadedProgramType::Closed
|
||||
| LoadedProgramType::DelayVisibility => {
|
||||
ic_logger_msg!(log_collector, "Program is not deployed");
|
||||
Err(Box::new(InstructionError::InvalidAccountData) as Box<dyn std::error::Error>)
|
||||
}
|
||||
LoadedProgramType::Typed(executable) => execute(invoke_context, executable),
|
||||
|
|
Loading…
Reference in New Issue