ethermint icon indicating copy to clipboard operation
ethermint copied to clipboard

More precise gasWanted

Open tomtau opened this issue 3 years ago • 1 comments

Proposal: Use more precise bounds for gasWanted via constant time estimates and/or linear time amortization analysis.

Current behavior: Right now, it uses the user's set gas limit or capping it by an arbitrary number: https://github.com/evmos/ethermint/blob/8e2c65295f0fa34ff64789ac568bab1d14b08549/app/ante/eth.go#L201

In the future with ABCI++, it may be possible to use gasUsed, but that's not possible now.

Desired behavior: Ideally, Ethermint could use more tighter bounds without the full EVM execution:

  • some constant checks: https://github.com/ethereum/go-ethereum/blob/3e693e1ef6e2da69847a30a14808b327aa07060e/internal/ethapi/api.go#L1022 (many of those are more for max bounds but there may be some more precise / more meaningful values taken from the state)
  • linear time analysis: https://www.cs.cmu.edu/~ankushd/docs/move20.pdf (there may be others such as https://arxiv.org/abs/1912.11929 but not sure about their complexity )

Use case:

  • better block utilization
  • less likely to go over the maximum block gas limit

Requests may be closed if we're not actively planning to work on them.

tomtau avatar Jun 30 '22 02:06 tomtau

This issue is stale because it has been open 45 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 15 '22 02:08 github-actions[bot]