Skip to content

fix(scripts): include build inputs in make_git_package cache key - #145

Merged
alexhulbert merged 2 commits into
flashbots:mainfrom
samlaf:fix--make-git-package-cache-key
Jul 27, 2026
Merged

fix(scripts): include build inputs in make_git_package cache key#145
alexhulbert merged 2 commits into
flashbots:mainfrom
samlaf:fix--make-git-package-cache-key

Conversation

@samlaf

@samlaf samlaf commented May 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #144.

The cache key was <package>-<git_describe> — source identity only. Build-input changes (RUSTFLAGS, GOFLAGS, cargo profile env vars, toolchain version) silently reused cached binaries built under different conditions.

Cache key is now <package>-<git_describe>-<env_hash>, where env_hash is sha256(build_cmd || $MAKE_GIT_PACKAGE_CACHE_KEY_EXTRA). build_cmd is always hashed in. MAKE_GIT_PACKAGE_CACHE_KEY_EXTRA is opt-in for caller-injected inputs — e.g., the rust toolchain version installed via rustup, so that toolchain bumps invalidate cached binaries built under the previous one.

Existing caches invalidate once when this lands.

…s#24)

Fixes flashbots#144

The cache key was `<package>-<git_describe>` — source identity only.
Build-input changes (RUSTFLAGS, GOFLAGS, cargo profile env vars,
toolchain version) silently reused cached binaries built under different
conditions.

Cache key is now `<package>-<git_describe>-<env_hash>`, where env_hash
is `sha256(build_cmd || $MAKE_GIT_PACKAGE_CACHE_KEY_EXTRA)`. build_cmd
is always hashed in. MAKE_GIT_PACKAGE_CACHE_KEY_EXTRA is opt-in for
caller-injected inputs — e.g., the rust toolchain version installed via
rustup, so that toolchain bumps invalidate cached binaries built under
the previous one.

Existing caches invalidate once when this lands.

@ameba23 ameba23 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.

💯 Great fix.

But worth noting this does not [yet] actually fix the issue for the callers of make_git_package in this repo - only external ones which explicitly set MAKE_GIT_PACKAGE_CACHE_KEY_EXTRA.

So as a followup we could set eg:

MAKE_GIT_PACKAGE_CACHE_KEY_EXTRA="rust_version=$RUST_VERSION"

in these files:

  • modules/l2/simulator/mkosi.build
  • modules/l2/op-rbuilder/mkosi.build
  • modules/l2/op-rbuilder-bproxy/mkosi.build

Comment thread scripts/make_git_package.sh Outdated
Co-authored-by: peg <ameba23@systemli.org>
@samlaf
samlaf requested review from a team as code owners July 27, 2026 18:33

@alexhulbert alexhulbert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@alexhulbert
alexhulbert merged commit dfe1a46 into flashbots:main Jul 27, 2026
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.

make_git_package.sh: cache key omits build inputs, can serve stale binaries

3 participants