Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion x/evm/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ func (fc EVMFeeCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate b

// calculate the priority by dividing the total fee with the native gas limit (i.e. the effective native gas price)
priority := fc.CalculatePriority(ctx, txData)
ctx = ctx.WithPriority(priority.Int64())

// only set priority if it is valid
if priority.IsInt64() {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

ctx = ctx.WithPriority(priority.Int64())
}

return next(ctx, tx, simulate)
}
Expand Down
Loading