Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

don't refund all the unused gas #1085

Closed
yihuang opened this issue May 18, 2022 · 4 comments · Fixed by #1087
Closed

don't refund all the unused gas #1085

yihuang opened this issue May 18, 2022 · 4 comments · Fixed by #1087

Comments

@yihuang
Copy link
Contributor

yihuang commented May 18, 2022

Proposal: don't refund all the unused gas

Adapt the cosmos-sdk proposal to ethermint.
Instead of charge user gas_used * gas_price as fee, charge max(gas_limit / 2, gas_used) * gas_price.

Positives:

  • Incentivize user to set tx gas limit more responsibly, which will help the block fill rate according to current check tx logic.
    • This motivation will be invalidated after we support abci++, which could happen in next year I guess.
  • Disincentivize arbitrage bots which often set a high gas limit to cover the slow path, while most of time enjoy the low gas fee of the fast path.

Negatives:

  • Clients need to change how it calculates the tx fee, since it's not compatible with ethereum anymore, we can't expect all the clients will change accordingly.
    • One mitigation of above issue is, return max(gas_limit / 2, gas_used) in place of gas_used in json-rpc, so client still calculate the correct fee, but get a wrong gas_used(we can add a new realGasUsed field?)

Current behavior: refund all unused gas

Desired behavior: only refund a portion of unused gas

Use case:

  • better block fill rate
  • punish bots
@adu-crypto
Copy link
Contributor

how about we use returned value of eth_estimateGas as estimated gas_used instead of gas_limit when including the txs in block and check only gas_limit when DeliverTx

@yihuang
Copy link
Contributor Author

yihuang commented May 18, 2022

that'll make the check tx much heavier, which breaks the assumption of the design, and introduce new dos attack venerability.

@zmanian
Copy link

zmanian commented May 20, 2022

This suggestion has a negative impact on some common patterns in EVM development.

The way Uniswap handle's tx expiration is to have a quick check to see if the block height is greater than zero before doing a swap. This is done while spending much less gas than a swap.

At low transaction fees, these semantic differences won't have a huge impact.

Unfortunately a more holistic solution seems to depend on using ABCI++ to have the proposer actually pre-execute all the transactions

@yihuang
Copy link
Contributor Author

yihuang commented May 21, 2022

The way Uniswap handle's tx expiration is to have a quick check to see if the block height is greater than zero before doing a swap. This is done while spending much less gas than a swap.

is this a feature or bug though, this opens the room for bots to do lots of low gas trials, only need to pay the heavier gas when it succeeds.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants