fix: carry the AOT factory glue in-crate instead of via examples - #110
Merged
Conversation
`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.
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
force-pushed
the
fix/aot-common-workspace
branch
from
July 29, 2026 09:31
acae4d3 to
a3e619c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
cargo install --git ... pico-clifailure caused by a cross-workspace path dependency introduced in #106.Problem
pico-perf(root workspace) path-depended onexamples/aot_common(nestedexamplesworkspace). When installing via Git, Cargo scans the repository, loads both workspaces, and throws a workspace membership error.Fix
pico-perf's dependency onexamples/aot_commonwith a localsrc/aot_glue.rsthat directly usespico-aot-dispatch(aligning with the pattern inprover/src/aot_glue.rs).