Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Wrong gas estimation for call #3749

Closed
ngotchac opened this issue Dec 8, 2016 · 3 comments
Closed

Wrong gas estimation for call #3749

ngotchac opened this issue Dec 8, 2016 · 3 comments
Labels
F2-bug 🐞 The client fails to follow expected behavior. M4-core ⛓ Core client code / Rust.

Comments

@ngotchac
Copy link
Contributor

ngotchac commented Dec 8, 2016

The gas estimation for a method using the call function might be wrong.
Take these contract as example:

contract B {
  uint public n;
  
  function callSetN(address _contract, uint _n) {
    _contract.call(bytes4(sha3("setN(uint256)")), _n); // E's storage is set, D is not modified 
  }
}

contract A {
  uint public n;
  
  function setN(uint _n) {
    n = _n;
  }
}

A call to the callSetN method is estimated with 52,976 gas, but when looking at the trace, the transaction runs out of gas : https://testnet.etherscan.io/vmtrace?txhash=0xc2a1a4bb3760e730f7567e7f290c60279356cfa717516da45aff48edec3221bd&type=parity

@tomusdrw
Copy link
Collaborator

Just realized that it might be related to changes in recent hard fork. Now call provides up to 63/64 gas instead of everything - this would explain why it works with high gas, and then after using exactly the value provided it fails.

Probably we could track calls and increase the gas accordingly.

@5chdn
Copy link
Contributor

5chdn commented May 9, 2017

This issue is labelled with bug: The client fails to follow expected behavior; and is inactive for several months. It's neither assigned nor linked to a milestone.

Please, decide on a deadline and assign this ticket to a developer within 7 days or close it if fixed otherwise.

@arkpar
Copy link
Collaborator

arkpar commented May 10, 2017

Fixed by #4100

@arkpar arkpar closed this as completed May 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

No branches or pull requests

4 participants