Description
A precompile that allows the caller to burn a specified amount of gas, and return a portion of the gas burned to the caller as Ether
Motivation
Some EVM chains include a form of contract secured revenue (CSR), where a portion of the gas used by the contract is returned to the owner of the contract as Ether via some mechanism. CSR, in its straightforward form, creates a perverse incentive for developers to write bloated code, or run loops of wasteful compute / state writes in order to burn gas.
This proposal describes a way for CSR to be implemented in a computationally efficient and scalable way. Additionally, it provides a standardized interface that improves cross-chain compatibility of smart contract code.
This proposal is also designed to be flexible enough to be implemented either as a predeploy, or a precompile.
Benefits
- Enable baked-in taxes for token transfers (e.g. creator royalties).
- Increase sequencer fees, so that L2s can feel more generous in accruing value back to L1.
- Promote development on L2s, which are perfectly suited for novel incentive mechanisms at the core level.
- Tax high frequency trading on L2s (e.g. probabilistic MEVs) and route value back to authentic users.
Details
For nomenclature, we shall refer to this precompile as the Gasback precompile.
The behavior of the precompile can be described by the following Solidity smart contract.
- Caller calls Gasback precompile with
abi.encode(gasToBurn)
. - Upon successful execution:
- The precompile MUST consume at least
gasToBurn
amount of gas. - The precompile MUST force send the caller Ether up to
basefee * gasToBurn
. The force sending MUST NOT revert. This is to accommodate contracts that cannot implement a fallback function. - The precompile MUST return
abi.encode(amountToGive)
, whereamountToGive
is the amount of Ether force sent to the caller.
- The precompile MUST consume at least
- Else, the precompile MUST return empty returndata.
Suggested Implementation (op-geth level)
Security Considerations
As long as the contract always returns less than or equal to the gas burned, the L2 chain implementing it can never become insolvent.
To make DDoS infeasible, the amount of Ether returned by a call can be adjusted to a ratio (e.g. 50-90%). Alternatively, each call to the contract can burn a flat amount of gas that will not be returned as Ether.
To manage the basefee, the precompile can be dynamically configured to switch to a no-op if the basefee gets too high.