dynamicfee

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: GPL-3.0, LGPL-3.0, LGPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type Window [WindowLen]uint64

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 ParseWindow(bytes []byte) (Window, error)

func (*Window) Add

func (w *Window) Add(amounts ...uint64)

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) Bytes

func (w *Window) Bytes() []byte

func (*Window) Shift

func (w *Window) Shift(n uint64)

Shift removes the oldest n entries from the window and adds n new empty entries.

func (*Window) Sum

func (w *Window) Sum() uint64

Sum returns the sum of all the entries in the window.

If the sum overflows, math.MaxUint64 is returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL