properties icon indicating copy to clipboard operation
properties copied to clipboard

PropertiesHelper: Investigation solutions to not collude with forge-st/Test.sol's assertion

Open montyly opened this issue 2 years ago • 2 comments

Ex: maybe making a lib version?

See https://twitter.com/agfviggiano/status/1732328333105418326

montyly avatar Dec 06 '23 13:12 montyly

See POC: https://github.com/aviggiano/forge-crytic-properties-poc

[I] ➜ forge test
[⠒] Compiling...
[⠑] Compiling 25 files with 0.8.21
[⠘] Solc 0.8.21 finished in 437.32ms
Error:
Compiler run failed:
Error (6480): Derived contract must override function "assertEq". Two or more base classes define function with same name and parameter types.
 --> test/Counter.t.sol:8:1:
  |
8 | contract CounterTest is Test, PropertiesAsserts {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "DSTest":
   --> lib/forge-std/lib/ds-test/src/test.sol:151:5:
    |
151 |     function assertEq(int a, int b, string memory err) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "PropertiesAsserts":
  --> lib/properties/contracts/util/PropertiesHelper.sol:35:5:
   |
35 |     function assertEq(int256 a, int256 b, string memory reason) internal {
   |     ^ (Relevant source part starts here and spans across multiple lines).

Error (6480): Derived contract must override function "assertEq". Two or more base classes define function with same name and parameter types.
 --> test/Counter.t.sol:8:1:
  |
8 | contract CounterTest is Test, PropertiesAsserts {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "DSTest":
   --> lib/forge-std/lib/ds-test/src/test.sol:165:5:
    |
165 |     function assertEq(uint a, uint b, string memory err) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "PropertiesAsserts":
  --> lib/properties/contracts/util/PropertiesHelper.sol:24:5:
   |
24 |     function assertEq(uint256 a, uint256 b, string memory reason) internal {
   |     ^ (Relevant source part starts here and spans across multiple lines).

Error (6480): Derived contract must override function "assertGt". Two or more base classes define function with same name and parameter types.
 --> test/Counter.t.sol:8:1:
  |
8 | contract CounterTest is Test, PropertiesAsserts {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "DSTest":
   --> lib/forge-std/lib/ds-test/src/test.sol:315:5:
    |
315 |     function assertGt(int a, int b, string memory err) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "PropertiesAsserts":
   --> lib/properties/contracts/util/PropertiesHelper.sol:101:5:
    |
101 |     function assertGt(int256 a, int256 b, string memory reason) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).

Error (6480): Derived contract must override function "assertGt". Two or more base classes define function with same name and parameter types.
 --> test/Counter.t.sol:8:1:
  |
8 | contract CounterTest is Test, PropertiesAsserts {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "DSTest":
   --> lib/forge-std/lib/ds-test/src/test.sol:301:5:
    |
301 |     function assertGt(uint a, uint b, string memory err) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "PropertiesAsserts":
  --> lib/properties/contracts/util/PropertiesHelper.sol:90:5:
   |
90 |     function assertGt(uint256 a, uint256 b, string memory reason) internal {
   |     ^ (Relevant source part starts here and spans across multiple lines).

Error (6480): Derived contract must override function "assertLt". Two or more base classes define function with same name and parameter types.
 --> test/Counter.t.sol:8:1:
  |
8 | contract CounterTest is Test, PropertiesAsserts {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "DSTest":
   --> lib/forge-std/lib/ds-test/src/test.sol:429:5:
    |
429 |     function assertLt(int a, int b, string memory err) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "PropertiesAsserts":
   --> lib/properties/contracts/util/PropertiesHelper.sol:145:5:
    |
145 |     function assertLt(int256 a, int256 b, string memory reason) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).

Error (6480): Derived contract must override function "assertLt". Two or more base classes define function with same name and parameter types.
 --> test/Counter.t.sol:8:1:
  |
8 | contract CounterTest is Test, PropertiesAsserts {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "DSTest":
   --> lib/forge-std/lib/ds-test/src/test.sol:415:5:
    |
415 |     function assertLt(uint a, uint b, string memory err) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).
Note: Definition in "PropertiesAsserts":
   --> lib/properties/contracts/util/PropertiesHelper.sol:134:5:
    |
134 |     function assertLt(uint256 a, uint256 b, string memory reason) internal {
    |     ^ (Relevant source part starts here and spans across multiple lines).

aviggiano avatar Dec 06 '23 14:12 aviggiano

thanks @aviggiano ;)

montyly avatar Dec 06 '23 15:12 montyly