Skip to content

perf: optimize runtime gas cost for LSP6 + LSP20 #1319

perf: optimize runtime gas cost for LSP6 + LSP20

perf: optimize runtime gas cost for LSP6 + LSP20 #1319

Workflow file for this run

name: Foundry tests & Report gas diff
on:
pull_request:
# compare gas diff only when editing Solidity smart contract code
paths:
- "contracts/**/*.sol"
- "tests/foundry/**/*.sol"
jobs:
foundry-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- name: NPM Install
run: npm ci
- name: NPM build
run: npx hardhat compile
- name: Run Foundry tests
run: npm run test:foundry
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 }}
- name: Compare gas reports
uses: Rubilmax/[email protected]
with:
summaryQuantile: 0.9 # 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
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 }}