1

I developed and debugged this function in Remix but when I deploy the contract and execute this function it will either run out of gas or does not run at all. This is usually because Parity thinks it takes 21,000 gas to run the function.

function verifyPass(address _owner) {
  require(_owner != 0x0);
  var (,c,h,) = Storage(usedStorage).passByOwner(_owner);
  uint _country = uint(c);

  // An embassy can only verify passports of its own country
  require(_country != 0 && _country == embassiesOfCountry[msg.sender]);

  Storage(usedStorage).updatePassport(_owner, _country, bytes32(h), true);
}

Do you know why it fails? Or do you have a better idea to do the process of reading a value from another contract, updating values and posting it to another contract?

3
  • 1
    Please post all relevant functions of all relevant contracts. This is too little information. Try debugging in remix first. Send more than 21k gas, it will take a lot more.
    – SCBuergel
    Commented Jul 25, 2017 at 10:25
  • Just ignore the Parity recommendation, and try to increase the gas. If it's a testnet, provide 1,000,000 gas and check the transaction how many gas was really used, or try out the eth_estimateGas RPC API to figure out how much is required.
    – q9f
    Commented Jul 26, 2017 at 9:41
  • Thanks for the help. I think it must have been a problem with the deployed contract or with Parity's gas estimation but I deployed the same contract again and it worked beautifully.
    – larsl
    Commented Jul 30, 2017 at 22:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.