Using git, I got the ethereum source code and built it myself. And connected with Remix IDE's web3 provider environment. In the code below, the nums() function was executed well, but the add() function exceeded the gas limit.
A.sol
pragma solidity >=0.4.21 <0.6.0;
contract A {
uint num;
constructor(uint n) public {
num = n;
}
function add(uint n) public {
num += n;
}
function nums() public view returns (uint) {
return num;
}
}
B.sol
pragma solidity >=0.4.21 <0.6.0;
import "./A.sol";
contract B {
A a;
constructor(address addr) public {
a = A(addr);
}
function add(uint n) public {
a.add(n);
}
function nums() public view returns (uint) {
return a.nums();
}
}
The gas limit is set to 0x2fefd8000, and it is set to 1000000000 when running on Remix IDE. But there is no reason why the gas limit is over 800000. Do you know why?