Skip to content
Open
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
12 changes: 12 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Guest-only build flags: the key is scoped to the guest target, so host builds
# read this file and take nothing from it. Cargo joins `rustflags` across
# ancestor configs, so each guest crate keeps its own flags and gains this one.
[target.riscv64im-lambda-vm-elf]
# `compiler_builtins` turns `mem-unaligned` on for x86, aarch64 and bpf only, so
# on RISC-V `memcpy`/`memmove` reassemble every misaligned word by hand; this VM
# does unaligned scalar accesses natively (#864). The cfg reaches every crate in
# the guest graph, but only `compiler-builtins` reads that name, and it declares
# the value in its own check-cfg. It lives in that crate's `build.rs` with no
# stability guarantee: bumping the `nightly-2026-02-01` pin in the Makefile can
# turn this into a silent no-op.
rustflags = ["--cfg", "feature=\"mem-unaligned\""]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Low — worth one more sentence in the comment: this sets the cfg for every crate in the guest graph, and it can silently become a no-op.

Two things the comment doesn't say:

  1. --cfg feature="mem-unaligned" is not scoped to compiler_builtins — it's set on every crate compiled for this target (core/alloc/std, libc, and all of the ethrex guest's third-party deps). Today only compiler-builtins reads that name, so it's harmless, but if some dep ever declares a feature by that name it gets enabled without Cargo activating its dependencies. Also, since the cfg is unexpected for every crate that doesn't declare it, expect unexpected_cfgs warnings across the guest graph; pairing it with "--check-cfg", "cfg(feature, values(\"mem-unaligned\"))" in the same array unions the value into the expected set and keeps the build output clean.

  2. Nothing fails loudly if the flag stops taking effect, and the failure mode is the 8% cycle regression coming back with a green build. Three ways that happens: the pinned nightly-2026-02-01 sysroot's compiler-builtins renames/drops the knob (it's build.rs-internal, no stability guarantee — worth naming the nightly pin in Makefile as the coupling); RUSTFLAGS/CARGO_ENCODED_RUSTFLAGS is set in the environment, which replaces target.<triple>.rustflags rather than joining with it (unlike the ancestor-config joining the comment describes); or a guest is ever built from a cwd outside this repo tree.

4 changes: 2 additions & 2 deletions .github/workflows/hyperfine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
id: cache
with:
path: ${{ matrix.branch }}_programs/*.elf
key: benchmarks-${{ matrix.branch }}-${{ hashFiles( 'executor/programs/bench/**', 'syscalls/**' ) }}
key: benchmarks-${{ matrix.branch }}-${{ hashFiles( 'executor/programs/bench/**', 'syscalls/**', '.cargo/config.toml' ) }}
restore-keys: benchmarks-${{ matrix.branch }}-

- name: Setup Rust Environment
Expand All @@ -56,7 +56,7 @@ jobs:

- name: Export benchmark hashes
id: export-hashes
run: echo "benchmark-hashes-${{ matrix.branch }}=${{ hashFiles( 'executor/programs/bench/**', 'syscalls/**' ) }}" >> "$GITHUB_OUTPUT"
run: echo "benchmark-hashes-${{ matrix.branch }}=${{ hashFiles( 'executor/programs/bench/**', 'syscalls/**', '.cargo/config.toml' ) }}" >> "$GITHUB_OUTPUT"

build-binaries:
strategy:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/pr_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
path: |
executor/program_artifacts/rust
executor/shared_target
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile') }}
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
rust-elf-artifacts-

Expand Down Expand Up @@ -275,7 +275,7 @@ jobs:
path: |
executor/program_artifacts/rust
executor/shared_target
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile') }}
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
rust-elf-artifacts-

Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:
path: |
executor/program_artifacts/rust
executor/shared_target
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile') }}
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
rust-elf-artifacts-

Expand All @@ -409,7 +409,7 @@ jobs:
uses: actions/cache@v4
with:
path: executor/program_artifacts/recursion
key: recursion-elf-artifacts-${{ hashFiles('bench_vs/lambda/**', 'prover/src/**', 'prover/Cargo.toml', 'crypto/**/src/**', 'crypto/**/Cargo.toml', 'executor/src/**', 'executor/Cargo.toml', 'syscalls/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'Makefile') }}
key: recursion-elf-artifacts-${{ hashFiles('bench_vs/lambda/**', 'prover/src/**', 'prover/Cargo.toml', 'crypto/**/src/**', 'crypto/**/Cargo.toml', 'executor/src/**', 'executor/Cargo.toml', 'syscalls/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
recursion-elf-artifacts-

Expand Down Expand Up @@ -480,7 +480,7 @@ jobs:
path: |
executor/program_artifacts/rust
executor/shared_target
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile') }}
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
rust-elf-artifacts-

Expand Down Expand Up @@ -508,7 +508,7 @@ jobs:
uses: actions/cache@v4
with:
path: executor/program_artifacts/recursion
key: recursion-elf-artifacts-${{ hashFiles('bench_vs/lambda/**', 'prover/src/**', 'prover/Cargo.toml', 'crypto/**/src/**', 'crypto/**/Cargo.toml', 'executor/src/**', 'executor/Cargo.toml', 'syscalls/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'Makefile') }}
key: recursion-elf-artifacts-${{ hashFiles('bench_vs/lambda/**', 'prover/src/**', 'prover/Cargo.toml', 'crypto/**/src/**', 'crypto/**/Cargo.toml', 'executor/src/**', 'executor/Cargo.toml', 'syscalls/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
recursion-elf-artifacts-

Expand Down Expand Up @@ -564,7 +564,7 @@ jobs:
path: |
executor/program_artifacts/rust
executor/shared_target
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile') }}
key: rust-elf-artifacts-${{ hashFiles('executor/programs/rust/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'syscalls/**', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
rust-elf-artifacts-

Expand All @@ -581,7 +581,7 @@ jobs:
uses: actions/cache@v4
with:
path: executor/program_artifacts/recursion
key: recursion-elf-artifacts-${{ hashFiles('bench_vs/lambda/**', 'prover/src/**', 'prover/Cargo.toml', 'crypto/**/src/**', 'crypto/**/Cargo.toml', 'executor/src/**', 'executor/Cargo.toml', 'syscalls/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'Makefile') }}
key: recursion-elf-artifacts-${{ hashFiles('bench_vs/lambda/**', 'prover/src/**', 'prover/Cargo.toml', 'crypto/**/src/**', 'crypto/**/Cargo.toml', 'executor/src/**', 'executor/Cargo.toml', 'syscalls/**', 'executor/programs/riscv64im-lambda-vm-elf.json', 'Makefile', '.cargo/config.toml') }}
restore-keys: |
recursion-elf-artifacts-

Expand Down
Loading