1

With solidity view function, you can specific the amount of gas to use. My understand is since it is not a state changing transaction, all the gas cost is not charged for, and the client should be able to allow the call function to run with a gas limit larger than the block limit.

According to Can Solidity constant functions be arbitrarily complex? I should be able to pass any amount of gas as a parameter.

However, my truffle & Ganache set up doesn't allow me to do so.

Example: instance.Mymethod.call({gas:900000000})

error: Exceeds block gas limit

Mymethod is a view function.

Can anyone tell me if this is a problem with the Ganache client or is it a legit constraint that read only (view, pure, constant) function should not consume more gas than the block limit?

Thank you, Tao

  • Ganache has a -l parameter to specify a gas limit you might try if that helps you github.com/trufflesuite/ganache-cli#using-ganache-cli. – Ismael Jul 28 '18 at 1:28
  • -l specified the block limit. you can increase your block limit, but again read only operation shouldn't subject to block limit constraint – tao chen Jul 30 '18 at 6:28
0

Truffle sucks. I solved it and now can run mocha ganache tests without truffle. Solidity Exceeds block gas limit during Mocha Tests with Ganache-cli

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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