params

package
v1.16.20 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: GPL-3.0, LGPL-3.0 Imports: 13 Imported by: 40

Documentation

Index

Constants

View Source
const (
	Wei   = 1
	GWei  = 1e9
	Ether = 1e18
)

These are the multipliers for ether denominations. Example: To get the wei value of an amount in 'gwei', use

new(big.Int).Mul(value, big.NewInt(params.GWei))
View Source
const (
	// BloomBitsBlocks is the number of blocks a single bloom bit section vector
	// contains on the server side.
	BloomBitsBlocks uint64 = 4096

	// BloomBitsBlocksClient is the number of blocks a single bloom bit section vector
	// contains on the light client side
	BloomBitsBlocksClient uint64 = 32768

	// BloomConfirms is the number of confirmation blocks before a bloom section is
	// considered probably final and its rotated bits are calculated.
	BloomConfirms = 256

	// CHTFrequency is the block frequency for creating CHTs
	CHTFrequency = 32768

	// BloomTrieFrequency is the block frequency for creating BloomTrie on both
	// server/client sides.
	BloomTrieFrequency = 32768

	// HelperTrieConfirmations is the number of confirmations before a client is expected
	// to have the given HelperTrie available.
	HelperTrieConfirmations = 2048

	// HelperTrieProcessConfirmations is the number of confirmations before a HelperTrie
	// is generated
	HelperTrieProcessConfirmations = 256

	// CheckpointFrequency is the block frequency for creating checkpoint
	CheckpointFrequency = 32768

	// CheckpointProcessConfirmations is the number before a checkpoint is generated
	CheckpointProcessConfirmations = 256

	// FullImmutabilityThreshold is the number of blocks after which a chain segment is
	// considered immutable (i.e. soft finality). It is used by the downloader as a
	// hard limit against deep ancestors, by the blockchain against deep reorgs, by
	// the freezer as the cutoff threshold and by clique as the snapshot trust limit.
	FullImmutabilityThreshold = 90000

	// LightImmutabilityThreshold is the number of blocks after which a header chain
	// segment is considered immutable for light client(i.e. soft finality). It is used by
	// the downloader as a hard limit against deep ancestors, by the blockchain against deep
	// reorgs, by the light pruner as the pruning validity guarantee.
	LightImmutabilityThreshold = 30000
)
View Source
const (
	// BlobTxBlobGasPerBlob is the gas consumption of a single data blob (== blob byte size)
	BlobTxBlobGasPerBlob = 1 << 17 // 131072
	// BlobTxTargetBlobGasPerBlock is the target blob gas per block
	// Calculated as 3 blobs per block * gas per blob
	BlobTxTargetBlobGasPerBlock = 3 * BlobTxBlobGasPerBlob
	// BlobTxBlobGaspriceUpdateFraction is the fraction for blob gas price updates
	BlobTxBlobGaspriceUpdateFraction = 3338477
	// MaxBlobGasPerBlock is the max blob gas per block (6 blobs)
	MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob
)

Re-export missing constants from geth params that might not exist in current version

View Source
const (
	VersionMajor = 0     // Major version component of the current release
	VersionMinor = 7     // Minor version component of the current release
	VersionPatch = 8     // Patch version component of the current release
	VersionMeta  = "lux" // Version metadata to append to the version string
)
View Source
const (

	// TODO: Value to pass to geth's Rules by default where the appropriate
	// context is not available in the lux code. (similar to context.TODO())
	IsMergeTODO = true
)

Variables

View Source
var (
	// SubnetEVMDefaultConfig is the default configuration
	// without any network upgrades.
	SubnetEVMDefaultChainConfig = WithExtra(
		&ChainConfig{
			ChainID: DefaultChainID,

			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),
		},
		extras.SubnetEVMDefaultChainConfig,
	)

	TestChainConfig = WithExtra(
		&ChainConfig{
			ChainID:             big.NewInt(1337),
			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),

			ShanghaiTime: utils.TimeToNewUint64(InitiallyActiveTime),
			CancunTime:   utils.TimeToNewUint64(InitiallyActiveTime),
			BlobScheduleConfig: &ethparams.BlobScheduleConfig{
				Cancun: &ethparams.BlobConfig{
					Target:         3,
					Max:            6,
					UpdateFraction: 3338477,
				},
			},
		},
		extras.TestChainConfig,
	)

	TestPreSubnetEVMChainConfig = WithExtra(
		&ChainConfig{
			ChainID:             big.NewInt(1337),
			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),

			ShanghaiTime: utils.TimeToNewUint64(InitiallyActiveTime),
			CancunTime:   utils.TimeToNewUint64(InitiallyActiveTime),
			BlobScheduleConfig: &ethparams.BlobScheduleConfig{
				Cancun: &ethparams.BlobConfig{
					Target:         3,
					Max:            6,
					UpdateFraction: 3338477,
				},
			},
		},
		extras.TestPreSubnetEVMChainConfig,
	)

	TestSubnetEVMChainConfig = WithExtra(
		&ChainConfig{
			ChainID:             big.NewInt(1337),
			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),
		},
		extras.TestSubnetEVMChainConfig,
	)

	TestDurangoChainConfig = WithExtra(
		&ChainConfig{
			ChainID:             big.NewInt(1337),
			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),
			ShanghaiTime:        utils.TimeToNewUint64(InitiallyActiveTime),
		},
		extras.TestDurangoChainConfig,
	)

	TestEtnaChainConfig = WithExtra(
		&ChainConfig{
			ChainID:             big.NewInt(1337),
			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),
			ShanghaiTime:        utils.TimeToNewUint64(InitiallyActiveTime),
			CancunTime:          utils.TimeToNewUint64(InitiallyActiveTime),
			BlobScheduleConfig: &ethparams.BlobScheduleConfig{
				Cancun: &ethparams.BlobConfig{
					Target:         3,
					Max:            6,
					UpdateFraction: 3338477,
				},
			},
		},
		extras.TestEtnaChainConfig,
	)

	TestFortunaChainConfig = WithExtra(
		&ChainConfig{
			ChainID:             big.NewInt(1337),
			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),
			ShanghaiTime:        utils.TimeToNewUint64(InitiallyActiveTime),
			CancunTime:          utils.TimeToNewUint64(InitiallyActiveTime),
			BlobScheduleConfig: &ethparams.BlobScheduleConfig{
				Cancun: &ethparams.BlobConfig{
					Target:         3,
					Max:            6,
					UpdateFraction: 3338477,
				},
			},
		},
		extras.TestFortunaChainConfig,
	)

	TestGraniteChainConfig = WithExtra(
		&ChainConfig{
			ChainID:             big.NewInt(1337),
			HomesteadBlock:      big.NewInt(0),
			EIP150Block:         big.NewInt(0),
			EIP155Block:         big.NewInt(0),
			EIP158Block:         big.NewInt(0),
			ByzantiumBlock:      big.NewInt(0),
			ConstantinopleBlock: big.NewInt(0),
			PetersburgBlock:     big.NewInt(0),
			IstanbulBlock:       big.NewInt(0),
			MuirGlacierBlock:    big.NewInt(0),
			BerlinBlock:         big.NewInt(0),
			LondonBlock:         big.NewInt(0),
			ShanghaiTime:        utils.TimeToNewUint64(InitiallyActiveTime),
			CancunTime:          utils.TimeToNewUint64(InitiallyActiveTime),
			BlobScheduleConfig: &ethparams.BlobScheduleConfig{
				Cancun: &ethparams.BlobConfig{
					Target:         3,
					Max:            6,
					UpdateFraction: 3338477,
				},
			},
		},
		extras.TestGraniteChainConfig,
	)

	TestRules = TestChainConfig.Rules(new(big.Int), IsMergeTODO, 0)
)
View Source
var (
	DefaultChainID   = big.NewInt(43214)
	DefaultFeeConfig = extras.DefaultFeeConfig
)
View Source
var BeaconRootsStorageAddress = common.HexToAddress("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02")

BeaconRootsStorageAddress is the address of the beacon roots storage contract

View Source
var (
	// InitiallyActiveTime represents the Unix epoch (time 0)
	InitiallyActiveTime = time.Unix(0, 0)
)

Local constants to replace upgrade package constants

View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()

Version holds the textual version string.

