params

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: GPL-3.0, LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Planck = 1
	Shor   = 1e9
	Quanta = 1e18
)

These are the multipliers for qrl denominations. Example: To get the planck value of an amount in 'shor', use

new(big.Int).Mul(value, big.NewInt(params.Shor))
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
)
View Source
const (
	GasLimitBoundDivisor uint64 = 1024     // The bound divisor of the gas limit, used in update calculations.
	MinGasLimit          uint64 = 5000     // Minimum the gas limit may ever be.
	MaxGasLimit          uint64 = 20000000 // Maximum the gas limit
	GenesisGasLimit      uint64 = 4712388  // Gas limit of the Genesis block.

	MaximumExtraDataSize  uint64 = 32    // Maximum size extra data may be after Genesis.
	SloadGas              uint64 = 50    // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
	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.

	Keccak256Gas     uint64 = 30 // Once per KECCAK256 operation.
	Keccak256WordGas uint64 = 6  // Once per word of the KECCAK256 operation's data.
	InitCodeWordGas  uint64 = 2  // Once per word of the init code when creating a contract.

	SstoreSentryGasEIP2200            uint64 = 2300  // Minimum gas required to be present for an SSTORE call, not consumed
	SstoreSetGasEIP2200               uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero
	SstoreResetGasEIP2200             uint64 = 5000  // Once per SSTORE operation from clean non-zero to something else
	SstoreClearsScheduleRefundEIP2200 uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot

	ColdAccountAccessCostEIP2929 = uint64(2600) // COLD_ACCOUNT_ACCESS_COST
	ColdSloadCostEIP2929         = uint64(2100) // COLD_SLOAD_COST
	WarmStorageReadCostEIP2929   = uint64(100)  // WARM_STORAGE_READ_COST

	// In EIP-2200: SstoreResetGas was 5000.
	// In EIP-2929: SstoreResetGas was changed to '5000 - COLD_SLOAD_COST'.
	// In EIP-3529: SSTORE_CLEARS_SCHEDULE is defined as SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST
	// Which becomes: 5000 - 2100 + 1900 = 4800
	SstoreClearsScheduleRefundEIP3529 uint64 = SstoreResetGasEIP2200 - ColdSloadCostEIP2929 + TxAccessListStorageKeyGas

	JumpdestGas uint64 = 1 // Once per JUMPDEST operation.

	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.
	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
	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.

	TxDataNonZeroGasEIP2028   uint64 = 16   // Per byte of non zero data attached to a transaction after EIP 2028
	TxAccessListAddressGas    uint64 = 2400 // Per address specified in EIP 2930 access list
	TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in EIP 2930 access list

	// These have been changed during the course of the chain
	SloadGasEIP2200 uint64 = 800 // Cost of SLOAD

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

	DefaultBaseFeeChangeDenominator = 8            // Bounds the amount the base fee can change between blocks.
	DefaultElasticityMultiplier     = 2            // Bounds the maximum gas limit a block may have.
	InitialBaseFee                  = 100000000000 // Initial base fee.

	MaxCodeSize     = 24576           // Maximum bytecode to permit for a contract
	MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions

	// Precompiled contract gas prices
	DepositrootGas     uint64 = 3000 // Deposit root operation gas price
	Sha256BaseGas      uint64 = 60   // Base price for a SHA256 operation
	Sha256PerWordGas   uint64 = 12   // Per-word price for a SHA256 operation
	IdentityBaseGas    uint64 = 15   // Base price for a data copy operation
	IdentityPerWordGas uint64 = 3    // Per-work price for a data copy operation

	// The Refund Quotient is the cap on how much of the used gas can be refunded. Before EIP-3529,
	// up to half the consumed gas could be refunded. Redefined as 1/5th in EIP-3529
	RefundQuotient        uint64 = 2
	RefundQuotientEIP3529 uint64 = 5
)

Variables

View Source
var (
	MainnetGenesisHash = common.HexToHash("0x01bc5f152bbe334ee169a63069fd2700933c470b40192d177136ff70dbef9c7b")
	BetaNetGenesisHash = common.HexToHash("0x73c6974a471c34fc65ce4051a78642ca25a4feb0eaa6ef420588955a518a7a12")
	TestnetGenesisHash = common.HexToHash("0x6a7659906cc310bbef84a9a934f1f5cffdf5487e5f43addcf0386e40396eebe7")
)

TODO(now.youtrack.cloud/issue/TGZ-16) Genesis hashes to enforce below configs on.

View Source
var (
	// MainnetChainConfig is the chain parameters to run a node on the main network.
	MainnetChainConfig = &ChainConfig{
		ChainID: big.NewInt(1),
	}
	// TestnetChainConfig contains the chain parameters to run a node on the BetaNet test network.
	TestnetChainConfig = &ChainConfig{
		ChainID: big.NewInt(1337),
	}
	// BetaNetChainConfig contains the chain parameters to run a node on the BetaNet test network.
	BetaNetChainConfig = &ChainConfig{
		ChainID: big.NewInt(32382),
	}

	// AllBeaconProtocolChanges contains every protocol change (QIPs) introduced
	// and accepted by the QRL core developers into the Beacon consensus.
	AllBeaconProtocolChanges = &ChainConfig{
		ChainID: big.NewInt(1337),
	}

	AllDevChainProtocolChanges = &ChainConfig{
		ChainID:   big.NewInt(1337),
		IsDevMode: true,
	}

	// TestChainConfig contains every protocol change (QIPs) introduced
	// and accepted by the QRL core developers for testing proposes.
	TestChainConfig = &ChainConfig{
		ChainID: big.NewInt(1),
	}

	// NonActivatedConfig defines the chain configuration without activating
	// any protocol change (QIPs).
	NonActivatedConfig = &ChainConfig{
		ChainID: big.NewInt(1),
	}
	TestRules = TestChainConfig.Rules(new(big.Int), 0)
)
View Source
var BetaNetBootnodes = []string{}

BetaNetBootnodes are the qnode URLs of the P2P bootstrap nodes running on the BetaNet test network.

View Source
var MainnetBootnodes = []string{}

TODO(now.youtrack.cloud/issue/TGZ-14) MainnetBootnodes are the qnode URLs of the P2P bootstrap nodes running on the main QRL network.

View Source
var NetworkNames = map[string]string{
	MainnetChainConfig.ChainID.String(): "mainnet",
}

NetworkNames are user friendly names to use in the chain spec banner.

View Source
var TestnetBootnodes = []string{
	"qnode://a236febea3d7795166a80912a61b7d892ec5db37ce64f412cfe1a149b371ff98a797f25b2a121fabab50608e366c4c643eea9c26ee80707347a95e2a8409bab8@35.178.202.23:30303",
	"qnode://c787514869780bc361d1931e602344700366f9c5a741688da4cc5264a4058416260bdcc3c127a3259d099dca7ac3e49942608748c5d4f9a525a5809b3f7326dc@13.41.66.82:30303",
}
View Source
var V5Bootnodes = []string{}

TODO(now.youtrack.cloud/issue/TGZ-21)

Functions

func KnownDNSNetwork

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

TODO(now.youtrack.cloud/issue/TGZ-21) 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.

Types

type ChainConfig

type ChainConfig struct {
	ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection

	IsDevMode bool `json:"isDev,omitempty"`
}

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) BaseFeeChangeDenominator

func (c *ChainConfig) BaseFeeChangeDenominator() uint64

BaseFeeChangeDenominator bounds the amount the base fee can change between blocks.

func (*ChainConfig) CheckCompatible

func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time uint64) *ConfigCompatError

CheckCompatible checks whether scheduled fork transitions have been imported with a mismatching chain configuration.

func (*ChainConfig) CheckConfigForkOrder

func (c *ChainConfig) CheckConfigForkOrder() error

CheckConfigForkOrder checks that we don't "skip" any forks, gqrl isn't pluggable enough to guarantee that forks can be implemented in a different order than on official networks

func (*ChainConfig) Description

func (c *ChainConfig) Description() string

Description returns a human-readable description of ChainConfig.

func (*ChainConfig) ElasticityMultiplier

func (c *ChainConfig) ElasticityMultiplier() uint64

ElasticityMultiplier bounds the maximum gas limit an EIP-1559 block may have.

func (*ChainConfig) Rules

func (c *ChainConfig) Rules(num *big.Int, timestamp uint64) Rules

Rules ensures c's ChainID is not nil.

type ConfigCompatError

type ConfigCompatError struct {
	What string

	// block numbers of the stored and new configurations if block based forking
	StoredBlock, NewBlock *big.Int

	// timestamps of the stored and new configurations if time based forking
	StoredTime, NewTime *uint64

	// the block number to which the local chain must be rewound to correct the error
	RewindToBlock uint64

	// the timestamp to which the local chain must be rewound to correct the error
	RewindToTime 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