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
207 changes: 195 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ commands:
command: |
# Manually craft the submodule update command in order to take advantage
# of the -j parameter, which speeds it up a lot.
git submodule update --init --recursive --force -j 8
git submodule update --init --recursive --single-branch --force -j 8
working_directory: packages/contracts-bedrock

# Notifies us on Slack a build fails on develop
Expand Down Expand Up @@ -806,7 +806,7 @@ jobs:
fi

# Let them cook!
KONA_VERSION=$(jq -r .version kona/version.json) \
KONA_VERSION=$(jq -r .version kona-proofs/version.json) \
docker buildx bake \
--progress plain \
--builder=buildx-build \
Expand Down Expand Up @@ -1690,6 +1690,15 @@ jobs:
checkout-method: blobless
- attach_workspace:
at: .
- run:
name: Configure Rust binary paths (sysgo)
command: |
ROOT_DIR="$(pwd)"
BIN_DIR="$ROOT_DIR/.circleci-cache/rust-binaries"
echo "export RUST_BINARY_PATH_KONA_NODE=$BIN_DIR/kona-node" >> "$BASH_ENV"
echo "export RUST_BINARY_PATH_KONA_SUPERVISOR=$BIN_DIR/kona-supervisor" >> "$BASH_ENV"
echo "export RUST_BINARY_PATH_OP_RBUILDER=$BIN_DIR/op-rbuilder" >> "$BASH_ENV"
echo "export RUST_BINARY_PATH_ROLLUP_BOOST=$BIN_DIR/rollup-boost" >> "$BASH_ENV"
# Restore cached Go modules
- restore_cache:
keys:
Expand Down Expand Up @@ -1782,6 +1791,17 @@ jobs:
steps:
- utils/checkout-with-mise:
checkout-method: blobless
- attach_workspace:
at: .
- run:
name: Configure Rust binary paths (sysgo)
command: |
ROOT_DIR="$(pwd)"
BIN_DIR="$ROOT_DIR/.circleci-cache/rust-binaries"
echo "export RUST_BINARY_PATH_KONA_NODE=$BIN_DIR/kona-node" >> "$BASH_ENV"
echo "export RUST_BINARY_PATH_KONA_SUPERVISOR=$BIN_DIR/kona-supervisor" >> "$BASH_ENV"
echo "export RUST_BINARY_PATH_OP_RBUILDER=$BIN_DIR/op-rbuilder" >> "$BASH_ENV"
echo "export RUST_BINARY_PATH_ROLLUP_BOOST=$BIN_DIR/rollup-boost" >> "$BASH_ENV"
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
Expand Down Expand Up @@ -2030,20 +2050,20 @@ jobs:
checkout-method: blobless
- restore_cache:
name: Restore kona cache
key: kona-prestate-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/version.json" }}
key: kona-prestate-{{ checksum "./kona-proofs/justfile" }}-{{ checksum "./kona-proofs/version.json" }}
- run:
name: Build kona prestates
command: just build-prestates
working_directory: kona
working_directory: kona-proofs
- save_cache:
key: kona-prestate-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/version.json" }}
key: kona-prestate-{{ checksum "./kona-proofs/justfile" }}-{{ checksum "./kona-proofs/version.json" }}
name: Save Kona to cache
paths:
- "kona/prestates/"
- "kona-proofs/prestates/"
- persist_to_workspace:
root: .
paths:
- "kona/prestates/*"
- "kona-proofs/prestates/*"

