3

the default value for uint variable is 10 now on function call, I want to change this value to 0

steps to reproduce:

  1. copy the following code to remix:

    contract test {
        uint128 public aPos=10;
        function updateQuota( uint128  _Quota){
            aPos = _Quota;
        }
    }
    
  2. Use the environment as a web3 provider (configure local ganache server with remix ID)

  3. Deploy contract.

  4. Call updateQuota function with parameter as 0

  5. Shows error as

"transact to test.updateQuota errored: base fee exceeds gas limit "

.

Question: how to assign zero value to uint variable when we work with the web3 provider (local ganache server)

2
  • This (annoying) problem has also been reported on GitHub (web3.js if I remember correctly). Aug 16, 2018 at 10:07
  • Surprisingly i'm facing exact same issue when following Pet Shop tutorial from Truffle. Have you managed to fix this? Long shot, but remember how? May 9, 2021 at 23:37

1 Answer 1

2

You most probably have assinged too little gas to the transaction. The Solidity code is fine (works as-expected with injected JS VM). Try using gasPrice: 8000000000 and gas: 4700000, that should run fine on ganache.

2
  • 1
    i changes with this gas price and gas limit but still not working.. Aug 16, 2018 at 10:54
  • What values do you have for price + and block gas limit on the ganache gui? (i think the defaults are "6721975" for the maximum block gas and 20000000000 for the price) Aug 24, 2018 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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