File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -159,10 +159,18 @@ abstract contract StdChains {
159159 } else {
160160 chain.rpcUrl = vm.envString (envName);
161161 }
162- // distinguish 'not found' from 'cannot read'
163- bytes memory notFoundError =
162+ // Distinguish 'not found' from 'cannot read'
163+ // The upstream error thrown by forge for failing cheats changed so we check both the old and new versions
164+ bytes memory oldNotFoundError =
164165 abi.encodeWithSignature ("CheatCodeError " , string (abi.encodePacked ("invalid rpc url " , chainAlias)));
165- if (keccak256 (notFoundError) != keccak256 (err) || bytes (chain.rpcUrl).length == 0 ) {
166+ bytes memory newNotFoundError = abi.encodeWithSignature (
167+ "CheatcodeError(string) " , string (abi.encodePacked ("invalid rpc url: " , chainAlias))
168+ );
169+ bytes32 errHash = keccak256 (err);
170+ if (
171+ (errHash != keccak256 (oldNotFoundError) && errHash != keccak256 (newNotFoundError))
172+ || bytes (chain.rpcUrl).length == 0
173+ ) {
166174 /// @solidity memory-safe-assembly
167175 assembly {
168176 revert (add (32 , err), mload (err))
Original file line number Diff line number Diff line change @@ -208,13 +208,9 @@ contract StdChainsTest is Test {
208208
209209 // Should error if default RPCs flag is set to false.
210210 stdChainsMock.exposed_setFallbackToDefaultRpcUrls (false );
211- vm.expectRevert (
212- "Failed to get environment variable `ANVIL_RPC_URL` as type `string`: environment variable not found "
213- );
211+ vm.expectRevert ();
214212 stdChainsMock.exposed_getChain (31337 );
215- vm.expectRevert (
216- "Failed to get environment variable `SEPOLIA_RPC_URL` as type `string`: environment variable not found "
217- );
213+ vm.expectRevert ();
218214 stdChainsMock.exposed_getChain ("sepolia " );
219215 }
220216}
You can’t perform that action at this time.
0 commit comments