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

tao chen
  • 21
  • 1
  • Ganache has a -l parameter to specify a gas limit you might try if that helps you https://github.com/trufflesuite/ganache-cli#using-ganache-cli. – Ismael Jul 28 '18 at 01: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 06:28

1 Answers1

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

Russo
  • 1,784
  • 1
  • 21
  • 30