Skip to content

Commit

Permalink
Handle the panic for pre-execution failure. (#2571)
Browse files Browse the repository at this point in the history
* Handle the panic for pre execution failed

* return VMPanicError if paniced
  • Loading branch information
steelgeek091 authored Sep 4, 2024
1 parent d390675 commit a2ed748
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions moveos/moveos/src/moveos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,15 @@ impl MoveOS {
if !is_system_call {
// system pre_execute
// we do not charge gas for system_pre_execute function
session
.execute_function_call(self.system_pre_execute_functions.clone(), false)
.expect("system_pre_execute should not fail.");
match session.execute_function_call(self.system_pre_execute_functions.clone(), false) {
Ok(_) => {}
Err(error) => {
log::warn!("System pre execution failed: {:?}", error);
return Err(Error::from(VMPanicError::SystemCallPanicError(
format_err!("Execute System Pre call Panic {:?}", error),
)));
}
}
}

match self.execute_action(&mut session, action.clone()) {
Expand Down

0 comments on commit a2ed748

Please sign in to comment.