piecrust
piecrust copied to clipboard
Improve WASM error processing - avoid Unknown when there is a wasm trap
Summary
Currently, soma runtime wasm traps are converted to ContractError::Unknown which is making problem diagnostics harder. It would be nice to have these kind of errors passed through back to contract call receipt. Currently, the receipt only contains ContractError::Unknown value with no further information.
Possible solution design or implementation
RuntimeError(wasm trap: out of bounds memory access) should be converted into some new value of ContractError, and not to ContractError::Unknown. This could be done in file imports.rs line 271: let c_err = ContractError::from(err)
Additional context
The issue was detected when troubleshooting errors in protected transfer contract method test.