cannon-kona-host:
docker:
Expand All @@ -2053,7 +2073,7 @@ jobs:
checkout-method: blobless
- restore_cache:
name: Restore kona host cache
key: kona-host-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/version.json" }}
key: kona-host-{{ checksum "./kona-proofs/justfile" }}-{{ checksum "./kona-proofs/version.json" }}
- run: # The mise plugin for clang is broken so install via apt-get
name: Install clang
command: |
Expand All @@ -2062,16 +2082,121 @@ jobs:
- run:
name: Build kona host
command: just build-kona-host
working_directory: kona
working_directory: kona-proofs
- save_cache:
key: kona-host-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/version.json" }}
key: kona-host-{{ checksum "./kona-proofs/justfile" }}-{{ checksum "./kona-proofs/version.json" }}
name: Save Kona host to cache
paths:
- "kona/bin/kona-host"
- "kona-proofs/bin/kona-host"
- persist_to_workspace:
root: .
paths:
- "kona/bin/kona-host"
- "kona-proofs/bin/kona-host"

# Build a single Rust binary for sysgo tests (parameterized).
rust-binary-build:
docker:
- image: <<pipeline.parameters.default_docker_image>>
resource_class: xlarge
parameters:
directory:
description: "Directory containing the Cargo workspace"
type: string
binaries:
description: "Space-separated list of binary names to copy from target/release into the cache"
type: string
build_command:
description: "Cargo build command to run"
type: string
needs_clang:
description: "Whether to install clang (needed by bindgen for reth-mdbx-sys)"
type: boolean
default: false
steps:
- utils/checkout-with-mise:
checkout-method: blobless
- run:
name: Get << parameters.directory >> submodule HASH
command: |
mkdir -p .circleci-cache
# Verify the path is a git submodule (gitlink). For submodules, ls-tree prints:
# 160000 commit <sha> <path>
MODE_AND_TYPE="$(git ls-tree HEAD << parameters.directory >> | awk '{print $1 " " $2}')"
if [ "$MODE_AND_TYPE" != "160000 commit" ]; then
echo "ERROR: << parameters.directory >> is not a submodule path (expected '160000 commit', got '$MODE_AND_TYPE')" >&2
git ls-tree HEAD << parameters.directory >> >&2 || true
exit 1
fi

git ls-tree HEAD << parameters.directory >> | awk '{print $3}' > .circleci-cache/expected-submod-sha.txt
echo "Expected submodule HASH: $(cat .circleci-cache/expected-submod-sha.txt)"
echo "<< parameters.binaries >>" | tr ' ' '\n' | awk 'NF' | sort -u > .circleci-cache/expected-binaries.txt
echo "Expected binaries: $(tr '\n' ' ' < .circleci-cache/expected-binaries.txt)"
- restore_cache:
name: Restore << parameters.directory >> cache
keys:
- rust-<< parameters.directory >>-v8-{{ checksum ".circleci-cache/expected-submod-sha.txt" }}-{{ checksum ".circleci-cache/expected-binaries.txt" }}
- run:
name: Build << parameters.directory >> submodule (if needed)
command: |
ROOT_DIR="$(pwd)"
BIN_CACHE_DIR="$ROOT_DIR/.circleci-cache/rust-binaries"

HIT=true
for bin in << parameters.binaries >>; do
if [ ! -f "$BIN_CACHE_DIR/$bin" ]; then
HIT=false
break
fi
done
if [ "$HIT" = "true" ]; then
echo "Cache hit - binaries exist"
exit 0
fi

echo "Cache miss - will build"
# Only run on cache miss. We intentionally do not cache into the submodule directory so that cache
# restore cannot make the submodule path non-empty (which breaks `git submodule update --init`).
git submodule update --init --recursive --depth 1 -j 8 --single-branch << parameters.directory >>

if [ "<< parameters.needs_clang >>" = "true" ]; then
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang
fi

cd << parameters.directory >> && << parameters.build_command >>

