Skip to content
Merged
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
6 changes: 4 additions & 2 deletions .github/scripts/run-example-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ BENCHMARK_CONFIGS=(
configs/examples/erc20.yml
configs/examples/simulator.yml
configs/examples/sload.yml
# configs/examples/snapshot.yml
configs/examples/rbuilder.yml
configs/examples/sstore.yml
# configs/examples/snapshot.yml
# configs/examples/tx-fuzz-geth.yml
)

Expand All @@ -26,5 +27,6 @@ for config in "${BENCHMARK_CONFIGS[@]}"; do
--root-dir $TEMP_DIR/data-dir \
--output-dir $TEMP_DIR/output \
--reth-bin $TEMP_DIR/bin/reth \
--geth-bin $TEMP_DIR/bin/geth
--geth-bin $TEMP_DIR/bin/geth \
--rbuilder-bin $TEMP_DIR/bin/rbuilder
done
216 changes: 216 additions & 0 deletions .github/workflows/_build-binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
# Reusable workflow for building all binaries
# This workflow is called by other workflows to build reth, geth, rbuilder, op-program, and contracts
name: Build Binaries

on:
workflow_call:
inputs:
reth_version:
description: "Reth version to build"
required: false
type: string
default: "27a8c0f5a6dfb27dea84c5751776ecabdd069646"
geth_version:
description: "Geth version to build"
required: false
type: string
default: "6cbfcd5161083bcd4052edc3022d9f99c6fe40e0"
rbuilder_version:
description: "Rbuilder version to build"
required: false
type: string
default: "23f42c8e78ba3abb45a8840df7037a27e196e601"

# Set minimal permissions for all jobs by default
permissions:
contents: read

jobs:
build-contracts:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # Required for artifact upload
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- name: Cache Forge artifacts
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
with:
path: |
contracts/out
contracts/cache
key: ${{ runner.os }}-forge-${{ hashFiles('**/foundry.toml', '**/*.sol') }}
restore-keys: |
${{ runner.os }}-forge-

- name: Build Contracts
run: |
forge build --force

- name: Upload contract artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: contracts
path: contracts/out/
retention-days: 1

build-reth:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # Required for artifact upload
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.11.0

- name: Cache reth binary
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
id: cache-reth
with:
path: ~/bin/reth
key: ${{ runner.os }}-reth-${{ inputs.reth_version }}

- name: Build reth
if: steps.cache-reth.outputs.cache-hit != 'true'
run: |
unset CI
mkdir -p ~/bin
cd clients
RETH_VERSION=${{ inputs.reth_version }} OUTPUT_DIR=~/bin ./build-reth.sh
# Rename op-reth to reth for consistency
[ -f ~/bin/op-reth ] && mv ~/bin/op-reth ~/bin/reth || true

- name: Upload reth artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: reth
path: ~/bin/reth
retention-days: 1

build-geth:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # Required for artifact upload
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0

- name: Cache geth binary
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
id: cache-geth
with:
path: ~/bin/geth
key: ${{ runner.os }}-geth-${{ inputs.geth_version }}

- name: Build geth
if: steps.cache-geth.outputs.cache-hit != 'true'
run: |
unset CI
mkdir -p ~/bin
cd clients
GETH_VERSION=${{ inputs.geth_version }} OUTPUT_DIR=~/bin ./build-geth.sh

- name: Upload geth artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: geth
path: ~/bin/geth
retention-days: 1

build-rbuilder:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # Required for artifact upload
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.11.0

- name: Cache rbuilder binary
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
id: cache-rbuilder
with:
path: ~/bin/rbuilder
key: ${{ runner.os }}-rbuilder-${{ inputs.rbuilder_version }}

- name: Build rbuilder
if: steps.cache-rbuilder.outputs.cache-hit != 'true'
run: |
unset CI
mkdir -p ~/bin
cd clients
RBUILDER_VERSION=${{ inputs.rbuilder_version }} OUTPUT_DIR=~/bin ./build-rbuilder.sh
# Rename op-rbuilder to rbuilder for consistency
[ -f ~/bin/op-rbuilder ] && mv ~/bin/op-rbuilder ~/bin/rbuilder || true

- name: Upload rbuilder artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: rbuilder
path: ~/bin/rbuilder
retention-days: 1

build-op-program:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # Required for artifact upload
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache op-program binary
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
id: cache-op-program
with:
path: op-program/versions/v1.6.1-rc.1/op-program
key: ${{ runner.os }}-op-program-${{ hashFiles('op-program/**') }}

- name: Build op-program
if: steps.cache-op-program.outputs.cache-hit != 'true'
run: |
curl https://mise.run | sh
pushd op-program
mise x -- ./build.sh
popd

- name: Upload op-program artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: op-program
path: op-program/versions/v1.6.1-rc.1/op-program
retention-days: 1
101 changes: 57 additions & 44 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ on:
branches: ["main"]
pull_request:

# Set minimal permissions for all jobs by default
permissions:
contents: read

jobs:
go-lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
Expand All @@ -35,6 +41,8 @@ jobs:
outputs:
COVERAGE: ${{ steps.unit.outputs.coverage }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
Expand All @@ -54,11 +62,23 @@ jobs:
run: |
go test -v -coverprofile=coverage.out ./...

# Call the reusable workflow that builds all binaries in parallel
build-binaries:
permissions:
contents: read
actions: write # Required for reusable workflow to upload artifacts
uses: ./.github/workflows/_build-binaries.yaml
with:
reth_version: 27a8c0f5a6dfb27dea84c5751776ecabdd069646
geth_version: 6cbfcd5161083bcd4052edc3022d9f99c6fe40e0
rbuilder_version: 23f42c8e78ba3abb45a8840df7037a27e196e601

basic-benchmarks:
runs-on: ubuntu-latest
env:
RETH_VERSION: 27a8c0f5a6dfb27dea84c5751776ecabdd069646
GETH_VERSION: 6cbfcd5161083bcd4052edc3022d9f99c6fe40e0
needs: build-binaries
permissions:
contents: read
actions: read # Required for artifact download
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
Expand All @@ -70,59 +90,52 @@ jobs:
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.11.0

- name: Install project dependencies
run: |
go mod download

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0

- name: Cache binaries
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
id: cache-bin
- name: Download contract artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: ${{ runner.temp }}/bin
key: ${{ runner.os }}-binaries-reth-${{ env.RETH_VERSION }}-geth-${{ env.GETH_VERSION }}

- name: Build Contracts
run: |
forge build --force

- name: Download geth and reth
if: steps.cache-bin.outputs.cache-hit != 'true'
run: |
unset CI
mkdir -p ${{ runner.temp }}/bin
name: contracts
path: contracts/out/

git clone https://github.com/paradigmxyz/reth
git -C reth checkout --force ${{ env.RETH_VERSION }}
- name: Download reth binary
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: reth
path: ${{ runner.temp }}/bin/

pushd reth
cargo build --features asm-keccak,jemalloc --profile release --bin op-reth --manifest-path crates/optimism/bin/Cargo.toml
cp ./target/release/op-reth ${{ runner.temp }}/bin/reth
popd
chmod +x ${{ runner.temp }}/bin/reth
- name: Download geth binary
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: geth
path: ${{ runner.temp }}/bin/

git clone https://github.com/ethereum-optimism/op-geth
git -C op-geth checkout --force ${{ env.GETH_VERSION }}
- name: Download rbuilder binary
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: rbuilder
path: ${{ runner.temp }}/bin/

pushd op-geth
make geth
cp ./build/bin/geth ${{ runner.temp }}/bin/geth
chmod +x ${{ runner.temp }}/bin/geth
popd
- name: Download op-program binary
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: op-program
path: ${{ runner.temp }}/bin/

echo "binaries compiled:"
- name: Make binaries executable
run: |
chmod +x ${{ runner.temp }}/bin/*
echo "Downloaded binaries:"
ls -la ${{ runner.temp }}/bin

- name: Setup op-program directory
run: |
mkdir -p op-program/versions/v1.6.1-rc.1
cp ${{ runner.temp }}/bin/op-program op-program/versions/v1.6.1-rc.1/
du -h -d 2 .

- name: Run examples
id: op-program
run: |
curl https://mise.run | sh
pushd op-program
mise x -- ./build.sh
popd
./.github/scripts/run-example-benchmarks.sh ${{ runner.temp }}
Loading