I am trying to test and deploy my contract using the latest ganache-cli v6.0.3 (ganache-core: 2.0.2) with Remix (http! version) on http://remix.ethereum.org. So, after starting ganache-cli without any extra parameters on standard port 8545, I connect on Remix via web3 Provider http://127.0.0.1:8545 and my accounts show up, as displayed by Ganache.
This is the contract I want to deploy:
pragma solidity ^0.4.20;
contract Test {
uint[4] public arr; // [0,0,0,0]
event TestLog(string logmessage);
function Test() public {
arr[0] = 1; // [1,0,0,0]
}
function checkArray() public {
if(arr[0] == 1) { // arr == [1,?,?,?]
arr[1] = 1;
arr[0] = 0; // switch values [0,1,0,0]
}
TestLog("some log");
}
}
It works fine with the in-built Javascript VM in Remix: [vm] from:0xca3...a733c, to:Test.checkArray() 0x692...77b3a, value:0 wei, data:0x7b3...f7296, 1 logs, hash:0xa6f...87209
If i try to run the checkArray function in Remix connected to ganache via web3 Provider, I get an transact to Test.checkArray errored: VM Exception while processing transaction: out of gas
error.
What am I doing wrong here? Bumping up gasLimit with ganache-cli -l 5000000
did not help, as well as even higher values and a follow up test with a very small gasPrice and high gas limit. Is it a Remix problem setting wrong gas limits on the Remix website when building the transaction? I also tried it on a private geth node with the same result: out of gas...
Any help gladly appreciated!