Hi, community, I'm trying to break ethernaut level 13, I have a simple sol source code, as below:
contract Hack {
using SafeMath for uint256;
GatekeeperOne public gkp;
bytes8 txOrigin16 = 0x0123456789abcdef;
function setGatekeeperOne(address _addr) public {
gkp = GatekeeperOne(_addr);
}
function letMeIn() public {
address(gkp).call.gas(150 + 8191 * 3)(abi.encodeWithSignature("enter(bytes8)", txOrigin16));
}
}
And I use the code to debug for finding the proper gas value. In remix, I deploy the contracts in JavaScript VM, set the gas limit to 3000000 in remix, execute functions to produce transaction. But once I open the debugger, I find that the "remain gas" is 9940 at the begining, and when I step into the line of checking gas value("require(gasleft().mod(8191) == 0);"), the "remaining gas" reduced to 4183, which obviously too low to pass this level(as show in image below).
What's wrong with me here?
After reading lots of docs and videos, I see their "remaining gas" is very large.