Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

wrong precision in calculation of gas fee during call AnteHandler #799

Closed
KamiD opened this issue Feb 16, 2021 · 2 comments · Fixed by #798
Closed

wrong precision in calculation of gas fee during call AnteHandler #799

KamiD opened this issue Feb 16, 2021 · 2 comments · Fixed by #798

Comments

@KamiD
Copy link

KamiD commented Feb 16, 2021

System info: [Include Ethermint commit, operating system name, and other relevant details]
Code: 177574a

Steps to reproduce:

fee := sdk.NewDecCoin(evmDenom, sdk.NewIntFromBigInt(msgEthTx.Fee()))

call NewDecCoin will increment precision to 18, it means if you call it like:

fee := NewDecCoin("eth",1)

The fee will become to 1000000000000000000, that's a wrong precision calculation

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior: [What you expected to happen]

Actual behavior: [What actually happened]

Additional info: [Include gist of relevant config, logs, etc.]

@araskachoi
Copy link
Contributor

That looks correct here no? the proper precision should be 1x10^18 and that's what it looks like it's doing here. can you provide more explanation here? otherwise, this looks like a non-issue

@KamiD
Copy link
Author

KamiD commented Feb 19, 2021

That looks correct here no? the proper precision should be 1x10^18 and that's what it looks like it's doing here. can you provide more explanation here? otherwise, this looks like a non-issue

for example: if I set gas price to 1 GWEI in metamask or any other wallets of ethereum, the member Price of MsgEthereumTx will be set to 1000000000, that means Price has already increase to 1 x 10^9, it equal with 0.000000009 eth, if here increase precision with 18 again, it will be 1 x 1000000000^18, that's a wrong precision number

freddyli7 pushed a commit that referenced this issue Apr 19, 2021
This was referenced Apr 19, 2021
freddyli7 added a commit that referenced this issue Apr 19, 2021
Co-authored-by: Freddy Li <freddyli@Freddys-MacBook-Pro-2.local>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants