gas

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

README

The gas package contains the necessary code for estimating and pricing l1 gas. Currently it's mostly barebone placeholders, but will evolve into precompiled smart contracts and binders for accessing their state in order to fit it in the gas mechanics.

Documentation

Index

Constants

View Source
const L1TxGas = 300_000

L1TxGas - a crude estimation of the cost of publishing an L1 tx

View Source
const MaxHistoricMA = 50

MaxHistoricMA - the maximum number of historic blocks

View Source
const MovingAverageWindow = 300 // `3600 / 12` - last 1 hour

MovingAverageWindow - the more traffic on the network, the lower this number can get. Should be roughly the number of blocks between rollups. - note that increasing this value will have to increase the number of cached blocks in the cache_service

View Source
const TxsPerRollup = 250

TxsPerRollup - the number of transactions in a rollup. A conservative estimation.

Variables

This section is empty.

Functions

func CalculateL1Size added in v1.1.0

func CalculateL1Size(data []byte) *big.Int

CalculateL1Size - calculates the size of the published transaction.

Types

type Oracle

type Oracle interface {
	SubmitL1Block(ctx context.Context, headBlock *types.Header) error
	EstimateL1StorageGasCost(ctx context.Context, tx *types.Transaction, block *types.Header, header *common.BatchHeader) (*big.Int, error)
	EstimateL1CostForMsg(ctx context.Context, args *gethapi.TransactionArgs, header *common.BatchHeader) (*big.Int, error)
}

Oracle - the interface for the future precompiled gas oracle contract which will expose necessary l1 information.

func NewGasOracle

func NewGasOracle(l1ChainCfg *params.ChainConfig, storage storage.BlockResolver, logger gethlog.Logger) Oracle

Jump to

Keyboard shortcuts

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