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
imp(fees): only allow user to pass in aevmos native token as transaction fees #1998
Conversation
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.
Thanks @luchenqun left a comment
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.
Thanks for the contribution @luchenqun !
@fedekunze @0xstepit |
Tests will need to be updated in that case so that they pass |
Due to the peculiarities of evmos fees, it seems difficult to fix these tests. |
Head branch was pushed to by a user without write access
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1998 +/- ##
=======================================
Coverage 70.44% 70.45%
=======================================
Files 340 340
Lines 25492 25498 +6
=======================================
+ Hits 17959 17965 +6
Misses 6609 6609
Partials 924 924
|
I made a compromise modification. I have imposed the following limitations on transaction fees:
Now all unit tests can pass. The only unresolved case is that when the chain allows users to submit transactions with a gasPrice of 0, users can still use stake native tokens as transaction fees. However, although not perfect, the current issues mentioned above on the evmos mainnet have been resolved. Because the gasPrice on the evmos mainnet is not 0, if stake native tokens are used as transaction fees, they will definitely not pass the sufficien fee checks. |
Description
Because evmos = cosmos + evm. Cosmos can include multiple native tokens as transaction fees, but for evmos, which needs to be compatible with evm, the transaction fees can only be in the form of a single native token, which is aevmos. However, currently there are no restrictions on transaction fees in the evmos code.
Note that for testing convenience, the baseFee and minGasPrice in the feemarket module have been set to 0.
Using the command
evmosd tx bank send node0 evmos1qqqqhe5pnaq5qq39wqkn957aydnrm45sdn8583 1024aevmos --fees=1000000000aevmos,666stake,888unknowntoken --home ./nodes/node0/evmosd --broadcast-mode sync -y
to send a transaction will be successful. The transaction receipt information is as follows:However, there are two unreasonable issues:
Issue 1: The sender doesn't actually have
stake
andunknowntoken
, but the transaction still succeeds.Issue 2: We can allocate
stake
andunknowntoken
native tokens to the address corresponding to node0 in the genesis block's bank module(the mainnet can replace the native token with an IBC type token), and the transaction will still succeed. However, the system does not deduct the666stake
and888unknowntoken
transaction fees provided by the sender, only deducting the1000000000aevmos
in the fees.Since evmos can only use aevmos native token as fees, we should add restrictions in checkTx. However, considering the special scenario where baseFee and minGasPrice in the feemarket module are set to 0, it is reasonable to have fees as nil, fees array as empty, and fees array as 1 with denom being aevmos, while others are considered illegal fees.
Of course, after fixing this issue, many test cases run command make test would fail because cosmos-sdk defaults to using stake native token as fees. So I am raising this issue first to see your thoughts on this problem.