-
Notifications
You must be signed in to change notification settings - Fork 37
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
limit modexp call to 8192 bit inputs #1391
base: zkevm
Are you sure you want to change the base?
Conversation
816d2c4
to
e60a53f
Compare
The behavior should be slightly different since we tried to mimic ethereum specification and some special cases are handled before checking the lenght. |
b1bc392
to
39bd2dc
Compare
LGTM xD |
hmmmm |
The unreachable code is effectively the same so I've combined the statements now |
expBitLen = exp.BitLen() | ||
modBitLen = mod.BitLen() | ||
) | ||
|
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.
if modulo size is 0, the precompile returns 0 and it consumes GAS. This case is not handled.
if base size is 0 & modsize < 8192, it should also return 0 and consume GAS. This case is not handled.
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.
core/vm/contracts_zkevm.go
Outdated
switch { | ||
case mod.BitLen() == 0: | ||
|
||
if modBitLen == 0 { | ||
// Modulo 0 is undefined, return zero |
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.
comment is not right
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.
I have removed this comment. It was there from the original erigon implementation.
To tackle #1385