Skip to content

fix: carry the AOT factory glue in-crate instead of via examples - #110

Merged
succinctli merged 2 commits into
mainfrom
fix/aot-common-workspace
Jul 29, 2026
Merged

fix: carry the AOT factory glue in-crate instead of via examples#110
succinctli merged 2 commits into
mainfrom
fix/aot-common-workspace

Conversation

@kaiwei-0

Copy link
Copy Markdown
Contributor

Summary

Fixes cargo install --git ... pico-cli failure caused by a cross-workspace path dependency introduced in #106.

Problem

pico-perf (root workspace) path-depended on examples/aot_common (nested examples workspace). When installing via Git, Cargo scans the repository, loads both workspaces, and throws a workspace membership error.

Fix

  • Removed invalid dependency: Replaced pico-perf's dependency on examples/aot_common with a local src/aot_glue.rs that directly uses pico-aot-dispatch (aligning with the pattern in prover/src/aot_glue.rs).

`cargo install --git https://github.com/brevis-network/pico pico-cli` fails on
v2.1.0:

    error: package `.../examples/aot_common/Cargo.toml` is a member of the
           wrong workspace
    expected: .../Cargo.toml
    actual:   .../examples/Cargo.toml

`perf` is a member of the root workspace, but it path-depended on
`examples/aot_common`, which is a declared member of the nested `examples`
workspace. A git source enumerates the whole repository to find the requested
package, so it loads both workspaces and rejects the conflicting membership.
v2.0.0 installs fine; the dependency came in with #106.

`perf` only ever used one symbol from that crate -- `register_with_vm()`. So it
now carries its own `src/aot_glue.rs` and depends on the generated
`pico-aot-dispatch` directly, which is nobody's declared workspace member and
therefore fine to path-depend on.

This is the pattern already used elsewhere: `cargo pico new` ships the same
file as `prover/src/aot_glue.rs`, and the AOT examples keep their own copy. The
glue has to name the *generated* dispatch crate, and that crate is regenerated
per guest ELF, so a shared library crate cannot hold it -- `aot-runtime` would
form a dependency cycle, since `aot-generated` already depends on it.

`examples/aot_common` is left untouched and stays example-only, which is what
it was for. No root-workspace crate depends on it any more, so the workspace
conflict is gone without touching any AOT execution path: the example binaries
still call `run_aot` as a compile-time symbol and need no registration.

Also drop references to internal branch and repository names from comments
(vm/src/emulator/aot.rs, vm/src/proverchain/riscv.rs,
aot-runtime/src/emulator/memory.rs, aot-codegen/src/compiler.rs) and point
sdk/sdk's AOT note at the generated project's aot_glue.rs.

Verified: `cargo install --git file://<repo> --branch <this>` now passes package
selection (the only path that reproduces the bug -- cargo metadata and CI are
green even on the broken tree); fmt, `cargo metadata --all-features`, the
examples workspace, the CI clippy gate, `cargo check -p pico-perf --features
aot` and the fibonacci AOT example all clean.
@kaiwei-0
kaiwei-0 requested review from succinctli and zktommy July 29, 2026 08:24

@zktommy zktommy left a comment

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.

LGTM

v2.1.0 cannot be installed from git (see the previous commit), so the fix needs
a release users can point at. Bumping the version keeps `cargo pico --version`
able to distinguish the two.

Only one manifest carries the number: the root `[workspace.package] version`.
The eight member crates inherit it via `version.workspace = true`, and nothing
else in the repository hardcodes it -- no README, CI workflow, script, source
file or project template.

Both tracked lockfiles were refreshed with `cargo update --workspace`, which
re-resolves workspace members without touching third-party dependencies: cargo
reported 47 (root) and 13 (perf/bench_apps) dependencies deliberately left
behind their latest compatible versions, and the package count is unchanged in
both (608 and 573). The diffs are nothing but the nine and four local crates
moving 2.1.0 -> 2.1.1.

Note for anyone editing these by hand: `rustc-hex` is a third-party crate whose
own version happens to be 2.1.0, so a blind search-and-replace over
Cargo.lock corrupts it. It is verified untouched here.

The other two lockfiles (examples/, vm/examples/patch-testing/) are gitignored
and regenerate on demand.
@kaiwei-0
kaiwei-0 force-pushed the fix/aot-common-workspace branch from acae4d3 to a3e619c Compare July 29, 2026 09:31
@succinctli
succinctli merged commit 33fb15b into main Jul 29, 2026
6 checks passed
@succinctli
succinctli deleted the fix/aot-common-workspace branch July 29, 2026 10:06
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.

3 participants