params

package
v1.0.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package params contains configuration parameters for Kaia.

Source Files

Each file contains following parameters.

  • bootnodes.go : Provides boot nodes information for Mainnet and Kairos
  • computation_cost_params.go : Defines computation costs for each opcode
  • config.go : Defines various structs for different settings of a network. Also provides getters for those settings
  • denomination.go : Defines units of KAIA
  • gas_table.go : Organizes gas prices for different Kaia phases. Currently prices for Mainnet is defined
  • governance_params.go : Defines constants for governance and reward system. Also provides setters and getters for reward releated variables
  • network_params.go : Defines network parameters that need to be constant between clients. Only `BloomBitsBlocks` is defined at the moment
  • protocol_params.go : Defines fee schedule, total time limit and maximum computation cost
  • version.go : Defines release and version number. Also provides a getter for the version

Copyright 2024 The Kaia Authors This file is part of the Kaia library.

The Kaia library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Kaia library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Kaia library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	// Computation cost for opcodes
	ExtCodeHashComputationCost    = 1000
	Create2ComputationCost        = 10000
	StaticCallComputationCost     = 10000
	ReturnDataSizeComputationCost = 10
	ReturnDataCopyComputationCost = 40
	RevertComputationCost         = 0
	DelegateCallComputationCost   = 696
	StopComputationCost           = 0
	AddComputationCost            = 150
	MulComputationCost            = 200
	SubComputationCost            = 219
	DivComputationCost            = 404
	SdivComputationCost           = 739
	ModComputationCost            = 812
	SmodComputationCost           = 560
	AddmodComputationCost         = 3349
	MulmodComputationCost         = 4757
	ExpComputationCost            = 5000
	ShlComputationCost            = 1603
	ShrComputationCost            = 1346
	SarComputationCost            = 1815
	SignExtendComputationCost     = 481
	LtComputationCost             = 201
	GtComputationCost             = 264
	SltComputationCost            = 176
	SgtComputationCost            = 222
	EqComputationCost             = 220
	IszeroComputationCost         = 165
	AndComputationCost            = 288
	XorComputationCost            = 657
	OrComputationCost             = 160
	NotComputationCost            = 1289
	ByteComputationCost           = 589
	Sha3ComputationCost           = 2465
	AddressComputationCost        = 284
	BalanceComputationCost        = 1407
	OriginComputationCost         = 210
	CallerComputationCost         = 188
	CallValueComputationCost      = 149
	CallDataLoadComputationCost   = 596
	CallDataSizeComputationCost   = 194
	CallDataCopyComputationCost   = 100
	CodeSizeComputationCost       = 145
	CodeCopyComputationCost       = 898
	GasPriceComputationCost       = 131
	ExtCodeSizeComputationCost    = 1481
	ExtCodeCopyComputationCost    = 1000
	BlockHashComputationCost      = 500
	CoinbaseComputationCost       = 189
	TimestampComputationCost      = 265
	NumberComputationCost         = 202
	DifficultyComputationCost     = 180
	GasLimitComputationCost       = 166
	PopComputationCost            = 140
	MloadComputationCost          = 376
	MstoreComputationCost         = 288
	Mstore8ComputationCost        = 5142
	SloadComputationCost          = 835
	SstoreComputationCost         = 1548
	JumpComputationCost           = 253
	JumpiComputationCost          = 176
	PcComputationCost             = 147
	MsizeComputationCost          = 137
	GasComputationCost            = 230
	JumpDestComputationCost       = 10
	PushComputationCost           = 120
	Dup1ComputationCost           = 190
	Dup2ComputationCost           = 190
	Dup3ComputationCost           = 176
	Dup4ComputationCost           = 142
	Dup5ComputationCost           = 177
	Dup6ComputationCost           = 165
	Dup7ComputationCost           = 147
	Dup8ComputationCost           = 157
	Dup9ComputationCost           = 138
	Dup10ComputationCost          = 174
	Dup11ComputationCost          = 141
	Dup12ComputationCost          = 144
	Dup13ComputationCost          = 157
	Dup14ComputationCost          = 143
	Dup15ComputationCost          = 237
	Dup16ComputationCost          = 149
	Swap1ComputationCost          = 141
	Swap2ComputationCost          = 156
	Swap3ComputationCost          = 145
	Swap4ComputationCost          = 135
	Swap5ComputationCost          = 115
	Swap6ComputationCost          = 146
	Swap7ComputationCost          = 199
	Swap8ComputationCost          = 130
	Swap9ComputationCost          = 160
	Swap10ComputationCost         = 134
	Swap11ComputationCost         = 147
	Swap12ComputationCost         = 128
	Swap13ComputationCost         = 121
	Swap14ComputationCost         = 114
	Swap15ComputationCost         = 197
	Swap16ComputationCost         = 128
	Log0ComputationCost           = 100
	Log1ComputationCost           = 1000
	Log2ComputationCost           = 1000
	Log3ComputationCost           = 1000
	Log4ComputationCost           = 1000
	CreateComputationCost         = 2094
	CallComputationCost           = 5000
	CallCodeComputationCost       = 4000
	ReturnComputationCost         = 0
	SelfDestructComputationCost   = 0

	// Computation cost for precompiled contracts
	EcrecoverComputationCost                       = 113150
	Sha256PerWordComputationCost                   = 100
	Sha256BaseComputationCost                      = 1000
	Ripemd160PerWordComputationCost                = 10
	Ripemd160BaseComputationCost                   = 100
	IdentityPerWordComputationCost                 = 0
	IdentityBaseComputationCost                    = 0
	BigModExpPerGasComputationCost                 = 10
	BigModExpBaseComputationCost                   = 100
	Bn256AddComputationCost                        = 8000
	Bn256ScalarMulComputationCost                  = 100000
	Bn256ParingBaseComputationCost                 = 2000000
	Bn256ParingPerPointComputationCost             = 1000000
	BlobTxPointEvaluationPrecompileComputationCost = 2200000
	VMLogPerByteComputationCost                    = 0
	VMLogBaseComputationCost                       = 10
	FeePayerComputationCost                        = 10
	ValidateSenderPerSigComputationCost            = 180000
	ValidateSenderBaseComputationCost              = 10000

	// computation costs added at istanbulCompatible
	ChainIDComputationCost      = 120
	SelfBalanceComputationCost  = 374
	Blake2bBaseComputationCost  = 10000
	Blake2bScaleComputationCost = 10

	// computation cost added at londonCompatible
	BaseFeeComputationCost = 198

	// computation cost added at KoreCompatible
	RandomComputationCost = 1498

	// computation cost added at ShanghaiCompatible
	Push0ComputationCost = 80

	// computation cost added at CancunCompatible
	McopyComputationCost       = 250
	TloadComputationCost       = 220
	TstoreComputationCost      = 280
	BlobHashComptationCost     = 165
	BlobBaseFeeComputationCost = 120

	// opcode computation cost modification - istanbul
	AddmodComputationCostIstanbul = 1410
	MulmodComputationCostIstanbul = 1760
	ShlComputationCostIstanbul    = 478
	ShrComputationCostIstanbul    = 498
	SarComputationCostIstanbul    = 834
	XorComputationCostIstanbul    = 454
	NotComputationCostIstanbul    = 364

	// opcode computation cost codification - cancun
	SdivComputationCostCancun    = 360
	ModComputationCostCancun     = 320
	AddmodComputationCostCancun  = 360
	MulmodComputationCostCancun  = 700
	ExpComputationCostCancun     = 720
	Sha3ComputationCostCancun    = 560
	Mstore8ComputationCostCancun = 230

	SloadComputationCostCancun  = 2550
	SstoreComputationCostCancun = 2510
	Log1ComputationCostCancun   = 500
	Log2ComputationCostCancun   = 500
	Log3ComputationCostCancun   = 500
	Log4ComputationCostCancun   = 500

	OpcodeComputationCostLimit         = 100000000      // 100ms
	OpcodeComputationCostLimitCancun   = 150000000      // 150ms
	OpcodeComputationCostLimitInfinite = math.MaxUint64 // pass it to disable computation cost checks
)
View Source
const (
	VMLogToFile   = 0x1
	VMLogToStdout = 0x2
	VMLogToAll    = VMLogToFile | VMLogToStdout

	UpperGasLimit = uint64(999999999999)

	// Default max price for gas price oracle
	DefaultGPOMaxPrice = 500 * Gkei
)
View Source
const (
	Kei  = 1   // kei
	Gkei = 1e9 // gkei
	KAIA = 1e18
)

These are the multipliers for KAIA denominations. Example: To get the kei value of an amount in 'gkei', use

new(big.Int).Mul(value, big.NewInt(params.Gkei))
View Source
const (
	// Block reward will be separated by three pieces and distributed
	RewardSliceCount      = 3
	RewardKip82SliceCount = 2
	// GovernanceConfig is stored in a cache which has below capacity
	GovernanceCacheLimit    = 512
	GovernanceIdxCacheLimit = 1000
	// The prefix for governance cache
	GovernanceCachePrefix = "governance"

	CheckpointInterval       = 1024 // For Istanbul snapshot
	SupplyCheckpointInterval = 128  // for SupplyManager tracking native token supply
)
View Source
const (
	// Governance Key
	GovernanceMode int = iota
	GoverningNode
	Epoch
	Policy
	CommitteeSize
	UnitPrice
	MintingAmount
	Ratio
	UseGiniCoeff
	DeferredTxFee
	MinimumStake
	AddValidator
	RemoveValidator
	StakeUpdateInterval
	ProposerRefreshInterval
	ConstTxGasHumanReadable
	CliqueEpoch
	Timeout
	LowerBoundBaseFee
	UpperBoundBaseFee
	GasTarget
	MaxBlockGasUsedForBaseFee
	BaseFeeDenominator
	GovParamContract
	Kip82Ratio
	DeriveShaImpl
)
View Source
const (
	GovernanceMode_None = iota
	GovernanceMode_Single
	GovernanceMode_Ballot
)
View Source
const (
	// Proposer policy
	// At the moment this is duplicated in istanbul/config.go, not to make a cross reference
	// TODO-Klatn-Governance: Find a way to manage below constants at single location
	RoundRobin = iota
	Sticky
	WeightedRandom
)
View Source
const (
	CallValueTransferGas  uint64 = 9000  // Paid for CALL when the value transfer is non-zero.                  // G_callvalue
	CallNewAccountGas     uint64 = 25000 // Paid for CALL when the destination address didn't exist prior.      // G_newaccount
	TxGas                 uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. // G_transaction
	TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. // G_transaction + G_create
	TxDataZeroGas         uint64 = 4     // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. // G_txdatazero
	QuadCoeffDiv          uint64 = 512   // Divisor for the quadratic particle of the memory cost equation.
	SstoreSetGas          uint64 = 20000 // Once per SLOAD operation.                                           // G_sset
	LogDataGas            uint64 = 8     // Per byte in a LOG* operation's data.                                // G_logdata
	CallStipend           uint64 = 2300  // Free gas given at beginning of call.                                // G_callstipend
	Sha3Gas               uint64 = 30    // Once per SHA3 operation.                                                 // G_sha3
	Sha3WordGas           uint64 = 6     // Once per word of the SHA3 operation's data.                              // G_sha3word
	InitCodeWordGas       uint64 = 2     // Once per word of the init code when creating a contract.				 // G_InitCodeWord
	SstoreResetGas        uint64 = 5000  // Once per SSTORE operation if the zeroness changes from zero.             // G_sreset
	SstoreClearGas        uint64 = 5000  // Once per SSTORE operation if the zeroness doesn't change.                // G_sreset
	SstoreRefundGas       uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero.               // R_sclear

	// gasSStoreEIP2200
	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   // Paid per byte for a CREATE operation to succeed in placing code into state. // G_codedeposit
	ExpGas                uint64 = 10    // Once per EXP instruction
	LogGas                uint64 = 375   // Per LOG* operation.                                                          // G_log
	CopyGas               uint64 = 3     // Partial payment for COPY operations, multiplied by words copied, rounded up. // G_copy
	CreateGas             uint64 = 32000 // Once per CREATE operation & contract-creation transaction.               // G_create
	Create2Gas            uint64 = 32000 // Once per CREATE2 operation
	SelfdestructRefundGas uint64 = 24000 // Refunded following a selfdestruct operation.                                  // R_selfdestruct
	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. // G_memory
	LogTopicGas           uint64 = 375   // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas.   // G_logtopic
	TxDataNonZeroGas      uint64 = 68    // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. // G_txdatanonzero

	CallGas         uint64 = 700  // Static portion of gas for CALL-derivates after EIP 150 (Tangerine)
	ExtcodeSizeGas  uint64 = 700  // Cost of EXTCODESIZE after EIP 150 (Tangerine)
	SelfdestructGas uint64 = 5000 // Cost of SELFDESTRUCT post EIP 150 (Tangerine)

	// Istanbul version of BalanceGas, SloadGas, ExtcodeHash is added.
	BalanceGasEIP150             uint64 = 400 // Cost of BALANCE     before EIP 1884
	BalanceGasEIP1884            uint64 = 700 // Cost of BALANCE     after  EIP 1884 (part of Istanbul)
	SloadGasEIP150               uint64 = 200 // Cost of SLOAD       before EIP 1884
	SloadGasEIP1884              uint64 = 800 // Cost of SLOAD       after  EIP 1884 (part of Istanbul)
	SloadGasEIP2200              uint64 = 800 // Cost of SLOAD       after  EIP 2200 (part of Istanbul)
	ExtcodeHashGasConstantinople uint64 = 400 // Cost of EXTCODEHASH before EIP 1884
	ExtcodeHashGasEIP1884        uint64 = 700 // Cost of EXTCODEHASH after  EIP 1884 (part in Istanbul)

	// EXP has a dynamic portion depending on the size of the exponent
	// was set to 10 in Frontier, was raised to 50 during Eip158 (Spurious Dragon)
	ExpByte uint64 = 50

	// Extcodecopy has a dynamic AND a static cost. This represents only the
	// static portion of the gas. It was changed during EIP 150 (Tangerine)
	ExtcodeCopyBase uint64 = 700

	// CreateBySelfdestructGas is used when the refunded account is one that does
	// not exist. This logic is similar to call.
	// Introduced in Tangerine Whistle (Eip 150)
	CreateBySelfdestructGas uint64 = 25000

	// Fee for Service Chain
	// TODO-Kaia-ServiceChain The following parameters should be fixed.
	// TODO-Kaia-Governance The following parameters should be able to be modified by governance.
	TxChainDataAnchoringGas uint64 = 21000 // Per transaction anchoring chain data. NOTE: Not payable on data of calls between transactions. // G_transactionchaindataanchoring
	ChainDataAnchoringGas   uint64 = 100   // Per byte of anchoring chain data NOTE: Not payable on data of calls between transactions. // G_chaindataanchoring

	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

	Bn256AddGasByzantium               uint64 = 500    // Gas needed for an elliptic curve addition
	Bn256AddGasIstanbul                uint64 = 150    // Istanbul version of gas needed for an elliptic curve addition
	Bn256ScalarMulGasByzantium         uint64 = 40000  // Gas needed for an elliptic curve scalar multiplication
	Bn256ScalarMulGasIstanbul          uint64 = 6000   // Istanbul version of gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGasByzantium       uint64 = 100000 // Base price for an elliptic curve pairing check
	Bn256PairingBaseGasIstanbul        uint64 = 45000  // Istanbul version of base price for an elliptic curve pairing check
	Bn256PairingPerPointGasByzantium   uint64 = 80000  // Per-point price for an elliptic curve pairing check
	Bn256PairingPerPointGasIstanbul    uint64 = 34000  // Istanbul version of per-point price for an elliptic curve pairing check
	BlobTxPointEvaluationPrecompileGas uint64 = 50000  // Gas price for the point evaluation precompile.
	VMLogBaseGas                       uint64 = 100    // Base price for a VMLOG operation
	VMLogPerByteGas                    uint64 = 20     // Per-byte price for a VMLOG operation
	FeePayerGas                        uint64 = 300    // Gas needed for calculating the fee payer of the transaction in a smart contract.
	ValidateSenderGas                  uint64 = 5000   // Gas needed for validating the signature of a message.

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

	GasLimitBoundDivisor uint64 = 1024    // The bound divisor of the gas limit, used in update calculations.
	MinGasLimit          uint64 = 5000    // Minimum the gas limit may ever be.
	GenesisGasLimit      uint64 = 4712388 // Gas limit of the Genesis block.

	MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.

	EpochDuration   uint64 = 30000 // Duration between proof-of-work epochs.
	CallCreateDepth uint64 = 1024  // Maximum depth of call/create stack.
	StackLimit      uint64 = 1024  // Maximum size of VM stack allowed.

	// eip-3860: limit and meter initcode (Shanghai)
	MaxCodeSize     = 24576           // Maximum bytecode to permit for a contract
	MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions

	// istanbul BFT
	BFTMaximumExtraDataSize uint64 = 65 // Maximum size extra data may be after Genesis.

	// AccountKey
	// TODO-Kaia: Need to fix below values.
	TxAccountCreationGasDefault uint64 = 0
	TxValidationGasDefault      uint64 = 0
	TxAccountCreationGasPerKey  uint64 = 20000 // WARNING: With integer overflow in mind before changing this value.
	TxValidationGasPerKey       uint64 = 15000 // WARNING: With integer overflow in mind before changing this value.

	// Fee for new tx types
	// TODO-Kaia: Need to fix values
	TxGasAccountCreation       uint64 = 21000
	TxGasAccountUpdate         uint64 = 21000
	TxGasFeeDelegated          uint64 = 10000
	TxGasFeeDelegatedWithRatio uint64 = 15000
	TxGasCancel                uint64 = 21000

	// Network Id
	UnusedNetworkId              uint64 = 0
	AspenNetworkId               uint64 = 1000
	KairosNetworkId              uint64 = 1001
	MainnetNetworkId             uint64 = 8217
	ServiceChainDefaultNetworkId uint64 = 3000

	TxGasValueTransfer     uint64 = 21000
	TxGasContractExecution uint64 = 21000

	TxDataGas uint64 = 100

	TxAccessListAddressGas    uint64 = 2400 // Per address specified in EIP 2930 access list
	TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in EIP 2930 access list

	// ZeroBaseFee exists for supporting Ethereum compatible data structure.
	ZeroBaseFee uint64 = 0
)
View Source
const (
	DefaultBlockGenerationInterval  = int64(1) // unit: seconds
	DefaultBlockGenerationTimeLimit = 250 * time.Millisecond
)
View Source
const (
	ReleaseNum   = 0
	VersionMajor = 1 // Major version component of the current release
	VersionMinor = 0 // Minor version component of the current release
	VersionPatch = 3 // Patch version component of the current release
)
View Source
const (
	// BloomBitsBlocks is the number of blocks a single bloom bit section vector
	// contains.
	BloomBitsBlocks uint64 = 4096
)
View Source
const (
	PasswordLength = 16
)

Variables

View Source
var (
	MainnetGenesisHash      = common.HexToHash("0xc72e5293c3c3ba38ed8ae910f780e4caaa9fb95e79784f7ab74c3c262ea7137e") // mainnet genesis hash to enforce below configs on
	KairosGenesisHash       = common.HexToHash("0xe33ff05ceec2581ca9496f38a2bf9baad5d4eed629e896ccb33d1dc991bc4b4a") // Kairos genesis hash to enforce below configs on
	AuthorAddressForTesting = common.HexToAddress("0xc0ea08a2d404d3172d2add29a45be56da40e2949")
)

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(int64(MainnetNetworkId)),
		IstanbulCompatibleBlock:  big.NewInt(86816005),
		LondonCompatibleBlock:    big.NewInt(86816005),
		EthTxTypeCompatibleBlock: big.NewInt(86816005),
		MagmaCompatibleBlock:     big.NewInt(99841497),
		KoreCompatibleBlock:      big.NewInt(119750400),
		ShanghaiCompatibleBlock:  big.NewInt(135456000),
		CancunCompatibleBlock:    big.NewInt(147534000),
		KaiaCompatibleBlock:      big.NewInt(162900480),
		RandaoCompatibleBlock:    big.NewInt(147534000),
		RandaoRegistry: &RegistryConfig{
			Records: map[string]common.Address{
				"KIP113": common.HexToAddress("0x3e80e75975bdb8e04B800485DD28BebeC6d97679"),
			},
			Owner: common.HexToAddress("0x04992a2B7E7CE809d409adE32185D49A96AAa32d"),
		},
		Kip103CompatibleBlock: big.NewInt(119750400),
		Kip103ContractAddress: common.HexToAddress("0xD5ad6D61Dd87EdabE2332607C328f5cc96aeCB95"),
		Kip160CompatibleBlock: big.NewInt(162900480),
		Kip160ContractAddress: common.HexToAddress("0xa4df15717Da40077C0aD528296AdBBd046579Ee9"),
		DeriveShaImpl:         2,
		Governance: &GovernanceConfig{
			GoverningNode:  common.HexToAddress("0x52d41ca72af615a1ac3301b0a93efa222ecc7541"),
			GovernanceMode: "single",
			Reward: &RewardConfig{
				MintingAmount:          mintingAmount,
				Ratio:                  "34/54/12",
				UseGiniCoeff:           true,
				DeferredTxFee:          true,
				StakingUpdateInterval:  86400,
				ProposerUpdateInterval: 3600,
				MinimumStake:           big.NewInt(5000000),
			},
		},
		Istanbul: &IstanbulConfig{
			Epoch:          604800,
			ProposerPolicy: 2,
			SubGroupSize:   22,
		},
		UnitPrice: 25000000000,
	}

	// KairosChainConfig contains the chain parameters to run a node on the Kairos.
	KairosChainConfig = &ChainConfig{
		ChainID:                  big.NewInt(int64(KairosNetworkId)),
		IstanbulCompatibleBlock:  big.NewInt(75373312),
		LondonCompatibleBlock:    big.NewInt(80295291),
		EthTxTypeCompatibleBlock: big.NewInt(86513895),
		MagmaCompatibleBlock:     big.NewInt(98347376),
		KoreCompatibleBlock:      big.NewInt(111736800),
		ShanghaiCompatibleBlock:  big.NewInt(131608000),
		CancunCompatibleBlock:    big.NewInt(141367000),
		KaiaCompatibleBlock:      big.NewInt(156660000),

		RandaoCompatibleBlock: big.NewInt(141367000),
		RandaoRegistry: &RegistryConfig{
			Records: map[string]common.Address{
				"KIP113": common.HexToAddress("0x4BEed0651C46aE5a7CB3b7737345d2ee733789e6"),
			},
			Owner: common.HexToAddress("0x04992a2B7E7CE809d409adE32185D49A96AAa32d"),
		},
		Kip103CompatibleBlock: big.NewInt(119145600),
		Kip103ContractAddress: common.HexToAddress("0xD5ad6D61Dd87EdabE2332607C328f5cc96aeCB95"),
		Kip160CompatibleBlock: big.NewInt(156660000),
		Kip160ContractAddress: common.HexToAddress("0x3D478E73c9dBebB72332712D7265961B1868d193"),

		DeriveShaImpl: 2,
		Governance: &GovernanceConfig{
			GoverningNode:  common.HexToAddress("0x99fb17d324fa0e07f23b49d09028ac0919414db6"),
			GovernanceMode: "single",
			Reward: &RewardConfig{
				MintingAmount:          mintingAmount,
				Ratio:                  "34/54/12",
				UseGiniCoeff:           true,
				DeferredTxFee:          true,
				StakingUpdateInterval:  86400,
				ProposerUpdateInterval: 3600,
				MinimumStake:           big.NewInt(5000000),
			},
		},
		Istanbul: &IstanbulConfig{
			Epoch:          604800,
			ProposerPolicy: 2,
			SubGroupSize:   22,
		},
		UnitPrice: 25000000000,
	}

	// AllGxhashProtocolChanges contains every protocol change (GxIPs) introduced
	// and accepted by the Kaia developers into the Kaia consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllGxhashProtocolChanges = &ChainConfig{
		ChainID:  big.NewInt(0),
		Gxhash:   new(GxhashConfig),
		Clique:   nil,
		Istanbul: nil,
	}

	// AllCliqueProtocolChanges contains every protocol change (GxIPs) introduced
	// and accepted by the Kaia developers into the Clique consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllCliqueProtocolChanges = &ChainConfig{
		ChainID:  big.NewInt(0),
		Gxhash:   nil,
		Clique:   &CliqueConfig{Period: 0, Epoch: 30000},
		Istanbul: nil,
	}

	TestChainConfig = &ChainConfig{
		ChainID:       big.NewInt(1),
		Gxhash:        new(GxhashConfig),
		Clique:        nil,
		Istanbul:      nil,
		UnitPrice:     1,
		DeriveShaImpl: 0,
	}
	TestRules = TestChainConfig.Rules(new(big.Int))

	// istanbul BFT
	BFTTestChainConfig = &ChainConfig{
		ChainID:  big.NewInt(1),
		Gxhash:   new(GxhashConfig),
		Clique:   nil,
		Istanbul: nil,
	}
)
View Source
var (
	// Default Values: Constants used for getting default values for configuration
	DefaultGovernanceMode            = "none"
	DefaultGoverningNode             = "0x0000000000000000000000000000000000000000"
	DefaultGovParamContract          = "0x0000000000000000000000000000000000000000"
	DefaultEpoch                     = uint64(604800)
	DefaultProposerPolicy            = uint64(RoundRobin)
	DefaultSubGroupSize              = uint64(21)
	DefaultUnitPrice                 = uint64(250000000000)
	DefaultLowerBoundBaseFee         = uint64(25000000000)
	DefaultUpperBoundBaseFee         = uint64(750000000000)
	DefaultGasTarget                 = uint64(30000000)
	DefaultMaxBlockGasUsedForBaseFee = uint64(60000000)
	DefaultBaseFeeDenominator        = uint64(20)
	DefaultMintingAmount             = big.NewInt(0)
	DefaultRatio                     = "100/0/0"
	DefaultKip82Ratio                = "20/80"
	DefaultUseGiniCoeff              = false
	DefaultDeferredTxFee             = false
	DefaultMinimumStake              = big.NewInt(2000000)
	DefaultStakeUpdateInterval       = uint64(86400) // 1 day
	DefaultProposerRefreshInterval   = uint64(3600)  // 1 hour
	DefaultPeriod                    = uint64(1)
	DefaultDeriveShaImpl             = uint64(0) // Orig
)
View Source
var (
	// Dummy Randao fields to be used in a Randao-enabled Genesis block.
	ZeroRandomReveal = make([]byte, 96)
	ZeroMixHash      = make([]byte, 32)

	TxGasHumanReadable uint64 = 4000000000 // NOTE: HumanReadable related functions are inactivated now

	// TODO-Kaia Change the variables used in GXhash to more appropriate values for Kaia network
	BlockScoreBoundDivisor = big.NewInt(2048)   // The bound divisor of the blockscore, used in the update calculations.
	GenesisBlockScore      = big.NewInt(131072) // BlockScore of the Genesis block.
	MinimumBlockScore      = big.NewInt(131072) // The minimum that the blockscore may ever be.
	DurationLimit          = big.NewInt(13)     // The decision boundary on the blocktime duration used to determine whether blockscore should go up or not.
)
View Source
var (
	// Execution time limit for all txs in a block
	BlockGenerationTimeLimit = DefaultBlockGenerationTimeLimit

	// TODO-Kaia-Governance Change the following variables to governance items which requires consensus of CCN
	// Block generation interval in seconds. It should be equal or larger than 1
	BlockGenerationInterval = DefaultBlockGenerationInterval
)

Parameters for execution time limit These parameters will be re-assigned by init options

View Source
var KairosBootnodes = map[common.ConnType]bootnodesByTypes{
	common.CONSENSUSNODE: {
		[]string{},
	},
	common.PROXYNODE: {
		[]string{},
	},
	common.ENDPOINTNODE: {
		[]string{
			"kni://779d766628247ebda5f3e108e9303bd8efdb8eba9fd8d6c529e2614aec7207ebf6614fe7e61d0d99b75e8b23dd3a679b112fd0de7e4e71a7008f0718710da48f@ston45-kairos.node.kaia.io:32323?ntype=bn",
		},
	},
}

KairosBootnodes are the URLs of bootnodes running on the Kairos network.

View Source
var MainnetBootnodes = map[common.ConnType]bootnodesByTypes{
	common.CONSENSUSNODE: {
		[]string{},
	},
	common.PROXYNODE: {
		[]string{},
	},
	common.ENDPOINTNODE: {
		[]string{
			"kni://18b36118cce093673499fc6e9aa196f047fe17a0de35b6f2a76a4557802f6abf9f89aa5e7330e93c9014b714b9df6378393611efe39aec9d3d831d6aa9d617ae@ston65.node.kaia.io:32323?ntype=bn",
			"kni://63f1c96874da85140ecca3ce24875cb5ef28fa228bc3572e16f690db4a48fc8067502d2f6e8f0c66fb558276a5ada1e4906852c7ae42b0003e9f9f25d1e123b1@ston873.node.kaia.io:32323?ntype=bn",
			"kni://94cc15e2014b86584908707de55800c0a2ea8a24dc5550dcb507043e4cf18ff04f21dc86ed17757dc63b1fa85bb418b901e5e24e4197ad4bbb0d96cd9389ed98@ston106.node.kaia.io:32323?ntype=bn",
		},
	},
}

