Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Contract to Contract interaction fails on Ganache but not on Ropsten with remix IDE #1174

Closed
simibac opened this issue Mar 23, 2019 · 2 comments

Comments

@simibac
Copy link

simibac commented Mar 23, 2019

Consider the followin two SC:

contract Contract1{
    Contract2 c2;
    constructor() public{
        c2 = new Contract2();
    }
    
    function setTestVariableOfSCInstanceToOne() public {
        c2.setTestVariable(1);
    }
    
    function getTestVariableOfSCInstance() public view returns(uint){
        return c2.getTestVariable();
    }
}

contract Contract2{
    uint testVariable;
    
    constructor() public {
        testVariable = 0;
    }
    
    function setTestVariable(uint _value) public returns(uint){
        testVariable = _value;
        return testVariable;
    }
    
    function getTestVariable() public view returns(uint){
        return testVariable;
    }
}

Calling the fuction setTestVariableOfInstanceToOne on Contract1 fails on Ganache but not on Ropsten in the remix IDE.

Expected Behavior

I want to be able to set the testVariable in Contract2 through Contract1.

Current Behavior

Console output in Remix IDE:

transact to Contract1.setTestVariableOfInstanceToOne errored: VM Exception while processing transaction: revert

Possible Solution

Steps to Reproduce (for bugs)

  1. copy contract from above into remix IDE
  2. compile Contract1
  3. try execute the function setTestVariableOfInstanceToOne

Context

Your Environment

  • Version used: Ganache 1.3, Solidity Compiler 5.3
  • Environment name and version (e.g. PHP 5.4 on nginx 1.9.1):
  • Server type and version:
  • Operating System and version: MacOS 10.14.3, Brave Browser
  • Link to your project:
@davidmurdoch
Copy link
Member

Thanks for reporting this issue, @simibac!

This was caused by a gas-estimation bug in ganache-core that was fixed in the latest ganache-core beta. We'll be promoting the beta to stable soon and will update Ganache UI once released.

@davidmurdoch
Copy link
Member

This should now be fixed in our latest beta: https://github.com/trufflesuite/ganache/releases/tag/v2.0.1-beta.0 Let me know if you have any issues or if the fix doesn't work for you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants