Guard against compiler download race condition
Author: kanejCreated Aug 24, 2026Updated Sep 14, 2026
This follows from our work on the solx downloader: https://github.com/NomicFoundation/hardhat/pull/8556
The core solc downloader has a similar issue. We test whether a downloader is cached locally by checking for file existence, however, a failure leads to a three step process:
- download file
- Verify checksum on file
- chmod the file to allow execution
Only step 1 is required for other processes to see a cached compiler, even though it may not be verified nor executable.
We should resolve this by using the same approach as we used for solx, download to a tmp file location then atomically move it into place once verification and chmod have happened.
Source: NomicFoundation/hardhat