I'm running:
- Which Parity version?: v1.9.7-20180423 stable
- Which operating system?: Linux
- How installed?: docker-compose
- Are you fully synchronized?: yes
- Which network are you connected to?: ethereum
- Did you try to restart the node?: yes
Here is sample code contract which just trying to call pure function on another contract:
pragma solidity ^0.4.23;
contract Season {
address[] public requests;
constructor() public {
requests.push(new Request());
}
function getRequestsByFilter() public view returns(bool) {
Request r = Request(requests[0]);
bool ret = r.isMatch();
return ret;
}
}
contract Request {
function isMatch() public pure returns(bool) {
return true;
}
}
Contract ABI:
[{"constant":true,"inputs":[],"name":"getRequestsByFilter","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"requests","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
Contract Bin:
608060405234801561001057600080fd5b50600061001b61006f565b604051809103906000f080158015610037573d6000803e3d6000fd5b508154600181018355600092835260209092209091018054600160a060020a031916600160a060020a0390921691909117905561007e565b60405160b88061028083390190565b6101f38061008d6000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633bef595f811461005057806381d12c5814610079575b600080fd5b34801561005c57600080fd5b506100656100ba565b604080519115158252519081900360200190f35b34801561008557600080fd5b50610091600435610192565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60008060008060008154811015156100ce57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff1663904e2b936040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561015f57600080fd5b505af1158015610173573d6000803e3d6000fd5b505050506040513d602081101561018957600080fd5b50519392505050565b60008054829081106101a057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff169050815600a165627a7a72305820318b7facb613d242bed833cc4ace83ea4acd95062a7639ed27f4658d82c3947600296080604052348015600f57600080fd5b50609a8061001e6000396000f300608060405260043610603e5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663904e2b9381146043575b600080fd5b348015604e57600080fd5b5060556069565b604080519115158252519081900360200190f35b6001905600a165627a7a72305820731ac26809b20b529d23798a127c0ef6da8e5f6e6aced6917381b51fe430f8ea0029
Expected behaviour:
getRequestsByFilter returns true.
Actual behaviour:
getRequestsByFilter returns default value (false in this case) because it throws an exception when trying to call r.IsMatch().
On the other hand, this very bytecode works fine when deployed into Ganache. Other people on ethereum.stackexchange.com confirm that they have no problem with running this code on their networks.
As a result: _You are not able to call any other contract method_
You can get a confirmation from UI that it doesn't work by rewriting it in following manner:
pragma solidity ^0.4.23;
contract Season {
event Check(bool value);
function testCallContract() public {
Request r = new Request();
bool ret = r.isMatch();
emit Check(ret);
}
}
contract Request {
function isMatch() public pure returns(bool) {
return true;
}
}
And try to call testCallContract from UI you will get warning that this code will throw an error:

Abi:
[{"constant":false,"inputs":[],"name":"testCallContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"bool"}],"name":"Check","type":"event"}]
Bin:
608060405234801561001057600080fd5b50610246806100206000396000f3006080604052600436106100405763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633ac4aa358114610045575b600080fd5b34801561005157600080fd5b5061005a61005c565b005b600080610067610153565b604051809103906000f080158015610083573d6000803e3d6000fd5b5091508173ffffffffffffffffffffffffffffffffffffffff1663904e2b936040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156100ea57600080fd5b505af11580156100fe573d6000803e3d6000fd5b505050506040513d602081101561011457600080fd5b505160408051821515815290519192507f0f806f3a69aebe25b6129d19609333999fb4d2aed709217d19e0465d3bf3e72e919081900360200190a15050565b60405160b8806101638339019056006080604052348015600f57600080fd5b50609a8061001e6000396000f300608060405260043610603e5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663904e2b9381146043575b600080fd5b348015604e57600080fd5b5060556069565b604080519115158252519081900360200190f35b6001905600a165627a7a7230582099ec0787cbed192d804d32219a9dfd5ee0360d8b9fb54b29ae84685e10d1a4eb0029a165627a7a72305820ea9f8eb80539a0e02e4c65cbcf807310a4148aae82c93cb937ccdaf8a174c4ff0029
@Tbaut why you label it as UI problem? I have same results by calling API via JSONRPC.
Sorry, the description made me think of a UI problem. Can you then describe how to reproduce using RPC and a contract you deployed?
var contractABI = [{"constant":true,"inputs":[],"name":"getRequestsByFilter","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"requests","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}];
var contractAddress = "0xe71230F5F0f183C8D89d569Ad5Be053D68CaE18B";
var contractInstance = web3.eth.Contract(contractABI).at(contractAddress);
contractInstance.getRequestsByFilter(); // returns false
This issue looks really weird. I'm not even able to deploy the contract using dev chain spec.
@Pzixel I suspect this is indeed an UI problem. It seems to be a bug related to different behaviors in browsers.
getRequestsByFilter shows true.And it would be really great if you can help to reopen the issue in Parity UI repo. Thanks for reporting the bug!
@sorpaas I doubt it's UI bug because I was deploying through Chrome which should be ok corresponding to you.
I'l try to publish it via API and brb with results.
Okay, here we are:
[Fact]
public async Task Should_CreateRequestSuccessfully()
{
const string abi = "[{\"constant\":true,\"inputs\":[],\"name\":\"getRequestsByFilter\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requests\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]";
const string bin = "608060405234801561001057600080fd5b50600061001b61006f565b604051809103906000f080158015610037573d6000803e3d6000fd5b508154600181018355600092835260209092209091018054600160a060020a031916600160a060020a0390921691909117905561007e565b60405160b88061028083390190565b6101f38061008d6000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633bef595f811461005057806381d12c5814610079575b600080fd5b34801561005c57600080fd5b506100656100ba565b604080519115158252519081900360200190f35b34801561008557600080fd5b50610091600435610192565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60008060008060008154811015156100ce57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff1663904e2b936040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561015f57600080fd5b505af1158015610173573d6000803e3d6000fd5b505050506040513d602081101561018957600080fd5b50519392505050565b60008054829081106101a057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff169050815600a165627a7a72305820318b7facb613d242bed833cc4ace83ea4acd95062a7639ed27f4658d82c3947600296080604052348015600f57600080fd5b50609a8061001e6000396000f300608060405260043610603e5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663904e2b9381146043575b600080fd5b348015604e57600080fd5b5060556069565b604080519115158252519081900360200190f35b6001905600a165627a7a72305820731ac26809b20b529d23798a127c0ef6da8e5f6e6aced6917381b51fe430f8ea0029";
var web3 = new Web3(new ManagedAccount(EthereumSettings.AccountAddress, EthereumSettings.AccountPassword),
EthereumSettings.ParityConnectionString);
var receipt = await web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(abi, bin, web3.TransactionManager.Account.Address,
new HexBigInteger(4600000));
var contract = web3.Eth.GetContract(abi, receipt.ContractAddress);
var requestsCallResult = await contract.GetFunction("requests").CallAsync<string>(functionInput: 0);
var getRequestsByFilterCallResult = await contract.GetFunction("getRequestsByFilter").CallAsync<bool>();
Assert.NotNull(requestsCallResult);
Assert.True(getRequestsByFilterCallResult);
}
This code has absolutely same behavior as the previous one. requestCallResult is returning actual value while function returns false, see debug watch:

It's not UI bug, it's how it works. You can say "Well, it's UI or Nethereum issue, it's not parity", but I'm sure i can reproduce it with web3.js or any other API.
@Pzixel Would it be possible to get the raw HTTP requests sent in Nethereum? It might help to debug this issue.
And is there a way for you to set a custom gas value when calling getRequestsByFilter, as in here?
Also what network did you connect in the above test? It's Ethereum. My bad not reading the description carefully..
@sorpaas I can try to install fiddler, however, it may be cumbersome because some apps don't use proxy (which Fiddler hook is) and thus I can't get its traffic. It's solvable, but takes some time.
What's about providing more gas - yes, it's possible, but I don't think it's an issue so I'd like to provide HTTP requests first.
Since this (or similar) problems are reported to work with older Solidity versions, my guess would be that the VM is not configured to support returndatasize, but this is just a guess.
@cdetrio No, I have also checked it with 1.7.x or 1.6.x and it the same behavior holds.
@Pzixel I'm talking about solidity (which should be 0.4.18 / 0.4.23)
@chriseth ah, I see.
Well, I didn't try older compilers, that's true, because I use some features from 21+
@Pzixel have you activated the byzantium changes like returndatasize in your chain spec?
@rphmeier I'm not sure what it is. I'm using playground with following docker-compose.yml.
@Pzixel Yeah it looks like byzantium changes are not enabled in the chain config: https://github.com/orbita-center/parity-poa-playground/blob/master/parity/config/chain.json
Try adding those in the "params" section:
"eip140Transition": 0,
"eip211Transition": 0,
"eip214Transition": 0,
"eip658Transition": 0
And then recreate the chain.
@sorpaas okay, i'm going to check it tomorrow. Thank you for reply!
@sorpaas it seems that it works.
Parity UI shows an invalid values

However they are correct if I call methods via RPC:

Thank you for the solution. I hope it will work in more complicated scenarios too (it's just a MRE, not an actual problem). I'm going to create a bug in Parity UI repo, but it's not a bug in Parity itself anymore (unless you think it should be working on pre-bizantium networks).
P.S. Give me an advice which repo should I create an issue in?
https://github.com/paritytech/parity-ui redirects me to https://github.com/ethcore/parity which redirects me to https://github.com/paritytech/parity .
@Pzixel it's in https://github.com/Parity-JS/shell/
Most helpful comment
@Pzixel Yeah it looks like byzantium changes are not enabled in the chain config: https://github.com/orbita-center/parity-poa-playground/blob/master/parity/config/chain.json
Try adding those in the
"params"section:And then recreate the chain.