2

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

2
  • 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, 2018 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, 2018 at 6:28

1 Answer 1

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 and acknowledge you have read our privacy policy.

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