params

package
v0.6.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 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.
	MinGasLimit          uint64 = 15000000  // Minimum the gas limit may ever be.
	GenesisGasLimit      uint64 = 471238800 // 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.
	ETXBaseFeeMultiplier  uint64 = 2     // Multiplier for the base fee of ETXs.

	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("0x98e42a430780db6a01cf98ce6a199f45716b105df8bb9c003a0f09f5254b5768")
	GardenGenesisHash    = common.HexToHash("0x2b57b896bb0522a0b5e15fc68e0302eb3c514e47b06ab2a4de16c4bffd2ceeed")
	OrchardGenesisHash   = common.HexToHash("0x61e271714cd23808de7d1fa38d7965735ec8aafddbf3c00f985efede02022b6a")
	LocalGenesisHash     = common.HexToHash("0x4c35b1216decc6aa2431fa2d2a1c68f15d70f83a309041ed1bfef5ad6592a3d4")
	GalenaGenesisHash    = common.HexToHash("0x40f0fed9b91bbe258a0ce417262326ec3b85b68bfd722e09f4b0b3a424b46ddd")
)

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),
		Blake3pow:   new(Blake3powConfig),
		GenesisHash: ColosseumGenesisHash,
	}

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

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

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

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

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

	TestChainConfig = &ChainConfig{big.NewInt(1), new(Blake3powConfig), common.Hash{}}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	DifficultyBoundDivisor = big.NewInt(2048)   // The bound divisor of the difficulty, used in the update calculations.
	ZoneMinDifficulty      = big.NewInt(131072) // 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(3)      // 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://9dc1aea03908f3b12ecebd58e219a41b9d6245fa553252d30d494a31ed18553a2de0b00bd9ae79dade6b50e296152d05c4a43c1fc1d52f5f17a3b1d6646539b3@34.23.242.81",
	"enode://a03838cc0e6950e0f8ef4e3eeed70b1160a74a22ea2caf92c1bc7990aba8240e0659a0c6166fe56ed3ce4819e15edd2a6c786dcac6b645fc3231106e94e88254@35.227.19.217",
	"enode://cb98e824cc4a982017d3823fe4c6feec63f37895f21475b5048afafb5e8ca7d4fa8df2a9a36a5fdb928508f51409d2e325fc25591d20126248ac2422a93617fa@35.231.162.110",
}

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 Geth 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. See https://github.com/ethereum/discv4-dns-lists for more information.

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
	Blake3pow   *Blake3powConfig `json:"blake3pow,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 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