Including “from” in call returns incorrect data [fyi: infura/geth issue]
See original GitHub issueHi, I am sorry for this vague issue description, but this bug I have been seeing recently is really confusing to me:
Basically, I have one solidity contract function that should return my current ETH balance or ERC20 balance using “0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE” for ETH.
function getTriggerValue(address _account, address _coin, uint256, bool)
external
view
returns(uint256)
{
if (_coin == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
return _account.balance;
IERC20 erc20 = IERC20(_coin);
return erc20.balanceOf(_account);
}
Now the bug only happens if I call this function with coin="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
to query my own ETH balance.
So it does work for my account if I use any ERC20 address , but not our hardcoded ETH signal.
My Account: 0x203AdbbA2402a36C202F207caA8ce81f1A4c7a72
The BUG:
I always get a nonsense value returned if I use my account address and make a call to the function from ethers.js
using the following code
The Nonesense ETH Balance:
I also cross-checked this on Remix for my account and the result is the same nonsense:
What confuses me about this bug:
As soon as I use the exactly same code in ethers
but just a different account address (I tried my friend’s) everything works as expected and I got the correct result for his account balance.
I also cross-checked on Remix and the result is correct:
This looks too weird for me to dig further, so I wanted to bring it to your attention. I believe Remix uses ethers.js
too, which might explain why my results match 1:1 between the two environments.
Maybe you can help?
If you wanna give it a try, here is the stuff you need:
Solidity Interface to function I get the bug for:
pragma solidity ^0.6.0;
interface TriggerBalance {
function getTriggerValue(address _account, address _coin, uint256, bool)
external
view
returns(uint256);
}
Deployment address of TriggerBalance on ropsten: 0xaf4c11A90e98D0C5ecFb403C62Cc8Dfe8DF11030
My EOA address where I find the bug: 0x203AdbbA2402a36C202F207caA8ce81f1A4c7a72
Try maybe with your own EOA address and see if you get the bug or not.
Otherwise here is my friend’s address where the bug does not occur, oddly: 0xe2A8950bC498e19457BE5bBe2C25bC1f535C743e
Issue Analytics
- State:
- Created 4 years ago
- Comments:25 (9 by maintainers)
Top GitHub Comments
Hey there @gitpusha . Thanks for using Infura. Richard reached out to us and after looking into this with our engineering team it appears to be a bug in the client version we run which is geth-1.9. I’m going to report it upstream to the go-ethereum team and see what they say.
@egalano did you report upstream?