contracts: New contract events + unconfusions (#4685)

* contracts: during execution -> contract trapped during execution

This message confused many people so we are improving it to make clear what happened.

* contracts: rename Event::Contract -> Event::ContractExecution

* contracts: fix tests after ContractExecution renaming

* contracts: Add Evicted and Restored events

* fix doc comment

* wrap to not go over (soft) 100 column line limit

* add event deposit for eventual eviction upon pay_rent

* contracts: adjust tests for the new events

* emit Evicted event immediately and add tombstone flag bool
This commit is contained in:
Hero Bird
2020-01-21 13:06:54 +01:00
committed by Sergei Pepyakin
parent 169a48c0c5
commit caa6efa5ec
6 changed files with 131 additions and 13 deletions
+4 -2
View File
@@ -1430,7 +1430,9 @@ mod tests {
MockExt::default(),
&mut gas_meter
),
Err(ExecError { reason: DispatchError::Other("during execution"), buffer: _ })
Err(ExecError {
reason: DispatchError::Other("contract trapped during execution"), buffer: _
})
);
}
@@ -1472,7 +1474,7 @@ mod tests {
MockExt::default(),
&mut gas_meter
),
Err(ExecError { reason: DispatchError::Other("during execution"), buffer: _ })
Err(ExecError { reason: DispatchError::Other("contract trapped during execution"), buffer: _ })
);
}
@@ -109,7 +109,7 @@ pub(crate) fn to_execution_result<E: Ext>(
Err(ExecError { reason: "validation error".into(), buffer: runtime.scratch_buf }),
// Any other kind of a trap should result in a failure.
Err(sp_sandbox::Error::Execution) | Err(sp_sandbox::Error::OutOfBounds) =>
Err(ExecError { reason: "during execution".into(), buffer: runtime.scratch_buf }),
Err(ExecError { reason: "contract trapped during execution".into(), buffer: runtime.scratch_buf }),
}
}