params

package
v0.14.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: GPL-3.0 Imports: 10 Imported by: 4

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

	// 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.
	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 (
	GasLimitBoundDivisor    uint64 = 1024    // The bound divisor of the gas limit, used in update calculations.
	PercentGasUsedThreshold uint64 = 95      // Percent Gas used threshold at which the gas limit adjusts
	MinGasLimit             uint64 = 5000000 // Minimum the gas limit may ever be.
	GenesisGasLimit         uint64 = 5000000 // Gas limit of the Genesis block.

	MaximumExtraDataSize  uint64 = 32                                                       // Maximum size extra data may be after Genesis.
	ExpByteGas            uint64 = 10                                                       // Times ceil(log256(exponent)) for the EXP instruction.
	CallValueTransferGas  uint64 = 9000                                                     // Paid for CALL when the value transfer is non-zero.
	CallNewAccountGas     uint64 = 25000                                                    // Paid for CALL when the destination address didn't exist prior.
	TxGas                 uint64 = 21000                                                    // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
	TxGasContractCreation uint64 = 53000                                                    // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions.
	TxDataZeroGas         uint64 = 4                                                        // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions.
	QuadCoeffDiv          uint64 = 512                                                      // Divisor for the quadratic particle of the memory cost equation.
	LogDataGas            uint64 = 8                                                        // Per byte in a LOG* operation's data.
	CallStipend           uint64 = 2300                                                     // Free gas given at beginning of call.
	ETXGas                uint64 = 21000                                                    // Per ETX generated by opETX or normal cross-chain transfer.
	ETXRegionMaxFraction  int    = common.NumRegionsInPrime * (common.NumZonesInRegion - 1) // The maximum fraction of transactions for cross-region ETXs
	ETXPrimeMaxFraction   int    = common.NumRegionsInPrime * common.NumZonesInRegion       // The maximum fraction of transactions for cross-prime ETXs
	ETXRLimitMin          int    = 10                                                       // Minimum possible cross-region ETX limit
	ETXPLimitMin          int    = 10                                                       // Minimum possible cross-prime ETX limit
	EtxExpirationAge      uint64 = 100                                                      // Number of blocks an ETX may wait for inclusion at the destination

	Sha3Gas     uint64 = 30 // Once per SHA3 operation.
	Sha3WordGas uint64 = 6  // Once per word of the SHA3 operation's data.

	SstoreClearGas  uint64 = 5000  // Once per SSTORE operation if the zeroness doesn't change.
	SstoreRefundGas uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero.

	NetSstoreNoopGas  uint64 = 200   // Once per SSTORE operation if the value doesn't change.
	NetSstoreInitGas  uint64 = 20000 // Once per SSTORE operation from clean zero.
	NetSstoreCleanGas uint64 = 5000  // Once per SSTORE operation from clean non-zero.
	NetSstoreDirtyGas uint64 = 200   // Once per SSTORE operation from dirty.

	NetSstoreClearRefund      uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot
	NetSstoreResetRefund      uint64 = 4800  // Once per SSTORE operation for resetting to the original non-zero value
	NetSstoreResetClearRefund uint64 = 19800 // Once per SSTORE operation for resetting to the original zero value

	SstoreSentryGas uint64 = 2300  // Minimum gas required to be present for an SSTORE call, not consumed
	SstoreSetGas    uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero
	SstoreResetGas  uint64 = 5000  // Once per SSTORE operation from clean non-zero to something else

	ColdAccountAccessCost = uint64(2600) // COLD_ACCOUNT_ACCESS_COST
	ColdSloadCost         = uint64(2100) // COLD_SLOAD_COST
	WarmStorageReadCost   = uint64(100)  // WARM_STORAGE_READ_COST

	// SSTORE_CLEARS_SCHEDULE is defined as SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST
	// Which becomes: 5000 - 2100 + 1900 = 4800
	SstoreClearsScheduleRefund uint64 = SstoreResetGas - ColdSloadCost + TxAccessListStorageKeyGas // Once per SSTORE operation for clearing an originally existing storage slot

	JumpdestGas   uint64 = 1     // Once per JUMPDEST operation.
	EpochDuration uint64 = 30000 // Duration between proof-of-work epochs.

	CreateDataGas         uint64 = 200   //
	CallCreateDepth       uint64 = 1024  // Maximum depth of call/create stack.
	ExpGas                uint64 = 10    // Once per EXP instruction
	LogGas                uint64 = 375   // Per LOG* operation.
	CopyGas               uint64 = 3     //
	StackLimit            uint64 = 1024  // Maximum size of VM stack allowed.
	TierStepGas           uint64 = 0     // Once per operation, for a selection of them.
	LogTopicGas           uint64 = 375   // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas.
	CreateGas             uint64 = 32000 // Once per CREATE operation & contract-creation transaction.
	Create2Gas            uint64 = 32000 // Once per CREATE2 operation
	SelfdestructRefundGas uint64 = 24000 // Refunded following a selfdestruct operation.
	MemoryGas             uint64 = 3     // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL.

	TxDataNonZeroGas          uint64 = 16   // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions.
	TxAccessListAddressGas    uint64 = 2400 // Per address specified in access list
	TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in access list

	// These have been changed during the course of the chain
	CallGas         uint64 = 700 // Static portion of gas for CALL-derivates
	BalanceGas      uint64 = 700 // The cost of a BALANCE operation
	ExtcodeSizeGas  uint64 = 700 // Cost of EXTCODESIZE
	SloadGas        uint64 = 800
	ExtcodeHashGas  uint64 = 700  // Cost of EXTCODEHASH
	SelfdestructGas uint64 = 5000 // Cost of SELFDESTRUCT

	// EXP has a dynamic portion depending on the size of the exponent
	ExpByte uint64 = 50 // was raised to 50

	// Extcodecopy has a dynamic AND a static cost. This represents only the
	// static portion of the gas.
	ExtcodeCopyBase uint64 = 700

	// CreateBySelfdestructGas is used when the refunded account is one that does
	// not exist. This logic is similar to call.
	CreateBySelfdestructGas uint64 = 25000

	BaseFeeChangeDenominator = 8        // Bounds the amount the base fee can change between blocks.
	ElasticityMultiplier     = 2        // Bounds the maximum gas limit a block may have.
	InitialBaseFee           = 1        // Initial base fee for blocks.
	MaxBaseFee               = 1 * GWei // Maximum base fee for blocks.

	MaxCodeSize = 24576 // Maximum bytecode to permit for a contract

	EcrecoverGas        uint64 = 3000 // Elliptic curve sender recovery gas price
	Sha256BaseGas       uint64 = 60   // Base price for a SHA256 operation
	Sha256PerWordGas    uint64 = 12   // Per-word price for a SHA256 operation
	Ripemd160BaseGas    uint64 = 600  // Base price for a RIPEMD160 operation
	Ripemd160PerWordGas uint64 = 120  // Per-word price for a RIPEMD160 operation
	IdentityBaseGas     uint64 = 15   // Base price for a data copy operation
	IdentityPerWordGas  uint64 = 3    // Per-work price for a data copy operation

	Bn256AddGas             uint64 = 150   // Gas needed for an elliptic curve addition
	Bn256ScalarMulGas       uint64 = 6000  // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGas     uint64 = 45000 // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGas uint64 = 34000 // Per-point price for an elliptic curve pairing check

	// The Refund Quotient is the cap on how much of the used gas can be refunded
	RefundQuotient uint64 = 5
)

