Skip to content

Commit

Permalink
Merge branch 'develop' into sc-fix/remove-immutables-from-superchain-…
Browse files Browse the repository at this point in the history
…erc20-beacon
  • Loading branch information
agusduha committed Oct 1, 2024
2 parents 40e2069 + d05fb50 commit 53ece5c
Show file tree
Hide file tree
Showing 244 changed files with 4,923 additions and 2,939 deletions.
211 changes: 28 additions & 183 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.51.0
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.53.0
ci_builder_rust_image:
type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder-rust:latest
Expand Down Expand Up @@ -791,7 +791,7 @@ jobs:
name: run Go linter
command: |
# Identify how many cores it defaults to
golangci-lint --help | grep concurrency
golangci-lint run --help | grep concurrency
make lint-go
working_directory: .
- save_cache:
Expand Down Expand Up @@ -1058,7 +1058,7 @@ jobs:
key: cannon-prestate-{{ checksum "./cannon/bin/cannon" }}-{{ checksum "op-program/bin/op-program-client.elf" }}
name: Save Cannon prestate to cache
paths:
- "op-program/bin/prestate.json"
- "op-program/bin/prestate.bin.gz"
- "op-program/bin/meta.json"
- "op-program/bin/prestate-proof.json"
- run:
Expand All @@ -1079,7 +1079,7 @@ jobs:
- persist_to_workspace:
root: .
paths:
- "op-program/bin/prestate.json"
- "op-program/bin/prestate.bin.gz"
- "op-program/bin/meta.json"
- "op-program/bin/prestate-proof.json"

Expand Down Expand Up @@ -1146,184 +1146,33 @@ jobs:
- notify-failures-on-develop:
mentions: "@proofs-squad"

devnet:
machine:
image: <<pipeline.parameters.base_image>>
parameters:
variant:
type: string
environment:
DOCKER_BUILDKIT: 1
DEVNET_NO_BUILD: 'true'
# Default value; Can be overridden.
DEVNET_L2OO: 'false'
DEVNET_ALTDA: 'false'
cannon-stf-verify:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
steps:
- checkout
- attach_workspace: { at: "." }
- check-changed:
patterns: op-(.+),packages,ops-bedrock,bedrock-devnet
- when:
condition:
equal: ['altda', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_ALTDA = true
command: echo 'export DEVNET_ALTDA=true' >> $BASH_ENV
- when:
condition:
equal: ['altda-generic', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_ALTDA = true
command: echo 'export DEVNET_ALTDA=true' >> $BASH_ENV
- run:
name: Set GENERIC_ALTDA = true
command: echo 'export GENERIC_ALTDA=true' >> $BASH_ENV
- setup_remote_docker
- restore_cache:
name: Restore Go modules cache
key: gomod-{{ checksum "go.sum" }}
- restore_cache:
name: Restore Go build cache
keys:
- golang-build-cache-devnet-{{ checksum "go.sum" }}
- golang-build-cache-devnet-
- run:
name: Install latest golang
command: |
VER=$(jq -r .go < versions.json)
sudo rm -rf /usr/local/go
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: |
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: |
go install -v github.com/protolambda/eth2-testnet-genesis@$(jq -r .eth2_testnet_genesis < versions.json)
- run:
name: foundryup
command: |
curl -L https://foundry.paradigm.xyz | bash
source $HOME/.bashrc
foundryup
echo 'export PATH=$HOME/.foundry/bin:$PATH' >> $BASH_ENV
source $HOME/.bashrc
forge --version
- run:
name: Install Just
command: |
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
- when:
condition:
not:
equal: ['default', <<parameters.variant>>]
steps:
- run:
name: Use non-default devnet allocs
command: rm -r .devnet && mv .devnet-<<parameters.variant>> .devnet
- run:
name: Load and tag docker images
command: |
IMAGE_BASE_PREFIX="us-docker.pkg.dev/oplabs-tools-artifacts/images"
# Load from previous docker-build job
docker load < "./op-node.tar"
docker load < "./op-proposer.tar"
docker load < "./op-batcher.tar"
docker load < "./op-challenger.tar"
docker load < "./da-server.tar"
# rename to the tags that the docker-compose of the devnet expects
docker tag "$IMAGE_BASE_PREFIX/op-node:<<pipeline.git.revision>>" "$IMAGE_BASE_PREFIX/op-node:devnet"
docker tag "$IMAGE_BASE_PREFIX/op-proposer:<<pipeline.git.revision>>" "$IMAGE_BASE_PREFIX/op-proposer:devnet"
docker tag "$IMAGE_BASE_PREFIX/op-batcher:<<pipeline.git.revision>>" "$IMAGE_BASE_PREFIX/op-batcher:devnet"
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: Bring up the stack
command: |
# Specify like this to avoid a forced rebuild of the contracts + devnet L1
PYTHONPATH=./bedrock-devnet python3 ./bedrock-devnet/main.py --monorepo-dir=.
echo "Waiting for 10 seconds to give the devnet time to settle in..."
sleep 10
- run:
name: Test the stack
command: make devnet-test
- run:
name: Dump op-node logs
command: |
docker logs ops-bedrock-op-node-1 || echo "No logs."
when: on_fail
- run:
name: Dump op-geth logs
command: |
docker logs ops-bedrock-l2-1 || echo "No logs."
when: on_fail
- golang-build-cache-cannon-stf-verify-{{ checksum "go.sum" }}
- golang-build-cache-cannon-stf-verify-
- run:
name: Dump l1 logs
command: |
docker logs ops-bedrock-l1-1 || echo "No logs."
when: on_fail
- run:
name: Dump l1-bn logs
command: |
docker logs ops-bedrock-l1-bn-1 || echo "No logs."
when: on_fail
- run:
name: Dump l1-vc logs
command: |
docker logs ops-bedrock-l1-vc-1 || echo "No logs."
when: on_fail
- run:
name: Dump op-batcher logs
command: |
docker logs ops-bedrock-op-batcher-1 || echo "No logs."
when: on_fail
- run:
name: Dump op-proposer logs
command: |
docker logs ops-bedrock-op-proposer-1 || echo "No logs."
when: on_fail
- run:
name: Dump op-challenger logs
command: |
docker logs ops-bedrock-op-challenger-1 || echo "No logs."
when: on_fail
- run:
name: Dump da-server logs
command: |
docker logs ops-bedrock-da-server-1 || echo "No logs."
when: on_fail
- run:
name: Log deployment artifact
command: |
cat broadcast/Deploy.s.sol/900/run-latest.json || echo "No deployment file found"
when: on_fail
working_directory: packages/contracts-bedrock
- run:
name: Log devnet config
command: |
cat deploy-config/devnetL1.json || echo "No devnet config found"
when: on_fail
working_directory: packages/contracts-bedrock
name: Build cannon
command: make cannon
- run:
name: Log artifacts directory
command: |
ls -R forge-artifacts || echo "No forge artifacts found"
when: on_fail
working_directory: packages/contracts-bedrock
name: Verify the Cannon STF
command: make -C ./cannon cannon-stf-verify
- save_cache:
name: Save Go build cache
key: golang-build-cache-devnet-{{ checksum "go.sum" }}
key: golang-build-cache-cannon-stf-verify-{{ checksum "go.sum" }}
paths:
- /home/circleci/.cache/go-build
- "/root/.cache/go-build"
- notify-failures-on-develop:
mentions: "@proofs-squad"

semgrep-scan:
parameters:
Expand Down Expand Up @@ -1361,7 +1210,7 @@ jobs:
# --timeout (in seconds) limits the time per rule and file.
# SEMGREP_TIMEOUT is the same, but docs have conflicting defaults (5s in CLI flag, 1800 in some places)
# https://semgrep.dev/docs/troubleshooting/semgrep-app#if-the-job-is-aborted-due-to-taking-too-long
command: semgrep ci --timeout=100
command: semgrep ci --timeout=100 --no-suppress-errors
# If semgrep hangs, stop the scan after 20m, to prevent a useless 5h job
no_output_timeout: 20m
- notify-failures-on-develop
Expand Down Expand Up @@ -1611,6 +1460,9 @@ workflows:
- op-program
- op-service
- op-supervisor
- go-test:
name: semver-natspec-tests
module: packages/contracts-bedrock/scripts/checks/semver-natspec
- go-test-kurtosis:
name: op-chain-ops-integration
module: op-chain-ops
Expand Down Expand Up @@ -1703,18 +1555,6 @@ workflows:
- cannon-prestate:
requires:
- go-mod-download
- devnet:
matrix:
parameters:
variant: ["default", "altda", "altda-generic"]
requires:
- contracts-bedrock-build
- op-batcher-docker-build
- op-proposer-docker-build
- op-node-docker-build
- op-challenger-docker-build
- da-server-docker-build
- cannon-prestate
- check-generated-mocks-op-node
- check-generated-mocks-op-service
- cannon-go-lint-and-test:
Expand Down Expand Up @@ -1839,7 +1679,7 @@ workflows:

scheduled-fpp:
when:
equal: [ build_four_hours, <<pipeline.schedule.name>> ]
equal: [ build_hourly, <<pipeline.schedule.name>> ]
jobs:
- fpp-verify:
context:
Expand Down Expand Up @@ -1867,6 +1707,11 @@ workflows:
- cannon-prestate:
requires:
- go-mod-download
- cannon-stf-verify:
requires:
- go-mod-download
context:
- slack
- contracts-bedrock-build:
skip_pattern: test
context:
Expand Down
2 changes: 2 additions & 0 deletions .semgrepignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ packages/contracts-bedrock/src/L2/SuperchainWETH.sol
packages/contracts-bedrock/src/L2/interfaces/ISuperchainWETH.sol
packages/contracts-bedrock/src/governance/GovernanceToken.sol
packages/contracts-bedrock/src/governance/interfaces/IGovernanceToken.sol
packages/contracts-bedrock/src/dispute/interfaces/IFaultDisputeGame.sol
packages/contracts-bedrock/src/dispute/interfaces/IPermissionedDisputeGame.sol
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ reproducible-prestate: ## Builds reproducible-prestate binary
.PHONY: reproducible-prestate

# Include any files required for the devnet to build and run.
DEVNET_CANNON_PRESTATE_FILES := op-program/bin/prestate-proof.json op-program/bin/prestate.json op-program/bin/prestate-proof-mt.json op-program/bin/prestate-mt.bin.gz
DEVNET_CANNON_PRESTATE_FILES := op-program/bin/prestate-proof.json op-program/bin/prestate.bin.gz op-program/bin/prestate-proof-mt.json op-program/bin/prestate-mt.bin.gz


$(DEVNET_CANNON_PRESTATE_FILES):
make cannon-prestate
make cannon-prestate-mt

cannon-prestate: op-program cannon ## Generates prestate using cannon and op-program
./cannon/bin/cannon load-elf --type singlethreaded --path op-program/bin/op-program-client.elf --out op-program/bin/prestate.json --meta op-program/bin/meta.json
./cannon/bin/cannon run --proof-at '=0' --stop-at '=1' --input op-program/bin/prestate.json --meta op-program/bin/meta.json --proof-fmt 'op-program/bin/%d.json' --output ""
./cannon/bin/cannon load-elf --type singlethreaded-2 --path op-program/bin/op-program-client.elf --out op-program/bin/prestate.bin.gz --meta op-program/bin/meta.json
./cannon/bin/cannon run --proof-at '=0' --stop-at '=1' --input op-program/bin/prestate.bin.gz --meta op-program/bin/meta.json --proof-fmt 'op-program/bin/%d.json' --output ""
mv op-program/bin/0.json op-program/bin/prestate-proof.json
.PHONY: cannon-prestate

Expand Down
3 changes: 0 additions & 3 deletions cannon/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ venv
*.log
testdata/example/bin
contracts/out
state.json
*.json
*.json.gz
*.pprof
*.out
bin
Expand Down
34 changes: 34 additions & 0 deletions cannon/Dockerfile.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM golang:1.22.7-alpine3.20 as builder

RUN apk add --no-cache make bash

COPY ./go.mod /app/go.mod
COPY ./go.sum /app/go.sum

WORKDIR /app

RUN echo "go mod cache: $(go env GOMODCACHE)"
RUN echo "go build cache: $(go env GOCACHE)"

RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go mod download

COPY . /app

# We avoid copying the full .git dir into the build for just some metadata.
# Instead, specify:
# --build-arg GIT_COMMIT=$(git rev-parse HEAD)
# --build-arg GIT_DATE=$(git show -s --format='%ct')
ARG GIT_COMMIT
ARG GIT_DATE

ARG TARGETOS TARGETARCH

FROM --platform=$BUILDPLATFORM us-docker.pkg.dev/oplabs-tools-artifacts/images/cannon:v1.1.0-alpha.1 AS cannon-v2

FROM --platform=$BUILDPLATFORM builder as cannon-verify
COPY --from=cannon-v2 /usr/local/bin/cannon /usr/local/bin/cannon-v2
# verify the latest singlethreaded VM behavior against cannon-v2
RUN cd cannon && make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2
RUN --mount=type=cache,target=/root/.cache/go-build cd cannon && \
make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2 \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE
Loading

0 comments on commit 53ece5c

Please sign in to comment.