cosmos/ethermint

wrong precision in calculation of gas fee during call AnteHandler

KamiD opened this issue · 2 comments

KamiD commented

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.]

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 commented

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