View Source
var VersionWithMeta = func() string {
	v := Version
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

VersionWithMeta holds the textual version string including the metadata.

Functions

func GetExtra

func GetExtra(c *ChainConfig) *extras.ChainConfig

func GetExtrasRules added in v0.8.6

func GetExtrasRules(ethRules Rules, c *ChainConfig, timestamp uint64) *extras.Rules

GetExtrasRules returns the extras.Rules for the given params.Rules and timestamp

func SetEthUpgrades

func SetEthUpgrades(c *ChainConfig) error

SetEthUpgrades enables Ethereum network upgrades using the same time as the Lux network upgrade that enables them.

TODO: Prior to Cancun, Lux upgrades are referenced inline in the code in place of their Ethereum counterparts. The original Ethereum names should be restored for maintainability.

func SetExtra added in v0.8.8

func SetExtra(c *ChainConfig, extra *extras.ChainConfig)

SetExtra updates the ChainConfig extra payload

func SetNetworkUpgradeDefaults

func SetNetworkUpgradeDefaults(c *ChainConfig)

func SetRulesContext added in v0.8.8

func SetRulesContext(r *Rules, c *ChainConfig, timestamp uint64)

SetRulesContext associates a Rules instance with its ChainConfig and timestamp

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

Types

type ChainConfig

type ChainConfig = ethparams.ChainConfig

ChainConfig is the core config which determines the blockchain settings.

ChainConfig is stored in the database on a per block basis. This means that any network, identified by its genesis block, can have its own set of configuration options.

func Copy

func Copy(c *ChainConfig) *ChainConfig

Copy creates a deep copy of the ChainConfig and its extras. Returns a pointer to ensure the extras mapping remains valid.

func WithExtra

func WithExtra(c *ChainConfig, extra *extras.ChainConfig) *ChainConfig

WithExtra sets the extra payload on `c` and returns the modified argument.

type ChainConfigJSON added in v0.8.8

type ChainConfigJSON struct {
	*ChainConfig
}

ChainConfigJSON is a wrapper for ChainConfig that handles JSON marshaling/unmarshaling with extras fields. This is used when we need to unmarshal JSON that contains both standard ChainConfig fields and extras fields.

func (*ChainConfigJSON) MarshalJSON added in v0.8.8

func (c *ChainConfigJSON) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ChainConfig with extras fields

func (*ChainConfigJSON) UnmarshalJSON added in v0.8.8

func (c *ChainConfigJSON) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the JSON into the ChainConfig and handles extras fields

type ChainConfigWithUpgradesJSON

type ChainConfigWithUpgradesJSON struct {
	ChainConfig
	UpgradeConfig extras.UpgradeConfig `json:"upgrades,omitempty"`
}

func ToWithUpgradesJSON added in v0.8.4

func ToWithUpgradesJSON(c *ChainConfig) *ChainConfigWithUpgradesJSON

ToWithUpgradesJSON converts the ChainConfig to ChainConfigWithUpgradesJSON with upgrades explicitly displayed. ChainConfig does not include upgrades in its JSON output. This is a workaround for showing upgrades in the JSON output.

func (*ChainConfigWithUpgradesJSON) MarshalJSON

func (cu *ChainConfigWithUpgradesJSON) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. This is a workaround for the fact that the embedded ChainConfig struct has a MarshalJSON method, which prevents the default JSON marshalling from working for UpgradeConfig. TODO: consider removing this method by allowing external tag for the embedded ChainConfig struct.

func (*ChainConfigWithUpgradesJSON) UnmarshalJSON

func (cu *ChainConfigWithUpgradesJSON) UnmarshalJSON(input []byte) error

type Rules

type Rules = ethparams.Rules

Rules wraps ChainConfig and is merely syntactic sugar or can be used for functions that do not have or require information about the block.

Rules is a one time interface meaning that it shouldn't be used in between transition phases.

func RulesAt added in v0.8.8

func RulesAt(c *ChainConfig, blockNum *big.Int, isMerge bool, timestamp uint64) Rules

RulesAt returns the Rules for the given ChainConfig at the specified timestamp This is a helper that properly sets up the RulesExtra with precompile information

type RulesExtra added in v0.8.4

type RulesExtra struct {
	IsSubnetEVM bool
	IsDurango   bool
	IsEtna      bool
	IsFortuna   bool
	IsGranite   bool

	// Fields for predicate support
	PredicatersExist bool
	Predicaters      map[common.Address]precompileconfig.Predicater

	// LuxRules for header verification
	LuxRules extras.LuxRules
	// contains filtered or unexported fields
}

RulesExtra represents extra EVM rules - part of libevm integration

func GetRulesExtra added in v0.5.5

func GetRulesExtra(rules Rules) RulesExtra

GetRulesExtra returns the RulesExtra for the given Rules

func (RulesExtra) IsPrecompileEnabled added in v0.8.4

func (r RulesExtra) IsPrecompileEnabled(addr common.Address) bool

IsPrecompileEnabled checks if a precompile is enabled

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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