Variables

View Source
var (
	// Progpow GenesisHashes
	ProgpowColosseumGenesisHash  = common.HexToHash("0x6053d0826a42d11d44a2172d309809aa6abb97bf7cdc24a3dd8be81ee6528468")
	ProgpowGardenGenesisHash     = common.HexToHash("0x3725ae59140167e31e4d4457e9948d716c687ac3a4b278350137356ee73060d1")
	ProgpowOrchardGenesisHash    = common.HexToHash("0xeb625504882304b641551f8f33706cc4a7009b14325fa52af92274032504c46e")
	ProgpowLocalGenesisHash      = common.HexToHash("0x7f594e88d6c93a00680840a855b7c9349218751cc344562dacb43a63eec02d93")
	ProgpowLighthouseGenesisHash = common.HexToHash("0x2cf2f1ab8901e7bad77fbe9a671c12218229bcc1a725ec1c7cb3342a076d4596")

	// Blake3GenesisHashes
	Blake3PowColosseumGenesisHash  = common.HexToHash("0xe6e0ff26dafbb1ff849b965fc300ebc9eee2708686943030d958dc4cc4b6c0ea")
	Blake3PowGardenGenesisHash     = common.HexToHash("0x3fb55aff423ca143fd714e256530be8a34e21bd85f8dc62587f9fb559b739f36")
	Blake3PowOrchardGenesisHash    = common.HexToHash("0x418ea8cd5f17277e4bb94cba7170a494fc53df23b915ed42a8fe9f6052a4327b")
	Blake3PowLocalGenesisHash      = common.HexToHash("0x6181f4781316452abf66aaafa44568a4e9f56bb10c276c9d7b3964efea4fbc56")
	Blake3PowLighthouseGenesisHash = common.HexToHash("0x8431222ba8848050619fc1bca9447a351b7079684ea57c1cb0ab5d09d4bb4c51")
)

Genesis hashes to enforce below configs on.

View Source
var (
	// ColosseumChainConfig is the chain parameters to run a node on the Colosseum network.
	ProgpowColosseumChainConfig = &ChainConfig{
		ChainID:     big.NewInt(9000),
		Progpow:     new(ProgpowConfig),
		GenesisHash: ProgpowColosseumGenesisHash,
	}

	Blake3PowColosseumChainConfig = &ChainConfig{
		ChainID:     big.NewInt(9000),
		Blake3Pow:   new(Blake3powConfig),
		GenesisHash: Blake3PowColosseumGenesisHash,
	}

	// GardenChainConfig contains the chain parameters to run a node on the Garden test network.
	ProgpowGardenChainConfig = &ChainConfig{
		ChainID:     big.NewInt(12000),
		Progpow:     new(ProgpowConfig),
		GenesisHash: ProgpowGardenGenesisHash,
	}

	Blake3PowGardenChainConfig = &ChainConfig{
		ChainID:     big.NewInt(12000),
		Blake3Pow:   new(Blake3powConfig),
		GenesisHash: Blake3PowGardenGenesisHash,
	}

	// OrchardChainConfig contains the chain parameters to run a node on the Orchard test network.
	ProgpowOrchardChainConfig = &ChainConfig{
		ChainID:     big.NewInt(15000),
		Progpow:     new(ProgpowConfig),
		GenesisHash: ProgpowOrchardGenesisHash,
	}

	Blake3PowOrchardChainConfig = &ChainConfig{
		ChainID:     big.NewInt(15000),
		Blake3Pow:   new(Blake3powConfig),
		GenesisHash: Blake3PowOrchardGenesisHash,
	}

	// LighthouseChainConfig contains the chain parameters to run a node on the Lighthouse test network.
	ProgpowLighthouseChainConfig = &ChainConfig{
		ChainID:     big.NewInt(17000),
		Blake3Pow:   new(Blake3powConfig),
		Progpow:     new(ProgpowConfig),
		GenesisHash: ProgpowLighthouseGenesisHash,
	}

	Blake3PowLighthouseChainConfig = &ChainConfig{
		ChainID:     big.NewInt(17000),
		Blake3Pow:   new(Blake3powConfig),
		GenesisHash: Blake3PowLighthouseGenesisHash,
	}

	// LocalChainConfig contains the chain parameters to run a node on the Local test network.
	ProgpowLocalChainConfig = &ChainConfig{
		ChainID:     big.NewInt(1337),
		Progpow:     new(ProgpowConfig),
		GenesisHash: ProgpowLocalGenesisHash,
	}

	Blake3PowLocalChainConfig = &ChainConfig{
		ChainID:     big.NewInt(1337),
		Blake3Pow:   new(Blake3powConfig),
		GenesisHash: Blake3PowLocalGenesisHash,
	}

	// AllProgpowProtocolChanges contains every protocol change introduced
	// and accepted by the Quai core developers into the Progpow consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllProgpowProtocolChanges = &ChainConfig{big.NewInt(1337), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Hash{}}

	TestChainConfig = &ChainConfig{big.NewInt(1), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Hash{}}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	ColosseumGasCeil        uint64 = 160000000
	GardenGasCeil           uint64 = 160000000
	OrchardGasCeil          uint64 = 50000000
	LighthouseGasCeil       uint64 = 160000000
	LocalGasCeil            uint64 = 20000000
	DifficultyBoundDivisor         = big.NewInt(2048)  // The bound divisor of the difficulty, used in the update calculations.
	ZoneMinDifficulty              = big.NewInt(1000)  // The minimum difficulty in a zone. Prime & regions should be multiples of this value
	MinimumDifficulty              = ZoneMinDifficulty // The minimum that the difficulty may ever be.
	GenesisDifficulty              = ZoneMinDifficulty // Difficulty of the Genesis block.
	DurationLimit                  = big.NewInt(12)    // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	GardenDurationLimit            = big.NewInt(7)     // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	OrchardDurationLimit           = big.NewInt(12)    // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	LighthouseDurationLimit        = big.NewInt(7)     // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	LocalDurationLimit             = big.NewInt(2)     // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	TimeFactor                     = big.NewInt(7)
	PrimeEntropyTarget             = big.NewInt(441) // This is TimeFactor*TimeFactor*common.NumZonesInRegion*common.NumRegionsInPrime
	RegionEntropyTarget            = big.NewInt(21)  // This is TimeFactor*common.NumZonesInRegion
)
View Source
var ColosseumBootnodes = []string{
	"enode://aa76ab25bd9657efc8371103649ad9fc099388f1b303b18ab9b5fbdd43c8bae1e039357eb6a5a3aa86679f58ed0231c88bd207393448a7226d63fdc4651698cb@35.202.3.128",
	"enode://7a80da93d6ba5299fccf4dc195c0a9efaee5ef3ef9ae00c7ae4db72f10cd26750b7acaf956a381f3101860b58c931b56a4524051440382f1be5e33dc247a9b52@35.184.84.143",
	"enode://1ba881701345af5491ec9ced31d2c325bdd296219015856109e8405bfa51665c0dc91b85a93541ba2ae6294d0dee4ef9c8cab7364594234447b30237631e90c6@35.224.101.46",
}

ColosseumBootnodes are the enode URLs of the P2P bootstrap nodes running on the Colosseum test network.

View Source
var GardenBootnodes = []string{
	"enode://f353567741755a4b35afb4641618b34c7e3c1666b49c9e519e8336c124ba8c2c556f00e9edcd87599994e9674ebdea3503a5ff1948a257c1540fe9f8c0fedf62@35.231.138.241",
	"enode://aa3d4daa8ea958c8a4fe3c56a7c5c0509754eec9b2e4eb45ac5fe9eb16bea442da0b50a0ac09e5fdf7711eb6b64df76dcd22e48d69f2f938d19fc60b9a8fd579@34.118.24.175",
	"enode://13ed279b8013b61ef41466d4f07679fe17c407af4f6ae09b34042c72635eef314e9020f732a96a739abaa88f51108b76698f6b7335397be99418c371e5c3bcce@34.68.104.77",
}

GardenBootnodes are the enode URLs of the P2P bootstrap nodes running on the Garden test network.

View Source
var LighthouseBootnodes = []string{
	"enode://ee89c22bff79d040fcf3dbaea3bcbe429e68b0ca9e32671027554e96aea3f132f6abed8cf5be514c50b76cf2cab96c7d9064a93f0bbd0903f26df4be01ce0e6a@35.196.124.28",
	"enode://b39cf3080c8c9165bf0b50a7f6c8ff5a3568649b0c57ae786f630a054722fccfec7e3232594eb37a62a04e7c310a4d4e899ea42c0bd5a5043a248510715e2af9@35.187.55.110",
	"enode://ce3daf05c462b36bc1a6261b8edb0cd72bf041c1f8fb59100d6a09dc3415d1f136cc8768b12129db73c48085c8e01d7a606be447d3f681f405ab427641599235@34.92.50.205",
}

