Given the following Solidity code,
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.10;
contract Contract {
bool public immutable IS_TRUE;
constructor() {
IS_TRUE = true;
}
}
My IDE (remix.ethereum.org) informs me that the gas requirement is infinite.
I am surprised because there are no loops, no imported data changes. It's just a constant that I declare, and a read access method.
Here is the complete error message:
Gas costs:
Gas requirement of function Contract.IS_TRUE is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)
Here is a screenshot:
Is this a bug, or should I optimize my code? Thank you.