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

fix(revenue): fixed the problem that users send transactions with gasPrice of 0 to precompiled contracts always failed #2032

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

luchenqun
Copy link
Contributor

Description

I mentioned in the TODO of #2030 that "I have noticed that sending a transaction with gas price set to 0 to invoke a precompiled contract always fails. This might be a bug in all precompiled contracts.",I fixed this issue.

Steps:

First, setting baseFee and minGasPrice in freemarker module are both 0

Then send a transaction with a gasPrice of 0, such as calling the delegate function in the precompiled contract Staking.
Note: the gasPrice in the transaction below is 0x0

{
    "jsonrpc":"2.0",
    "id":127402646348373,
    "method":"eth_sendTransaction",
    "params":[
        {
            "gas":"0x1406f40",
            "gasPrice":"0x0",
            "from":"0x00000be6819f41400225702d32d3dd23663dd690",
            "value":"0x0",
            "data":"0x53266bbb00000000000000000000000000000be6819f41400225702d32d3dd23663dd69000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000003365766d6f7376616c6f7065723168616a68367268686b6a716b7765743677716c64336c67783875723479336b686c6a6678383200000000000000000000000000",
            "to":"0x0000000000000000000000000000000000000800"
        }
    ]
}

The problem will recur!

Copy link

codecov bot commented Nov 12, 2023

Codecov Report

Merging #2032 (125f076) into main (17c0a46) will increase coverage by 0.14%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

❗ Current head 125f076 differs from pull request most recent head 9f240c5. Consider uploading reports for the commit 9f240c5 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2032      +/-   ##
==========================================
+ Coverage   70.39%   70.54%   +0.14%     
==========================================
  Files         338      335       -3     
  Lines       25223    25091     -132     
==========================================
- Hits        17756    17700      -56     
+ Misses       6558     6485      -73     
+ Partials      909      906       -3     
Files Coverage Δ
x/revenue/v1/keeper/evm_hooks.go 85.50% <100.00%> (+0.43%) ⬆️

... and 3 files with indirect coverage changes

@luchenqun luchenqun changed the title fix(revenue): fixed the problem that users cannot send transactions with gasPrice of 0 to precompiled contracts fix(revenue): fixed the problem that users send transactions with gasPrice of 0 to precompiled contracts always failed Nov 13, 2023
@luchenqun
Copy link
Contributor Author

@fedekunze Could you please help me review the code? Merge as soon as possible if is reasonable. Because I am used to sending transactions with a gasprice of 0 so that I can easily check the flow of native token.

Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left one comment

@fedekunze fedekunze merged commit 1ee31e4 into evmos:main Nov 15, 2023
16 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants