-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return msg.sender.balance;
returns unexpected value
#2325
Comments
This is translated into this (with 0.4.12-develop.2017.5.30+commit.64f76b30.Darwin.appleclang
This seems to be correct. Does it work properly with on-chain transactions? It only fails with |
FWIW, I've also seen this (and been very confused by it), in my case using MetaMask to call a constant contract function that returns the balance of an address - about 50% of the time I get the correct result, other times I get 115792089237316195423570985008687907853269984665640564039455084007913129639935. Perhaps a geth/MetaMask issue - never seen with JavascriptVM. |
@o0ragman0o @kieranelby since it is not present on ethereumjs-vm, but both of you have seen it with geth, please open an issue on go-ethereum. |
I've realised that
|
From Solidity's perspective it still makes sense, it is part of the state and constant functions can read the state, just they cannot modify it. Since this flag is also populated in the ABI JSON, certain tools (such as web3.js) will consider those functions can be executed via I'm not sure why sender would be omitted in |
I'm not aware enough of how |
i'm experiencing the same behavior. my smartcontract looks like this: |
This is still doesn't look a Solidity bug. Please report it to Metamask or any other client you are using. |
Closing this as the generated code seemed to be correct. |
This is related to: eth/api_backend.go func (b *EthAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error) { math.MaxBig256 == 115792089237316195423570985008687907853269984665640564039455084007913129639935 Is a constant in Geth( common/math/big.go) |
I'm raising this first as a Solidity issue but maybe a deeper issue present.
This was raised on SE yesterday and I have confirmed unexpected behaviour with a contract on Rinkeby
The return value of
msg.sender.balance
appears to be a unit cast negative value unassociated with the actual account balance.Behaviour is present in Geth.
Behaviour not present in the JavascriptVM which works as expected.
Have not tested on Parity.
The text was updated successfully, but these errors were encountered: