Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/ethereum-optimism/optimism
Browse files Browse the repository at this point in the history
… into develop
  • Loading branch information
zobront committed Aug 12, 2024
2 parents b0a3c4e + 995ddcf commit a0b95aa
Show file tree
Hide file tree
Showing 191 changed files with 1,562 additions and 8,201 deletions.
167 changes: 59 additions & 108 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
parameters:
ci_builder_image:
type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.50.0
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.51.0
ci_builder_rust_image:
type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder-rust:latest
Expand Down Expand Up @@ -103,6 +103,13 @@ commands:
pip3 install -r requirements.txt
python3 main.py "<<parameters.patterns>>"
install-contracts-dependencies:
description: "Install the dependencies for the smart contracts"
steps:
- run:
command: just install
working_directory: packages/contracts-bedrock

notify-failures-on-develop:
description: "Notify Slack"
parameters:
Expand Down Expand Up @@ -137,7 +144,7 @@ jobs:
- run:
name: build Cannon example binaries
command: make elf # only compile ELF binaries with Go, we do not have MIPS GCC for creating the debug-dumps.
working_directory: cannon/example
working_directory: cannon/testdata/example
- run:
name: Cannon Go lint
command: |
Expand Down Expand Up @@ -177,44 +184,22 @@ jobs:
resource_class: xlarge
steps:
- checkout
- run:
name: "Check L1 geth version"
command: ./ops/scripts/geth-version-checker.sh || (echo "geth version is wrong, update ci-builder"; false)
- run:
name: git submodules
command: make submodules
- restore_cache:
name: Restore PNPM Package Cache
keys:
- pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
# - run: # temporarily disabled, to update ci-builder.
# name: "Check L1 geth version"
# command: ./ops/scripts/geth-version-checker.sh || (echo "geth version is wrong, update ci-builder"; false)
- install-contracts-dependencies
- restore_cache:
name: Restore Go modules cache
key: gomod-{{ checksum "go.sum" }}
# Fetch node_modules into the pnpm store
# This will cache node_modules based on pnpm-lock so other steps can instantly install them with `pnpm install --prefer-offline`
# --prefer-offline installs node_modules instantly by just reading from cache if it exists rather than fetching from network
# when installing node_modules pnpm simply adds symlinks instead of copying the files which is why it is pretty much instant to run --prefer-offline
# this allows a caching strategy of only checking pnpm-lockfile so we don't have to keep it in sync with our packages
# For more information see https://pnpm.io/cli/fetch
- run:
name: Fetch dependencies
command: pnpm fetch --frozen-lockfile --prefer-offline
- save_cache:
name: Save PNPM Package Cache
key: pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
paths:
- "node_modules"
- run:
name: Install dependencies
command: pnpm install
- run:
name: print forge version
command: forge --version
- run:
name: Build monorepo
name: Build contracts
environment:
FOUNDRY_PROFILE: ci
command: pnpm build
command: just build
working_directory: packages/contracts-bedrock
- run:
name: Generate L2OO allocs
command: DEVNET_L2OO="true" make devnet-allocs
Expand All @@ -239,12 +224,9 @@ jobs:
- persist_to_workspace:
root: "."
paths:
- "packages/**/dist"
- "packages/contracts-bedrock/cache"
- "packages/contracts-bedrock/artifacts"
- "packages/contracts-bedrock/forge-artifacts"
- "packages/contracts-bedrock/tsconfig.tsbuildinfo"
- "packages/contracts-bedrock/tsconfig.build.tsbuildinfo"
- ".devnet/allocs-l1.json"
- ".devnet/allocs-l2-delta.json"
- ".devnet/allocs-l2-ecotone.json"
Expand Down Expand Up @@ -450,9 +432,9 @@ jobs:
- run:
name: Sign
command: |
git clone https://github.com/ethereum-optimism/binary_signer
cd binary_signer/signer
git checkout tags/v1.0.3
VER=$(jq -r .binary_signer < versions.json)
wget -O - "https://github.com/ethereum-optimism/binary_signer/archive/refs/tags/v${VER}.tar.gz" | tar xz
cd "binary_signer-${VER}/signer"
IMAGE_PATH="<<parameters.registry>>/<<parameters.repo>>/<<parameters.docker_name>>:<<pipeline.git.revision>>"
echo $IMAGE_PATH
Expand Down Expand Up @@ -516,9 +498,7 @@ jobs:
resource_class: xlarge
steps:
- checkout
- run:
name: git submodules
command: make submodules
- install-contracts-dependencies
- check-changed:
patterns: contracts-bedrock,op-node
- run:
Expand All @@ -528,7 +508,7 @@ jobs:
# We do not use the pre-built contracts becuase forge coverage uses different optimizer settings
- run:
name: test and generate coverage
command: pnpm coverage:lcov
command: just coverage-lcov
no_output_timeout: 18m
environment:
FOUNDRY_PROFILE: ci
Expand All @@ -545,93 +525,88 @@ jobs:
resource_class: xlarge
steps:
- checkout
- run:
name: git submodules
command: make submodules
- check-changed:
patterns: contracts-bedrock,op-node
- install-contracts-dependencies
- run:
name: print dependencies
command: just dep-status
working_directory: packages/contracts-bedrock
- run:
name: print forge version
command: forge --version
working_directory: packages/contracts-bedrock
- run:
name: run tests
command: pnpm test
command: just test
environment:
FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock
no_output_timeout: 15m
- run:
name: print failed test traces
command: just test-rerun
environment:
FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock
when: on_fail

contracts-bedrock-checks:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
resource_class: xlarge
steps:
- checkout
- run:
name: git submodules
command: make submodules
- restore_cache:
name: Restore PNPM Package Cache
keys:
- pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
- attach_workspace: { at: "." }
- install-contracts-dependencies
- check-changed:
patterns: contracts-bedrock,op-node
- setup_remote_docker:
docker_layer_caching: true
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install
working_directory: packages/contracts-bedrock
- run:
name: forge version
command: forge --version
- run:
# The solc warnings check must be the first step to build the contracts, that way the
# warnings are output here. On subsequent runs, forge will read artifacts from the cache
# so warnings would not occur.
name: solc warnings check
command: |
forge build --deny-warnings || echo "export SOLC_WARNINGS_CHECK=1" >> "$BASH_ENV"
forge build --force --deny-warnings || echo "export SOLC_WARNINGS_CHECK=1" >> "$BASH_ENV"
environment:
FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock
- run:
# Semver lock must come second because one of the later steps may modify the cache & force a contracts rebuild.
name: semver lock
command: |
pnpm semver-lock
just semver-lock
git diff --exit-code semver-lock.json || echo "export SEMVER_LOCK_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: check deploy configs
command: pnpm validate-deploy-configs || echo "export DEPLOY_CONFIGS_STATUS=1" >> "$BASH_ENV"
command: just validate-deploy-configs || echo "export DEPLOY_CONFIGS_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: lint
command: |
pnpm lint:check || echo "export LINT_STATUS=1" >> "$BASH_ENV"
just lint-check || echo "export LINT_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: gas snapshot
command: |
pnpm gas-snapshot --check || echo "export GAS_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
just gas-snapshot-check || echo "export GAS_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
environment:
FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock
no_output_timeout: 15m
- run:
name: invariant docs
command: |
pnpm autogen:invariant-docs
just autogen-invariant-docs
git diff --exit-code ./invariant-docs/*.md || echo "export INVARIANT_DOCS_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: snapshots
command: |
pnpm snapshots:check || echo "export SNAPSHOTS_STATUS=1" >> "$BASH_ENV"
just snapshots-check || echo "export SNAPSHOTS_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: size check
Expand Down Expand Up @@ -685,19 +660,12 @@ jobs:
resource_class: medium
steps:
- checkout
- restore_cache:
name: Restore PNPM Package Cache
keys:
- pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
- attach_workspace: { at: "." }
- run:
name: Install dependencies
command: pnpm install
- check-changed:
patterns: contracts-bedrock
- run:
name: validate spacers
command: pnpm validate-spacers
command: just validate-spacers
working_directory: packages/contracts-bedrock

todo-issues:
Expand Down Expand Up @@ -1071,9 +1039,7 @@ jobs:
key: gomod-{{ checksum "go.sum" }}
- restore_cache:
key: golang-build-cache
- run:
name: git submodules
command: make submodules
- install-contracts-dependencies
- run:
name: generate devnet allocs
command: make devnet-allocs
Expand Down Expand Up @@ -1125,19 +1091,17 @@ jobs:
- run:
name: Install latest golang
command: |
wget https://go.dev/dl/go1.21.1.linux-amd64.tar.gz
VER=$(jq -r .go < versions.json)
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
wget "https://go.dev/dl/go${VER}.linux-amd64.tar.gz" -O - | sudo tar -C /usr/local -xz
export PATH=$PATH:/usr/local/go/bin
go version
- run:
name: Install Geth
command: |
wget https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-1.13.14-2bd6bd01.tar.gz
# geth only provides md5 sums sadly
echo '76a04354dba9980fcbc35bece2957b30 geth-alltools-linux-amd64-1.13.14-2bd6bd01.tar.gz' | md5sum -c -
tar -xzvf geth-alltools-linux-amd64-1.13.14-2bd6bd01.tar.gz
sudo cp geth-alltools-linux-amd64-1.13.14-2bd6bd01/* /usr/local/bin
VER=$(jq -r .geth_release < versions.json)
wget "https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-${VER}.tar.gz" -O - | tar xz
sudo cp "geth-alltools-linux-amd64-${VER}"/* /usr/local/bin
- run:
name: Install eth2-testnet-genesis
command: |
Expand All @@ -1152,23 +1116,12 @@ jobs:
source $HOME/.bashrc
forge --version
- run:
name: Install NVM
command: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm --version
- run:
name: Install Node
command: |
nvm install
nvm use && node --version && npm --version
- run:
name: Install pnpm
name: Install Just
command: |
npm i pnpm --global
- run:
name: git submodules
command: make submodules
VER=$(jq -r .just < versions.json)
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/bin --tag "${VER}"
echo 'export PATH="${PATH}:$HOME/bin"' >> $BASH_ENV
- install-contracts-dependencies
- attach_workspace:
at: "."
- when:
Expand Down Expand Up @@ -1196,9 +1149,9 @@ jobs:
docker tag "$IMAGE_BASE_PREFIX/op-challenger:<<pipeline.git.revision>>" "$IMAGE_BASE_PREFIX/op-challenger:devnet"
docker tag "$IMAGE_BASE_PREFIX/da-server:<<pipeline.git.revision>>" "$IMAGE_BASE_PREFIX/da-server:devnet"
- run:
name: pnpm install and build
command: |
pnpm install && pnpm build
name: Build contracts
working_directory: packages/contracts-bedrock
command: just build
- run:
name: Bring up the stack
command: |
Expand Down Expand Up @@ -1481,17 +1434,15 @@ jobs:
resource_class: xlarge
steps:
- checkout
- run:
name: Checkout Submodule
command: make submodules
- install-contracts-dependencies
- check-changed:
no_go_deps: "true"
patterns: contracts-bedrock/test/kontrol,contracts-bedrock/src/L1/OptimismPortal\.sol,contracts-bedrock/src/L1/OptimismPortal2\.sol,contracts-bedrock/src/L1/L1CrossDomainMessenger\.sol,contracts-bedrock/src/L1/L1ERC721Bridge\.sol,contracts-bedrock/src/L1/L1StandardBridge\.sol,contracts-bedrock/src/L1/ResourceMetering\.sol,contracts-bedrock/src/universal/StandardBridge\.sol,contracts-bedrock/src/universal/ERC721Bridge\.sol,contracts-bedrock/src/universal/CrossDomainMessenger\.sol
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Run Kontrol Tests
command: pnpm test:kontrol
command: just test-kontrol
working_directory: ./packages/contracts-bedrock
- store_artifacts:
path: ./packages/contracts-bedrock/test/kontrol/logs/kontrol-results_latest.tar.gz
Expand Down
24 changes: 0 additions & 24 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,5 @@ description: Common setup steps used by our workflows
runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Setup foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install node dependencies
shell: bash
run: pnpm install --frozen-lockfile
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
main-branch-name: "develop"
- run: |
echo "nx using following shas:"
echo "BASE: ${{ env.NX_BASE }}"
echo "HEAD: ${{ env.NX_HEAD }}"
shell: bash
Loading

0 comments on commit a0b95aa

Please sign in to comment.