Documentation
¶
Index ¶
Constants ¶
View Source
const ( // WindowLen is the number of seconds of gas consumption to track. WindowLen = 10 // upgrade. // MinBaseFee = 75 * utils.GWei // upgrade. // MaxBaseFee = 225 * utils.GWei // block. // Note: ChainEVM historic blocks used 25 GWei as initial base fee. InitialBaseFee = 25 * utils.GWei // TargetGas is the target amount of gas to be included in the window. The // target amount of gas per second equals [TargetGas] / [WindowLen]. // TargetGas = 10_000_000 // IntrinsicBlockGas is the amount of gas that should always be included in // the window. // IntrinsicBlockGas = 1_000_000 // BaseFeeChangeDenominator is the denominator used to smoothen base fee // changes. // BaseFeeChangeDenominator = 12 // WindowSize is the number of bytes that are used to encode the window. WindowSize = wrappers.LongLen * WindowLen )
Variables ¶
View Source
var ErrWindowInsufficientLength = errors.New("insufficient length for window")
Functions ¶
This section is empty.
Types ¶
type Window ¶
Window is a window of the last WindowLen seconds of gas usage.
Index 0 is the oldest entry, and WindowLen-1 is the current entry.
func ParseWindow ¶
func (*Window) Add ¶
Add adds the amounts to the most recent entry in the window.
If the most recent entry overflows, it is set to math.MaxUint64.
func (*Window) Shift ¶
Shift removes the oldest n entries from the window and adds n new empty entries.
func (*Window) Sum ¶
Sum returns the sum of all the entries in the window.
If the sum overflows, math.MaxUint64 is returned.
Click to show internal directories.
Click to hide internal directories.