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 snapshot to CI #331

Closed
wants to merge 25 commits into from
Closed
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
317 changes: 317 additions & 0 deletions .gas-snapshot

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
with:
version: nightly

- name: Compile
run: yarn prettier-check
- 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 @@ -52,7 +52,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
env:
FOUNDRY_FUZZ_SEED: "0x4444"
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Finally, before opening a pull request please do the following:
- Run the tests and snapshots. Commands are outlined in the [tests](#tests) section.
- Document any new functions, structs, or interfaces following the natspec standard.
- Add tests! For smaller contributions, they should be tested with unit tests, and fuzz tests where possible. For bigger contributions, they should be tested with integration tests and invariant tests where possible.
- Make sure all commits are [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)
- Make sure all commits are [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)

## Standards

Expand Down Expand Up @@ -62,7 +62,7 @@ This repo currently uses hardhat and forge tests. Please run both test suites be

`yarn prettier` to run the formatter (runs both typescript and solidity formatting)

`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 @@ -8,7 +8,11 @@ ffi = true
fs_permissions = [{ access = "read-write", path = ".forge-snapshots/"}, { access = "read", path = "./foundry-out"}]
evm_version = 'paris'

[profile.ci]
fuzz_runs = 100000
[profile.default.fuzz]
runs = 100
snreynolds marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -15,7 +15,7 @@ build-hardhat: install-hardhat
yarn build

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

snapshots-hardhat: install-hardhat
yarn snapshots
Expand Down