question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`--miner.callGasLimit` implementation is wrong

See original GitHub issue

The purpose of the miner.callGasLimit option is to set a cap on gas that is used in an eth_call/eth_estimateGas RPC call (as in geth’s --rpc.gascap option). The purpose of this option is to prevent a DOS attack wherein a contract is uploaded with an infinite loop and eth_call is used on that contract, causing miners to work very very hard.

Currently, it’s used as a default gas limit for a transaction that is calling eth_call/eth_estimateGas.

Fix it!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
davidmurdochcommented, Jun 30, 2022

Thanks for the additional information, we’ll look into it! I’ve opened https://github.com/trufflesuite/ganache/pull/3322 to correct the documentation issue.

1reaction
anishnaikcommented, Jun 30, 2022

Is there an update on this? I believe this is causing differential behavior b/w the latest release of ganache and the deprecated ganache-cli@6.12.2

eth_estimateGas is throwing an out-of-gas error when extremely large contracts are being deployed with the latest release (v7.3.2). This does not occur with the old ganache-cli. My working assumption is that it is because miner.callGasLimit is not being correctly used.

To reproduce, you can try to deploy ComptrollerHarness using hardhat (instead of saddle) + ganache.

This is the ganache-cli command: ganache-cli --deterministic --gasLimit 10000000000000000 --allowUnlimitedContractSize

This is the ganache command: ganache --deterministic --gasLimit 10000000000000000 --chain.allowUnlimitedContractSize

The ganache command returns the following error in hardhat:

     ProviderError: VM Exception while processing transaction: out of gas
      at HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:78:19)
      at GanacheGasMultiplierProvider._getMultipliedGasEstimation (node_modules/hardhat/src/internal/core/providers/gas-providers.ts:72:59)
      at GanacheGasMultiplierProvider.request (node_modules/hardhat/src/internal/core/providers/gas-providers.ts:309:19)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

 {'message': 'VM Exception while processing transaction: out of gas', 'stack': 'RuntimeError: VM Exception while processing transaction: out of gas\n    at exactimate (/usr/local/lib/node_modules/ganache/dist/node/1.js:2:113332)', 'code': -32000, 'name': 'RuntimeError', 'data': {'hash': None, 'programCounter': 97, 'result': '0x', 'reason': None, 'message': 'out of gas'}}

The current working solution is to specify a gasLimit directly to the call for await ComptrollerHarness.deploy({gasLimit: some_limit}); however, this seems to hint at a larger problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understand the potential issue of miner controlled gaslimit
However, my question is that, what could go wrong, if a malicious miner intentionally control the "block.gaslimit" property used by Solidity ...
Read more >
Ganache CLI options - Truffle Suite
When false , only one request is processed at a time. The default is true . ... The block time (in seconds) for...
Read more >
Ganache Fork Avalanche - HackMD
[string] [default: 0x1] --miner.callGasLimit Sets the transaction gas limit in WEI for eth_call and eth_estimateGas calls.
Read more >
ganache - npm
[string] [default: 0x1] --miner.callGasLimit Sets the transaction gas limit in WEI for eth_call and eth_estimateGas calls.
Read more >
github.com-trufflesuite-ganache_-_2022-01-23_22-09-54
--miner.callGasLimit Sets the transaction gas limit in WEI for ethcall and ethestimateGas calls. [string] [default: 0x1fffffffffffff] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found