piecrust icon indicating copy to clipboard operation
piecrust copied to clipboard

Improve WASM error processing - avoid Unknown when there is a wasm trap

Open miloszm opened this issue 1 year ago • 1 comments

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.

miloszm avatar Feb 06 '24 16:02 miloszm