-
Notifications
You must be signed in to change notification settings - Fork 2k
bump(revm
: step 1): bump revm
to 21.0.0
release
#10183
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okiee,
some things required workarounds but overall this lgtm even though the total diff is quite large
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's great, left couple of nits and some questions if we could decouple more from op?
… is present and tx type is legacy
…e environment less error prone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this lgtm now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, will re approve if we decide to use new revm / foundry-fork-db release instead patched but not a blocker
The cheat codes �m.roll and �m.warp now have an upper threshold of ype(uint64).max: foundry-rs/foundry#10183. Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
I think this is problematic, its now effectively impossible to write tests with foundry that hit valid states in the EVM due to e.g. u64 timestamps. What is the proposed solution for this? This is actually a very significant breaking change that reduces functionality |
Given that Revm now operates on u64 for these fields it would lead to incorrect assumptions if we permit U256 inputs (#10367). In Foundry tests, if you are using U256 fuzz inputs you should bound them to u64 using vm.bound() or make the fuzz input be u64. If this is not satisfactory please expand on your use case, preferably with an example. |
This is not good because we have contracts that use uint256 timestamps and we want to test for correctness throughout the entire range. We wouldn't want to bound the tests (with fuzzing or not) because even if we can't trigger these states from foundry they can exist on chain. Isn't it kind of broken to not support this? |
The reason why we shrunk to u64 is that it is impossible to trigger this on chain. So if you use timestamp more than u64 you are testing an impossible flow here. |
Stacked PRs:
revm
: step 2): bumpalloy
+revm
+alloy-evm
+ other deps to latest #10454revm
: step 3): reintroduce precompile injection #10508Benchmarks
forge test
revm 23 @
ec4ffd3)Conclusion: on average at least 12% faster!
Notes:
1024
from256
for all testsdeadline
totype(uint64).max - 1
on all cases, now enforced (see breaking changes)Benchmarks
anvil
mem and cpu
ref #7940 (comment)
https://github.com/PhilippLgh/anvil-perf
ref #4399 (comment)
https://github.com/mshakeg/anvil-backtester
ref #6017 (comment)) - blocksToMine: 10, nullSwapsPerBlock: 2000, totalTxs: 40000, 3 runs
run2: 4.605
run3: 4.626
run2: 4.672
run3: 4.676
(more is better)
run2: 8686.210640608035
run3: 8646.779074794638
run2: 8561.643835616438
run3: 8554.31993156544
(less is better)
run2: 0.115125
run3: 0.11565
run2: 0.1168
run3: 0.1169
https://github.com/xmtp/xmtpd
ref #10122 (comment)
29.907s
29.856s
29.867s
29.890s
29.988s
29.771s
30.017s
29.769s
Known breaking changes ❗⚠️
Revm now operates on
u64
for the following fields:chain id
tx.gas_price
block.basefee
block.number
block.timestamp
Thereforce we must constrain the input we accept to up
u64::max
for the following cheatcodes:vm.chainId
vm.fee
vm.roll
vm.txGasPrice
vm.warp
vm.setBlockhash
These cheatcodes will raise an error if a value >
u64::max
is passed.Because of these Revm fields changing the Anvil state files are known to currently break, this can possibly be handled in a follow-up where we flexibly read from old state files but write in the new form. This is not currently handled in this PR.
Closes
Closes: #10367
Follow ups that will become unlocked, to check
Verify bug(cast
): trace printer returns "broken" gas value around0x1
precompile #10276 has been fixedCustomPrintTracer
to use Revm'sTracerEip3155
#10329forge bind
): generated contract bindings are incompatible with alloy-rs0.14.0
+ serde is not added as dependency #10321prague hardfork
): add support for EIP-2935, currently missing #10357 (relies on alloy-evm)PR Checklist