Trying to pass the second gate, but I don't understand why Remix throws the following error when I am trying to execute the function: Gas estimation failed Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? execution reverted

This is my code.

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IGatekeeperOne {
  function enter(bytes8 _gateKey) external returns (bool);
contract Building  {
  IGatekeeperOne gatekeeperOne = IGatekeeperOne(0x6AdE211c87Fe3E6C1e074EFbf7C0a58BDDCbdEB1);
  event Failed(bytes reason, uint256 gas);
  function attack() public {
    uint256 initialGas = 80000;
      gatekeeperOne.enter{gas: initialGas}('0x001');

1 Answer 1


Because you would be failing on the gateTwo's require.

The gas needs to be a multiple of 8191 by the time it gets to gateTwo()

  • Also do you know why I can't find an OPCODE GAS when I click on debug in remix after I initiate the function. Commented Oct 12, 2022 at 3:32
  • No, sorry, I'm not sure about it. Try doing your tests with Foundry, it's a great smart contracts development framework and is a lot more powerful than remix. You can run your tests with forge test -vvvvv to print out every details about your tx and why it fails. Look here book.getfoundry.sh/forge/tests. Alos, if my answer helped, don't forget to give an upvote, that helps me. Thanks Commented Oct 12, 2022 at 18:21
  • Thank you very much. If you have time could you please check my question about Shop Challenge. Commented Oct 13, 2022 at 6:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.