Not able to call function in another contract
System information
Geth version: geth version 1.7.2
OS & Version: Ubuntu 16.04
Branch, Commit Hash or Release: master ee21fdb101bf82144f11d599efbfda0c3ec30c97
Expected behaviour
setInfo() must change the value of the info state variable.
Actual behaviour
setInfo() does not change the value of the info state variable.
Steps to reproduce the behaviour
PreReq: node v8, truffle v4.1.6
Run the 7 node network
Clone https://github.com/aas312/consumer-quorum
Run npm run build
Run node sandbox.js
Hi @aas312 I know we exchanged messages on Slack, please reopen if this is still an issue.
@fixanoid this is still an issue. The issue is only resolved if I use 0.4.18. For 0.4.21 and above this is not fixed.
@aas312 , testing and reproducing error as per your specification. Will revert on this. Thanks
So, here's the code deployed on a raft-based quorum standalone node:
pragma solidity ^0.4.18;
contract A {
string abc = "abc";
function foo() returns (string _fooRet) {
return abc;
}
}
contract B {
A public aref;
string public ret;
function createFoo (address _contractAddress) {
aref = A(_contractAddress);
ret = aref.foo();
}
}
Unable to fetch the updated value of aref & ret once the createFoo() was called with the address of A deployed.
@aas312 , can you concur?
I get the error :
TypeError: Type inaccessible dynamic type is not implicitly convertible to expected type string storage ref. ret = aref.foo();
^--------^
when I compile the code
The problem is that dynamic returns for strings wasn't supported until solidity 0.4.22
The options are to either use 0.4.22 or pass it as bytes32 or something and convert it on the front end
I changed the contract to use uint8
pragma solidity ^0.4.18;
contract A {
uint8 abc = 1;
function foo() public returns (uint8 _fooRet) {
return abc;
}
}
pragma solidity ^0.4.18;
import './A.sol';
contract B {
A private aref;
function B(address _contractAddress) {
aref = A(_contractAddress);
}
function getFoo() public returns (uint8) {
return aref.foo();
}
}
WIth solc 0.4.18 I get 1 when I call getFoo but with 0.4.24 i don't get the same value
Same, with solc 0.4.18 i get the correct value, with 0.4.24 it fails
Same when deploying on non- quorum chains
Same when deploying on non-quorum chains
@realcodywburns do you mean using 0.4.24 fails on other clients as well, not just Quorum ?
Yes, ETC is having the same issue when using solc 0.4.24. The contracts compile and run correctly on eth mainnet & testnets, however they fail on etc mainnet and morden. I'm looking into it now.
The breaking change came with version 0.4.22 . It looks like it is something involving Support accessing dynamic return data in post-byzantium EVMs.
Code compiled with cross contract calls using 0.4.21 is functional, same code with 0.4.22 is unable to make cross contract calls.
Solution(?) it seems that >0.4.22 versions of solc compile for Byzantium by default.
Adding ByzantiumBlock=0 to genesis should fix the problem on quorum
Fixed in 7 nodes example with: https://github.com/jpmorganchase/quorum-examples/commit/90a2895a5335ac0e23b769479f0527f5336597a7
Related threads: https://github.com/ethereum/solidity/issues/3969 https://github.com/ethereum/solidity/issues/4259
@jpmsam , we tried to re-init the chain with the updated genesis but still encountering same issues.
Is there a docker image which has these changes resolved? Thanks
@kggp1995 please open new issue with detailed description of the problem.
Quorum official docker images are here: https://hub.docker.com/u/quorumengineering/