Allow to distinguish out of gas from other traps (#4883)
* contracts: Allow to distinguish out of gas from other traps When a contract encounters a runtime error a wasm trap is triggered and the execution is halted. Currently, no matter what was the cause for the trap it is always reported as: DispatchError::Other("contract trapped during execution"). However, the trap that is triggered if a contract exhausts its gas budget is particulary interesting. Therefore we add a seperate error message for this cause: DispatchError::Other("ran out of gas during contract execution"). A test is added hat executes a contract that never terminates. Therefore it always exhausts is gas budget. * fixup! contracts: Allow to distinguish out of gas from other traps Remove overlong lines. * fixup! contracts: Allow to distinguish out of gas from other traps Rename Contract to Contracts
parent
5b7512e2
Showing
- substrate/bin/node/runtime/src/lib.rs 1 addition, 1 deletionsubstrate/bin/node/runtime/src/lib.rs
- substrate/frame/contracts/src/tests.rs 45 additions, 0 deletionssubstrate/frame/contracts/src/tests.rs
- substrate/frame/contracts/src/wasm/runtime.rs 67 additions, 11 deletionssubstrate/frame/contracts/src/wasm/runtime.rs
Please register or sign in to comment