SIP-2055: Dynamic Gas Fee Module - Ecotone

Author
StatusImplemented
TypeGovernance
NetworkOptimism
ImplementorTBD
ReleaseTBD
ProposalLoading status...

Simple Summary

The sip proposes to put in place a new dynamic gas fee module which replaces the one currently implemented under SIP-2013. The new module would incorporate the necessary changes in transaction costs associated with optimism's ecotone upgrade. Depending on governance, optimism is expected to update their gas pricing mechanism around the same time as ethereum rolls out EIP-4844 at slot 296568. Therefore, this sip would be implemented immediately following ecotone. It is important to mention that around a 3x decrease in gas costs is anticipated because of these changes.

Abstract

The dynamic gas fee module is a standard Gnosis Safe Module that is able to alter the minKeeperFee in our PerpsV2MarketSettings within bounds specified in the contract and configurable via governance:

  • The calculation steps of the minKeeperFee is as follows (detailed example below):
  1. costOfExecutionGross := (l2GasPrice * l2GasUnits + l1GasPrice * l1GasUnits) * ETH/USD
  2. profitMargin := max(profitMarginUSD; costOfExecutionGross * profitMarginPercent )
  3. costOfExecutionNet := costOfExecutionGross + profitMargin
  4. minKeeperFee := min(costOfExecutionNet ; minKeeperFeeUpperBound)
  • The ETH/USD price is obtained with the on-chain chainlink ETH oracle
  • The profit margin is incorporated in order to absorb shocks to gas prices on the one hand and to incentivize a decentralized keeper network
  • The upper bound on the minKeeperFee is incorporated for safety purposes
  • The number of gas units required on L1 and L2 are configurable via SCCP
  • Computation of l2GasPriceand l1GasPrice are detailed here

Motivation

The main motivation is to continue to incentivize the decentralized community keepers to execute perps v2 settlement & liquidation transactions by covering the cost of execution.

Specification

The following functions would be incorporated into the new DynamicGasFeeModule:

getMinKeeperFee:

This is a getter public function that returns computed gas price given on-chain variables

setMinKeeperFee:

This is a publicly callable function that updates the minKeeperFee in PerpsV2MarketSettings

getParameters:

This is a getter public function that returns the current configurations specified under the Configurable Values section

setParameters:

This can only be called by the owner, whereby the variables specified under the Configurable Values section, can be updated

setPaused:

Allows to pause and unpause the gnosis module

Owner

Returns the owner of the module that can pause the module

L1 and L2 Gas Price:

As per the ecotone specification, the L1 and L2 gas price are obtained as per the below:

l1GasPrice = (baseFeeScalar * l1BaseFee * 16 + blobBaseFeeScalar * blobBaseFee) / (16 * 10 ** decimals)

where the below variables are obtained by calling the functions on the optimism gas price precompile under 0x420000000000000000000000000000000000000F:

  • baseFeeScalar
  • l1BaseFee
  • blobBaseFeeScalar
  • blobBaseFee
  • decimals

l2GasPrice is obtained by simply calling block.baseFee

Test Cases

Gas Price Module Configurations:

  • profitMarginPercent: 20%
  • profitMarginUSD: 1 sUSD
  • minKeeperFeeUpperBound: 30 sUSD
  • gasUnitsL1 : 10,500 GAS
  • gasUnitsL2 : 1.35e6 GAS

On-chain Gas Price Values:

  • l1BaseFee : 50 GWEI
  • baseFeeScalar: 7600
  • blobBaseFee: 320 (40 GWEI * 16 scaling)
  • blobBaseFeeScalar: 0.862e6
  • decimals: 6
  • l2GasPrice: 0.005 GWEI/GAS
  • ETH/USD: 2500$

Min Keeper Fee Calculation:

  • l1GasPrice = (7600 * 50e9 * 16 + 320e9 * 0.862e6) / (16 * 10 ** 6) / 1e9 = 17.62 GWEI/GAS
  • costOfExecutionGrossGwei = 17.62 GWEI/GAS * 10,500 GAS + 0.005 GWEI/GAS * 1.35e6 GAS = 191,760 GWEI
  • costOfExecutionGrossUSD = (191,760/1e9) ETH * 2500 USD/ETH ~= 0.48 sUSD
  • profitMargin = max(1 ; 20% * 0.48) = 1 sUSD
  • costOfExecutionNet = 1+0.48 = 1.48 sUSD
  • minKeeperFee = min(1.48;30) = 1.48 sUSD

Configurable Values (Via SCCP)

  • minKeeperFeeUpperBound being the upper bound on the minKeeperFee that can be updated, (set to 30 sUSD)
  • gasUnitsL1 and gasUnitsL2 being the number of gas units required to settle a offchain delayed order
  • profitMarginUSD being a profit margin in sUSD, applied on the cost of execution, (set to 1 sUSD)
  • profitMarginPercent being a keeper profit margin in percentage, applied on the cost of execution, (set to 20%)

References:

Copyright and related rights waived via CC0.