Skip to content

Commit

Permalink
sc-executor-polkavm: fix exception handling in call_with_allocation_s…
Browse files Browse the repository at this point in the history
…tats()

Signed-off-by: Jarkko Sakkinen <[email protected]>
  • Loading branch information
jarkkojs committed Nov 21, 2024
1 parent 5b37507 commit 0582e94
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions substrate/client/executor/polkavm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,22 @@ impl WasmInstance for Instance {
}

match self.0.call_typed(&mut (), name, (data_pointer, raw_data_length)) {
Ok(()) => (),
Err(polkavm::CallError::Trap) => (),
Ok(()) => {},
Err(polkavm::CallError::Trap) => {
return (
Err(format!("call into the runtime method '{name}' failed: trap").into()),
None,
);
},
Err(polkavm::CallError::Error(error)) => {
return (
Err(format!("call into the runtime method '{name}' failed: {error}").into()),
None,
);
},
Err(polkavm::CallError::NotEnoughGas) =>
unreachable!("NotEnoughGas error has not been implemented"),
Err(polkavm::CallError::User(_)) => unreachable!("User error has not been implemented"),
}
Err(polkavm::CallError::NotEnoughGas) => unreachable!("gas metering is never enabled"),
Err(polkavm::CallError::User(_)) => unreachable!(),
};

let result_pointer = self.0.reg(Reg::A0);
let result_length = self.0.reg(Reg::A1);
Expand Down

0 comments on commit 0582e94

Please sign in to comment.