Documentation ¶
Index ¶
Constants ¶
const (
BackupFilename = "eip1559state.json"
)
Variables ¶
var ( DefaultBaseFee = sdk.MustNewDecFromStr("0.01") MinBaseFee = sdk.MustNewDecFromStr("0.0025") MaxBaseFee = sdk.MustNewDecFromStr("5") // Max increase per block is a factor of 1.06, max decrease is 9/10 // If recovering at ~30M gas per block, decrease is .94 MaxBlockChangeRate = sdk.NewDec(1).Quo(sdk.NewDec(10)) TargetGas = int64(75_000_000) // In face of continuous spam, will take ~19 blocks from base fee > spam cost, to mempool eviction // ceil(log_{1.06}(RecheckFeeConstant)) // So potentially 1.8 minutes of impaired UX from 1559 nodes on top of time to get to base fee > spam. RecheckFeeConstant = "3.0" ResetInterval = int64(3000) )
var CurEipState = EipState{ BackupFilePath: "", CurBaseFee: sdk.NewDec(0), // contains filtered or unexported fields }
CurEipState is a global variable used in the BeginBlock, EndBlock and DeliverTx (fee decorator AnteHandler) functions, it's also using when determining if a transaction has enough gas to successfully execute
var RecheckFeeDec = sdk.MustNewDecFromStr(RecheckFeeConstant)
Functions ¶
func BeginBlockCode ¶
BeginBlockCode runs at the start of every block and it reset the CurEipStates lastBlockHeight and totalGasWantedThisBlock
func DeliverTxCode ¶
DeliverTxCode is run on every transaction and will collect the gas for every transaction for use calculating gas
func EndBlockCode ¶
EndBlockCode runs at the end of every block and it updates the base fee based on the block attributes
Types ¶
type EipState ¶
type EipState struct { BackupFilePath string CurBaseFee osmomath.Dec `json:"cur_base_fee"` // contains filtered or unexported fields }
EipState tracks the current base fee and totalGasWantedThisBlock this structure is never written to state
func (*EipState) GetCurBaseFee ¶
GetCurBaseFee returns a clone of the CurBaseFee to avoid overwriting the initial value in the EipState, we use this in the AnteHandler to Check transactions
func (*EipState) GetCurRecheckBaseFee ¶
GetCurRecheckBaseFee returns a clone of the CurBaseFee / RecheckFeeConstant to account for rechecked transactions in the feedecorator ante handler