MainnetBootnodes are the URLs of bootnodes running on the Kaia main network.

View Source
var OpcodeComputationCostLimitOverride = uint64(0)

OpcodeComputationCostLimitOverride set by --opcode-computation-cost-limit. Overrides chain default settings above.

View Source
var TargetGasLimit = GenesisGasLimit // The artificial target
View Source
var VMLogTarget = 0x0

VMLogTarget sets the output target of vmlog. The values below can be OR'ed.

  • 0x0: no output (default)
  • 0x1: file (DATADIR/logs/vm.log)
  • 0x2: stdout (like logger.DEBUG)
View Source
var Version = func() string {
	v := fmt.Sprintf("v%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
	return v
}()

Version holds the textual version string.

Functions

func CalcProposerBlockNumber

func CalcProposerBlockNumber(blockNum uint64) uint64

CalcProposerBlockNumber returns number of block where list of proposers is updated for block blockNum

func CalcStakingBlockNumber

func CalcStakingBlockNumber(blockNum uint64) uint64

CalcStakingBlockNumber returns number of block which contains staking information required to make a new block with blockNum.

func GetMaximumExtraDataSize

func GetMaximumExtraDataSize() uint64

istanbul BFT

func IsCheckpointInterval

func IsCheckpointInterval(blockNum uint64) bool

func IsProposerUpdateInterval

func IsProposerUpdateInterval(blockNum uint64) (bool, uint64)

func IsStakingUpdateInterval

func IsStakingUpdateInterval(blockNum uint64) bool

func ProposerUpdateInterval

func ProposerUpdateInterval() uint64

func SetProposerUpdateInterval

func SetProposerUpdateInterval(num uint64)

func SetStakingUpdateInterval

func SetStakingUpdateInterval(num uint64)

func StakingUpdateInterval

func StakingUpdateInterval() uint64

func VersionWithCommit

func VersionWithCommit(gitCommit string) string

Types

type ChainConfig

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

	// "Compatible" means that it is EVM compatible(the opcode and precompiled contracts are the same as Ethereum EVM).
	// In other words, not all the hard fork items are included.
	IstanbulCompatibleBlock  *big.Int `json:"istanbulCompatibleBlock,omitempty"`  // IstanbulCompatibleBlock switch block (nil = no fork, 0 = already on istanbul)
	LondonCompatibleBlock    *big.Int `json:"londonCompatibleBlock,omitempty"`    // LondonCompatibleBlock switch block (nil = no fork, 0 = already on london)
	EthTxTypeCompatibleBlock *big.Int `json:"ethTxTypeCompatibleBlock,omitempty"` // EthTxTypeCompatibleBlock switch block (nil = no fork, 0 = already on ethTxType)
	MagmaCompatibleBlock     *big.Int `json:"magmaCompatibleBlock,omitempty"`     // MagmaCompatible switch block (nil = no fork, 0 already on Magma)
	KoreCompatibleBlock      *big.Int `json:"koreCompatibleBlock,omitempty"`      // KoreCompatible switch block (nil = no fork, 0 already on Kore)
	ShanghaiCompatibleBlock  *big.Int `json:"shanghaiCompatibleBlock,omitempty"`  // ShanghaiCompatible switch block (nil = no fork, 0 already on shanghai)
	CancunCompatibleBlock    *big.Int `json:"cancunCompatibleBlock,omitempty"`    // CancunCompatible switch block (nil = no fork, 0 already on Cancun)
	KaiaCompatibleBlock      *big.Int `json:"kaiaCompatibleBlock,omitempty"`      // KaiaCompatible switch block (nil = no fork, 0 already on Kaia)

	// Kip103 is a special purpose hardfork feature that can be executed only once
	// Both Kip103CompatibleBlock and Kip103ContractAddress should be specified to enable KIP103
	Kip103CompatibleBlock *big.Int       `json:"kip103CompatibleBlock,omitempty"` // Kip103Compatible activate block (nil = no fork)
	Kip103ContractAddress common.Address `json:"kip103ContractAddress,omitempty"` // Kip103 contract address already deployed on the network

	// Kip160 is an optional hardfork
	// Both Kip160CompatibleBlock and Kip160ContractAddress should be specified to enable KIP160
	Kip160CompatibleBlock *big.Int       `json:"kip160CompatibleBlock,omitempty"` // Kip160Compatible activate block (nil = no fork)
	Kip160ContractAddress common.Address `json:"kip160ContractAddress,omitempty"` // Kip160 contract address already deployed on the network

	// Randao is an optional hardfork
	// RandaoCompatibleBlock, RandaoRegistryRecords and RandaoRegistryOwner all must be specified to enable Randao
	RandaoCompatibleBlock *big.Int        `json:"randaoCompatibleBlock,omitempty"` // RandaoCompatible activate block (nil = no fork)
	RandaoRegistry        *RegistryConfig `json:"randaoRegistry,omitempty"`        // Registry initial states

	// Various consensus engines
	Gxhash   *GxhashConfig   `json:"gxhash,omitempty"` // (deprecated) not supported engine
	Clique   *CliqueConfig   `json:"clique,omitempty"`
	Istanbul *IstanbulConfig `json:"istanbul,omitempty"`

	UnitPrice     uint64            `json:"unitPrice"`
	DeriveShaImpl int               `json:"deriveShaImpl"`
	Governance    *GovernanceConfig `json:"governance"`
}

ChainConfig is the blockchain 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) CheckCompatible

func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height 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, geth isn't pluggable enough to guarantee that forks can be implemented in a different order than on official networks

func (*ChainConfig) Copy

func (c *ChainConfig) Copy() *ChainConfig

func (*ChainConfig) IsCancunForkEnabled

func (c *ChainConfig) IsCancunForkEnabled(num *big.Int) bool

IsCancunForkEnabled returns whether num is either equal to the cancun block or greater.

func (*ChainConfig) IsEthTxTypeForkEnabled

func (c *ChainConfig) IsEthTxTypeForkEnabled(num *big.Int) bool

IsEthTxTypeForkEnabled returns whether num is either equal to the ethTxType block or greater.

func (*ChainConfig) IsIstanbulForkEnabled

func (c *ChainConfig) IsIstanbulForkEnabled(num *big.Int) bool

IsIstanbulForkEnabled returns whether num is either equal to the istanbul block or greater.

func (*ChainConfig) IsKIP103ForkBlock

func (c *ChainConfig) IsKIP103ForkBlock(num *big.Int) bool

IsKIP103ForkBlock returns whether num is equal to the kip103 block.

func (*ChainConfig) IsKIP160ForkBlock

func (c *ChainConfig) IsKIP160ForkBlock(num *big.Int) bool

IsKIP160ForkBlock returns whether num is equal to the kip160 block.

func (*ChainConfig) IsKaiaForkBlockParent

func (c *ChainConfig) IsKaiaForkBlockParent(num *big.Int) bool

IsKaiaForkBlockParent returns whether num is equal to the kaia block.

func (*ChainConfig) IsKaiaForkEnabled

func (c *ChainConfig) IsKaiaForkEnabled(num *big.Int) bool

IsKaiaForkEnabled returns whether num is either equal to the kaia block or greater.

func (*ChainConfig) IsKoreForkEnabled

func (c *ChainConfig) IsKoreForkEnabled(num *big.Int) bool

IsKoreForkEnabled returns whether num is either equal to the kore block or greater.

func (*ChainConfig) IsLondonForkEnabled

func (c *ChainConfig) IsLondonForkEnabled(num *big.Int) bool

IsLondonForkEnabled returns whether num is either equal to the london block or greater.

func (*ChainConfig) IsMagmaForkEnabled

func (c *ChainConfig) IsMagmaForkEnabled(num *big.Int) bool

IsMagmaForkEnabled returns whether num is either equal to the magma block or greater.

func (*ChainConfig) IsRandaoForkBlock

func (c *ChainConfig) IsRandaoForkBlock(num *big.Int) bool

IsRandaoForkBlock returns whether num is equal to the randao block.

func (*ChainConfig) IsRandaoForkBlockParent

func (c *ChainConfig) IsRandaoForkBlockParent(num *big.Int) bool

IsRandaoForkBlockParent returns whether num is one block before the randao block.

