params

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: GPL-3.0 Imports: 13 Imported by: 218

Documentation

Overview

Package params contains configuration parameters for Klaytn.

Source Files

Each file contains following parameters.

  • bootnodes.go : Provides boot nodes information for Cypress and Baobab
  • 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 KLAY
  • gas_table.go : Organizes gas prices for different Klaytn phases. Currently prices for Cypress 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

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
	ExpComputationCost            = 5000
	SignExtendComputationCost     = 481
	LtComputationCost             = 201
	GtComputationCost             = 264
	SltComputationCost            = 176
	SgtComputationCost            = 222
	EqComputationCost             = 220
	IszeroComputationCost         = 165
	AndComputationCost            = 288
	OrComputationCost             = 160
	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
	Push0ComputationCost          = 80
	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
	VMLogPerByteComputationCost         = 0
	VMLogBaseComputationCost            = 10
	FeePayerComputationCost             = 10
	ValidateSenderPerSigComputationCost = 180000
	ValidateSenderBaseComputationCost   = 10000

	// computation costs for opcode added at istanbulCompatible Protocol Upgrade
	ChainIDComputationCost      = 120
	SelfBalanceComputationCost  = 374
	Blake2bBaseComputationCost  = 10000
	Blake2bScaleComputationCost = 10

	// computation costs for opcode added at londonCompatible Protocol Upgrade
	BaseFeeComputationCost = 198

	// Opcode Computation Cost Modification
	AddmodComputationCost         = 3349
	AddmodComputationCostIstanbul = 1410
	MulmodComputationCost         = 4757
	MulmodComputationCostIstanbul = 1760
	NotComputationCost            = 1289
	NotComputationCostIstanbul    = 364
	ShlComputationCost            = 1603
	ShlComputationCostIstanbul    = 478
	ShrComputationCost            = 1346
	ShrComputationCostIstanbul    = 498
	SarComputationCost            = 1815
	SarComputationCostIstanbul    = 834
	XorComputationCost            = 657
	XorComputationCostIstanbul    = 454

	// computation costs for opcode added at koreCompatible Protocol Upgrade
	RandomComputationCost = 1498
)
View Source
const (
	VMLogToFile   = 0x1
	VMLogToStdout = 0x2
	VMLogToAll    = VMLogToFile | VMLogToStdout

	UpperGasLimit = uint64(999999999999)
)
View Source
const (
	Peb      = 1    // official notation 'peb'
	Kpeb     = 1e3  // official notation 'kpeb'
	Mpeb     = 1e6  // same
	Gpeb     = 1e9  // same
	Ston     = 1e9  // official notation 'ston'
	UKLAY    = 1e12 // official notation 'uKLAY'
	MiliKLAY = 1e15 // official notation 'mKLAY'
	KLAY     = 1e18 // same
	KKLAY    = 1e21 // official notation 'kKLAY'
	MKLAY    = 1e24 // same
	GKLAY    = 1e27 // same
)

These are the multipliers for KLAY denominations. Example: To get the peb value of an amount in 'ston', use

new(big.Int).Mul(value, big.NewInt(params.Ston))
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"
)
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-Klaytn-ServiceChain The following parameters should be fixed.
	// TODO-Klaytn-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
	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-Klaytn: 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-Klaytn: 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
	BaobabNetworkId              uint64 = 1001
	CypressNetworkId             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
	DefaultOpcodeComputationCostLimit = uint64(100000000)
)
View Source
const (
	ReleaseNum   = 0
	VersionMajor = 1  // Major version component of the current release
	VersionMinor = 11 // Minor version component of the current release
	VersionPatch = 0  // 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 (
	CypressGenesisHash      = common.HexToHash("0xc72e5293c3c3ba38ed8ae910f780e4caaa9fb95e79784f7ab74c3c262ea7137e") // cypress genesis hash to enforce below configs on
	BaobabGenesisHash       = common.HexToHash("0xe33ff05ceec2581ca9496f38a2bf9baad5d4eed629e896ccb33d1dc991bc4b4a") // baobab genesis hash to enforce below configs on
	AuthorAddressForTesting = common.HexToAddress("0xc0ea08a2d404d3172d2add29a45be56da40e2949")
)

Genesis hashes to enforce below configs on.

