fix(rom-setup): key asm/ROM caches on their build inputs#1079
Open
RogerTaule wants to merge 4 commits into
Open
fix(rom-setup): key asm/ROM caches on their build inputs#1079RogerTaule wants to merge 4 commits into
RogerTaule wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes stale asm/ROM cache reuse by incorporating additional build inputs (transpiler, embedded float ELF, emulator-asm sources, and linked libs) into the cache key/filenames, and adds automation to prevent regressions.
Changes:
- Add
rom-setup/build.rsto bake build-time fingerprints (ZISK_ROM_INPUTS_HASH,ZISK_ASM_INPUTS_HASH) and incorporate them into ROM/verkey and asm cache filenames. - Extend asm cache keying to include runtime hashing of linked static libs, and update downstream consumers to use the new canonical basename helper.
- Add a probe example + shell script + CI workflow to validate cache invalidation behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/test_asm_cache_invalidation.sh | Script to mutate inputs and assert cache filename changes (regression guard). |
| rom-setup/src/utils.rs | ROM/verkey cache filenames now include a build-time ROM-inputs hash. |
| rom-setup/src/asm_setup.rs | Adds deps hashing + canonical asm basename computation; updates generation to key on deps. |
| rom-setup/examples/cache_probe.rs | Small probe example to print the computed asm cache basename. |
| rom-setup/Cargo.toml | Enables build.rs and adds build-dependency on blake3. |
| rom-setup/build.rs | Computes build-time fingerprints over ROM/asm inputs and exposes them via rustc-env. |
| prover-backend/src/utils.rs | Switches to rom_setup::compute_asm_basename for asm cache filenames. |
| lib-c/c/Makefile | Uses deterministic ar mode to stabilize archive bytes for hashing. |
| .github/workflows/asm_cache_invalidation.yml | New CI workflow to run the cache invalidation regression test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🔄 ZisK Cycle TrackingEmulator cost report ( Summary
Per-Guest Breakdownbigint
bls12_381
bn254
diagnostic
hashes
secp256k1
secp256r1
uint256
🔴 increase (regression) · 🟢 decrease (improvement) · ➖ no change. |
The asm binaries and ROM/verkey were cached by guest-ELF hash alone, so a change to the transpiler, the embedded float ELF, or the linked C libs reused stale artifacts — including returning the wrong program vk. Fold a fingerprint of those inputs into the cache filenames: build.rs bakes build-time hashes of the transpiler + float (ROM) and + emulator-asm sources (asm); asm_setup.rs adds the runtime lib contents; utils.rs keys the ROM/verkey on them. lib-c uses so the hash is stable. Adds unit tests, a before/after script, and a CI workflow.
5add28a to
514c511
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.
The asm binaries and ROM/verkey were cached by guest-ELF hash alone, so a change to the transpiler, the embedded float ELF, or the linked C libs reused stale artifacts — including returning the wrong program vk.
Fold a fingerprint of those inputs into the cache filenames: build.rs bakes build-time hashes of the transpiler + float (ROM) and + emulator-asm sources (asm); asm_setup.rs adds the runtime lib contents; utils.rs keys the ROM/verkey on them. lib-c uses so the hash is stable.
Adds unit tests, a before/after script, and a CI workflow.