LighthouseBootnodes are the enode URLs of the P2P bootstrap nodes running on the Lighthouse test network

View Source
var OrchardBootnodes = []string{
	"enode://f99403abcfbee37e3232e6bb4d7fda4d70496585a53857ccb4aff5ec32d0f27186b5097430d5806f20f2003f35cfec5d778598a3945d530f212b7072caab9b8a@35.188.17.207",
	"enode://142e48e3c36e5fe21aebf2941f2e63eb4720febe67de17dd84baf010e33c76275567ede53674007ab2848eec53022cd0cb94bcbea10960ae93edb5497c8caa2a@104.198.69.162",
	"enode://d6d27b273682f8abc7ffff04dc9006bd40f0a079a8ba24da351b714506bb82c1f106ff073fa04983345aef15c876c602209b48b37d8ee10dad581fd1d9db9263@34.23.150.43",
}

OrchardBootnodes are the enode URLs of the P2P bootstrap nodes running on the Orchard test network

View Source
var V5Bootnodes = []string{}

Functions

func ArchiveVersion

func ArchiveVersion(gitCommit string) string

ArchiveVersion holds the textual version string used for Quai archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func KnownDNSNetwork

func KnownDNSNetwork(genesis common.Hash, protocol string) string

KnownDNSNetwork returns the address of a public DNS-based node list for the given genesis hash and protocol.

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

Types

type Blake3powConfig

type Blake3powConfig struct{}

Blake3powConfig is the consensus engine configs for proof-of-work based sealing.

func (*Blake3powConfig) String

func (c *Blake3powConfig) String() string

String implements the stringer interface, returning the consensus engine details.

type CachedVersion

type CachedVersion struct {
	// contains filtered or unexported fields
}

Version contains software version data parsed from the VERSION file

var Version CachedVersion

func (*CachedVersion) Full

func (v *CachedVersion) Full() string

Full loads the cached full version string, or reads it from a file

func (*CachedVersion) Major

func (v *CachedVersion) Major() int

Major loads the cached major version, or reads it from a file

func (*CachedVersion) Meta

func (v *CachedVersion) Meta() string

Meta loads the cached version metadata, or reads it from a file Metadata may be empty if no metadata was provided

func (*CachedVersion) Minor

func (v *CachedVersion) Minor() int

Minor loads the cached minor version, or reads it from a file

func (*CachedVersion) Patch

func (v *CachedVersion) Patch() int

Patch loads the cached patch version, or reads it from a file

func (*CachedVersion) Short

func (v *CachedVersion) Short() string

Full loads the cached full version string, or reads it from a file

type ChainConfig

type ChainConfig struct {
	ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection
	// Various consensus engines
	ConsensusEngine string
	Blake3Pow       *Blake3powConfig `json:"blake3pow,omitempty"`
	Progpow         *ProgpowConfig   `json:"progpow,omitempty"`
	GenesisHash     common.Hash
}

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 (*ChainConfig) Rules

func (c *ChainConfig) Rules(num *big.Int) Rules

Rules ensures c's ChainID is not nil.

func (*ChainConfig) String

func (c *ChainConfig) String() string

String implements the fmt.Stringer interface.

type ConfigCompatError

type ConfigCompatError struct {
	What string
	// block numbers of the stored and new configurations
	StoredConfig, NewConfig *big.Int
	// the block number to which the local chain must be rewound to correct the error
	RewindTo uint64
}

ConfigCompatError is raised if the locally-stored blockchain is initialised with a ChainConfig that would alter the past.

func (*ConfigCompatError) Error

func (err *ConfigCompatError) Error() string

type ProgpowConfig

type ProgpowConfig struct{}

ProgpowConfig is the consensus engine configs for proof-of-work based sealing.

func (*ProgpowConfig) String

func (c *ProgpowConfig) String() string

String implements the stringer interface, returning the consensus engine details.

type Rules

type Rules struct {
	ChainID *big.Int
}

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.

Jump to

Keyboard shortcuts

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