-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meta(compatibility): handle EVM Semantic differences across chains #748
Comments
@mds1 with #1715 how should we handle it when we're forking arbitrum for example? another then we'd:
|
Hmm, something like that would work, however it only solves that one difference and there are many other differences, so it's probably worth thinking of a more generalized approach first before implementing that. However, both Arbitrum and Optimism have major upgrades coming soon ™️ (Nitro and Bedrock, respectively), which will change some of those semantics. They'll both still be a bit different than L1, but they will get more similar to L1 AFAIK, so some of the above differences go away and some other changes arise. (I only mention those two L2s since they're the most popular, but there are others I'm less familiar with). Perhaps a good path forward here is to:
IMO this particular block number difference is easy enough to work around at the moment thanks |
Adding to this issue an issue encountered while fixing an unrelated problem:
|
Do any contributors have a sense of the latest thinking around this? I see For my context: Builders and security researchers on Scroll have run into issues where forge tests don't account for EVM differences on our L2. One example: we revert calls to So, we don't need additional precompiles or opcodes, but we do need to revert calls to some of them, and the ability to patch the behavior of others would be very helpful. Even for optimism, who has up-to-date tooling in |
Component
Forge
Describe the feature you would like
As L2s grow in popularity, developers will run into issues due to the fact that not all EVM compatible networks have the same semantics as L1. For example, if you want to develop and test against a forked Arbitrum:
block.number
returns the most recent L1 block. But forge doesn't know this.lastBlockNumber
storage variable, that variable will have L1 block numberslastBlockNumber
stored, forge'sblock.number
will return the provider's block number, which is about 6M, but the last L1 block is about 14McurrentBlock - lastBlock
would evaluate to6M - 14M
In forge, we can use the
vm.roll
cheatcode to simply move the block number forward or back as required and work around this. And maybe that's ok, but:vm.roll
conditionally based on network, and I don't think there's currently an easy way to do thatSo the scope of this issue is: how should forge handle this? Some possibilities:
The three ideas above a ll have their pros and cons, and there may be other ideas.
Personally I lean away from option 1, and would prefer options 2 or 3. As a developer, those would give me more confidence that my system does behave as intended, whereas with option 1 it's much harder to get that confidence.
Another question is how many networks have differing semantics, and how many differences are there? If it's just Arbitrum's
block.number
different, option 2 is much more feasible than if there's multiple networks and multiple other differences, that gets much more complex.Additional context
The text was updated successfully, but these errors were encountered: