We are running a number of Parity Private Networks running with PoA.
The configuration being
Parity 2.3.7-stable-7d1415a-20190320
Linux Ubuntu 16.04.6
We recently updated the version of Solidity our contracts were compiled under and have found that we can no longer make calls to methods within the Contract. We have investigated this in detail and have found that when contracts are compiled to for solidity versions higher than 0.5.4 we can no longer access the methods in the contract (we progressively compiled contracts from 0.4.x up to 0.5.7 = current stable release).
Having discovered the issue we wrote an extremely basic contract, to test what/ when the problem occurred. The contract being as follows:
pragma solidity ^0.5.5;
contract test {
address public owner = 0x005e6478C5f01671f632d987e1aE862c570B7FB8;
string public name = "Fred";
constructor() public {
}
function getOwner() view public returns (address) {
return owner;
}
}
We have tried calling the getOwner method via web3 IPC calls using both the most uptodate version of web3 (1.0.0-beta.50) and a much older version - both versions of web3 successfully can call getOwner and receive the returned address value IF the contract is compiled on versions of solidity of 0.5.4 and below, but fail for higher versions. To eliminate the possibility of this being a problem in the web3 code we repeated the experiment, but instead accessing the contract via CURL calls e.g.
curl localhost:55260 -X POST --data '{"jsonrpc":"2.0", "method":"eth_call", "params":[{"from": "0x00e9415aa2b0a4b37537c5f0e3f5dfc6b0a46aac", "to": "0xb45211274e8644bef6517aca557aa247d99e5a67", "data": "0x893d20e8"}], "id":1}' -H "Content-Type: application/json"
This behaved identically to the web3 i.e. getOwner() could be called successfully as long as the contract was compiled for Solidity 0.5.4 and below. For 0.5.5 to the latest stable release 0.5.7 the following error is generated (from the curl calls although effectively identical to that thrown out by web3):
{"jsonrpc":"2.0","error":{"code":-32015,"message":"VM execution error.","data":"Bad instruction 1c"},"id":1}
SO I think that eliminates web3 etc.
As a matter of interest we also have a private Geth chain and we observe identical behaviour here to with contracts compiled for 0.5.5 solidity onwards
Parity (and geth) have no awareness of solidity, only the EVM. If you are seeing bad instructions, that is almost certainly an issue with the solidity compiler.
See #10513 for more context - you can't use an ABI generated for prior versions of the contract to communicate with a contract compiled with solidity 0.5.5+
Thanks for replying Joshua - I believe we have eventually worked out the problem, based on feedback from a similar post I made to the Solidity GitHub page - my understanding is that with the advent of Constantinople fork and St Petersburg the EVM code changed and that contracts compiled with versions of solidity 0.5.5 and greater are only compatible with networks running Constantinople/St Petersburg - and hence my question on Gitter re. setting a PoA to be on St Petersburg. I managed to figure out the necessary changes to the spec file to switch our chains over so that they are now running as such and as a consequence, contracts compiled under solidity 0.5.5 and more recent now are behaving as expected.
realise that just in case someone else reads this with a similar issue - I should have said when you compile with Solidity you can specify the EVM version to compile, but that if you don't specify anything it defaults to the most recent available to that compiler which for 0.5.5 and 0.5.6 is Petersburg. Had I specified Byzantium (which are nodes were running on at the time) when compiling on the most recent Solidity, the contacts would have functioned. However we want our nodes running on the latest stable code etc so we have moved them over to St Persburg
Most helpful comment
Thanks for replying Joshua - I believe we have eventually worked out the problem, based on feedback from a similar post I made to the Solidity GitHub page - my understanding is that with the advent of Constantinople fork and St Petersburg the EVM code changed and that contracts compiled with versions of solidity 0.5.5 and greater are only compatible with networks running Constantinople/St Petersburg - and hence my question on Gitter re. setting a PoA to be on St Petersburg. I managed to figure out the necessary changes to the spec file to switch our chains over so that they are now running as such and as a consequence, contracts compiled under solidity 0.5.5 and more recent now are behaving as expected.