SRI-CSL / solidity

This is solc-verify, a modular verifier for Solidity.
https://github.com/SRI-CSL/solidity/blob/boogie/SOLC-VERIFY-README.md
GNU General Public License v3.0
51 stars 14 forks source link

this.balance in Truffle #122

Open hajduakos opened 4 years ago

hajduakos commented 4 years ago

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.

dddejan commented 4 years ago

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.