question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Including “from” in call returns incorrect data [fyi: infura/geth issue]

See original GitHub issue

Hi, 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

image

The Nonesense ETH Balance:

image

I also cross-checked this on Remix for my account and the result is the same nonsense:

image

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:

image

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:closed
  • Created 4 years ago
  • Comments:25 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
egalanocommented, Feb 7, 2020

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.

1reaction
ligicommented, Feb 17, 2020

I’m going to report it upstream to the go-ethereum team and see what they say.

@egalano did you report upstream?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found