mkdir -p "$BIN_CACHE_DIR"
for bin in << parameters.binaries >>; do
SRC="$ROOT_DIR/<< parameters.directory >>/target/release/$bin"
DST="$BIN_CACHE_DIR/$bin"
if [ ! -f "$SRC" ]; then
echo "ERROR: expected built binary not found at $SRC" >&2
exit 1
fi
cp "$SRC" "$DST"
chmod +x "$DST" || true
done
no_output_timeout: 30m
- save_cache:
key: rust-<< parameters.directory >>-v8-{{ checksum ".circleci-cache/expected-submod-sha.txt" }}-{{ checksum ".circleci-cache/expected-binaries.txt" }}
name: Save << parameters.directory >> cache
paths:
- ".circleci-cache/rust-binaries"
- persist_to_workspace:
root: .
paths:
- ".circleci-cache/rust-binaries"

# Aggregator job - allows downstream jobs to depend on a single job instead of listing all build jobs.
rust-binaries-for-sysgo:
docker:
- image: <<pipeline.parameters.default_docker_image>>
resource_class: small
steps:
- run:
name: All Rust binaries ready
command: echo "All Rust binaries built and persisted to workspace"

publish-cannon-prestates:
resource_class: medium
Expand Down Expand Up @@ -3169,12 +3294,41 @@ workflows:
- cannon-prestate-quick:
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binary-build:
name: rust-build-kona
directory: kona
binaries: "kona-node kona-supervisor"
build_command: cargo build --release --bin kona-node --bin kona-supervisor
needs_clang: true
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binary-build:
name: rust-build-op-rbuilder
directory: op-rbuilder
binaries: "op-rbuilder"
build_command: cargo build --release -p op-rbuilder --bin op-rbuilder
needs_clang: true
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binary-build:
name: rust-build-rollup-boost
directory: rollup-boost
binaries: "rollup-boost"
build_command: cargo build --release -p rollup-boost --bin rollup-boost
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binaries-for-sysgo:
requires:
- rust-build-kona
- rust-build-op-rbuilder
- rust-build-rollup-boost
- op-acceptance-tests-flake-shake:
context:
- circleci-repo-readonly-authenticated-github-token
requires:
- contracts-bedrock-build
- cannon-prestate-quick
- rust-binaries-for-sysgo
- op-acceptance-tests-flake-shake-report:
requires:
- op-acceptance-tests-flake-shake
Expand Down Expand Up @@ -3280,6 +3434,34 @@ workflows:
- cannon-kona-host: # needed for sysgo tests (if any package is in-memory)
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binary-build:
name: rust-build-kona
directory: kona
binaries: "kona-node kona-supervisor"
build_command: cargo build --release --bin kona-node --bin kona-supervisor
needs_clang: true
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binary-build:
name: rust-build-op-rbuilder
directory: op-rbuilder
binaries: "op-rbuilder"
build_command: cargo build --release -p op-rbuilder --bin op-rbuilder
needs_clang: true
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binary-build:
name: rust-build-rollup-boost
directory: rollup-boost
binaries: "rollup-boost"
build_command: cargo build --release -p rollup-boost --bin rollup-boost
context:
- circleci-repo-readonly-authenticated-github-token
- rust-binaries-for-sysgo:
requires:
- rust-build-kona
- rust-build-op-rbuilder
- rust-build-rollup-boost
# IN-MEMORY (all)
- op-acceptance-tests:
name: memory-all
Expand All @@ -3294,6 +3476,7 @@ workflows:
- cannon-prestate-quick
- cannon-kona-prestate
- cannon-kona-host
- rust-binaries-for-sysgo
# Generate flaky test report
- generate-flaky-report:
name: generate-flaky-tests-report
Expand Down
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,12 @@
[submodule "packages/contracts-bedrock/lib/superchain-registry"]
path = packages/contracts-bedrock/lib/superchain-registry
url = https://github.com/ethereum-optimism/superchain-registry
[submodule "op-rbuilder"]
path = op-rbuilder
url = git@github.com:flashbots/op-rbuilder.git
[submodule "rollup-boost"]
path = rollup-boost
url = git@github.com:flashbots/rollup-boost.git
[submodule "kona"]
path = kona
url = git@github.com:op-rs/kona.git
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ golang-docker: ## Builds Docker images for Go components using buildx
GIT_COMMIT=$$(git rev-parse HEAD) \
GIT_DATE=$$(git show -s --format='%ct') \
IMAGE_TAGS=$$(git rev-parse HEAD),latest \
KONA_VERSION=$$(jq -r .version kona/version.json) \
KONA_VERSION=$$(jq -r .version kona-proofs/version.json) \
docker buildx bake \
--progress plain \
--load \
Expand Down
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Build all Rust binaries (release) for sysgo tests.
build-rust-release:
cd kona && cargo build --release --bin kona-node --bin kona-supervisor
cd op-rbuilder && cargo build --release -p op-rbuilder --bin op-rbuilder
cd rollup-boost && cargo build --release -p rollup-boost --bin rollup-boost

