Linked Questions

43 votes
3 answers
21k views

What are the limitations to estimateGas and when would its estimate be considerably wrong?

web3.eth.estimateGas and JSON-RPC estimateGas can be used to see how much gas should be specified for a transaction, before crafting the transaction. Since it is an estimate, are there any ...
eth's user avatar
  • 86k
17 votes
2 answers
2k views

Can Solidity view/pure functions be arbitrarily complex?

Non-constant functions are limited in computational complexity by the block gas limit. I assume, but am not sure, that this does not apply to view/pure functions. Are view/pure functions in any way ...
SCBuergel's user avatar
  • 8,774
7 votes
2 answers
7k views

Solidity Exceeds block gas limit during Mocha Tests with Ganache-cli

How can I increase the gas limit in this case? The error message is "n: Exceeds block gas limit" or "base fee exceeds gas limit". I think there is some kind of api I need to set the block gas limit ...
Russo's user avatar
  • 1,784
13 votes
1 answer
4k views

Gas consumption of a view public function

In my contract I have a view public function that returns an array of bytes32 elements. In remix it produces a warning saying it might run out of block gas limit if I use this function. As I had read ...
kathi's user avatar
  • 199
4 votes
2 answers
2k views

Is there a gas limit for view requests?

E.g. a function that just returns huge struct data. Is there any limit in data so that calling this function will not be possible? pragma solidity ^0.4.13; contract Project { struct Person { ...
Senju's user avatar
  • 701
0 votes
1 answer
1k views

Why view/pure functions need gas?

pragma solidity ^0.4.11; contract Test { function toBytes(address a) public pure returns (bytes b) { assembly { let m := mload(0x40) mstore(add(m, 20), xor(...
hebothu's user avatar
2 votes
0 answers
635 views

High gas consumption when using `staticcall` on a non-view/pure function

Even though functions called with staticcall cannot modify the state, I ran into an issue when (accidentally) calling a non-view/pure function using staticcall. For example, using this contract: ...
Morten's user avatar
  • 6,027
2 votes
1 answer
595 views

Exceeds block gas limit error to call view functions

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 ...
tao chen's user avatar
1 vote
1 answer
186 views

How to interpret the "Gas Limit" column on etherscan's internal txns view?

Here's a Kovan transaction I'm trying to optimize: https://kovan.etherscan.io/tx/0xdbe1d6369f80d0672c90eabefccc6ca972e13f921ac83c8cc28cb310f2837a0a#internal I've noticed that the "Internal Txns&...
Thomas C. G. de Vilhena's user avatar
1 vote
1 answer
66 views

Block Gas Limit Doubt

Suppose i have a loop. Here user is a struct of which player is an address. address[] memory addrs = new address[](n); for(uint i=0;i<n;i++){ addrs[i] = user.player; } return addrs; This is a ...
Sundeep Kumar's user avatar