-
Notifications
You must be signed in to change notification settings - Fork 486
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
Fix modexp record gas #1290
base: master
Are you sure you want to change the base?
Fix modexp record gas #1290
Conversation
} else { | ||
Err(PrecompileFailure::Error { | ||
exit_status: ExitError::Other("failed".into()), | ||
Ok(PrecompileOutput { | ||
exit_status: ExitSucceed::Returned, | ||
output: vec![], | ||
}) |
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 case seems unclear to me, it's basically when bytes.len() > mod_len
, which shouldn't be possible except for this case of mod_len == 0
. Maybe this is better written by handling that case specifically rather than assume it is the case in the final catch-all } else {
block.
Also see the comment above this (line ~ 215
) which is relevant:
// always true except in the case of zero-length modulus, which leads to
// output of length and value 1.
This seems to contradict the expectation of returning an empty vec.
frontier/frame/evm/precompile/modexp/src/lib.rs
Lines 176 to 187 in 272fe88
Line 185 will not be executed because it will return at Line 176