Skip to content

feat(test-suite): replace fhevm bash cli with Bun runtime #42

feat(test-suite): replace fhevm bash cli with Bun runtime

feat(test-suite): replace fhevm bash cli with Bun runtime #42

name: contracts-upgrade-version-check
permissions: {}
on:
pull_request:
# Compare PR bytecode against the last deployed release, not main.
# This avoids unnecessary reinitializer bumps when multiple PRs modify
# the same contract between deployments. Keep in sync with *-upgrade-tests.yml.
env:
UPGRADE_FROM_TAG: v0.11.0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
check-changes:
name: contracts-upgrade-version-check/check-changes
permissions:
contents: 'read' # Required to checkout repository code
pull-requests: 'read' # Required to read pull request for paths-filter
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
host-contracts:
- .github/workflows/contracts-upgrade-version-check.yml
- ci/check-upgrade-versions.ts
- ci/merge-address-constants.ts
- host-contracts/**
gateway-contracts:
- .github/workflows/contracts-upgrade-version-check.yml
- ci/check-upgrade-versions.ts
- ci/merge-address-constants.ts
- gateway-contracts/**
check:
name: contracts-upgrade-version-check/${{ matrix.package }} (bpr)
needs: check-changes
if: ${{ needs.check-changes.outputs.packages != '[]' }}
permissions:
contents: 'read' # Required to checkout repository code
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.check-changes.outputs.packages) }}
include:
- package: host-contracts
extra-deps: forge soldeer install
- package: gateway-contracts
extra-deps: ''
steps:
- name: Checkout PR branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
- name: Checkout baseline (last deployed release)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.UPGRADE_FROM_TAG }}
path: baseline
persist-credentials: 'false'
- name: Install Bun
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- name: Install PR dependencies
working-directory: ${{ matrix.package }}
run: npm ci
- name: Install baseline dependencies
working-directory: baseline/${{ matrix.package }}
run: npm ci
- name: Install Forge dependencies
if: matrix.extra-deps != ''
env:
PACKAGE: ${{ matrix.package }}
EXTRA_DEPS: ${{ matrix.extra-deps }}
run: |
(cd "$PACKAGE" && $EXTRA_DEPS)
(cd "baseline/$PACKAGE" && $EXTRA_DEPS)
- name: Setup compilation
env:
PACKAGE: ${{ matrix.package }}
run: |
# Generate addresses on both sides independently, then merge them.
# Address constants are embedded in bytecode, so both sides must compile
# with identical values. We can't just copy one side's addresses to the
# other because contracts may be added or removed between versions — the
# baseline would fail to compile if it references a removed constant, or
# the PR would fail if it references a new one. Merging gives both sides
# the full union of constants with consistent values (PR wins for shared).
(cd "$PACKAGE" && make ensure-addresses)
(cd "baseline/$PACKAGE" && make ensure-addresses)
bun ci/merge-address-constants.ts "baseline/$PACKAGE/addresses" "$PACKAGE/addresses"
# Use PR's foundry.toml for both so compiler settings match (cbor_metadata, bytecode_hash)
cp "$PACKAGE/foundry.toml" "baseline/$PACKAGE/foundry.toml"
- name: Run upgrade version check
env:
PACKAGE: ${{ matrix.package }}
run: bun ci/check-upgrade-versions.ts "baseline/$PACKAGE" "$PACKAGE"