Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reproducible guest build #1713

Merged
merged 2 commits into from
Jan 16, 2025
Merged

Fix reproducible guest build #1713

merged 2 commits into from
Jan 16, 2025

Conversation

exeokan
Copy link
Contributor

@exeokan exeokan commented Jan 15, 2025

Description

REPR_GUEST_BUILD=1 make build was failing for me:

error: failed to run custom build command for `citrea-risc0-light-client v0.6.0 (/Users/ege/citrea/guests/risc0/light-client-proof)`

Caused by:
  process didn't exit successfully: `/Users/ege/citrea/target/debug/build/citrea-risc0-light-client-c585ed2bb5fac12a/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=SKIP_GUEST_BUILD
  cargo:rerun-if-env-changed=REPR_GUEST_BUILD
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-env-changed=CITREA_NETWORK
  cargo:rerun-if-env-changed=L2_GENESIS_ROOT
  cargo:rerun-if-env-changed=BATCH_PROOF_METHOD_ID
  cargo:rerun-if-env-changed=PROVER_DA_PUB_KEY
  cargo:warning=SKIP_GUEST_BUILD not set. Defaulting to performing guest build.
  cargo:rerun-if-env-changed=RISC0_SKIP_BUILD
  Building guest package citrea-risc0-light-client.light-client-proof-bitcoin
  cargo:rerun-if-env-changed=RISC0_SKIP_BUILD
  Docker version 27.4.0, build bde2b89

  --- stderr
  Docker context: "/Users/ege/citrea/guests"
  Building ELF binaries in light-client-proof-bitcoin for riscv32im-risc0-zkvm-elf target...
  #0 building with "desktop-linux" instance using docker driver

  #1 [internal] load build definition from Dockerfile
  #1 transferring dockerfile: 1.05kB done
  #1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)
  #1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 13)
  #1 DONE 0.0s

  #2 [internal] load metadata for docker.io/risczero/risc0-guest-builder:r0.1.81.0
  #2 DONE 1.5s

  #3 [build 1/5] FROM docker.io/risczero/risc0-guest-builder:r0.1.81.0@sha256:0e7defd9eed78139314efbe3e66d7218941e85c85f4fa2ece17087a6eb01f263
  #3 DONE 0.0s

  #4 [internal] load build context
  #4 transferring context: 304.34kB 0.0s done
  #4 DONE 0.0s

  #5 [build 2/5] WORKDIR /src
  #5 CACHED

  #6 [build 3/5] COPY . .
  #6 DONE 0.0s

  #7 [build 4/5] RUN cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path risc0/light-client-proof/bitcoin/Cargo.toml
  #7 0.537 error: failed to load manifest for dependency `bitcoin-da`
  #7 0.537 
  #7 0.537 Caused by:
  #7 0.538   failed to read `/crates/bitcoin-da/Cargo.toml`
  #7 0.538 
  #7 0.538 Caused by:
  #7 0.538   No such file or directory (os error 2)
  #7 ERROR: process "/bin/sh -c cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path $CARGO_MANIFEST_PATH" did not complete successfully: exit code: 101
  ------
   > [build 4/5] RUN cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path risc0/light-client-proof/bitcoin/Cargo.toml:
  0.537 error: failed to load manifest for dependency `bitcoin-da`
  0.537 
  0.537 Caused by:
  0.538   failed to read `/crates/bitcoin-da/Cargo.toml`
  0.538 
  0.538 Caused by:
  0.538   No such file or directory (os error 2)
  ------

   3 warnings found (use docker --debug to expand):
   - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)
   - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 13)
   - InvalidBaseImagePlatform: Base image risczero/risc0-guest-builder:r0.1.81.0 was pulled with platform "linux/amd64", expected "linux/arm64" for current build (line 1)
  Dockerfile:9
  --------------------
ENV CC_riscv32im_risc0_zkvm_elf="/root/.local/share/cargo-risczero/cpp/bin/riscv32-unknown-elf-gcc"
ENV CFLAGS_riscv32im_risc0_zkvm_elf="-march=rv32im -nostdlib"
RUN cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path $CARGO_MANIFEST_PATH
RUN cargo +risc0 build --release --locked --target riscv32im-risc0-zkvm-elf --manifest-path $CARGO_MANIFEST_PATH
    11 |     
  --------------------
  ERROR: failed to solve: process "/bin/sh -c cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path $CARGO_MANIFEST_PATH" did not complete successfully: exit code: 101
  325  /usr/local/bin/dockerd --config-file /run/config/docker/daemon.json --containerd /run/containerd/containerd.sock --pidfile /run/desktop/docker.pid --swarm-default-advertise-addr=192.168.65.3 --host-gateway-ip 192.168.65.254
  github.com/moby/buildkit/executor/runcexecutor.exitError
        /root/build-deb/engine/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go:391
  github.com/moby/buildkit/executor/runcexecutor.(*runcExecutor).Run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go:339
  github.com/moby/buildkit/solver/llbsolver/ops.(*ExecOp).Exec
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go:472
  github.com/moby/buildkit/solver.(*sharedOp).Exec.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/jobs.go:1100
  github.com/moby/buildkit/util/flightcontrol.(*call[...]).run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go:122
  sync.(*Once).doSlow
        /usr/local/go/src/sync/once.go:74
  sync.(*Once).Do
        /usr/local/go/src/sync/once.go:65
  runtime.goexit
        /usr/local/go/src/runtime/asm_arm64.s:1222

  57599 v0.19.2-desktop.1 /Users/ege/.docker/cli-plugins/docker-buildx buildx build --output=/Users/ege/citrea/guests/target/riscv-guest/riscv32im-risc0-zkvm-elf/docker -f /var/folders/70/j4h5vq3s1m989g_7ptp_259c0000gn/T/.tmp4TMF17/Dockerfile /Users/ege/citrea/guests
  google.golang.org/grpc.(*ClientConn).Invoke
        google.golang.org/grpc@v1.66.3/call.go:35
  github.com/moby/buildkit/api/services/control.(*controlClient).Solve
        github.com/moby/buildkit@v0.18.0/api/services/control/control_grpc.pb.go:88
  github.com/moby/buildkit/client.(*Client).solve.func2
        github.com/moby/buildkit@v0.18.0/client/solve.go:269
  golang.org/x/sync/errgroup.(*Group).Go.func1
        golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78
  runtime.goexit
        runtime/asm_arm64.s:1223

  325  /usr/local/bin/dockerd --config-file /run/config/docker/daemon.json --containerd /run/containerd/containerd.sock --pidfile /run/desktop/docker.pid --swarm-default-advertise-addr=192.168.65.3 --host-gateway-ip 192.168.65.254
  github.com/moby/buildkit/solver.(*edge).execOp
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/edge.go:966
  github.com/moby/buildkit/solver/internal/pipe.NewWithFunction[...].func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/internal/pipe/pipe.go:78
  runtime.goexit
        /usr/local/go/src/runtime/asm_arm64.s:1222

  57599 v0.19.2-desktop.1 /Users/ege/.docker/cli-plugins/docker-buildx buildx build --output=/Users/ege/citrea/guests/target/riscv-guest/riscv32im-risc0-zkvm-elf/docker -f /var/folders/70/j4h5vq3s1m989g_7ptp_259c0000gn/T/.tmp4TMF17/Dockerfile /Users/ege/citrea/guests
  github.com/moby/buildkit/client.(*Client).solve.func2
        github.com/moby/buildkit@v0.18.0/client/solve.go:285
  golang.org/x/sync/errgroup.(*Group).Go.func1
        golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78

  325  /usr/local/bin/dockerd --config-file /run/config/docker/daemon.json --containerd /run/containerd/containerd.sock --pidfile /run/desktop/docker.pid --swarm-default-advertise-addr=192.168.65.3 --host-gateway-ip 192.168.65.254
  github.com/moby/buildkit/solver/llbsolver/ops.(*ExecOp).Exec
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go:493
  github.com/moby/buildkit/solver.(*sharedOp).Exec.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/jobs.go:1100


  View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/0r1tdxxt1qnzhb11fjnr45t2w
  thread 'main' panicked at /Users/ege/.cargo/registry/src/index.crates.io-6f17d22bba15001f/risc0-build-1.2.0/src/lib.rs:776:14:
  called `Result::unwrap()` on an `Err` value: docker build failed
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: citrea-risc0-batch-proof@0.6.0: SKIP_GUEST_BUILD not set. Defaulting to performing guest build.

