blockgascost

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: GPL-3.0, LGPL-3.0, LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

upgrade.

Index

Constants

View Source
const (
	// MinBlockGasCost is the minimum block gas cost.
	MinBlockGasCost = 0
	// MaxBlockGasCost is the maximum block gas cost. If the block gas cost
	// would exceed this value, the block gas cost is set to this value.
	MaxBlockGasCost = 1_000_000
	// TargetBlockRate is the target amount of time in seconds between blocks.
	// If blocks are produced faster than this rate, the block gas cost is
	// increased. If blocks are produced slower than this rate, the block gas
	// cost is decreased.
	TargetBlockRate = 2

	// BlockGasCostStep is the rate at which the block gas cost changes per
	// second.
	//
	BlockGasCostStep = 50_000

	// upgrade.
	//
	// This value modifies the previously used `dynamicfee.MinBaseFee`.
	//
	MinBaseFee = 25 * utils.GWei

	// upgrade.
	//
	// This value modifies the previously used `dynamicfee.MaxBaseFee`.
	MaxBaseFee = 1_000 * utils.GWei
)

Variables

This section is empty.

Functions

func BlockGasCost

func BlockGasCost(
	parentCost uint64,
	step uint64,
	timeElapsed uint64,
) uint64

BlockGasCost calculates the required block gas cost.

cost = parentCost + step * (TargetBlockRate - timeElapsed)

The returned cost is clamped to [MinBlockGasCost, MaxBlockGasCost].

Types

This section is empty.

Jump to

Keyboard shortcuts

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