Fix Foundry blockhash ordering and CI cache cleanup#3863
Open
MontrealAI wants to merge 3 commits into
Open
Conversation
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.
Motivation
vm.setBlockhash: block number must be less than or equal to the current block numberbecause tests set blockhashes for future blocks.forge_versionkeys infoundry.tomlproducing warnings.foundry_compilers::cache) suggested stale/corrupted incremental compiler cache was being restored by CI.Description
function _rollPastAndSetBlockhash(uint256, bytes32)and replaced directvm.setBlockhash(...)calls intest/v2/ValidatorStakeLock.t.sol,test/v2/ValidationFinalizeGas.t.sol, andtest/v2/ValidatorSelectionFuzz.t.solso the target block is always in the past before callingvm.setBlockhash.forge_versionprofile keys fromfoundry.tomlto silence Foundry warnings.rm -f cache/solidity-files-cache.json || true) prior to runningforge testin the Foundry CI jobs (.github/workflows/fuzz.yml,.github/workflows/ci.yml, and.github/workflows/contracts.yml).Testing
forgeis not available in the environment (error:forge: command not found).forge test --match-path test/v2/ValidatorStakeLock.t.sol -vvvvandforge test -vvvv --ffi --fuzz-runs 256 --match-contract 'CommitReveal|Stake|Fee|Slashing'.forge test, and Foundry jobs are expected to stop surfacing the previous deserialization error and thevm.setBlockhashfailures once the workflows run.Codex Task