mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-11-15 07:07:16 +00:00
Added 2 options to control expected result to revive-runner (#438)
Added 2 options to control expected result to `revive-runner`:
```
--verify-failure <VERIFY_FAILURE>
The expected call result of the contract execution
Possible values:
- instantiate: The contract instantiation must fail
- call: The contract execution must fail
--verify-call-gas-consumed <VERIFY_CALL_GAS_CONSUMED>
The expected amount of consumed gas by the contract execution
```
---------
Co-authored-by: xermicus <bigcyrill@hotmail.com>
This commit is contained in:
1 parent
4c85a3113d
commit
540ec03cd7
2 files changed
+36
-3
No files matched your search
@@ -127,7 +127,7 @@ impl ExtBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/// Expectation for a call
|
||||
/// Expectation for a call. This struct is initialized by the user and compared to the actual call result.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct VerifyCallExpectation {
|
||||
/// When provided, the expected gas consumed
|
||||
@@ -135,7 +135,7 @@ pub struct VerifyCallExpectation {
|
||||
/// When provided, the expected output
|
||||
#[serde(default, with = "hex")]
|
||||
pub output: OptionalHex<Vec<u8>>,
|
||||
///Expected call result
|
||||
/// Expected call result
|
||||
pub success: bool,
|
||||
}
|
||||
|
||||
@@ -190,6 +190,7 @@ impl Default for VerifyCallExpectation {
|
||||
impl VerifyCallExpectation {
|
||||
/// Verify that the expectations are met
|
||||
fn verify(self, result: &CallResult) {
|
||||
// Check if the call was successful. Here `self.success` is an expectation given by the user and `result` is the actual call result.
|
||||
assert_eq!(
|
||||
self.success,
|
||||
!result.did_revert(),
|
||||
|
||||
Reference in new issue
Block a user