View Source
var (
	// CypressChainConfig is the chain parameters to run a node on the cypress main network.
	CypressChainConfig = &ChainConfig{
		ChainID:                  big.NewInt(int64(CypressNetworkId)),
		IstanbulCompatibleBlock:  big.NewInt(86816005),
		LondonCompatibleBlock:    big.NewInt(86816005),
		EthTxTypeCompatibleBlock: big.NewInt(86816005),
		MagmaCompatibleBlock:     big.NewInt(99841497),
		KoreCompatibleBlock:      big.NewInt(119750400),
		Kip103CompatibleBlock:    big.NewInt(119750400),
		ShanghaiCompatibleBlock:  nil,
		Kip103ContractAddress:    common.HexToAddress("0xD5ad6D61Dd87EdabE2332607C328f5cc96aeCB95"),
		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,
	}

	// BaobabChainConfig contains the chain parameters to run a node on the Baobab test network.
	BaobabChainConfig = &ChainConfig{
		ChainID:                  big.NewInt(int64(BaobabNetworkId)),
		IstanbulCompatibleBlock:  big.NewInt(75373312),
		LondonCompatibleBlock:    big.NewInt(80295291),
		EthTxTypeCompatibleBlock: big.NewInt(86513895),
		MagmaCompatibleBlock:     big.NewInt(98347376),
		KoreCompatibleBlock:      big.NewInt(111736800),
		Kip103CompatibleBlock:    big.NewInt(119145600),
		Kip103ContractAddress:    common.HexToAddress("0xD5ad6D61Dd87EdabE2332607C328f5cc96aeCB95"),
		ShanghaiCompatibleBlock:  big.NewInt(131608000),
		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 klaytn developers into the Klaytn 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 klaytn 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 (
	TxGasHumanReadable uint64 = 4000000000 // NOTE: HumanReadable related functions are inactivated now

	// TODO-Klaytn Change the variables used in GXhash to more appropriate values for Klaytn 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-Klaytn-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
	// Computation cost limit for a tx. For now, it is approximately 100 ms
	OpcodeComputationCostLimit = DefaultOpcodeComputationCostLimit
)

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

View Source
var BaobabBootnodes = map[common.ConnType]bootnodesByTypes{
	common.CONSENSUSNODE: {
		[]string{
			"kni://d8adb5a300d7ee0fcde4d6777362c1e0e03d208a2f3978d6d3993a2ada4a64af2580b97d4b4bf21201b1596cea761ecf53f196153bae8bbb0948b3c6397303b2@ston98.baobab.klaytn.net:32323?ntype=bn",
		},
	},
	common.ENDPOINTNODE: {
		[]string{
			"kni://779d766628247ebda5f3e108e9303bd8efdb8eba9fd8d6c529e2614aec7207ebf6614fe7e61d0d99b75e8b23dd3a679b112fd0de7e4e71a7008f0718710da48f@ston45.baobab.klaytn.net:32323?ntype=bn",
		},
	},
	common.PROXYNODE: {
		[]string{
			"kni://779d766628247ebda5f3e108e9303bd8efdb8eba9fd8d6c529e2614aec7207ebf6614fe7e61d0d99b75e8b23dd3a679b112fd0de7e4e71a7008f0718710da48f@ston45.baobab.klaytn.net:32323?ntype=bn",
		},
	},
}

BaobabBootnodes are the URLs of bootnodes running on the Baobab test network.

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

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

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

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

	// 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 added in v1.7.3

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 added in v1.9.0

func (c *ChainConfig) Copy() *ChainConfig

func (*ChainConfig) IsEthTxTypeForkEnabled added in v1.8.0

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

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

func (*ChainConfig) IsIstanbulForkEnabled added in v1.8.0

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

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

func (*ChainConfig) IsKIP103ForkBlock added in v1.10.2

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

IsKIP103ForkBlock returns whether num is equal to the kip103 block.

func (*ChainConfig) IsKoreForkEnabled added in v1.10.0

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

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

func (*ChainConfig) IsLondonForkEnabled added in v1.8.0

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

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

func (*ChainConfig) IsMagmaForkEnabled added in v1.9.0

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

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

func (*ChainConfig) IsShanghaiForkEnabled added in v1.11.0

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 added in v1.6.0

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 added in v1.10.0

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 added in v1.5.3

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 added in v1.7.0

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 added in v1.7.0

func NewCodeInfo(codeFormat CodeFormat, vmVersion VmVersion) CodeInfo

func NewCodeInfoWithRules added in v1.7.0

func NewCodeInfoWithRules(codeFormat CodeFormat, r Rules) CodeInfo

func (CodeInfo) GetCodeFormat added in v1.7.0

func (t CodeInfo) GetCodeFormat() CodeFormat

func (CodeInfo) GetVmVersion added in v1.7.0

func (t CodeInfo) GetVmVersion() VmVersion

func (CodeInfo) String added in v1.7.0

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 added in v1.9.0

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

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

func NewGovParamSet added in v1.9.0

func NewGovParamSet() *GovParamSet

func NewGovParamSetBytesMap added in v1.9.0

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

func NewGovParamSetBytesMapTolerant added in v1.10.2

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

func NewGovParamSetChainConfig added in v1.9.0

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

func NewGovParamSetIntMap added in v1.9.0

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

func NewGovParamSetMerged added in v1.9.0

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 added in v1.9.0

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

func (*GovParamSet) BaseFeeDenominator added in v1.10.0

func (p *GovParamSet) BaseFeeDenominator() uint64

func (*GovParamSet) CommitteeSize added in v1.9.0

func (p *GovParamSet) CommitteeSize() uint64

func (*GovParamSet) DeferredTxFee added in v1.9.0

func (p *GovParamSet) DeferredTxFee() bool

func (*GovParamSet) DeriveShaImpl added in v1.10.0

func (p *GovParamSet) DeriveShaImpl() int

func (*GovParamSet) Epoch added in v1.9.0

func (p *GovParamSet) Epoch() uint64

func (*GovParamSet) GasTarget added in v1.10.0

func (p *GovParamSet) GasTarget() uint64

func (*GovParamSet) Get added in v1.9.0

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

Returns a parameter value and a boolean indicating success.

func (*GovParamSet) GovParamContract added in v1.10.0

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

func (*GovParamSet) GovernanceModeInt added in v1.9.0

func (p *GovParamSet) GovernanceModeInt() int

func (*GovParamSet) GovernanceModeStr added in v1.9.0

func (p *GovParamSet) GovernanceModeStr() string

func (*GovParamSet) GoverningNode added in v1.9.0

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

func (*GovParamSet) IntMap added in v1.9.0

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

func (*GovParamSet) Kip82Ratio added in v1.10.0

func (p *GovParamSet) Kip82Ratio() string

func (*GovParamSet) LowerBoundBaseFee added in v1.10.0

func (p *GovParamSet) LowerBoundBaseFee() uint64

func (*GovParamSet) MaxBlockGasUsedForBaseFee added in v1.10.0

func (p *GovParamSet) MaxBlockGasUsedForBaseFee() uint64

func (*GovParamSet) MinimumStakeBig added in v1.9.0

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

func (*GovParamSet) MinimumStakeStr added in v1.9.0

func (p *GovParamSet) MinimumStakeStr() string

func (*GovParamSet) MintingAmountBig added in v1.9.0

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

func (*GovParamSet) MintingAmountStr added in v1.9.0

func (p *GovParamSet) MintingAmountStr() string

func (*GovParamSet) MustGet added in v1.9.0

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

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

func (*GovParamSet) Policy added in v1.9.0

func (p *GovParamSet) Policy() uint64

func (*GovParamSet) ProposerRefreshInterval added in v1.9.0

func (p *GovParamSet) ProposerRefreshInterval() uint64

func (*GovParamSet) Ratio added in v1.9.0

func (p *GovParamSet) Ratio() string

func (*GovParamSet) StakeUpdateInterval added in v1.9.0

func (p *GovParamSet) StakeUpdateInterval() uint64

func (*GovParamSet) StrMap added in v1.9.0

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

func (*GovParamSet) Timeout added in v1.9.0

func (p *GovParamSet) Timeout() uint64

func (*GovParamSet) ToChainConfig added in v1.10.0

func (p *GovParamSet) ToChainConfig() *ChainConfig

func (*GovParamSet) ToGovernanceConfig added in v1.10.0

func (p *GovParamSet) ToGovernanceConfig() *GovernanceConfig

func (*GovParamSet) ToIstanbulConfig added in v1.10.0

func (p *GovParamSet) ToIstanbulConfig() *IstanbulConfig

func (*GovParamSet) ToKIP71Config added in v1.10.0

func (p *GovParamSet) ToKIP71Config() *KIP71Config

func (*GovParamSet) ToRewardConfig added in v1.10.0

func (p *GovParamSet) ToRewardConfig() *RewardConfig

func (*GovParamSet) UnitPrice added in v1.9.0

func (p *GovParamSet) UnitPrice() uint64

func (*GovParamSet) UpperBoundBaseFee added in v1.10.0

func (p *GovParamSet) UpperBoundBaseFee() uint64

func (*GovParamSet) UseGiniCoeff added in v1.9.0

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 added in v1.5.3

func GetDefaultGovernanceConfig() *GovernanceConfig

func GetDefaultGovernanceConfigForGenesis added in v1.10.0

func GetDefaultGovernanceConfigForGenesis() *GovernanceConfig

cypress 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 added in v1.5.3

func GetDefaultIstanbulConfig() *IstanbulConfig

func (*IstanbulConfig) String

func (c *IstanbulConfig) String() string

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

type KIP71Config added in v1.9.0

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 added in v1.9.0

func GetDefaultKIP71Config() *KIP71Config

type RewardConfig

type RewardConfig struct {
	MintingAmount          *big.Int `json:"mintingAmount"`
	Ratio                  string   `json:"ratio"`                  // Define how much portion of reward be distributed to CN/KFF/KCF
	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 peb to join CCO
}

RewardConfig stores information about the network's token economy

func GetDefaultRewardConfig added in v1.5.3

func GetDefaultRewardConfig() *RewardConfig

func GetDefaultRewardConfigForGenesis added in v1.10.0

func GetDefaultRewardConfigForGenesis() *RewardConfig

type Rules

type Rules struct {
	ChainID     *big.Int
	IsIstanbul  bool
	IsLondon    bool
	IsEthTxType bool
	IsMagma     bool
	IsKore      bool
	IsShanghai  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 added in v1.7.0

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 added in v1.7.0

func (t VmVersion) String() string

Jump to

Keyboard shortcuts

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