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
This commit is contained in:
Alexander Theißen
2020-02-14 11:46:45 +01:00
committed by GitHub
parent 5b7512e2e4
commit b999911bcf
3 changed files with 113 additions and 12 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 218,
spec_version: 219,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
};