# Checks that TODO comments have corresponding issues.
todo-checker:
./ops/scripts/todo-checker.sh
Expand Down
1 change: 1 addition & 0 deletions kona
Submodule kona added at be9d67
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion op-acceptance-tests/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ acceptance-test devnet="" gate="base":
echo "Building contracts (local build)..."
cd {{REPO_ROOT}}
echo " - Updating submodules..."
git submodule update --init --recursive
git submodule update --init --recursive --single-branch -j 8
echo " - Installing mise..."
mise install
cd packages/contracts-bedrock
Expand All @@ -62,6 +62,10 @@ acceptance-test devnet="" gate="base":
cd {{REPO_ROOT}}
make cannon-prestates
fi

echo "Building Rust binaries (kona-node, kona-supervisor, op-rbuilder, rollup-boost)..."
cd {{REPO_ROOT}}
just build-rust-debug
fi

cd {{REPO_ROOT}}/op-acceptance-tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !ci

// use a tag prefixed with "!". Such tag ensures that the default behaviour of this test would be to be built/run even when the go toolchain (go test) doesn't specify any tag filter.
package flashblocks

import (
Expand Down
4 changes: 2 additions & 2 deletions op-devstack/shared/challenger/challenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func applyCannonKonaConfig(c *config.Config, rollupCfgs []*rollup.Config, l1Gene
if err := applyVmConfig(root, &c.CannonKona, c.Datadir, rollupCfgs, l1Genesis, l2Geneses); err != nil {
return err
}
c.CannonKona.Server = root + "kona/bin/kona-host"
c.CannonKona.Server = root + "kona-proofs/bin/kona-host"
absRoot, err := filepath.Abs(root)
if err != nil {
return fmt.Errorf("failed to get absolute path to prestate dir: %w", err)
}
c.CannonKonaAbsolutePreStateBaseURL, err = url.Parse("file:" + absRoot + "/kona/prestates")
c.CannonKonaAbsolutePreStateBaseURL, err = url.Parse("file:" + absRoot + "/kona-proofs/prestates")
if err != nil {
return fmt.Errorf("failed to create kona prestates url: %w", err)
}
Expand Down
11 changes: 7 additions & 4 deletions op-devstack/sysgo/l2_cl_kona.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,13 @@ func WithKonaNode(l2CLID stack.L2CLNodeID, l1CLID stack.L1CLNodeID, l1ELID stack
)
}

execPath := os.Getenv("KONA_NODE_EXEC_PATH")
p.Require().NotEmpty(execPath, "KONA_NODE_EXEC_PATH environment variable must be set")
_, err = os.Stat(execPath)
p.Require().NotErrorIs(err, os.ErrNotExist, "executable must exist")
execPath, err := EnsureRustBinary(p, RustBinarySpec{
SrcDir: "kona",
Package: "kona-node",
Binary: "kona-node",
})
p.Require().NoError(err, "prepare kona-node binary")
p.Require().NotEmpty(execPath, "kona-node binary path resolved")

k := &KonaNode{
id: l2CLID,
Expand Down
Loading