Skip to content

apollo_infra_utils: resolve cargo_manifest_dir at runtime#14524

Open
Yoni-Starkware wants to merge 1 commit into
main-v0.14.3from
yonatan/cargo-manifest-dir-runtime-resolution
Open

apollo_infra_utils: resolve cargo_manifest_dir at runtime#14524
Yoni-Starkware wants to merge 1 commit into
main-v0.14.3from
yonatan/cargo-manifest-dir-runtime-resolution

Conversation

@Yoni-Starkware

Copy link
Copy Markdown
Collaborator

Problem

compile_time_cargo_manifest_dir!() expands to env!("CARGO_MANIFEST_DIR"), which rustc bakes in at compile time. With a shared rustc-wrapper cache (sccache, default shared ~/.cache/sccache), an object compiled in one checkout can be served to another. In a git worktree this makes the macro return a different checkout's manifest dir, so expect_file! / fixture-regeneration paths (program_hash.json, hint_coverage, cende preconfirmed_block, …) read/write the wrong repository — the test passes locally against the wrong copy and the worktree's committed fixtures stay stale (then fail CI).

This is a recurring footgun when regenerating fixtures from a worktree.

Fix

Resolve CARGO_MANIFEST_DIR at runtime — Cargo and nextest set it in the test/build process environment, so it reflects the checkout that's actually executing — with a compile-time env! fallback for execution outside Cargo (e.g. deployed binaries; behavior there is unchanged).

Renamed compile_time_cargo_manifest_dir!cargo_manifest_dir! since it no longer resolves at compile time. Pure mechanical rename across the 11 call sites; one array site in contracts.rs adjusted for the String return type.

Verification

cargo test -p apollo_infra_utils passes (path_test exercises the runtime resolution). CI verifies the full build across the call sites.

🤖 Generated with Claude Code

@cursor

cursor Bot commented Jun 17, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Changes OS program hashes, proof/version rules, and consensus proposal-queue behavior—core liveness and what transactions/proofs are accepted. Large dependency and fixture surface increases regression risk despite added tests.

Overview
Bumps the workspace to 0.19.0-rc.1 with refreshed Cargo.lock: Cairo 2.19.0-rc.3, newer stwo / stwo-cairo / proving-utils git pins, and related dependency churn (e.g. ark 0.6 in cairo-lang-runner, sha3 0.12).

Starknet OS & client-side proving are the main protocol shift: new OS / virtual OS / aggregator program hashes, PROOF1-only proof facts (drops PROOF0), a single allowed virtual OS program hash, StarknetOsConfig4 with Blake2s config and public-keys hashing (no Pedersen on those paths), and versioned constants / gateway max Sierra 1.9 plus SHA512 libfunc gating. Fixtures, allowed libfuncs, and integration proof expectations are updated accordingly.

Consensus & batching: fixes inverted round ordering in set_height_and_round so skipped rounds don’t strand queued proposals; adds regression tests. Cende HTTP client gets per-attempt timeouts for retries. Blob parent_proposal_commitment is tested to bind the parent fee_proposal.

Infra & tooling: cargo_manifest_dir! reads CARGO_MANIFEST_DIR at runtime (compile-time env! fallback) so shared sccache / git worktrees don’t write fixtures to the wrong checkout. blockifier_reexecution is dropped from apollo_http_server (serde moved to starknet_api). Deploy configs gain templated committer inner cache size; dashboards tweak L1 alert window and fee-target panel type.

CI: hybrid system test pins k3d v5.5.0, waits on local-path-provisioner deployment rollout, quotes trigger script args; cdk8s workflow runs port uniqueness pytest and a job that synths production overlays (mainnet / sepolia).

Reviewed by Cursor Bugbot for commit b33523d. Bugbot is set up for automated code reviews on this repo. Configure here.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Artifacts upload workflows:

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cb6427c. Configure here.

Comment thread crates/blockifier_test_utils/src/compile_cache.rs
`env!("CARGO_MANIFEST_DIR")` is baked in at compile time. With a shared `rustc-wrapper` cache
(sccache, default shared cache dir), an object compiled in one checkout is served to another, so in
a git worktree the macro returns a *different* checkout's path — making `expect_file!`/fixture
regeneration write to the wrong repository (a recurring footgun when regenerating fixtures from a
worktree).

Resolve `CARGO_MANIFEST_DIR` at runtime (Cargo and nextest set it for the test/build process),
falling back to the compile-time `env!` value when absent (e.g. binaries run outside Cargo, where
behavior is unchanged). Renamed `compile_time_cargo_manifest_dir!` → `cargo_manifest_dir!` since it
no longer resolves at compile time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Yoni-Starkware Yoni-Starkware force-pushed the yonatan/cargo-manifest-dir-runtime-resolution branch from cb6427c to b33523d Compare June 17, 2026 06:04
@Yoni-Starkware Yoni-Starkware changed the base branch from main to main-v0.14.3 June 17, 2026 06:04
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.

2 participants