params

package
v0.12.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: GPL-3.0 Imports: 10 Imported by: 3

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 (
	ColosseumGenesisHash = common.HexToHash("0x937e935af7be23cee3a138dcc0e1a0ba1ccf2c9d085d144d4fb2e6fbd54fdd67")
	GardenGenesisHash    = common.HexToHash("0x8975f8760d317524559986d595058d4d66c05d62e0eda1d740cdee56a25788a5")
	OrchardGenesisHash   = common.HexToHash("0x5627aca8194b46ed071f92746ecf975542b12ce406905d715b4be8f044749956")
	LocalGenesisHash     = common.HexToHash("0x9e7149a4f5ff07675e0e7881f004cd0dc1f5a28bb9ba8c4de86794ba6fe80b60")
	GalenaGenesisHash    = common.HexToHash("0xe0a395a3fcd7ecbb28dd66eeceab2fb40db01a2bfbf9e5fbc5b93269104df19a")
)

Genesis hashes to enforce below configs on.

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

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

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

	// GalenaChainConfig contains the chain parameters to run a node on the Galena test network.
	GalenaChainConfig = &ChainConfig{
		ChainID:     big.NewInt(17000),
		Progpow:     new(ProgpowConfig),
		GenesisHash: GalenaGenesisHash,
	}

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

	// 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), new(ProgpowConfig), common.Hash{}}

	TestChainConfig = &ChainConfig{big.NewInt(1), new(ProgpowConfig), common.Hash{}}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	ColosseumGasCeil       uint64 = 50000000
	GardenGasCeil          uint64 = 17000000
	OrchardGasCeil         uint64 = 50000000
	GalenaGasCeil          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(10)    // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	GardenDurationLimit           = big.NewInt(3)     // 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.
	GalenaDurationLimit           = big.NewInt(12)    // 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)
)
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 GalenaBootnodes = []string{
	"enode://12fa0822887c7c8829c1d30e7aaf430587cc71827f5ab2028ee39acf02c113eb01a4c130258074d3c7868f68280f854036a8a51beb4df96af314f94c7f45966e@34.175.138.4",
	"enode://1dab5f7739dfd6fb037a676607fc86ecc76eff3906abaa8f8662e236eb01937b27db1309c89e0c3af807a64b491f401f52ff75daca49689c99cfe949c359623c@35.199.83.89",
	"enode://402a7cc416700f8717ff35416dfcb3c286921bc4261a9e8cc9948cfac9e3589c8db25fffcf7d6877ec0e7ad93c83e6bde93d4918923dfb9c24c1635a57c5aba2@34.64.122.86",
}

GalenaBootnodes are the enode URLs of the P2P bootstrap nodes running on the Galena test network

View Source
var GardenBootnodes = []string{
	"enode://f353567741755a4b35afb4641618b34c7e3c1666b49c9e519e8336c124ba8c2c556f00e9edcd87599994e9674ebdea3503a5ff1948a257c1540fe9f8c0fedf62@34.22.72.242",
	"enode://aa3d4daa8ea958c8a4fe3c56a7c5c0509754eec9b2e4eb45ac5fe9eb16bea442da0b50a0ac09e5fdf7711eb6b64df76dcd22e48d69f2f938d19fc60b9a8fd579@34.175.158.49",
	"enode://3ecc23f02242be9249ac8b3aa2217514151106c152aa34b92f4287551d85300f9708740cb28d5ee39df3aec08315d624d8311fffc4c5e7ea24bc7422fc801972@35.198.7.119",
	"enode://13ed279b8013b61ef41466d4f07679fe17c407af4f6ae09b34042c72635eef314e9020f732a96a739abaa88f51108b76698f6b7335397be99418c371e5c3bcce@34.29.49.205",
}

GardenBootnodes are the enode URLs of the P2P bootstrap nodes running on the Garden 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 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
	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