Skip to content

Commit 0399312

Browse files
fix: dont fail on selectChain when current chain is anvil (#78)
1 parent d9cfaf6 commit 0399312

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/contracts/utils/ChainHelpers.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ library ChainIds {
2929
uint256 internal constant BOB = 60808;
3030
uint256 internal constant PLASMA = 9745;
3131
uint256 internal constant XLAYER = 196;
32+
uint256 internal constant ANVIL = 31337;
3233
}
3334

3435
library TestNetChainIds {
@@ -59,7 +60,7 @@ library ChainHelpers {
5960
error UnknownChainId();
6061

6162
function selectChain(Vm vm, uint256 chainId) internal returns (uint256, uint256) {
62-
uint256 previousFork = vm.activeFork();
63+
uint256 previousFork = block.chainid != ChainIds.ANVIL ? vm.activeFork() : type(uint256).max;
6364
if (chainId == block.chainid) return (previousFork, previousFork);
6465
uint256 newFork;
6566
if (chainId == ChainIds.MAINNET) {

0 commit comments

Comments
 (0)