Skip to content

Commit

Permalink
add repro
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo committed Sep 15, 2022
1 parent c98b8ee commit 962d679
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions testdata/repros/Issue3221.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.0;

import "ds-test/test.sol";
import "../cheats/Cheats.sol";

// https://github.com/foundry-rs/foundry/issues/3221
contract Issue3221Test is DSTest {
Cheats constant vm = Cheats(HEVM_ADDRESS);
uint256 fork1;
uint256 fork2;

function setUp() public {
fork1 = vm.createFork(
"https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
7475589
);
fork2 = vm.createFork(
"https://api.avax-test.network/ext/bc/C/rpc",
12880747
);
}

function testForkNonce() public {
address user = address(0xF0959944122fb1ed4CfaBA645eA06EED30427BAA);

// Loads but doesn't touch
assertEq(vm.getNonce(user), 0);

vm.selectFork(fork2);
assertEq(vm.getNonce(user), 3);
vm.prank(user);
new Counter();

vm.selectFork(fork1);
assertEq(vm.getNonce(user), 3);
vm.prank(user);
new Counter();
}
}

contract Counter {}

0 comments on commit 962d679

Please sign in to comment.