Skip to content
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

this.balance in Truffle #122

Open
hajduakos opened this issue Dec 24, 2019 · 1 comment
Open

this.balance in Truffle #122

hajduakos opened this issue Dec 24, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@hajduakos
Copy link
Member

There is a Truffle test failing (Payable.sol). I isolated the issue, and seems like address(this).balance generates an invalid opcode. Even the following very simple example fails with Truffle:

pragma solidity >=0.5.0;

contract ThisBalance {
    uint x;
    function() external payable {
        x = address(this).balance;
    }
}

There was a change in v0.5.13 in the opcode:

Code Generator: Use SELFBALANCE opcode for address(this).balance if using Istanbul EVM.

So there might be some mismatch between the EVM version the compiler targets and the one we run using Truffle.

@hajduakos hajduakos added the bug Something isn't working label Dec 24, 2019
@dddejan
Copy link
Member

dddejan commented Dec 24, 2019

Good catch, I was baffled at what's going on. If I change the version to petersburg the test passes. Let's keep this open, we need to upgrade to istanbul when truffle allows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants