-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💥 Add
echidna
-Based Property Tests (#239)
### 🕓 Changelog This PR adds the `echidna`-based [property](https://github.com/crytic/properties) tests for the `ERC20` and `ERC721` contracts (closes #184). The `ERC4626` properties are not integrated as they are already covered by [`erc4626-tests`](https://github.com/a16z/erc4626-tests). Please note that [`hevm`](https://github.com/ethereum/hevm) doesn't strip whitespace characters (!) and since Foundry doesn't easily allow for piping of commands, I wrote a Python scripts [`compile.py`](https://github.com/pcaversaccio/snekmate/blob/feat/echidna/lib/utils/compile.py) that strips away all whitespace characters. --------- Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
- Loading branch information
1 parent
a070840
commit afcf7cc
Showing
21 changed files
with
566 additions
and
308 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ jobs: | |
- ubuntu-latest | ||
language: | ||
- javascript-typescript | ||
- python | ||
|
||
steps: | ||
- name: Checkout | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,7 @@ dist | |
|
||
# Ape build files | ||
.build | ||
|
||
# Echidna files | ||
echidna-corpus | ||
crytic-export |
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
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
Submodule properties
added at
58fcb6
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import sys, subprocess | ||
|
||
result = subprocess.run(["vyper"] + sys.argv[1:], capture_output=True, text=True) | ||
if result.returncode != 0: | ||
raise Exception("Error compiling: " + sys.argv[1]) | ||
|
||
# Remove any leading and trailing whitespace characters | ||
# from the compilation result. | ||
sys.stdout.write(result.stdout.strip()) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: WTFPL | ||
pragma solidity ^0.8.25; | ||
|
||
import {VyperDeployer} from "utils/VyperDeployer.sol"; | ||
|
||
import {ITokenMock} from "properties/ERC20/external/util/ITokenMock.sol"; | ||
|
||
import {CryticERC20ExternalBasicProperties} from "properties/ERC20/external/properties/ERC20ExternalBasicProperties.sol"; | ||
import {CryticERC20ExternalBurnableProperties} from "properties/ERC20/external/properties/ERC20ExternalBurnableProperties.sol"; | ||
import {CryticERC20ExternalMintableProperties} from "properties/ERC20/external/properties/ERC20ExternalMintableProperties.sol"; | ||
|
||
contract CryticERC20ExternalHarness is | ||
CryticERC20ExternalBasicProperties, | ||
CryticERC20ExternalBurnableProperties, | ||
CryticERC20ExternalMintableProperties | ||
{ | ||
string private constant _NAME = "MyToken"; | ||
string private constant _SYMBOL = "WAGMI"; | ||
uint8 private constant _DECIMALS = 18; | ||
string private constant _NAME_EIP712 = "MyToken"; | ||
string private constant _VERSION_EIP712 = "1"; | ||
uint256 private constant _INITIAL_SUPPLY = type(uint8).max; | ||
|
||
VyperDeployer private vyperDeployer = new VyperDeployer(); | ||
|
||
constructor() { | ||
bytes memory args = abi.encode( | ||
_NAME, | ||
_SYMBOL, | ||
_DECIMALS, | ||
_INITIAL_SUPPLY, | ||
_NAME_EIP712, | ||
_VERSION_EIP712 | ||
); | ||
token = ITokenMock( | ||
vyperDeployer.deployContract( | ||
"src/snekmate/tokens/mocks/", | ||
"ERC20Mock", | ||
args | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.