diff --git a/.circleci/continue/kona.yml b/.circleci/continue/kona.yml index 63a6e9b26b25d..0a9f4e689cc7d 100644 --- a/.circleci/continue/kona.yml +++ b/.circleci/continue/kona.yml @@ -984,7 +984,7 @@ jobs: command: | CANNON_TAG="$(cat .config/cannon_tag)" cd docker/fpvm-prestates - just "<>" "<>" "<< pipeline.git.branch >>" "$CANNON_TAG" + just "<>" "<>" "$CANNON_TAG" - run: name: Upload prestates to GCS command: | diff --git a/.circleci/continue/main.yml b/.circleci/continue/main.yml index 4f52658c0a2b5..29efd98f35d15 100644 --- a/.circleci/continue/main.yml +++ b/.circleci/continue/main.yml @@ -1174,7 +1174,6 @@ jobs: fi # Let them cook! - KONA_VERSION=$(jq -r .version kona/version.json) \ docker buildx bake \ --progress plain \ --builder=buildx-build \ @@ -2494,20 +2493,20 @@ jobs: enable-mise-cache: true - restore_cache: name: Restore kona cache - key: kona-prestate-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/version.json" }} + key: kona-prestate-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/.config/cannon_tag" }} - run: name: Build kona prestates command: just build-prestates working_directory: kona - save_cache: - key: kona-prestate-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/version.json" }} + key: kona-prestate-{{ checksum "./kona/justfile" }}-{{ checksum "./kona/.config/cannon_tag" }} name: Save Kona to cache paths: - - "kona/prestates/" + - "kona/prestate-artifacts-*/" - persist_to_workspace: root: . paths: - - "kona/prestates/*" + - "kona/prestate-artifacts-*/*" # Aggregator job - allows downstream jobs to depend on a single job instead of listing all build jobs. diff --git a/.github/actions/docker-build-prep/action.yml b/.github/actions/docker-build-prep/action.yml index 8f44ee69ea29a..4cde0a3dd2c4a 100644 --- a/.github/actions/docker-build-prep/action.yml +++ b/.github/actions/docker-build-prep/action.yml @@ -1,13 +1,10 @@ name: 'Docker Build Prep' -description: 'Prepare environment for docker builds (checkout, kona version, git versions)' +description: 'Prepare environment for docker builds (checkout, git versions)' outputs: versions: description: 'JSON object mapping image names to their GIT_VERSION' value: ${{ steps.compute_versions.outputs.versions }} - kona_version: - description: 'KONA_VERSION from kona/version.json' - value: ${{ steps.kona.outputs.version }} date: description: 'Current date in YYYYMMDD format' value: ${{ steps.date.outputs.date }} @@ -22,14 +19,6 @@ runs: DATE=$(date +%Y%m%d) echo "date=$DATE" >> $GITHUB_OUTPUT - - name: Read KONA_VERSION from kona/version.json - id: kona - shell: bash - run: | - KONA_VERSION=$(jq -r .version kona/version.json) - echo "version=$KONA_VERSION" >> $GITHUB_OUTPUT - echo "KONA_VERSION: $KONA_VERSION" - - name: Compute GIT_VERSION for all images id: compute_versions shell: bash diff --git a/.github/workflows/branches.yaml b/.github/workflows/branches.yaml index 80f6840575761..496e7f64aa281 100644 --- a/.github/workflows/branches.yaml +++ b/.github/workflows/branches.yaml @@ -25,7 +25,6 @@ jobs: contents: read outputs: versions: ${{ steps.prep.outputs.versions }} - kona_version: ${{ steps.prep.outputs.kona_version }} date: ${{ steps.prep.outputs.date }} steps: - name: Harden the runner @@ -73,7 +72,6 @@ jobs: registry: us-docker.pkg.dev/oplabs-tools-artifacts/images env: | GIT_VERSION=${{ fromJson(needs.prep.outputs.versions)[matrix.image_name] }} - KONA_VERSION=${{ needs.prep.outputs.kona_version }} set: | *.args.GIT_COMMIT=${{ github.sha }} *.args.GIT_DATE=${{ needs.prep.outputs.date }} @@ -115,7 +113,6 @@ jobs: registry: ttl.sh/${{ github.sha }} env: | GIT_VERSION=${{ fromJson(needs.prep.outputs.versions)[matrix.image_name] }} - KONA_VERSION=${{ needs.prep.outputs.kona_version }} set: | *.args.GIT_COMMIT=${{ github.sha }} *.args.GIT_DATE=${{ needs.prep.outputs.date }} diff --git a/.github/workflows/tags.yaml b/.github/workflows/tags.yaml index 9d749491ba600..1d5e5b7167136 100644 --- a/.github/workflows/tags.yaml +++ b/.github/workflows/tags.yaml @@ -14,7 +14,6 @@ jobs: image_name: ${{ steps.parse-tag.outputs.image_name }} version: ${{ steps.parse-tag.outputs.version }} versions: ${{ steps.prep.outputs.versions }} - kona_version: ${{ steps.prep.outputs.kona_version }} steps: - name: Harden the runner uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2 @@ -43,7 +42,6 @@ jobs: registry: us-docker.pkg.dev/oplabs-tools-artifacts/images env: | GIT_VERSION=${{ fromJson(needs.prep.outputs.versions)[needs.prep.outputs.image_name] }} - KONA_VERSION=${{ needs.prep.outputs.kona_version }} set: | *.args.GIT_COMMIT=${{ github.sha }} *.args.GIT_DATE=${{ github.event.head_commit.timestamp }} diff --git a/Makefile b/Makefile index 324c8f497e220..c263eee72274d 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,6 @@ 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) \ docker buildx bake \ --progress plain \ --load \ @@ -148,8 +147,11 @@ cannon: ## Builds cannon binary make -C ./cannon cannon .PHONY: cannon -reproducible-prestate: ## Builds reproducible-prestate binary - make -C ./op-program reproducible-prestate +reproducible-prestate: ## Builds reproducible prestates for op-program and kona + make -C ./op-program build-reproducible-prestate + cd kona && just build-reproducible-prestate + make -C ./op-program output-prestate-hash + cd kona && just output-prestate-hash .PHONY: reproducible-prestate cannon-prestates: cannon op-program diff --git a/docker-bake.hcl b/docker-bake.hcl index f2b8fec9ff83f..c793dfa57cb1a 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -6,10 +6,6 @@ variable "REPOSITORY" { default = "oplabs-tools-artifacts/images" } -variable "KONA_VERSION" { - default = "none" -} - variable "GIT_COMMIT" { default = "dev" } @@ -148,7 +144,6 @@ target "op-challenger" { GIT_COMMIT = "${GIT_COMMIT}" GIT_DATE = "${GIT_DATE}" OP_CHALLENGER_VERSION = "${OP_CHALLENGER_VERSION}" - KONA_VERSION="${KONA_VERSION}" } target = "op-challenger-target" platforms = split(",", PLATFORMS) diff --git a/kona/docker/docker-bake.hcl b/kona/docker/docker-bake.hcl index 989951152dfbe..0757c5b3f8458 100644 --- a/kona/docker/docker-bake.hcl +++ b/kona/docker/docker-bake.hcl @@ -79,15 +79,6 @@ target "generic" { // Proof Images // //////////////////////////////////////////////////////////////// -variable "ASTERISC_TAG" { - // The tag of `asterisc` to use in the `kona-asterisc-prestate` target. - // - // You can override this if you'd like to use a different tag to generate the prestate. - // https://github.com/ethereum-optimism/asterisc/releases - default = "v1.3.0" - description = "The tag of asterisc to use in the kona-asterisc-prestate target." -} - variable "CANNON_TAG" { // The tag of `cannon` to use in the `kona-cannon-prestate` target. // @@ -98,7 +89,7 @@ variable "CANNON_TAG" { } variable "CLIENT_BIN" { - // The `kona-client` binary to use in the `kona-{asterisc/cannon}-prestate` targets. + // The `kona-client` binary to use in the `kona-cannon-prestate` target. // // You can override this if you'd like to use a different `kona-client` binary to generate // the prestate. @@ -107,7 +98,7 @@ variable "CLIENT_BIN" { // - `kona` (single-chain) // - `kona-int` (interop) default = "kona" - description = "The kona-client binary to use in the proof prestate targets. Valid options: kona, kona-int" + description = "The kona-client binary to use in the proof prestate target. Valid options: kona, kona-int" } variable "KONA_CUSTOM_CONFIGS" { @@ -123,14 +114,6 @@ variable "CUSTOM_CONFIGS_CONTEXT" { } -target "asterisc-builder" { - description = "Rust build environment for bare-metal RISC-V 64-bit IMA (Asterisc FPVM ISA)" - inherits = ["docker-metadata-action"] - context = "docker/asterisc" - dockerfile = "asterisc.dockerfile" - platforms = split(",", PLATFORMS) -} - target "cannon-builder" { description = "Rust build environment for bare-metal MIPS64r1 (Cannon FPVM ISA)" inherits = ["docker-metadata-action"] @@ -143,20 +126,6 @@ target "cannon-builder" { platforms = split(",", PLATFORMS) } -target "kona-asterisc-prestate" { - description = "Prestate builder for kona-client with Asterisc FPVM" - inherits = ["docker-metadata-action"] - context = "." - dockerfile = "docker/fpvm-prestates/asterisc-repro.dockerfile" - args = { - CLIENT_BIN = "${CLIENT_BIN}" - CLIENT_TAG = "${GIT_REF_NAME}" - ASTERISC_TAG = "${ASTERISC_TAG}" - } - # Only build on linux/amd64 for reproducibility. - platforms = ["linux/amd64"] -} - target "kona-cannon-prestate" { description = "Prestate builder for kona-client with Cannon FPVM" inherits = ["docker-metadata-action"] @@ -167,7 +136,6 @@ target "kona-cannon-prestate" { } args = { CLIENT_BIN = "${CLIENT_BIN}" - CLIENT_TAG = "${GIT_REF_NAME}" CANNON_TAG = "${CANNON_TAG}" KONA_CUSTOM_CONFIGS = "${KONA_CUSTOM_CONFIGS}" } diff --git a/kona/docker/fpvm-prestates/asterisc-repro.dockerfile b/kona/docker/fpvm-prestates/asterisc-repro.dockerfile deleted file mode 100644 index b32f9baad8580..0000000000000 --- a/kona/docker/fpvm-prestates/asterisc-repro.dockerfile +++ /dev/null @@ -1,107 +0,0 @@ -################################################################ -# Build Asterisc @ `ASTERISC_TAG` # -################################################################ - -FROM ubuntu:22.04 AS asterisc-build -SHELL ["/bin/bash", "-c"] - -ARG TARGETARCH -ARG ASTERISC_TAG - -# Install deps -RUN apt-get update && apt-get install -y --no-install-recommends git curl ca-certificates make - -ENV GO_VERSION=1.22.7 - -# Fetch go manually, rather than using a Go base image, so we can copy the installation into the final stage -RUN curl -sL https://go.dev/dl/go$GO_VERSION.linux-$TARGETARCH.tar.gz -o go$GO_VERSION.linux-$TARGETARCH.tar.gz && \ - tar -C /usr/local/ -xzf go$GO_VERSION.linux-$TARGETARCH.tar.gz -ENV GOPATH=/go -ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH - -# Clone and build Asterisc @ `ASTERISC_TAG` -RUN git clone https://github.com/ethereum-optimism/asterisc && \ - cd asterisc && \ - git checkout $ASTERISC_TAG && \ - make && \ - cp rvgo/bin/asterisc /asterisc-bin - -################################################################ -# Build kona-client @ `CLIENT_TAG` # -################################################################ - -FROM ghcr.io/op-rs/kona/asterisc-builder:0.3.0 AS client-build -SHELL ["/bin/bash", "-c"] - -ARG CLIENT_BIN -ARG CLIENT_TAG - -# Install deps -RUN apt-get update && apt-get install -y --no-install-recommends git - -# Clone kona at the specified tag -RUN git clone https://github.com/op-rs/kona - -# Build kona-client on the selected tag -RUN cd kona && \ - git checkout $CLIENT_TAG && \ - cargo build -Zbuild-std=core,alloc -p kona-client --bin $CLIENT_BIN --locked --profile release-client-lto && \ - mv ./target/riscv64imac-unknown-none-elf/release-client-lto/$CLIENT_BIN /kona-client-elf - -################################################################ -# Create `prestate.bin.gz` + `prestate-proof.json` # -################################################################ - -FROM ubuntu:22.04 AS prestate-build -SHELL ["/bin/bash", "-c"] - -ARG UID=10001 -ARG GID=10001 - -RUN groupadd --gid ${GID} app \ - && useradd --uid ${UID} --gid ${GID} \ - --home-dir /home/app --create-home \ - --shell /usr/sbin/nologin \ - app - -# Use a writable workspace owned by the non-root user -WORKDIR /work -RUN chown ${UID}:${GID} /work - -# Copy asterisc binary -COPY --from=asterisc-build /asterisc-bin /work/asterisc - -# Copy kona-client binary -COPY --from=client-build /kona-client-elf /work/kona-client-elf - -# Make the binaries executable -RUN chmod 0555 /work/asterisc /work/kona-client-elf - -USER ${UID}:${GID} - -# Create `prestate.bin.gz` -RUN /work/asterisc load-elf \ - --path=/work/kona-client-elf \ - --out=/work/prestate.bin.gz - -# Create `prestate-proof.json` -RUN /work/asterisc run \ - --proof-at "=0" \ - --stop-at "=1" \ - --input /work/prestate.bin.gz \ - --meta /work/meta.json \ - --proof-fmt "/work/%d.json" \ - --output "" && \ - mv /work/0.json /work/prestate-proof.json - -################################################################ -# Export Artifacts # -################################################################ - -FROM scratch AS export-stage - -COPY --from=prestate-build /work/asterisc . -COPY --from=prestate-build /work/kona-client-elf . -COPY --from=prestate-build /work/prestate.bin.gz . -COPY --from=prestate-build /work/prestate-proof.json . -COPY --from=prestate-build /work/meta.json . diff --git a/kona/docker/fpvm-prestates/cannon-repro.dockerfile b/kona/docker/fpvm-prestates/cannon-repro.dockerfile index fc73399d07f6f..fc7e8a482e15a 100644 --- a/kona/docker/fpvm-prestates/cannon-repro.dockerfile +++ b/kona/docker/fpvm-prestates/cannon-repro.dockerfile @@ -27,30 +27,25 @@ RUN git clone https://github.com/ethereum-optimism/optimism && \ cp bin/cannon /cannon-bin ################################################################ -# Build kona-client @ `CLIENT_TAG` # +# Build kona-client from local source # ################################################################ FROM ghcr.io/op-rs/kona/cannon-builder:0.3.0 AS client-build SHELL ["/bin/bash", "-c"] ARG CLIENT_BIN -ARG CLIENT_TAG ARG KONA_CUSTOM_CONFIGS COPY --from=custom_configs / /usr/local/kona-custom-configs -# Install deps -RUN apt-get update && apt-get install -y --no-install-recommends git - -# Clone kona at the specified tag -RUN git clone https://github.com/op-rs/kona +# Copy kona source from build context +COPY . /kona ENV KONA_CUSTOM_CONFIGS=$KONA_CUSTOM_CONFIGS ENV KONA_CUSTOM_CONFIGS_DIR=/usr/local/kona-custom-configs -# Build kona-client on the selected tag +# Build kona-client RUN cd kona && \ - git checkout $CLIENT_TAG && \ cargo build -Zbuild-std=core,alloc -p kona-client --bin $CLIENT_BIN --locked --profile release-client-lto && \ mv ./target/mips64-unknown-none/release-client-lto/$CLIENT_BIN /kona-client-elf diff --git a/kona/docker/fpvm-prestates/justfile b/kona/docker/fpvm-prestates/justfile index 60ddc0353e722..0f5849f995f1e 100644 --- a/kona/docker/fpvm-prestates/justfile +++ b/kona/docker/fpvm-prestates/justfile @@ -1,79 +1,20 @@ set positional-arguments -alias all := build-client-prestate-artifacts alias cannon := build-client-prestate-cannon-artifacts -alias asterisc := build-client-prestate-asterisc-artifacts # default recipe to display help information default: @just --list -# Build the `kona-client` prestate artifacts for the specified tags (asterisc + cannon). -build-client-prestate-artifacts kona_client_variant kona_tag asterisc_tag cannon_tag: - #!/bin/bash - - # Available variants of the client program, parsed from the binary targets of the `kona-client` crate. - manifest_path="$(realpath ../../bin/client/Cargo.toml)" - available_variants=($(cargo metadata --format-version=1 --manifest-path="$manifest_path" --no-deps | - jq -r --arg path "$manifest_path" '.packages[] | select(.manifest_path == $path) | .targets[] | select(.kind[] == "bin") | .name' | - xargs)) - - # Validates that `$1` is contained in `$2` - validate_option() { - local input="$1" - local valid_options=("${@:2}") - - for option in "${valid_options[@]}"; do - if [[ "$input" == "$option" ]]; then - return 0 - fi - done - - return 1 - } - - # Check if `kona_client_variant` is contained within the available variants. - if ! validate_option "{{kona_client_variant}}" "${available_variants[@]}"; then - echo "Invalid client program variant. Please choose from: ${available_variants[*]}" - exit 1 - fi - - just build-client-prestate-asterisc-artifacts {{kona_client_variant}} {{kona_tag}} {{asterisc_tag}} - just build-client-prestate-cannon-artifacts {{kona_client_variant}} {{kona_tag}} {{cannon_tag}} - -# Build the `kona-client` prestate artifacts for the latest release (asterisc). -build-client-prestate-asterisc-artifacts kona_client_variant kona_tag asterisc_tag out='./prestate-artifacts-asterisc': - #!/bin/bash - OUTPUT_DIR={{out}} - - # Docker bake env - export GIT_REF_NAME="{{kona_tag}}" - export CLIENT_BIN="{{kona_client_variant}}" - export ASTERISC_TAG="{{asterisc_tag}}" - export DEFAULT_TAG="kona-asterisc-prestate:local" - - # Navigate to workspace root - cd ../.. - - # Create the output directory - mkdir -p $OUTPUT_DIR - - echo "Building kona-client (variant: {{kona_client_variant}}) prestate artifacts for the asterisc target. 🐚 Kona Tag: {{kona_tag}} | 🎇 Asterisc Tag: {{asterisc_tag}}" - docker buildx bake \ - --set "*.output=$OUTPUT_DIR" \ - -f docker/docker-bake.hcl \ - kona-asterisc-prestate - -# Build the `kona-client` prestate artifacts for the latest release (cannon). +# Build the `kona-client` prestate artifacts from local source (cannon). build-client-prestate-cannon-artifacts \ kona_client_variant \ - kona_tag cannon_tag \ + cannon_tag \ out='./prestate-artifacts-cannon' \ custom_config_dir='': #!/bin/bash OUTPUT_DIR={{out}} # Docker bake env - export GIT_REF_NAME="{{kona_tag}}" export CLIENT_BIN="{{kona_client_variant}}" export CANNON_TAG="{{cannon_tag}}" export DEFAULT_TAG="kona-cannon-prestate:local" @@ -99,7 +40,7 @@ build-client-prestate-cannon-artifacts \ # Create the output directory mkdir -p $OUTPUT_DIR - echo "Building kona-client (variant: {{kona_client_variant}}) prestate artifacts for the cannon target. 🐚 Kona Tag: {{kona_tag}} | 🔫 Cannon Tag: {{cannon_tag}}" + echo "Building kona-client (variant: {{kona_client_variant}}) prestate artifacts for the cannon target. 🔫 Cannon Tag: {{cannon_tag}}" docker buildx bake \ --set "*.output=$OUTPUT_DIR" \ -f docker/docker-bake.hcl \ diff --git a/kona/justfile b/kona/justfile index e352f88c3416c..f8ef5b5359ca6 100644 --- a/kona/justfile +++ b/kona/justfile @@ -7,9 +7,6 @@ import "./docker/apps/justfile" import "./docs/justfile" KONA_ROOT := source_directory() -KONA_VERSION := shell('jq -r .version "$1/version.json"', KONA_ROOT) -KONA_PRESTATE_HASH := shell('jq -r .prestateHash "$1/version.json"', KONA_ROOT) -KONA_INTEROP_PRESTATE_HASH := shell('jq -r .interopPrestateHash "$1/version.json"', KONA_ROOT) set positional-arguments alias t := tests @@ -194,84 +191,47 @@ check-no-std: ### TODO(ethereum-optimism/optimism#18654): Remove these recipes once the migration is complete -build-all: build-prestates build-kona-host - build-prestates: build-cannon-prestate build-interop-prestate build-cannon-prestate: - @just build-prestate kona-client {{KONA_PRESTATE_HASH}} + @just build-prestate kona-client prestate-artifacts-cannon build-interop-prestate: - @just build-prestate kona-client-int {{KONA_INTEROP_PRESTATE_HASH}} + @just build-prestate kona-client-int prestate-artifacts-cannon-interop -build-prestate VARIANT HASH: +build-prestate VARIANT OUTPUT_DIR: #!/usr/bin/env bash set -euo pipefail - cd "{{KONA_ROOT}}" - # Check if required prestate already exists - if [[ -f "prestates/{{HASH}}.bin.gz" ]]; then - echo "Prestate {{HASH}} for variant {{VARIANT}} already exists" - exit - fi - echo "Building prestate..." - just checkout-kona - cd "{{KONA_ROOT}}/build/kona" - cd docker/fpvm-prestates - # Delete any existing artifacts (they're in .gitignore so reset --hard won't delete them) - rm -rf ../../prestate-artifacts-cannon - echo just cannon {{VARIANT}} "kona-client/v{{KONA_VERSION}}" $(cat ../../.config/cannon_tag) - just cannon {{VARIANT}} "kona-client/v{{KONA_VERSION}}" $(cat ../../.config/cannon_tag) - - # Check the prestate hash matches what we expect - ACTUAL_HASH=$(jq -r .pre ../../prestate-artifacts-cannon/prestate-proof.json) - if [[ "${ACTUAL_HASH}" != "{{HASH}}" ]]; then - echo "Incorrect prestate hash, expected {{HASH}} but was ${ACTUAL_HASH}" - exit 1 - fi - - mkdir -p "{{KONA_ROOT}}/prestates" - cp ../../prestate-artifacts-cannon/prestate.bin.gz "{{KONA_ROOT}}/prestates/{{HASH}}.bin.gz" - -build-kona-host: - #!/usr/bin/env bash - set -euo pipefail + echo "Building prestate for {{VARIANT}}..." + cd "{{KONA_ROOT}}/docker/fpvm-prestates" + CANNON_TAG=$(cat ../../.config/cannon_tag) + just cannon {{VARIANT}} "${CANNON_TAG}" "{{KONA_ROOT}}/{{OUTPUT_DIR}}" - # Check if kona-host has already been built - # This is a simplistic check that relies on CircleCI's cache being keyed on this file - # which contains the kona version we're checking out. Locally you may need to run - # just clean to force a rebuild if the kona version has changed. - if [[ -f "bin/kona-host" ]]; then - echo "kona-host already built. Assuming it is built from kona-client/v{{KONA_VERSION}}" - exit - fi + cd "{{KONA_ROOT}}" - echo "Building kona-host" - just checkout-kona - cd "{{KONA_ROOT}}/build/kona" - just build-native --bin kona-host + # Copy with hash-based name for challenger lookup + HASH=$(jq -r .pre "{{OUTPUT_DIR}}/prestate-proof.json") + cp "{{OUTPUT_DIR}}/prestate.bin.gz" "{{OUTPUT_DIR}}/${HASH}.bin.gz" + echo "Prestate for {{VARIANT}}: ${HASH}" - mkdir -p "{{KONA_ROOT}}/bin" - cp "{{KONA_ROOT}}/build/kona/target/debug/kona-host" "{{KONA_ROOT}}/bin/kona-host" +build-reproducible-prestate: + @just build-prestates -checkout-kona: - #!/usr/bin/env bash - set -euo pipefail +output-prestate-hash: + @echo "-------------------- Kona Prestates --------------------" + @echo "" + @echo "Cannon Absolute prestate hash:" + @jq -r .pre {{KONA_ROOT}}/prestate-artifacts-cannon/prestate-proof.json + @echo "" + @echo "Cannon Interop Absolute prestate hash:" + @jq -r .pre {{KONA_ROOT}}/prestate-artifacts-cannon-interop/prestate-proof.json + @echo "" - DIR="{{KONA_ROOT}}/build" - mkdir -p "${DIR}" - cd "${DIR}" - if [[ -d kona ]]; then - cd kona - git fetch origin - git checkout -f "kona-client/v{{KONA_VERSION}}" - git reset --hard HEAD - else - git clone -b "kona-client/v{{KONA_VERSION}}" https://github.com/op-rs/kona kona - cd kona - fi +reproducible-prestate: build-reproducible-prestate output-prestate-hash clean: #!/usr/bin/env bash set -euo pipefail - rm -rf "{{KONA_ROOT}}/build" "{{KONA_ROOT}}/prestates" "{{KONA_ROOT}}/bin" \ No newline at end of file + rm -rf "{{KONA_ROOT}}/build" + rm -rf "{{KONA_ROOT}}/prestate-artifacts-cannon" "{{KONA_ROOT}}/prestate-artifacts-cannon-interop" diff --git a/kona/rust-toolchain.toml b/kona/rust-toolchain.toml index c95c90571ff47..2340e4187e7b3 100644 --- a/kona/rust-toolchain.toml +++ b/kona/rust-toolchain.toml @@ -1,2 +1,3 @@ [toolchain] +# /ops/docker/op-stack-go/Dockerfile must match this version. channel = "1.88" diff --git a/kona/version.json b/kona/version.json deleted file mode 100644 index 8d8e7807a200a..0000000000000 --- a/kona/version.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.2.7", - "prestateHash": "0x0323914d3050e80c3d09da528be54794fde60cd26849cd3410dde0da7cd7d4fa", - "interopPrestateHash": "0x03f03018773fae0603f7c110ef1defa8d19b601b32ee530f9951987baec435b0" -} \ No newline at end of file diff --git a/kurtosis-devnet/justfile b/kurtosis-devnet/justfile index 29195104da56f..9ba597891a525 100644 --- a/kurtosis-devnet/justfile +++ b/kurtosis-devnet/justfile @@ -31,10 +31,7 @@ _docker_build_stack TAG TARGET *ARGS: (_docker_build TAG TARGET "../" "ops/docke cannon-image TAG='cannon:devnet': (_docker_build_stack TAG "cannon-target") da-server-image TAG='da-server:devnet': (_docker_build_stack TAG "da-server-target") op-batcher-image TAG='op-batcher:devnet': (_docker_build_stack TAG "op-batcher-target") -# TODO: this is a temporary hack to get the kona version right. -# Ideally the Dockerfile should be self-sufficient (right now we depend on -# docker-bake.hcl to do the right thing). -op-challenger-image TAG='op-challenger:devnet': (_docker_build_stack TAG "op-challenger-target" "--build-arg" "KONA_VERSION=1.0.1") +op-challenger-image TAG='op-challenger:devnet': (_docker_build_stack TAG "op-challenger-target") op-conductor-image TAG='op-conductor:devnet': (_docker_build_stack TAG "op-conductor-target") op-deployer-image TAG='op-deployer:devnet': (_docker_build_stack TAG "op-deployer-target") op-dispute-mon-image TAG='op-dispute-mon:devnet': (_docker_build_stack TAG "op-dispute-mon-target") diff --git a/op-devstack/shared/challenger/challenger.go b/op-devstack/shared/challenger/challenger.go index 8c50b23f7801c..44e7719d60fbb 100644 --- a/op-devstack/shared/challenger/challenger.go +++ b/op-devstack/shared/challenger/challenger.go @@ -84,7 +84,7 @@ func applyCannonKonaConfig(c *config.Config, rollupCfgs []*rollup.Config, l1Gene 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/prestate-artifacts-cannon") if err != nil { return fmt.Errorf("failed to create kona prestates url: %w", err) } diff --git a/op-devstack/sysgo/superroot.go b/op-devstack/sysgo/superroot.go index 45a165adc9dd7..89dfbdf3aa998 100644 --- a/op-devstack/sysgo/superroot.go +++ b/op-devstack/sysgo/superroot.go @@ -31,7 +31,6 @@ import ( "github.com/ethereum/go-ethereum/rpc" "github.com/lmittmann/w3" w3eth "github.com/lmittmann/w3/module/eth" - "github.com/stretchr/testify/require" ) // V2 structs for OPCM >= 7.0.0 (using IOPContractsManagerMigrator interface) @@ -285,30 +284,11 @@ func getInteropCannonAbsolutePrestate(t devtest.CommonT) common.Hash { } func getInteropCannonKonaAbsolutePrestate(t devtest.CommonT) common.Hash { - return loadKonaVersions(t).InteropPrestateHash + return getAbsolutePrestate(t, "kona/prestate-artifacts-cannon-interop/prestate-proof.json") } func getCannonKonaAbsolutePrestate(t devtest.CommonT) common.Hash { - return loadKonaVersions(t).PrestateHash -} - -func loadKonaVersions(t devtest.CommonT) konaVersions { - konaVersionPath := "kona/version.json" - root, err := findMonorepoRoot(konaVersionPath) - t.Require().NoError(err) - p := path.Join(root, konaVersionPath) - data, err := os.ReadFile(p) - t.Require().NoError(err, "Failed to read kona versions") - var versions konaVersions - err = json.Unmarshal(data, &versions) - require.NoError(t, err, "Failed to parse kona versions") - return versions -} - -type konaVersions struct { - Version string `json:"version"` - PrestateHash common.Hash `json:"prestateHash"` - InteropPrestateHash common.Hash `json:"interopPrestateHash"` + return getAbsolutePrestate(t, "kona/prestate-artifacts-cannon/prestate-proof.json") } func getAbsolutePrestate(t devtest.CommonT, prestatePath string) common.Hash { diff --git a/op-program/Makefile b/op-program/Makefile index 9cb5edf60eb58..a3c93af29fd3c 100644 --- a/op-program/Makefile +++ b/op-program/Makefile @@ -46,13 +46,16 @@ op-program-client-riscv: check-custom-chains: op-program-host ./bin/op-program configs check-custom-chains -reproducible-prestate: check-custom-chains +build-reproducible-prestate: check-custom-chains @docker build --build-arg GO_VERSION=1.24.2-alpine3.21 --build-arg EXPORT_TARGET=next --output ./bin/ --progress plain -f Dockerfile.repro ../ @docker build --build-arg GO_VERSION=1.24.2-alpine3.21 --build-arg EXPORT_TARGET=current --output ./bin/ --progress plain -f Dockerfile.repro ../ - @echo "-------------------- Production Prestates --------------------" +.PHONY: build-reproducible-prestate + +output-prestate-hash: + @echo "-------------------- op-program Production Prestates --------------------" @echo "\nCannon64 Absolute prestate hash: " @cat ./bin/prestate-proof-mt64.json | jq -r .pre - @echo "\n-------------------- Experimental Prestates --------------------" + @echo "\n-------------------- op-program Experimental Prestates --------------------" @echo "\nCannon64Next Absolute prestate hash: " @cat ./bin/prestate-proof-mt64Next.json | jq -r .pre @echo "\nCannonInterop Absolute prestate hash: " @@ -60,6 +63,9 @@ reproducible-prestate: check-custom-chains @echo "\nCannonInteropNext Absolute prestate hash: " @cat ./bin/prestate-proof-interopNext.json | jq -r .pre @echo +.PHONY: output-prestate-hash + +reproducible-prestate: build-reproducible-prestate output-prestate-hash .PHONY: reproducible-prestate verify-reproducibility: diff --git a/op-program/scripts/build-prestates.sh b/op-program/scripts/build-prestates.sh index 882f551d5a8b4..644f2430b374f 100755 --- a/op-program/scripts/build-prestates.sh +++ b/op-program/scripts/build-prestates.sh @@ -1,54 +1,63 @@ #!/usr/bin/env bash set -euo pipefail SCRIPTS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -KONA_REPO_URL=https://github.com/op-rs/kona +# Get the repo root (two levels up from op-program/scripts/) +REPO_ROOT=$(cd "${SCRIPTS_DIR}/../.." && pwd) TMP_DIR=$(mktemp -d) +WORKTREE_DIR="${TMP_DIR}/optimism" + function cleanup() { + git -C "${REPO_ROOT}" worktree remove "${WORKTREE_DIR}" --force 2>/dev/null || true rm -rf "${TMP_DIR}" } trap cleanup EXIT -echo "Using temp dir: ${TMP_DIR}" -cd "${TMP_DIR}" -# Need to check out a fresh copy of the monorepo so we can switch to specific tags without it also affecting the -# contents of this script (which is checked into the repo). -git clone https://github.com/ethereum-optimism/optimism --recurse-submodules +echo "Creating worktree in: ${WORKTREE_DIR}" +# Create a detached worktree - we'll checkout specific tags in the build functions +git -C "${REPO_ROOT}" worktree add "${WORKTREE_DIR}" HEAD --detach STATES_DIR="${SCRIPTS_DIR}/../temp/states" LOGS_DIR="${SCRIPTS_DIR}/../temp/logs" -REPO_DIR="${TMP_DIR}/optimism" -BIN_DIR="${REPO_DIR}/op-program/bin/" +BIN_DIR="${WORKTREE_DIR}/op-program/bin/" VERSIONS_FILE="${STATES_DIR}/versions.json" mkdir -p "${STATES_DIR}" "${LOGS_DIR}" -cd "${REPO_DIR}" +cd "${WORKTREE_DIR}" + +# Legacy kona versions that were tagged in the old op-rs/kona repo before migration +LEGACY_KONA_VERSIONS=( + "kona-client/v1.1.6" + "kona-client/v1.1.7" + "kona-client/v1.2.2" + "kona-client/v1.2.4" + "kona-client/v1.2.5" + "kona-client/v1.2.7" +) +LEGACY_KONA_REPO="https://github.com/op-rs/kona" +LEGACY_KONA_DIR="${TMP_DIR}/kona-legacy" -function build_kona_prestate() { +# Legacy kona prestates are built from the old op-rs/kona repo. +function build_legacy_kona_prestate() { local version=$1 - if [[ -z "${version}" ]]; then - echo "Error: version is required" - exit 1 - fi - local short_version - short_version=$(echo "${version}" | cut -c 14-) - local log_file="${LOGS_DIR}/build-kona-${short_version}.txt" - echo "Building Version: ${version} Logs: ${log_file}" + local log_file=$2 + local short_version="${version#*/}" + echo "Building legacy kona version: ${version} Logs: ${log_file}" - mkdir -p kona-prestate-build - cd kona-prestate-build + mkdir -p "${LEGACY_KONA_DIR}" + cd "${LEGACY_KONA_DIR}" if [[ -d kona ]]; then cd kona git checkout --force "${version}" > "${log_file}" 2>&1 else - git clone -b "${version}" "$KONA_REPO_URL" kona > "${log_file}" 2>&1 + git clone -b "${version}" "${LEGACY_KONA_REPO}" kona > "${log_file}" 2>&1 cd kona fi # kona doesn't define a just dependency in its mise config. # but the monorepo does and it should be preinstalled by now. So let's setup the just shim. - MISE_DEFAULT_CONFIG_FILENAME="${REPO_DIR}"/mise.toml mise use just > "${log_file}" 2>&1 + MISE_DEFAULT_CONFIG_FILENAME="${WORKTREE_DIR}"/mise.toml mise use just > "${log_file}" 2>&1 cd docker/fpvm-prestates rm -rf ../../prestate-artifacts-cannon @@ -65,111 +74,118 @@ function build_kona_prestate() { cp ../../prestate-artifacts-cannon/prestate.bin.gz "${STATES_DIR}/${prestate_hash}.bin.gz" VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${short_version}\", \"hash\": \"${prestate_hash}\", \"type\": \"cannon64-kona-interop\"}]") echo "Built kona-interop ${version}: ${prestate_hash}" + + cd "${WORKTREE_DIR}" } -function build_op_program_prestate() { - local VERSION=$1 - if [[ -z "${VERSION}" ]]; then - echo "Error: VERSION is required" - exit 1 - fi - local SHORT_VERSION # declared separately from assignment to avoid masking failures - SHORT_VERSION=$(echo "${VERSION}" | cut -c 13-) - local LOG_FILE="${LOGS_DIR}/build-${SHORT_VERSION}.txt" - echo "Building Version: ${VERSION} Logs: ${LOG_FILE}" - # use --force to overwrite any mise.toml changes - git checkout --force "${VERSION}" > "${LOG_FILE}" 2>&1 +function build_prestates() { + local version=$1 + local log_file=$2 + local short_version="${version#*/}" + echo "Building version: ${version} Logs: ${log_file}" + + git checkout --force "${version}" > "${log_file}" 2>&1 + if [ -f mise.toml ]; then - echo "Install dependencies with mise" >> "${LOG_FILE}" - # we rely only on go and jq for the reproducible-prestate build. - # The mise cache should already have jq preinstalled - # But we need to ensure that this ${VERSION} has the correct go version - # So we replace the mise.toml with a minimal one that only specifies go - # Otherwise, `mise install` fails as it conflicts with other preinstalled dependencies + echo "Install dependencies with mise" >> "${log_file}" + # We need go (for op-program), just (for kona), and jq (for extracting hashes). + # jq should already be preinstalled in the mise cache. + # Replace mise.toml with a minimal one to avoid conflicts with other preinstalled dependencies. GO_VERSION=$(mise config get tools.go) cat > mise.toml << EOF [tools] go = "${GO_VERSION}" +just = "${JUST_VERSION}" EOF - mise install -v -y >> "${LOG_FILE}" 2>&1 + mise install -v -y >> "${log_file}" 2>&1 fi + rm -rf "${BIN_DIR}" - make reproducible-prestate >> "${LOG_FILE}" 2>&1 - - if [ -f "${BIN_DIR}/prestate-proof.json" ]; then - local HASH - HASH=$(cat "${BIN_DIR}/prestate-proof.json" | jq -r .pre) - if [ -f "${BIN_DIR}/prestate.bin.gz" ]; then - cp "${BIN_DIR}/prestate.bin.gz" "${STATES_DIR}/${HASH}.bin.gz" - else - cp "${BIN_DIR}/prestate.json" "${STATES_DIR}/${HASH}.json" + rm -rf kona/prestate-artifacts-* + make reproducible-prestate >> "${log_file}" 2>&1 + + if [[ "${version}" =~ ^op-program/v ]]; then + if [ -f "${BIN_DIR}/prestate-proof.json" ]; then + local hash + hash=$(jq -r .pre "${BIN_DIR}/prestate-proof.json") + if [ -f "${BIN_DIR}/prestate.bin.gz" ]; then + cp "${BIN_DIR}/prestate.bin.gz" "${STATES_DIR}/${hash}.bin.gz" + else + cp "${BIN_DIR}/prestate.json" "${STATES_DIR}/${hash}.json" + fi + VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${short_version}\", \"hash\": \"${hash}\", \"type\": \"cannon32\"}]") + echo "Built cannon32 ${version}: ${hash}" fi - VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${SHORT_VERSION}\", \"hash\": \"${HASH}\", \"type\": \"cannon32\"}]") - echo "Built cannon32 ${VERSION}: ${HASH}" - fi - if [ -f "${BIN_DIR}/prestate-proof-mt64.json" ]; then - local HASH - HASH=$(cat "${BIN_DIR}/prestate-proof-mt64.json" | jq -r .pre) - cp "${BIN_DIR}/prestate-mt64.bin.gz" "${STATES_DIR}/${HASH}.mt64.bin.gz" - VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${SHORT_VERSION}\", \"hash\": \"${HASH}\", \"type\": \"cannon64\"}]") - echo "Built cannon64 ${VERSION}: ${HASH}" + if [ -f "${BIN_DIR}/prestate-proof-mt64.json" ]; then + local hash + hash=$(jq -r .pre "${BIN_DIR}/prestate-proof-mt64.json") + cp "${BIN_DIR}/prestate-mt64.bin.gz" "${STATES_DIR}/${hash}.mt64.bin.gz" + VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${short_version}\", \"hash\": \"${hash}\", \"type\": \"cannon64\"}]") + echo "Built cannon64 ${version}: ${hash}" + fi + + if [ -f "${BIN_DIR}/prestate-proof-interop.json" ]; then + local hash + hash=$(jq -r .pre "${BIN_DIR}/prestate-proof-interop.json") + cp "${BIN_DIR}/prestate-interop.bin.gz" "${STATES_DIR}/${hash}.interop.bin.gz" + VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${short_version}\", \"hash\": \"${hash}\", \"type\": \"interop\"}]") + echo "Built cannon-interop ${version}: ${hash}" + fi fi - if [ -f "${BIN_DIR}/prestate-proof-interop.json" ]; then - local HASH - HASH=$(cat "${BIN_DIR}/prestate-proof-interop.json" | jq -r .pre) - cp "${BIN_DIR}/prestate-interop.bin.gz" "${STATES_DIR}/${HASH}.interop.bin.gz" - VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${SHORT_VERSION}\", \"hash\": \"${HASH}\", \"type\": \"interop\"}]") - echo "Built cannon-interop ${VERSION}: ${HASH}" + if [[ "${version}" =~ ^kona-client/v ]]; then + if [ -f "kona/prestate-artifacts-cannon/prestate-proof.json" ]; then + local hash + hash=$(jq -r .pre kona/prestate-artifacts-cannon/prestate-proof.json) + cp kona/prestate-artifacts-cannon/prestate.bin.gz "${STATES_DIR}/${hash}.bin.gz" + VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${short_version}\", \"hash\": \"${hash}\", \"type\": \"cannon64-kona\"}]") + echo "Built cannon64-kona ${version}: ${hash}" + fi + + if [ -f "kona/prestate-artifacts-cannon-interop/prestate-proof.json" ]; then + local hash + hash=$(jq -r .pre kona/prestate-artifacts-cannon-interop/prestate-proof.json) + cp kona/prestate-artifacts-cannon-interop/prestate.bin.gz "${STATES_DIR}/${hash}.bin.gz" + VERSIONS_JSON=$(echo "${VERSIONS_JSON}" | jq ". += [{\"version\": \"${short_version}\", \"hash\": \"${hash}\", \"type\": \"cannon64-kona-interop\"}]") + echo "Built cannon64-kona-interop ${version}: ${hash}" + fi fi } -# this global is written to by build_op_program_prestate and build_kona_prestate VERSIONS_JSON="[]" -readarray -t VERSIONS < <(git tag --list 'op-program/v*' --sort taggerdate) +readarray -t VERSIONS < <(git tag --list 'op-program/v*' 'kona-client/v*' --sort=taggerdate) for i in "${!VERSIONS[@]}"; do + tag="${VERSIONS[i]}" + log_file="${LOGS_DIR}/build-${tag//\//-}.txt" + pushd . - build_op_program_prestate "${VERSIONS[i]}" + build_prestates "${tag}" "${log_file}" popd - # after every 10 builds, cleanup docker artifacts to reclaim disk space - if [ "$CIRCLECI" = "true" ]; then + if [ "${CIRCLECI:-}" = "true" ]; then if (( (i + 1) % 10 == 0 )); then echo "Pruning docker build artifacts after ${i} builds" docker system prune -f fi fi done -echo "${VERSIONS_JSON}" > "${VERSIONS_FILE}" - -# ignore alpha, beta, and older kona-client releases. The cannon prestate builds are not well supported on these versions -EXCLUDED=( - "kona-client/v1.0.0" - "kona-client/v1.0.1" - "kona-client/v1.0.2" - "kona-client/v1.1.0-rc.1" - "kona-client/v1.1.0-rc.3" - "kona-client/v1.1.3" -) -printf "%s\n" "${EXCLUDED[@]}" > excluded.txt -readarray -t KONA_VERSIONS < <(git ls-remote --tags "$KONA_REPO_URL" | grep kona-client/ \ - | sed 's|.*refs/tags/||' | sed 's/\^{}//' | sort -u \ - | grep -v beta | grep -v alpha | grep -v -F -f excluded.txt) +# Build legacy kona prestates from the old op-rs/kona repo. +for i in "${!LEGACY_KONA_VERSIONS[@]}"; do + tag="${LEGACY_KONA_VERSIONS[i]}" + log_file="${LOGS_DIR}/build-legacy-${tag//\//-}.txt" -for i in "${!KONA_VERSIONS[@]}"; do pushd . - build_kona_prestate "${KONA_VERSIONS[i]}" + build_legacy_kona_prestate "${tag}" "${log_file}" popd - # after every 10 builds, cleanup docker artifacts to reclaim disk space - if [ "$CIRCLECI" = "true" ]; then + if [ "${CIRCLECI:-}" = "true" ]; then if (( (i + 1) % 10 == 0 )); then echo "Pruning docker build artifacts after ${i} builds" docker system prune -f fi fi done -echo "${VERSIONS_JSON}" > "${VERSIONS_FILE}" +echo "${VERSIONS_JSON}" > "${VERSIONS_FILE}" echo "All prestates successfully built and available in ${STATES_DIR}" diff --git a/ops/docker/op-stack-go/Dockerfile b/ops/docker/op-stack-go/Dockerfile index 51db686177fbf..23578ed54e73d 100644 --- a/ops/docker/op-stack-go/Dockerfile +++ b/ops/docker/op-stack-go/Dockerfile @@ -12,10 +12,6 @@ ARG TARGET_BASE_IMAGE=alpine:3.20 # The ubuntu target base image is used for the op-challenger build with kona. ARG UBUNTU_TARGET_BASE_IMAGE=ubuntu:22.04 -# The version of kona to use. -# The only build that uses this is `op-challenger-target`. -ARG KONA_VERSION=none - # builder_foundry does not need to be built on $BUILDPLATFORM, as foundry produces static binaries. FROM alpine:3.21 AS builder_foundry @@ -204,6 +200,31 @@ RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_INTEROP_MON_VERSION" \ op-interop-mon/op-interop-mon +# The Rust version must match kona/rust-toolchain.toml. We don't use "latest" to ensure reproducibility +FROM --platform=$BUILDPLATFORM rust:1.88 AS kona-host-builder +ARG TARGETARCH +# Install build dependencies and cross-compilation toolchains +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + libssl-dev \ + clang \ + pkg-config \ + gcc-aarch64-linux-gnu \ + gcc-x86-64-linux-gnu \ + && rm -rf /var/lib/apt/lists/* +COPY ./kona /kona +WORKDIR /kona +# Map TARGETARCH to Rust target triple, install it, and build +RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/kona/target \ + case "$TARGETARCH" in \ + amd64) RUST_TARGET=x86_64-unknown-linux-gnu ;; \ + arm64) RUST_TARGET=aarch64-unknown-linux-gnu ;; \ + *) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \ + esac && \ + rustup target add "$RUST_TARGET" && \ + RUSTFLAGS="-C target-cpu=generic" cargo build --bin kona-host --profile release-perf --target "$RUST_TARGET" && \ + cp "/kona/target/$RUST_TARGET/release-perf/kona-host" /kona-host + FROM $TARGET_BASE_IMAGE AS cannon-target COPY --from=cannon-builder /app/cannon/bin/cannon /usr/local/bin/ COPY --from=cannon-builder /app/cannon/multicannon/embeds/* /usr/local/bin/ @@ -221,9 +242,6 @@ FROM $TARGET_BASE_IMAGE AS op-node-target COPY --from=op-node-builder /app/op-node/bin/op-node /usr/local/bin/ CMD ["op-node"] -# Make the kona docker image published by upstream available as a source to copy kona from. -FROM ghcr.io/op-rs/kona/kona-host:$KONA_VERSION AS kona - # Also produce an op-challenger loaded with kona using ubuntu FROM $UBUNTU_TARGET_BASE_IMAGE AS op-challenger-target RUN apt-get update && apt-get install -y --no-install-recommends musl openssl ca-certificates @@ -233,8 +251,8 @@ COPY --from=op-program-builder /app/op-program/bin/op-program /usr/local/bin/ ENV OP_CHALLENGER_CANNON_SERVER=/usr/local/bin/op-program COPY --from=cannon-builder /app/cannon/bin/cannon /usr/local/bin/ ENV OP_CHALLENGER_CANNON_BIN=/usr/local/bin/cannon -# Copy in kona -COPY --from=kona /usr/local/bin/kona-host /usr/local/bin/ +# Copy in kona-host (built from local kona/ source) +COPY --from=kona-host-builder /kona-host /usr/local/bin/kona-host ENV OP_CHALLENGER_ASTERISC_KONA_SERVER=/usr/local/bin/kona-host ENV OP_CHALLENGER_CANNON_KONA_SERVER=/usr/local/bin/kona-host CMD ["op-challenger"] diff --git a/ops/docker/op-stack-go/Dockerfile.dockerignore b/ops/docker/op-stack-go/Dockerfile.dockerignore index 05f69639ac98b..76b400373741f 100644 --- a/ops/docker/op-stack-go/Dockerfile.dockerignore +++ b/ops/docker/op-stack-go/Dockerfile.dockerignore @@ -27,6 +27,10 @@ !/op-alt-da !/op-faucet !/op-interop-mon +!/kona +# Exclude large kona build artifacts +kona/target +kona/.git !/go.mod !/go.sum !/justfiles @@ -37,3 +41,6 @@ **/bin **/testdata **/tests + +# Re-include kona/bin which is excluded by **/bin above +!/kona/bin