FrontRun mitigation (ETH-1583, ETH-1646) (#249) #30
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
name: Report gas diff | |
on: | |
push: | |
paths: | |
- "contracts/**" | |
- "lib/**" | |
- ".github/**" | |
jobs: | |
compare_gas_reports: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: onbjerg/foundry-toolchain@v1 | |
with: | |
version: nightly | |
# Add any step generating a gas report to a temporary file named gasreport.ansi. For example: | |
- name: Run tests | |
run: forge test --gas-report > gasreport.ansi | |
env: | |
# make fuzzing semi-deterministic to avoid noisy gas cost estimation | |
# due to non-deterministic fuzzing (but still use pseudo-random fuzzing seeds) | |
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }} | |
MAINNET_FORK_RPC_URL: ${{ secrets.MAINNET_FORK_RPC_URL }} | |
- name: Compare gas reports | |
uses: Rubilmax/[email protected] | |
with: | |
summaryQuantile: 0.01 # only display the 10% most significant gas diffs in the summary (defaults to 20%) | |
sortCriteria: avg,max # sort diff rows by criteria | |
sortOrders: desc,asc # and directions | |
ignore: test-foundry/**/*,test/**/* # filter out gas reports from specific paths (test/ is included by default) | |
base: main # branch to compare against (defaults to current branch) | |
id: gas_diff | |
- name: Add gas diff to sticky comment | |
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
# delete the comment in case changes no longer impact gas costs | |
delete: ${{ !steps.gas_diff.outputs.markdown }} | |
message: ${{ steps.gas_diff.outputs.markdown }} |