Documentation ¶
Index ¶
Constants ¶
const (
BackupFilename = "eip1559state.json"
)
Variables ¶
var ( DefaultBaseFee = sdk.MustNewDecFromStr("0.01") MinBaseFee = sdk.MustNewDecFromStr("0.0025") MaxBaseFee = sdk.MustNewDecFromStr("10") // Max increase per block is a factor of 15/14, max decrease is 9/10 MaxBlockChangeRate = sdk.NewDec(1).Quo(sdk.NewDec(10)) TargetGas = int64(70_000_000) // In face of continuous spam, will take ~21 blocks from base fee > spam cost, to mempool eviction // ceil(log_{15/14}(RecheckFee mnConstant)) // So potentially 2 minutes of impaired UX from 1559 nodes on top of time to get to base fee > spam. RecheckFeeConstant = int64(4) ResetInterval = int64(2000) )
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
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