-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(invariant): decode custom error with target contract abis (#7559)
* fix(invariant): decode custom error with target contract abis * Changes after review: don't collect
- Loading branch information
Showing
5 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
testdata/default/fuzz/invariant/common/InvariantCustomError.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
import "ds-test/test.sol"; | ||
import "cheats/Vm.sol"; | ||
|
||
contract ContractWithCustomError { | ||
error InvariantCustomError(uint256, string); | ||
|
||
function revertWithInvariantCustomError() external { | ||
revert InvariantCustomError(111, "custom"); | ||
} | ||
} | ||
|
||
contract Handler is DSTest { | ||
ContractWithCustomError target; | ||
|
||
constructor() { | ||
target = new ContractWithCustomError(); | ||
} | ||
|
||
function revertTarget() external { | ||
target.revertWithInvariantCustomError(); | ||
} | ||
} | ||
|
||
contract InvariantCustomError is DSTest { | ||
Handler handler; | ||
|
||
function setUp() external { | ||
handler = new Handler(); | ||
} | ||
|
||
function invariant_decode_error() public {} | ||
} |