Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited tags
Link
Rob Hitchens
  • 55.6k
  • 11
  • 92
  • 147
Source Link

remix compiler warning infinite gas requirement

I'm trying to deploy a trivial faucet program which compiles OK with remix but I get the following error. "Gas requirement of function Faucet.withdraw(uint256) high: infinite. " This means that while it compiles I cannot deploy it to my Ganache blockchain. I understand the concept of gas for a function but I cannot see what is potentially infinite here: I have put a tiny limit on any withdrawal amount.

Could someone please explain?

pragma solidity >=0.5.0; contract Faucet { function withdraw(uint256 withdraw_amount) public { require(withdraw_amount <= 2000000); msg.sender.transfer(withdraw_amount); } // Accept any incoming amount function () external payable {} }