3

I'm trying to access a storage address array in a contract through web3 but I receive an error :

Error: Invalid JSON RPC response: {"id":3,"jsonrpc":"2.0","error":{"code":-32603}}
    at Object.InvalidResponse (inpage.js:14308)
    at inpage.js:14308
    at inpage.js:9935
    at inpage.js:735
    at next (inpage.js:5577)
    at inpage.js:1220
    at inpage.js:735
    at replenish (inpage.js:1255)
    at iterateeCallback (inpage.js:1245)
    at inpage.js:1220

The other interactions with the contract work fine. Here is as snippet of the contract :

contract MyContract{
    address[2048] public field;
    function getField() external view returns(address[2048]){
        return field;
    }
}

And here is a snippet of the js :

var ContractDef = web3.eth.contract(abi)
MyContract= ContractDef.at("...")
MyContract.getField(function(err, res){
    // err is set, res is undefined
})

I can see the eth_call in the ganache console. I tried changing gas price and limit parameters in ganache but no luck. I am quite new to Solidity / Smart contracts so I might be missing something here. Thanks for your help :)

versions :

  • solidity ^0.4.19
  • ganache-cli 6.0.3
  • truffle 4.0.6
BramBram
  • 31
  • 3

0 Answers0