-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💥 Add
halmos
-Based Symbolic Tests (#240)
### 🕓 Changelog This PR adds [`halmos`](https://github.com/a16z/halmos)-based symbolic tests for the `erc20`, `erc721`, `erc1155`, and `math` contracts (closes #180). The `erc721` and `erc1155` tests each take substantial amount of time as part of the CI. Hence, we run the new `halmos` CI pipeline each day at 03:30 a.m. (= "nightly" tests) as scheduled `cron` job instead of integrating it into the normal `push` and `pull_request` pipeline. Furthermore, the `halmos`-based `math` tests `testHalmosAssertMulDiv`, `testHalmosAssertWadLn`, `testHalmosAssertWadExp`, `testHalmosAssertCbrt`, and `testHalmosAssertWadCbrt` face out of memory issues as the timeout for the Z3 solver does not work for the queries of these tests. Thus, these tests are currently commented out. Additionally, the test `testHalmosAssertNoBackdoor` in the `erc721` and `erc1155` contracts is currently commented out due to performance and reverting path issues in `halmos`. Eventually, we target the `main` `halmos` branch (= "nightly" version) in the CI pipeline and use the [Yices 2 SMT solver](https://github.com/SRI-CSL/yices2). --------- Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
- Loading branch information
1 parent
f20faf7
commit 459ec3f
Showing
28 changed files
with
1,223 additions
and
219 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
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,87 @@ | ||
name: 👁️ Halmos symbolic tests | ||
|
||
on: | ||
schedule: | ||
- cron: "30 3 * * *" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
halmos-tests: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
python_version: | ||
- 3.12 | ||
architecture: | ||
- x64 | ||
halmos: | ||
- "--function testHalmos --storage-layout generic --solver-command=yices-smt2 --solver-parallel --test-parallel --early-exit --ffi --statistics -v" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
architecture: ${{ matrix.architecture }} | ||
|
||
- name: Install Vyper | ||
run: pip install git+https://github.com/vyperlang/vyper.git@master | ||
|
||
- name: Show the Vyper version | ||
run: vyper --version | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Install `setuptools` | ||
run: pip install setuptools | ||
|
||
- name: Install Halmos | ||
run: pip install git+https://github.com/a16z/halmos.git@main | ||
|
||
- name: Show the Halmos version | ||
run: halmos --version | ||
|
||
- name: Install Homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
|
||
- name: Install Yices 2 SMT solver | ||
run: brew install SRI-CSL/sri-csl/yices2 | ||
|
||
- name: Show the Foundry Halmos config | ||
run: forge config | ||
env: | ||
FOUNDRY_PROFILE: halmos | ||
|
||
- name: Run Halmos ERC-20 symbolic tests | ||
run: halmos --contract ERC20TestHalmos ${{ matrix.halmos }} | ||
env: | ||
FOUNDRY_PROFILE: halmos | ||
|
||
- name: Run Halmos ERC-721 symbolic tests | ||
run: halmos --contract ERC721TestHalmos ${{ matrix.halmos }} | ||
env: | ||
FOUNDRY_PROFILE: halmos | ||
|
||
- name: Run Halmos ERC-1155 symbolic tests | ||
run: halmos --contract ERC1155TestHalmos ${{ matrix.halmos }} | ||
env: | ||
FOUNDRY_PROFILE: halmos | ||
|
||
- name: Run Halmos math symbolic tests | ||
run: halmos --contract MathTestHalmos ${{ matrix.halmos }} | ||
env: | ||
FOUNDRY_PROFILE: halmos |
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
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 halmos-cheatcodes
added at
c0d865
Oops, something went wrong.