Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Issue with method call result with msg.sender and Geth 1.9.12 #3456

@Aniket-Engg

Description

@Aniket-Engg

Sample contract

contract GetMyBalance {

    // below function cant get right result
    // using Remix I get:
    // 0: uint256: 115792089237316195423570985008687907853269984665640564039457581007913129639935
    function _getMyBalance()
        // external
        public
        view
        returns(uint256)
    {
        return msg.sender.balance;
    }

    // Below can get right result
    // by calling getMyBalance()
    // and then get right 
    uint256 public logMyBalance_;
    function getMyBalance()
        external
    {
        logMyBalance_ = _getMyBalance();
    }

    // I can get right result
    uint256 public logMyBalance;
    function writeMyBalance() external {
        logMyBalance = msg.sender.balance;
    }
}

Expected behavior

Actual balance of caller

Actual behavior

115792089237316195423570985008687907853269984665640564039457581007913129639935

Steps to reproduce the behavior

  1. Deploy contract on any testnet except kovan or on Mainnet
  2. call _getMyBalance method

Related Issues on different repos

https://github.com/ethereum/remix/issues/1430
argotorg/solidity#8545

Versions

web3js: 1.2.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions