-
Notifications
You must be signed in to change notification settings - Fork 808
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
Priority big int conversion should not causing underflow #1787
base: main
Are you sure you want to change the base?
Conversation
ctx = ctx.WithPriority(priority.Int64()) | ||
|
||
// only set priority if it is valid | ||
if priority.IsInt64() { |
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.
what if priority is not int64? should we set some default priority?
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.
It will be default to 0 if not set
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.
But maybe we can explicitly set it to 0 again
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1787 +/- ##
==========================================
- Coverage 61.47% 61.42% -0.05%
==========================================
Files 257 257
Lines 22284 22289 +5
==========================================
- Hits 13698 13690 -8
- Misses 7629 7631 +2
- Partials 957 968 +11
|
Describe your changes and provide context
This PR fixes the immunify bug report: https://bugs.immunefi.com/dashboard/submission/32602?resolvedFilter=unresolved
The actual problem is:
this section of code:
priority is a big.Int that's converted to an int64 without first checking if such a conversion is possible with IsInt64(). If priority is negative, converting to int64 causes the final value to underflow and wrap around to a very large integer (for example MaxInt64 – max priority).
The code that sets priority for non-EVM transactions correctly calls IsInt64() (https://github.com/sei-protocol/sei-cosmos/blob/10546b70331d5f13e52b38acbf366a527566c3f1/x/auth/ante/validator_tx_fee.go#L77-L79), but the EVM version is missing this check.
Testing performed to validate your change