1

Completely new to using Remix (first few hours of using it) but confused by this behaviour. In the simple code example below using Remix, why does an operation as simple as incrementing a uint256 (commented in code as problem line) cause the Remix gas estimate to become infinite. Is this a bug?


 // SPDX-License-Identifier: MIT

pragma solidity 0.8.8; // 0.8.18

contract SimpleStorage { uint256 public favoriteNumber; // public creates a getter

function store(uint256 _favoriteNumber) public {
    favoriteNumber = _favoriteNumber;
    favoriteNumber = favoriteNumber + 1; // Problem line here ...
 }

}

  • Welcome to the Ethereum Stack Exchange! You might get a faster answer from the team https://github.com/ethereum/remix-project/issues If you do, please post your own answer. – eth Aug 20 '23 at 19:36

1 Answers1

0

Hi I am also new to this technology and I think the remix just cannot understand this line and shows infinite gas it does not mean the code is wrong or that it will take infinite gas. This user explained it better (I don't know how to give them credit but here is the link) Explained the infinite gas better

kartik
  • 1
  • 1
  • Welcome on the stack. If you think is question is already answered somewhere else on this stack, please flag the question as duplicate instead of posting a new answer. – Itération 122442 Aug 23 '23 at 06:42