-
Notifications
You must be signed in to change notification settings - Fork 84
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
bug: codecopy fails on high offset value #233
Comments
panic is happening inside this branch, will open a PR with fix
|
Nice one! I use a |
right, i came to same conclusion (#234 (comment)) when trying to test cases where Is it possible to implement |
I don't believe it is, at least I've never seen it
A:
2.5 gigabits is 3.125e+8 bytes, which is way less than whatever a usize allows us to store, so I'm going to keep the memory usize-indexed
in practice that would never happen because the gas costs for this would be insanely high and beyond tx gas limits |
I raised this in #203 (comment) aswell |
Offset is offset in bytecode no? So you could have high offset in bytecode (just because, doesn't cost anything) and low length. Then offset + size overflows Concerning your comment 203, it concerns returndatacopy, but imo codecopy should not be able to fail in the same manner |
whh not? In both cases values from the stack can eventually be too high 🤔 |
Well specs and evm codes dont mention any reverts on high values, too high of a code offset should be handled gracefully as here |
Bug Report
Kakarot version: 32b516e
Current behavior:
The CODECOPY opcode will fail if provided with a high value for the offset argument. However, specs state that if offset is > bytecode length, 0s should simply be copied in the memory.
Expected behavior:
Testing with a high value for the bytecode offset should pass with memory being filled with 0s.
Steps to reproduce:
Add the below test to the suite of tests and run
scarb test
:Test should fail with
The text was updated successfully, but these errors were encountered: