Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
montyly opened this issue Dec 6, 2023 · 2 comments

Comments

@montyly
Copy link
Member

montyly commented Dec 6, 2023

Ex: maybe making a lib version?

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

@aviggiano
Copy link
Contributor

aviggiano commented Dec 6, 2023

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).

@montyly
Copy link
Member Author

montyly commented Dec 6, 2023

thanks @aviggiano ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants