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 ...


1 Answer 1


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

  • 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. Aug 23, 2023 at 6:42

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