fork rate calculation and target0 address fixes #5245
Workflow file for this run
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: Benchmark | |
on: | |
push: | |
pull_request: | |
merge_group: | |
jobs: | |
detect-changes: | |
uses: ./.github/workflows/check_diff.yaml | |
with: | |
pattern: ^contracts/\|^test/\|^lib/\|^foundry\.toml$\|^python/gas_benchmarks\.py$\|^\.github/workflows/benchmark\.yml$ | |
benchmark: | |
name: benchmark | |
runs-on: ubuntu-latest-16core | |
needs: detect-changes | |
if: needs.detect-changes.outputs.changed == 'true' | |
env: | |
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} | |
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} | |
steps: | |
# Install the dependencies. | |
- uses: actions/checkout@v2 | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
# Run the gas benchmark and stores the output to a json file. | |
- name: Run benchmark | |
run: python python/gas_benchmarks.py benchmarks.json | |
# Load the benchmarks cache. We use a different cache key for every run | |
# because Github Actions caches are currently immutable. By specifying the | |
# same restore key, we can load the latest cache on restore and still save | |
# a new cache: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache. | |
- name: Download previous benchmark data | |
uses: actions/cache@v3 | |
with: | |
path: ./cache | |
key: benchmarks-${{ runner.os }}-${{ github.run_id }} | |
restore-keys: | | |
benchmarks-${{ runner.os }}- | |
# Comment on pull request. | |
- name: Create benchmark comment | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: jalextowle/[email protected] | |
with: | |
name: Hyperdrive Gas Benchmark | |
# We pass in raw benchmark data since there isn't a Solidity tool that | |
# is supported yet. | |
tool: "customSmallerIsBetter" | |
# For PRs, we don't save to the data file since we compare to the | |
# base branch. The output file specifies the current benchmark and | |
# the external data path specifies the latest benchmark on the base | |
# branch. | |
save-data-file: false | |
output-file-path: benchmarks.json | |
external-data-json-path: ./cache/benchmarks.json | |
# Always leave a comment on PRs. | |
comment-on-pull-request: true | |
comment-always: true | |
# Needed to allow the project to comment on PRs. | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
# Save the benchmark on push. | |
- name: Save benchmark data file | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
uses: jalextowle/[email protected] | |
with: | |
name: Hyperdrive Gas Benchmark | |
# We pass in raw benchmark data since there isn't a Solidity tool that | |
# is supported yet. | |
tool: "customSmallerIsBetter" | |
# We save to the data file when pushing to the base branch. The output | |
# file specifies the current benchmark and the external data path | |
# specifies the latest benchmark on the base branch. | |
output-file-path: benchmarks.json | |
external-data-json-path: ./cache/benchmarks.json | |
save-data-file: true | |
# Needed to allow the project to comment on PRs. | |
github-token: ${{ secrets.GITHUB_TOKEN }} |