func (*ChainConfig) IsRandaoForkEnabled

func (c *ChainConfig) IsRandaoForkEnabled(num *big.Int) bool

IsRandaoForkEnabled returns whether num is either equal to the randao block or greater.

func (*ChainConfig) IsShanghaiForkEnabled

func (c *ChainConfig) IsShanghaiForkEnabled(num *big.Int) bool

IsShanghaiForkEnabled returns whether num is either equal to the shanghai block or greater.

func (*ChainConfig) Rules

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

Rules ensures c's ChainID is not nil.

func (*ChainConfig) SetDefaults

func (c *ChainConfig) SetDefaults()

SetDefaults fills undefined chain config with default values so that nil pointer does not exist in the chain config

func (*ChainConfig) SetDefaultsForGenesis

func (c *ChainConfig) SetDefaultsForGenesis()

SetDefaultsForGenesis fills undefined chain config with default values. Only used for generating genesis. Empty values from genesis.json will be left out from genesis.

func (*ChainConfig) String

func (c *ChainConfig) String() string

String implements the fmt.Stringer interface.

type CliqueConfig

type CliqueConfig struct {
	Period uint64 `json:"period"` // Number of seconds between blocks to enforce
	Epoch  uint64 `json:"epoch"`  // Epoch length to reset votes and checkpoint
}

CliqueConfig is the consensus engine configs for proof-of-authority based sealing.

func GetDefaultCliqueConfig

func GetDefaultCliqueConfig() *CliqueConfig

func (*CliqueConfig) String

func (c *CliqueConfig) String() string

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

type CodeFormat

type CodeFormat uint8

CodeFormat is the version of the interpreter that smart contract uses

const (
	CodeFormatEVM CodeFormat = iota
	CodeFormatLast
)

Supporting CodeFormat CodeFormatLast should be equal or less than 16 because only the last 4 bits of CodeFormat are used for CodeInfo.

func (CodeFormat) String

func (t CodeFormat) String() string

func (CodeFormat) Validate

func (t CodeFormat) Validate() bool

type CodeInfo

type CodeInfo uint8

CodeInfo consists of 8 bits, and has information of the contract code. Originally, codeInfo only contains codeFormat information(interpreter version), but now it is divided into two parts. First four bit contains the deployment time (ex. 0x00(constantinople), 0x10(istanbul,...)), so it is called vmVersion. Last four bit contains the interpreter version (ex. 0x00(EVM), 0x01(EWASM)), so it is called codeFormat.

func NewCodeInfo

func NewCodeInfo(codeFormat CodeFormat, vmVersion VmVersion) CodeInfo

func NewCodeInfoWithRules

func NewCodeInfoWithRules(codeFormat CodeFormat, r Rules) CodeInfo

func (CodeInfo) GetCodeFormat

func (t CodeInfo) GetCodeFormat() CodeFormat

func (CodeInfo) GetVmVersion

func (t CodeInfo) GetVmVersion() VmVersion

func (CodeInfo) String

func (t CodeInfo) String() string

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 GovParamSet

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

GovParamSet is an immutable set of governance parameters with various convenience getters.

func NewGovParamSet

func NewGovParamSet() *GovParamSet

func NewGovParamSetBytesMap

func NewGovParamSetBytesMap(items map[string][]byte) (*GovParamSet, error)

func NewGovParamSetBytesMapTolerant

func NewGovParamSetBytesMapTolerant(items map[string][]byte) *GovParamSet

func NewGovParamSetChainConfig

func NewGovParamSetChainConfig(config *ChainConfig) (*GovParamSet, error)

func NewGovParamSetIntMap

func NewGovParamSetIntMap(items map[int]interface{}) (*GovParamSet, error)

func NewGovParamSetMerged

func NewGovParamSetMerged(base *GovParamSet, update *GovParamSet) *GovParamSet

Return a new GovParamSet that contains keys from both input sets. If a key belongs to both sets, the value from `update` is used.

func NewGovParamSetStrMap

func NewGovParamSetStrMap(items map[string]interface{}) (*GovParamSet, error)

func (*GovParamSet) BaseFeeDenominator

func (p *GovParamSet) BaseFeeDenominator() uint64

func (*GovParamSet) CommitteeSize

func (p *GovParamSet) CommitteeSize() uint64

func (*GovParamSet) DeferredTxFee

func (p *GovParamSet) DeferredTxFee() bool

func (*GovParamSet) DeriveShaImpl

func (p *GovParamSet) DeriveShaImpl() int

func (*GovParamSet) Epoch

func (p *GovParamSet) Epoch() uint64

func (*GovParamSet) GasTarget

func (p *GovParamSet) GasTarget() uint64

func (*GovParamSet) Get

func (p *GovParamSet) Get(key int) (interface{}, bool)

Returns a parameter value and a boolean indicating success.

func (*GovParamSet) GovParamContract

func (p *GovParamSet) GovParamContract() common.Address

func (*GovParamSet) GovernanceModeInt

func (p *GovParamSet) GovernanceModeInt() int

func (*GovParamSet) GovernanceModeStr

func (p *GovParamSet) GovernanceModeStr() string

func (*GovParamSet) GoverningNode

func (p *GovParamSet) GoverningNode() common.Address

func (*GovParamSet) IntMap

func (p *GovParamSet) IntMap() map[int]interface{}

func (*GovParamSet) Kip82Ratio

func (p *GovParamSet) Kip82Ratio() string

func (*GovParamSet) LowerBoundBaseFee

func (p *GovParamSet) LowerBoundBaseFee() uint64

func (*GovParamSet) MaxBlockGasUsedForBaseFee

func (p *GovParamSet) MaxBlockGasUsedForBaseFee() uint64

func (*GovParamSet) MinimumStakeBig

func (p *GovParamSet) MinimumStakeBig() *big.Int

func (*GovParamSet) MinimumStakeStr

func (p *GovParamSet) MinimumStakeStr() string

func (*GovParamSet) MintingAmountBig

func (p *GovParamSet) MintingAmountBig() *big.Int

func (*GovParamSet) MintingAmountStr

func (p *GovParamSet) MintingAmountStr() string

func (*GovParamSet) MustGet

func (p *GovParamSet) MustGet(key int) interface{}

Return a parameter value or return a nil if the key does not exist.

func (*GovParamSet) Policy

func (p *GovParamSet) Policy() uint64