error: failed to run custom build command for `citrea-risc0-batch-proof v0.6.0 (/Users/ege/citrea/guests/risc0/batch-proof)`

Caused by:
  process didn't exit successfully: `/Users/ege/citrea/target/debug/build/citrea-risc0-batch-proof-bed1185312ddc263/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=SKIP_GUEST_BUILD
  cargo:rerun-if-env-changed=REPR_GUEST_BUILD
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-env-changed=CITREA_NETWORK
  cargo:rerun-if-env-changed=SEQUENCER_PUBLIC_KEY
  cargo:rerun-if-env-changed=SEQUENCER_DA_PUB_KEY
  cargo:warning=SKIP_GUEST_BUILD not set. Defaulting to performing guest build.
  cargo:rerun-if-env-changed=RISC0_SKIP_BUILD
  Building guest package citrea-risc0-batch-proof.batch-proof-bitcoin
  cargo:rerun-if-env-changed=RISC0_SKIP_BUILD
  Docker version 27.4.0, build bde2b89

  --- stderr
  Docker context: "/Users/ege/citrea/guests"
  Building ELF binaries in batch-proof-bitcoin for riscv32im-risc0-zkvm-elf target...
  #0 building with "desktop-linux" instance using docker driver

  #1 [internal] load build definition from Dockerfile
  #1 transferring dockerfile: 1.03kB done
  #1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)
  #1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 13)
  #1 DONE 0.0s

  #2 [internal] load metadata for docker.io/risczero/risc0-guest-builder:r0.1.81.0
  #2 ...

  #3 [auth] risczero/risc0-guest-builder:pull token for registry-1.docker.io
  #3 DONE 0.0s

  #2 [internal] load metadata for docker.io/risczero/risc0-guest-builder:r0.1.81.0
  #2 DONE 1.5s

  #4 [build 1/5] FROM docker.io/risczero/risc0-guest-builder:r0.1.81.0@sha256:0e7defd9eed78139314efbe3e66d7218941e85c85f4fa2ece17087a6eb01f263
  #4 DONE 0.0s

  #5 [build 2/5] WORKDIR /src
  #5 CACHED

  #6 [internal] load build context
  #6 transferring context: 413.25kB 0.0s done
  #6 DONE 0.0s

  #7 [build 3/5] COPY . .
  #7 DONE 0.0s

  #8 [build 3/5] COPY . .
  #8 CACHED

  #9 [build 4/5] RUN cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path risc0/batch-proof/bitcoin/Cargo.toml
  #9 0.536 error: failed to load manifest for dependency `bitcoin-da`
  #9 0.536 
  #9 0.536 Caused by:
  #9 0.538   failed to read `/crates/bitcoin-da/Cargo.toml`
  #9 0.538 
  #9 0.538 Caused by:
  #9 0.538   No such file or directory (os error 2)
  #9 ERROR: process "/bin/sh -c cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path $CARGO_MANIFEST_PATH" did not complete successfully: exit code: 101
  ------
   > [build 4/5] RUN cargo +risc0 fetch --locked --target riscv32im-risc0-zkvm-elf --manifest-path risc0/batch-proof/bitcoin/Cargo.toml:
  0.536 error: failed to load manifest for dependency `bitcoin-da`
  0.536 
  0.536 Caused by:
  0.538   failed to read `/crates/bitcoin-da/Cargo.toml`
  0.538 
  0.538 Caused by:
  0.538   No such file or directory (os error 2)
  ------

@exeokan exeokan requested a review from eyusufatik as a code owner January 15, 2025 15:15
@auto-assign auto-assign bot requested a review from kpp January 15, 2025 15:15
@exeokan exeokan requested a review from rakanalh January 15, 2025 15:17
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.1%. Comparing base (ec4e19c) to head (b9ad686).
Report is 5 commits behind head on nightly.

Additional details and impacted files

see 8 files with indirect coverage changes

Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename this env var?

I don't want people to think that's the way to go for making repr. builds now.

the var can be "REPR_GUEST_BUILD_LATEST"

Copy link
Contributor

@rakanalh rakanalh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this since we don't actually use this except for l1-syncer tests. aproving for now.

@exeokan exeokan merged commit 1265a26 into nightly Jan 16, 2025
13 of 14 checks passed
@exeokan exeokan deleted the ege/fix-docker-guest-build branch January 16, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants