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

add snapshots to CI with tolerance #401

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FOUNDRY_FUZZ_SEED=0x4444
1 change: 0 additions & 1 deletion .forge-snapshots/swap with native.snap

This file was deleted.

328 changes: 328 additions & 0 deletions .gas-snapshot

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
with:
version: nightly

- name: Compile
- name: Lint
run: forge fmt --check
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ jobs:
with:
version: nightly

- name: Build
run: forge build

- name: Run tests
run: forge test -vvv
env:
FOUNDRY_PROFILE: ci

- name: Run forge snapshots
run: forge snapshot --check --tolerance 5
env:
FOUNDRY_FUZZ_SEED: "0x4444"
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ All contributions must follow the below standards. Maintainers will close out PR

## Tests

`forge snapshot`to update the forge gas snapshots
`forge snapshot`to update the forge gas snapshots. Note these must use a static fuzz seed, so please `source .env`, use `FOUNDRY_FUZZ_SEED=0x4444`, or use `just snapshots` when running forge snapshots.

`forge test` to run forge tests

Expand Down
8 changes: 6 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ ffi = true
fs_permissions = [{ access = "read-write", path = ".forge-snapshots/"}, { access = "read", path = "./out"}]
evm_version = 'paris'

[profile.ci]
fuzz_runs = 100000
[profile.default.fuzz]
runs = 100
seed = "0x4444"

[profile.ci.fuzz]
runs = 1000

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-forge: install-forge
forge build

snapshots-forge: install-forge test-forge
forge snapshot
FOUNDRY_FUZZ_SEED=0x4444 forge snapshot

install-forge:
forge install
Expand Down