Ethereum Asked on December 4, 2021
when test a contract i meet a confusing condition, so i tracked it by commented out per line, and distinguish it’s a uint storage variable be reset to 0. To make it clear, i write a test contract like below, and it reappear this error.
pragma solidity ^0.4.18;
contract testReset {
uint public _num;
constructor() public {
}
function _set(uint newnum) public {
_num = newnum;
}
function _reset() public {
_num = 0;
}
}
1) set to any number like 20;
2) reset to 0, but remix report error: “base fee exceeds gas limit.”
my environment is remix + ganache-cli, and compiler version is 0.4.24.
is it a solidity’s bug?
You are compiling with version 0.4.24 but your contract is asking for a version .18.
Anyway, I'm not sure if that is the problem but in general your code should work just fine. And it works just fine if you run it in online Remix. The problem has to be somehow related to your specific setup, but I'm unfortunately unable to pinpoint the exact reason.
Answered by Lauri Peltonen on December 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP