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

[pull] main from a16z:main #32

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
dd1c549
fix: better handle build output parsing failures (#122)
daejunpark Jul 18, 2023
2343ab7
test: more regression tests + external tests (#121)
daejunpark Jul 18, 2023
5295e6f
fix: leverage better pytest output on failed tests (#123)
karmacoma-eth Jul 19, 2023
f885d12
chore: tweak counterexample formatting (#124)
karmacoma-eth Jul 19, 2023
9233311
ci: update external test script (#134)
daejunpark Jul 20, 2023
0b92223
feat: support natspec annotations (#133)
daejunpark Jul 21, 2023
fec4bba
feat: add basic runner for baolean/symexec-bench (#135)
karmacoma-eth Jul 21, 2023
690e3b4
test: add halmos-cheatcodes example test (#136)
daejunpark Jul 21, 2023
d3d2329
ci: add macos runner (#137)
daejunpark Jul 21, 2023
a7789e6
test: remove unused files (#138)
daejunpark Jul 21, 2023
50ebba8
test: add token examples (#139)
daejunpark Jul 22, 2023
d7e3a4e
fix: honor pranks during contract creation (#140)
karmacoma-eth Jul 22, 2023
959b3cd
feat: change default prefix to `check_` (#141)
daejunpark Jul 22, 2023
0b0a3c0
docs: add readme for examples (#142)
daejunpark Jul 24, 2023
a740005
fix: broken references to mk_add and mk_mul (#144)
karmacoma-eth Jul 24, 2023
24a56ea
fix: revert state (#143)
daejunpark Jul 25, 2023
5b4169e
docs: add solady verification example (#147)
daejunpark Jul 25, 2023
dbf7e33
docs: update authors/maintainers in pyproject (#146)
daejunpark Jul 25, 2023
ca2b3c3
fix: exitcode for all setup failures (#150)
daejunpark Jul 26, 2023
a9384a5
docs: update pyproject (#151)
daejunpark Jul 26, 2023
48e7800
docs: update halmos command in readme (#152)
rappie Jul 30, 2023
2444e34
docs: add getting started guide (#153)
daejunpark Aug 2, 2023
c40d259
chore: Readability tweaks (#155)
karmacoma-eth Aug 3, 2023
eb6e4a1
fix: test contract creation (#157)
daejunpark Aug 3, 2023
fc61d2f
chore: add explicit message when we find a library placeholder (#158)
karmacoma-eth Aug 3, 2023
6602b9d
feat: implement DELEGATECALL and CALLCODE (#159)
daejunpark Aug 5, 2023
399a7cb
feat: support struct type (#161)
daejunpark Aug 8, 2023
1bafa77
feat: add --no-test-constructor option (#162)
daejunpark Aug 8, 2023
c5a3f0d
feat: support CREATE2 (#163)
daejunpark Aug 8, 2023
dac3fde
perf: avoid unnecessary deepcopy (#164)
daejunpark Aug 8, 2023
5f19dbd
feat: library linking (#165)
lowprivuser Aug 9, 2023
1524d20
perf: cache BitVectorSorts and use reverse stack ordering (#166)
karmacoma-eth Aug 11, 2023
246b425
fix: include model in json output (#171)
karmacoma-eth Aug 15, 2023
d2c5d27
fix: enable SDIV when --smt-div is on (#174)
karmacoma-eth Aug 15, 2023
de57280
add NamedTimer class (#168)
karmacoma-eth Aug 16, 2023
5a246dd
feat: extended json output by default (#176)
daejunpark Aug 16, 2023
e3aea14
fix: improve unknown call resolution (#170)
daejunpark Aug 16, 2023
38904d8
feat: summarized warnings (#183)
daejunpark Aug 17, 2023
6be83f7
docs: update readme (#187)
daejunpark Aug 22, 2023
8eb41ba
feat: add `ffi` cheatcode (#185)
luksgrin Sep 12, 2023
933117a
feat: add support for custom storage layouts (#192)
daejunpark Sep 15, 2023
adcbe0d
ci: specify environment for publish job (#193)
daejunpark Sep 16, 2023
59ebac8
refactor: storage layout handling (#194)
karmacoma-eth Sep 16, 2023
c13095d
fix: resolving address alias for infeasible paths (#195)
daejunpark Sep 19, 2023
e16be9f
fix: bitwise opcode semantics (#196)
daejunpark Sep 20, 2023
5926a9d
feat: add custom solver options (#197)
daejunpark Sep 25, 2023
c1a175f
test: add nonlinear tests (#198)
daejunpark Sep 27, 2023
d5be133
feat: execution traces (#199)
karmacoma-eth Oct 10, 2023
9ae36d1
docs: add fork testing example (#202)
daejunpark Oct 10, 2023
3f72a02
feat: smt solving refinement (#203)
daejunpark Oct 12, 2023
bdbcf51
chore: update pyproject.toml (#206)
daejunpark Oct 12, 2023
4620b71
feat: nicer output (#209)
karmacoma-eth Oct 20, 2023
6666a32
handle SIGINT and SIGTERM (#210)
karmacoma-eth Oct 24, 2023
4d2793f
ffi: decode output as hex if it looks like a hexstring (#215)
karmacoma-eth Oct 31, 2023
380314a
perf: single solver shared by multiple paths (#218)
daejunpark Nov 29, 2023
96061cf
ci: disable long and external tests in pull request build (#222)
daejunpark Nov 29, 2023
7761573
fix: decoding storage mapping with bytes key (#221)
daejunpark Nov 29, 2023
dd266b2
test: increase branching timeout for setup of token tests (#224)
daejunpark Nov 30, 2023
b9bc79e
breaking change: drop support for python 3.8 (#226)
daejunpark Dec 7, 2023
f5733f0
fix: normalize extracts for overflow checks (#225)
daejunpark Dec 7, 2023
12e4749
fix: revert code and storage (#227)
daejunpark Dec 7, 2023
7bb84d2
fix: keccak256("") (#228)
daejunpark Dec 7, 2023
996be64
fix: trace generation for shared solver (#231)
daejunpark Dec 20, 2023
cf08f4f
ci: cache pip wheels (#232)
daejunpark Dec 20, 2023
0e19c51
ci: use python cache (#234)
daejunpark Dec 21, 2023
8a0f31f
ci: disable caches + pin z3 4.12.2 + update actions (#235)
daejunpark Dec 21, 2023
2228ead
dep(z3): pin 4.12.2 in pyproject (#236)
daejunpark Dec 21, 2023
a5a48df
feat: introduce other failure modes (#237)
daejunpark Dec 21, 2023
3421763
feat: add --match-test and --match-contract (#238)
daejunpark Dec 21, 2023
153d9fe
fix: byte check + console.log (#239)
karmacoma-eth Dec 22, 2023
33dcdda
fix: calldata rendering bugfix, large memory offset bugfix (#242)
karmacoma-eth Dec 23, 2023
70ddda2
docs: add multicaller example (#241)
daejunpark Dec 23, 2023
59fa228
fix: use consistent hex prefix handling (#246)
karmacoma-eth Jan 10, 2024
51aed0b
feat: dump refined queries (#250)
karmacoma-eth Feb 7, 2024
f5684c3
perf: small bytecode caching optimizations (#249)
karmacoma-eth Feb 7, 2024
6979a11
Add --build-info to forge build command (#255)
karmacoma-eth Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Migrate code style to Black
449404c7a2b318b8203dbccbeac11c87d20c422f
00cc14c20659cbf717594451dfc7906b295dca98
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: psf/black@stable
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ on:
jobs:
pypi:
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/test-external.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Test external projects

on:
push:
branches: [main]
# pull_request:
# branches: [main]
workflow_dispatch:

jobs:
test:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
include:
- repo: "morpho-org/morpho-data-structures"
dir: "morpho-data-structures"
cmd: "halmos --function testProve --loop 4 --symbolic-storage"
branch: ""
- repo: "a16z/cicada"
dir: "cicada"
cmd: "halmos --contract LibUint1024Test --function testProve --loop 256"
branch: ""
- repo: "a16z/cicada"
dir: "cicada"
cmd: "halmos --contract LibPrimeTest --function testProve --loop 256"
branch: ""
- repo: "farcasterxyz/contracts"
dir: "farcaster-contracts"
cmd: "halmos"
branch: ""
- repo: "zobront/halmos-solady"
dir: "halmos-solady"
cmd: "halmos --function testCheck"
branch: ""

steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: halmos
# we won't be needing tests/lib for this workflow
submodules: false

- name: Checkout external repo
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
path: ${{ matrix.dir }}
ref: ${{ matrix.branch }}
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: python -m pip install --upgrade pip

- name: Install Halmos
run: python -m pip install -e ./halmos

- name: Test external repo
run: ${{ matrix.cmd }} -v -st --solver-timeout-assertion 0 --solver-threads 2
working-directory: ${{ matrix.dir }}
41 changes: 41 additions & 0 deletions .github/workflows/test-ffi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test FFI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
include:
- testname: "tests/ffi"

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest

- name: Install Halmos
run: python -m pip install -e .

- name: Run pytest
run: pytest -v tests/test_halmos.py -k ${{ matrix.testname }} --halmos-options="--ffi -v -st --solver-timeout-assertion 0"
45 changes: 45 additions & 0 deletions .github/workflows/test-long.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test long

on:
push:
branches: [main]
# pull_request:
# branches: [main]
workflow_dispatch:

jobs:
test:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
include:
- testname: "tests/solver"
- testname: "examples/simple"
- testname: "examples/tokens/ERC20"
- testname: "examples/tokens/ERC721"

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest

- name: Install Halmos
run: python -m pip install -e .

- name: Run pytest
run: pytest -x -v tests/test_halmos.py -k ${{ matrix.testname }} --halmos-options="-v -st --solver-timeout-assertion 0 --solver-threads 2" -s --log-cli-level=
25 changes: 10 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,33 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-2022"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.8.13", "3.9.13", "3.10.6"]
parallel: ["", "--test-parallel", "--solver-parallel", "--test-parallel --solver-parallel"]
exclude:
# python 3.8.13 is not available in windows-2022
- os: "windows-2022"
python-version: "3.8.13"
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11"]
parallel: ["", "--test-parallel"]
storage-layout: ["solidity", "generic"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
python -m pip install pytest

- name: Install Halmos
run: pip install -e .
run: python -m pip install -e .

- name: Run pytest
run: pytest

- name: Test Halmos
run: halmos --root tests --symbolic-storage --function test ${{ matrix.parallel }}
run: pytest -v -k "not long and not ffi" --ignore=tests/lib --halmos-options="-v -st ${{ matrix.parallel }} --storage-layout ${{ matrix.storage-layout }} --solver-timeout-assertion 0"
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ env/
venv/

# Foundry build files
*/cache/
*/out/
cache/
out/
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
[submodule "tests/lib/forge-std"]
path = tests/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "tests/lib/halmos-cheatcodes"]
path = tests/lib/halmos-cheatcodes
url = https://github.com/a16z/halmos-cheatcodes
[submodule "tests/lib/openzeppelin-contracts"]
path = tests/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "tests/lib/solmate"]
path = tests/lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "tests/lib/solady"]
path = tests/lib/solady
url = https://github.com/Vectorized/solady
[submodule "tests/lib/multicaller"]
path = tests/lib/multicaller
url = https://github.com/Vectorized/multicaller
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Contributing to Halmos

We greatly appreciate your feedback, suggestions, and contributions to make Halmos a better tool for everyone!

Join the [Halmos Telegram Group][chat] for any inquiries or further discussions.

[chat]: <https://t.me/+4UhzHduai3MzZmUx>

## Development Setup

If you want to submit a pull request, fork the repository:

```sh
gh repo fork a16z/halmos
```

Or, if you just want to develop locally, clone it:

```sh
git clone [email protected]:a16z/halmos.git
```

Create and activate a virtual environment:

```sh
python3.11 -m venv .venv
source .venv/bin/activate
```

Install the dependencies:

```sh
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
```

Install and run the git hook scripts:

```sh
pre-commit install
pre-commit run --all-files
```

## Coding Style

We recommend enabling the [black] formatter in your editor, but you can run it manually if needed:

```sh
python -m black .
```

[black]: <https://black.readthedocs.io/en/stable/>

## License

By contributing, you agree that your contributions will be licensed under its [AGPL-3.0](LICENSE) License.

## Disclaimer

_These smart contracts and code are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts and code. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions or loss of transmitted information. THE SMART CONTRACTS AND CODE CONTAINED HEREIN ARE FURNISHED AS IS, WHERE IS, WITH ALL FAULTS AND WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY, NON-INFRINGEMENT OR FITNESS FOR ANY PARTICULAR PURPOSE. Further, use of any of these smart contracts and code may be restricted or prohibited under applicable law, including securities laws, and it is therefore strongly advised for you to contact a reputable attorney in any jurisdiction where these smart contracts and code may be accessible for any questions or concerns with respect thereto. Further, no information provided in this repo should be construed as investment advice or legal advice for any particular facts or circumstances, and is not meant to replace competent counsel. a16z is not liable for any use of the foregoing, and users should proceed with caution and use at their own risk. See a16z.com/disclosures for more info._
Loading
Loading