ethconfig

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package ethconfig contains the configuration of the ETH and LES protocols.

Index

Constants

View Source
const EnableHistoryV3InTest = false
View Source
const EnableHistoryV4InTest = false
View Source
const HistoryV3AggregationStep = 3_125_000 // 100M / 32

AggregationStep number of transactions in smallest static file

Variables

View Source
var (
	FlagSnapKeepBlocks = "snap.keepblocks"
	FlagSnapStop       = "snap.stop"
)

Chains where snapshots are enabled by default

View Source
var DefaultTxPool2Config = func(fullCfg *Config) txpoolcfg.Config {
	pool1Cfg := &fullCfg.DeprecatedTxPool
	cfg := txpoolcfg.DefaultConfig
	cfg.PendingSubPoolLimit = int(pool1Cfg.GlobalSlots)
	cfg.BaseFeeSubPoolLimit = int(pool1Cfg.GlobalBaseFeeQueue)
	cfg.QueuedSubPoolLimit = int(pool1Cfg.GlobalQueue)
	cfg.PriceBump = pool1Cfg.PriceBump
	cfg.BlobPriceBump = fullCfg.TxPool.BlobPriceBump
	cfg.MinFeeCap = pool1Cfg.PriceLimit
	cfg.AccountSlots = pool1Cfg.AccountSlots
	cfg.BlobSlots = fullCfg.TxPool.BlobSlots
	cfg.LogEvery = 3 * time.Minute
	cfg.CommitEvery = 5 * time.Minute
	cfg.TracedSenders = pool1Cfg.TracedSenders
	cfg.CommitEvery = pool1Cfg.CommitEvery

	return cfg
}
View Source
var Defaults = Config{
	Sync: Sync{
		UseSnapshots:               false,
		ExecWorkerCount:            estimate.ReconstituteState.WorkersHalf(),
		ReconWorkerCount:           estimate.ReconstituteState.Workers(),
		BodyCacheLimit:             256 * 1024 * 1024,
		BodyDownloadTimeoutSeconds: 2,
	},
	Ethash: ethashcfg.Config{
		CachesInMem:      2,
		CachesLockMmap:   false,
		DatasetsInMem:    1,
		DatasetsOnDisk:   2,
		DatasetsLockMmap: false,
	},
	NetworkID: 1,
	Prune:     prune.DefaultMode,
	Miner: params.MiningConfig{
		GasLimit: 30_000_000,
		GasPrice: big.NewInt(params.GWei),
		Recommit: 3 * time.Second,
	},
	DeprecatedTxPool: DeprecatedDefaultTxPoolConfig,
	RPCGasCap:        50000000,
	GPO:              FullNodeGPO,
	RPCTxFeeCap:      1,

	ImportMode: false,
	Snapshot: BlocksFreezing{
		Enabled:    false,
		KeepBlocks: false,
		Produce:    true,
	},
}

Defaults contains default settings for use on the Ethereum main net.

View Source
var DeprecatedDefaultTxPoolConfig = DeprecatedTxPoolConfig{
	PriceLimit: 1,
	PriceBump:  10,

	AccountSlots:       16,
	GlobalSlots:        10_000,
	GlobalBaseFeeQueue: 30_000,
	AccountQueue:       64,
	GlobalQueue:        30_000,

	Lifetime: 3 * time.Hour,
}

DeprecatedDefaultTxPoolConfig contains the default configurations for the transaction pool.

View Source
var FullNodeGPO = gaspricecfg.Config{
	Blocks:           20,
	Default:          big.NewInt(0),
	Percentile:       60,
	MaxHeaderHistory: 0,
	MaxBlockHistory:  0,
	MaxPrice:         gaspricecfg.DefaultMaxPrice,
	IgnorePrice:      gaspricecfg.DefaultIgnorePrice,
}

FullNodeGPO contains default gasprice oracle settings for full node.

View Source
var LightClientGPO = gaspricecfg.Config{
	Blocks:           2,
	Percentile:       60,
	MaxHeaderHistory: 300,
	MaxBlockHistory:  5,
	MaxPrice:         gaspricecfg.DefaultMaxPrice,
	IgnorePrice:      gaspricecfg.DefaultIgnorePrice,
}

LightClientGPO contains default gasprice oracle settings for light client.

Functions

func UseSnapshotsByChainName

func UseSnapshotsByChainName(chain string) bool

Types

type BlocksFreezing

type BlocksFreezing struct {
	Enabled        bool
	KeepBlocks     bool // produce new snapshots of blocks but don't remove blocks from DB
	Produce        bool // produce new snapshots
	NoDownloader   bool // possible to use snapshots without calling Downloader
	Verify         bool // verify snapshots on startup
	DownloaderAddr string
}

func NewSnapCfg

func NewSnapCfg(enabled, keepBlocks, produce bool) BlocksFreezing

func (BlocksFreezing) String

func (s BlocksFreezing) String() string

type Config

type Config struct {
	Sync Sync

	// The genesis block, which is inserted if the database is empty.
	// If nil, the Ethereum main net block is used.
	Genesis *types.Genesis `toml:",omitempty"`

	// Protocol options
	NetworkID uint64 // Network ID to use for selecting peers to connect to

	// This can be set to list of enrtree:// URLs which will be queried for
	// for nodes to connect to.
	EthDiscoveryURLs []string

	Prune     prune.Mode
	BatchSize datasize.ByteSize // Batch size for execution stage

	ImportMode bool

	BadBlockHash common.Hash // hash of the block marked as bad

	Snapshot     BlocksFreezing
	Downloader   *downloadercfg.Cfg
	BeaconRouter beacon_router_configuration.RouterConfiguration
	CaplinConfig clparams.CaplinConfig

	Dirs datadir.Dirs

	// Address to connect to external snapshot downloader
	// empty if you want to use internal bittorrent snapshot downloader
	ExternalSnapshotDownloaderAddr string

	// Whitelist of required block number -> hash values to accept
	Whitelist map[uint64]common.Hash `toml:"-"`

	// Mining options
	Miner params.MiningConfig

	// Ethash options
	Ethash ethashcfg.Config

	Clique params.ConsensusSnapshotConfig
	Aura   chain.AuRaConfig
	Bor    chain.BorConfig

	// Transaction pool options
	DeprecatedTxPool DeprecatedTxPoolConfig
	TxPool           txpoolcfg.Config

	// Gas Price Oracle options
	GPO gaspricecfg.Config

	// RPCGasCap is the global gas cap for eth-call variants.
	RPCGasCap uint64 `toml:",omitempty"`

	// RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for
	// send-transction variants. The unit is ether.
	RPCTxFeeCap float64 `toml:",omitempty"`

	StateStream bool

	//  New DB and Snapshots format of history allows: parallel blocks execution, get state as of given transaction without executing whole block.",
	HistoryV3 bool

	// gRPC Address to connect to Heimdall node
	HeimdallgRPCAddress string

	// URL to connect to Heimdall node
	HeimdallURL string

	// No heimdall service
	WithoutHeimdall bool
	// Heimdall services active
	WithHeimdallMilestones bool
	// Ethstats service
	Ethstats string
	// Consensus layer
	InternalCL                  bool
	LightClientDiscoveryAddr    string
	LightClientDiscoveryPort    uint64
	LightClientDiscoveryTCPPort uint64
	SentinelAddr                string
	SentinelPort                uint64

	OverrideCancunTime *big.Int `toml:",omitempty"`

	ForcePartialCommit bool

	// Embedded Silkworm support
	SilkwormExecution bool
	SilkwormRpcDaemon bool
	SilkwormSentry    bool

	DisableTxPoolGossip bool
}

Config contains configuration options for ETH protocol.

func (Config) MarshalTOML

func (c Config) MarshalTOML() (interface{}, error)

MarshalTOML marshals as TOML.

func (*Config) UnmarshalTOML

func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error

UnmarshalTOML unmarshals from TOML.

type DeprecatedTxPoolConfig

type DeprecatedTxPoolConfig struct {
	Disable  bool
	Locals   []common.Address // Addresses that should be treated by default as local
	NoLocals bool             // Whether local transaction handling should be disabled

	PriceLimit uint64 // Minimum gas price to enforce for acceptance into the pool
	PriceBump  uint64 // Minimum price bump percentage to replace an already existing transaction (nonce)

	AccountSlots uint64 // Number of executable transaction slots guaranteed per account
	GlobalSlots  uint64 // Maximum number of executable transaction slots for all accounts
	AccountQueue uint64 // Maximum number of non-executable transaction slots permitted per account
	GlobalQueue  uint64 // Maximum number of non-executable transaction slots for all accounts

	GlobalBaseFeeQueue uint64 // Maximum number of non-executable transaction slots for all accounts

	Lifetime      time.Duration // Maximum amount of time non-executable transaction are queued
	StartOnInit   bool
	TracedSenders []string // List of senders for which tx pool should print out debugging info
	CommitEvery   time.Duration
}

DeprecatedTxPoolConfig are the configuration parameters of the transaction pool.

type Sync

type Sync struct {
	UseSnapshots bool
	// LoopThrottle sets a minimum time between staged loop iterations
	LoopThrottle     time.Duration
	ExecWorkerCount  int
	ReconWorkerCount int

	BodyCacheLimit             datasize.ByteSize
	BodyDownloadTimeoutSeconds int // TODO: change to duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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