func (*GovParamSet) ProposerRefreshInterval

func (p *GovParamSet) ProposerRefreshInterval() uint64

func (*GovParamSet) Ratio

func (p *GovParamSet) Ratio() string

func (*GovParamSet) StakeUpdateInterval

func (p *GovParamSet) StakeUpdateInterval() uint64

func (*GovParamSet) StrMap

func (p *GovParamSet) StrMap() map[string]interface{}

func (*GovParamSet) Timeout

func (p *GovParamSet) Timeout() uint64

func (*GovParamSet) ToChainConfig

func (p *GovParamSet) ToChainConfig() *ChainConfig

func (*GovParamSet) ToGovernanceConfig

func (p *GovParamSet) ToGovernanceConfig() *GovernanceConfig

func (*GovParamSet) ToIstanbulConfig

func (p *GovParamSet) ToIstanbulConfig() *IstanbulConfig

func (*GovParamSet) ToKIP71Config

func (p *GovParamSet) ToKIP71Config() *KIP71Config

func (*GovParamSet) ToRewardConfig

func (p *GovParamSet) ToRewardConfig() *RewardConfig

func (*GovParamSet) UnitPrice

func (p *GovParamSet) UnitPrice() uint64

func (*GovParamSet) UpperBoundBaseFee

func (p *GovParamSet) UpperBoundBaseFee() uint64

func (*GovParamSet) UseGiniCoeff

func (p *GovParamSet) UseGiniCoeff() bool

type GovernanceConfig

type GovernanceConfig struct {
	GoverningNode    common.Address `json:"governingNode"`
	GovernanceMode   string         `json:"governanceMode"`
	GovParamContract common.Address `json:"govParamContract"`
	Reward           *RewardConfig  `json:"reward,omitempty"`
	KIP71            *KIP71Config   `json:"kip71,omitempty"`
}

GovernanceConfig stores governance information for a network

func GetDefaultGovernanceConfig

func GetDefaultGovernanceConfig() *GovernanceConfig

func GetDefaultGovernanceConfigForGenesis

func GetDefaultGovernanceConfigForGenesis() *GovernanceConfig

Mainnet genesis config

func (*GovernanceConfig) DeferredTxFee

func (g *GovernanceConfig) DeferredTxFee() bool

type GxhashConfig

type GxhashConfig struct{}

GxhashConfig is the consensus engine configs for proof-of-work based sealing. Deprecated: Use IstanbulConfig or CliqueConfig.

func (*GxhashConfig) String

func (c *GxhashConfig) String() string

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

type IstanbulConfig

type IstanbulConfig struct {
	Epoch          uint64 `json:"epoch"`  // Epoch length to reset votes and checkpoint
	ProposerPolicy uint64 `json:"policy"` // The policy for proposer selection; 0: Round Robin, 1: Sticky, 2: Weighted Random
	SubGroupSize   uint64 `json:"sub"`
}

IstanbulConfig is the consensus engine configs for Istanbul based sealing.

func GetDefaultIstanbulConfig

func GetDefaultIstanbulConfig() *IstanbulConfig

func (*IstanbulConfig) String

func (c *IstanbulConfig) String() string

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

type KIP71Config

type KIP71Config struct {
	LowerBoundBaseFee         uint64 `json:"lowerboundbasefee"`         // Minimum base fee for dynamic gas price
	UpperBoundBaseFee         uint64 `json:"upperboundbasefee"`         // Maximum base fee for dynamic gas price
	GasTarget                 uint64 `json:"gastarget"`                 // Gauge parameter increasing or decreasing gas price
	MaxBlockGasUsedForBaseFee uint64 `json:"maxblockgasusedforbasefee"` // Maximum network and process capacity to allow in a block
	BaseFeeDenominator        uint64 `json:"basefeedenominator"`        // For normalizing effect of the rapid change like impulse gas used
}

Magma governance parameters

func GetDefaultKIP71Config

func GetDefaultKIP71Config() *KIP71Config

type RegistryConfig

type RegistryConfig struct {
	Records map[string]common.Address `json:"records"`
	Owner   common.Address            `json:"owner"`
}

RegistryConfig is the initial KIP-149 system contract registry states. It is installed at block (RandaoCompatibleBlock - 1). Initial states are not applied if RandaoCompatibleBlock is nil or 0. To install the initial states from the block 0, use the AllocRegistry to generate GenesisAlloc.

This struct only represents a special case of Registry state where: - there is only one record for each name - the activation of all records is zero - the names array is lexicographically sorted

type RewardConfig

type RewardConfig struct {
	MintingAmount          *big.Int `json:"mintingAmount"`
	Ratio                  string   `json:"ratio"`                  // Define how much portion of reward be distributed to CN/KIF/KEF
	Kip82Ratio             string   `json:"kip82ratio,omitempty"`   // Define how much portion of reward be distributed to proposer/stakers
	UseGiniCoeff           bool     `json:"useGiniCoeff"`           // Decide if Gini Coefficient will be used or not
	DeferredTxFee          bool     `json:"deferredTxFee"`          // Decide if TX fee will be handled instantly or handled later at block finalization
	StakingUpdateInterval  uint64   `json:"stakingUpdateInterval"`  // Interval when staking information is updated
	ProposerUpdateInterval uint64   `json:"proposerUpdateInterval"` // Interval when proposer information is updated
	MinimumStake           *big.Int `json:"minimumStake"`           // Minimum amount of kei to join CCO
}

RewardConfig stores information about the network's token economy

func GetDefaultRewardConfig

func GetDefaultRewardConfig() *RewardConfig

func GetDefaultRewardConfigForGenesis

func GetDefaultRewardConfigForGenesis() *RewardConfig

type Rules

type Rules struct {
	ChainID     *big.Int
	IsIstanbul  bool
	IsLondon    bool
	IsEthTxType bool
	IsMagma     bool
	IsKore      bool
	IsShanghai  bool
	IsCancun    bool
	IsKaia      bool
	IsRandao    bool
}

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.

type VmVersion

type VmVersion uint8

VmVersion contains the information of the contract deployment time (ex. 0x0(constantinople), 0x1(istanbul,...))

const (
	VmVersion0 VmVersion = iota // Deployed at Constantinople
	VmVersion1                  // Deployed at Istanbul, ...(later HFs would be added)
)

Supporting VmVersion

func (VmVersion) String

func (t VmVersion) String() string

Jump to

Keyboard shortcuts

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