vm.roll can result in panic on L2 network #1649
Labels
A-cheatcodes
Area: cheatcodes
C-forge
Command: forge
Cmd-forge-test
Command: forge test
P-high
Priority: high
T-bug
Type: bug
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0
What command(s) is the bug in?
forge test
Operating System
Linux
Describe the bug
As described in this issue, forge does not currently handle the idiosyncrasies of each EVM-compatible L2 network. In the context of testing contracts which rely on a block.number delta against an Arbitrum fork pinned at a certain block, using
vm.roll
as a workaround would suffice until now.However, after upgrading to foundry 2.0, forking an Arbitrum live network pinned at a certain block (i.e.:
forge test --fork-url ARBITRUM_RPC --fork-block-number 1337
) and then usingvm.roll
to set the test contract'sblock.number
to an L1 value results in a panic. This prevents me from testing some logic where the L2 contract calculates the difference between alastBlockNumber
variable and the current block.number (both L1 values).I think that the change responsible for this behavior is this commit. In fact, after downgrading foundry to the previous commit (
foundryup -C 4415ff47cc03c9f9657dd2959f57de411a4e67b2
), the test/vm.roll
worked again as expectedThe text was updated successfully, but these errors were encountered: