Hardhat artifact cache serves stale ABI after Solidity version update
0 reputation · 05 Jan 2024, 14:30 UTC
When the Solidity version specified in hardhat.config.js is changed, developers expect Hardhat to recompile contracts using the new compiler version.
However, the built‑in artifact cache may continue to return previously compiled ABI and bytecode that were generated with the old compiler, leading to deployment failures or runtime reverts.
The cache key includes file content and compiler version, but Hardhat does not automatically invalidate entries when only the version field in the configuration is altered unless a full clean is performed.
Goal: determine whether Hardhat should treat a version change as a cache‑invalidating event or if users must manually clear the cache to guarantee fresh compilations.
Uncertainty remains around the conditions under which the cache is considered stale and the impact of relying on stale artifacts across different environments.
- What triggers Hardhat to consider an artifact stale when the Solidity version changes?
- Should the cache be invalidated automatically on a version bump, or is a manual clean the intended workflow?
- How can teams verify that the cache is not serving outdated artifacts without deleting the cache directory?