Documentation
¶
Index ¶
- Constants
- Variables
- func BlockInterval() uint64
- func CooldownPeriod() uint32
- func EpochLength() uint32
- func EvictionCheckInterval() uint32
- func HayabusaTP() uint32
- func HighStakingPeriod() uint32
- func IsOriginBlocked(origin Address) bool
- func LoadCorrectReceiptsRoots() map[string]string
- func LockConfig()
- func LowStakingPeriod() uint32
- func MediumStakingPeriod() uint32
- func MockBlocklist(list []string)
- func NewBlake2b() hash.Hash
- func SeederInterval() uint32
- func SetConfig(cfg Config)
- func ValidatorEvictionThreshold() uint32
- type Address
- type Bytes32
- type Config
- type ForkConfig
- type StorageSize
Constants ¶
const ( TxGas uint64 = 5000 ClauseGas uint64 = params.TxGas - TxGas ClauseGasContractCreation uint64 = params.TxGasContractCreation - TxGas MinGasLimit uint64 = 1000 * 1000 InitialGasLimit uint64 = 10 * 1000 * 1000 // InitialGasLimit gas limit value int genesis block. GasLimitBoundDivisor uint64 = 1024 // from ethereum GetBalanceGas uint64 = 400 // EIP158 gas table SloadGas uint64 = 200 // EIP158 gas table SstoreSetGas uint64 = params.SstoreSetGas SstoreResetGas uint64 = params.SstoreResetGas MaxTxWorkDelay uint32 = 30 // (unit: block) if tx delay exceeds this value, no energy can be exchanged. TolerableBlockPackingTime = 500 * time.Millisecond // the indicator to adjust target block gas limit MaxStateHistory = 65535 // max guaranteed state history allowed to be accessed in EVM, presented in block number GasTargetPercentage = 75 // percentage of the block gas limit to determine the gas target InitialBaseFee = 10_000_000_000_000 // 10^13 wei, 0.00001 VTHO BaseFeeChangeDenominator = 8 // determines the percentage change in the base fee per block based on network utilization MaxPosScore = 10000 // max total score after PoS fork )
NOTE: any changes to gas limit or block interval may affect how the txIndex and blockNumber are stored in logdb/sequence.go: - an increase in gas limit may require more bits for txIndex; - if block frequency is increased, blockNumber will increment faster, potentially exhausting the allocated bits sooner than expected.
Constants of block chain.
const ( // AddressLength length of address in bytes. AddressLength = common.AddressLength )
Variables ¶
var ( KeyExecutorAddress = BytesToBytes32([]byte("executor")) KeyRewardRatio = BytesToBytes32([]byte("reward-ratio")) KeyValidatorRewardPercentage = BytesToBytes32([]byte("validator-reward-percentage")) KeyLegacyTxBaseGasPrice = BytesToBytes32([]byte("base-gas-price")) // the legacy tx default gas price KeyProposerEndorsement = BytesToBytes32([]byte("proposer-endorsement")) KeyMaxBlockProposers = BytesToBytes32([]byte("max-block-proposers")) KeyCurveFactor = BytesToBytes32([]byte("curve-factor")) // curve factor to define VTHO issuance after PoS KeyDelegatorContractAddress = BytesToBytes32([]byte("delegator-contract-address")) // staker switches to control the pause of staker and stargate, last bit pauses the delegator contract, second-to-last bit pauses the staker contract KeyStakerSwitches = BytesToBytes32([]byte("staker-switches")) InitialMaxBlockProposers uint64 = 101 InitialRewardRatio = big.NewInt(3e17) // 30% InitialValidatorRewardPercentage = 30 // 30% InitialBaseGasPrice = big.NewInt(1e15) InitialProposerEndorsement = new(big.Int).Mul(big.NewInt(1e18), big.NewInt(25000000)) InitialCurveFactor = big.NewInt(76800) EnergyGrowthRate = big.NewInt(5000000000) // WEI THOR per token(VET) per second. about 0.000432 THOR per token per day. NumberOfBlocksPerYear = big.NewInt(8640 * 365) // number of blocks per year, non leap (365 days) )
Keys of governance params.
var NoFork = ForkConfig{ VIP191: math.MaxUint32, ETH_CONST: math.MaxUint32, BLOCKLIST: math.MaxUint32, ETH_IST: math.MaxUint32, VIP214: math.MaxUint32, FINALITY: math.MaxUint32, GALACTICA: math.MaxUint32, HAYABUSA: math.MaxUint32, }
NoFork a special config without any forks.
var SoloFork = ForkConfig{
VIP191: 0,
ETH_CONST: 0,
BLOCKLIST: 0,
ETH_IST: 0,
VIP214: 0,
FINALITY: 0,
GALACTICA: 1,
HAYABUSA: 1,
}
SoloFork is used to define the solo fork config.
Functions ¶
func EpochLength ¶ added in v2.4.0
func EpochLength() uint32
default value is 180 blocks, 30 minutes
func EvictionCheckInterval ¶ added in v2.4.0
func EvictionCheckInterval() uint32
default value is 3 days
func IsOriginBlocked ¶
IsOriginBlocked returns true if the address is in the blocklist
func LoadCorrectReceiptsRoots ¶
LoadCorrectReceiptsRoots load a map from block ID to correct receipts root.
func LockConfig ¶ added in v2.4.0
func LockConfig()
LockConfig locks the config, preventing any further changes. Required for mainnet and testnet.
func MediumStakingPeriod ¶ added in v2.4.0
func MediumStakingPeriod() uint32
default value is 15 days
func SetConfig ¶ added in v2.4.0
func SetConfig(cfg Config)
SetConfig sets the config. If the config is not set, the default values will be used. If the config is locked, will panic.
func ValidatorEvictionThreshold ¶ added in v2.4.0
func ValidatorEvictionThreshold() uint32
default value is 7 days
Types ¶
type Address ¶
Address address of account.
func BytesToAddress ¶
BytesToAddress converts bytes slice into address. If b is larger than address legnth, b will be cropped (from the left). If b is smaller than address length, b will be extended (from the left).
func CreateContractAddress ¶
CreateContractAddress to generate contract address according to tx id, clause index and contract creation count.
func MustParseAddress ¶
MustParseAddress convert string presented address into Address type, panic on error.
func ParseAddress ¶
ParseAddress convert string presented address into Address type.
func (Address) Hex ¶ added in v2.4.0
Hex returns an EIP55-compliant hex string representation of the address.
func (*Address) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Address) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Bytes32 ¶
type Bytes32 [32]byte
Bytes32 array of 32 bytes.
func BytesToBytes32 ¶
BytesToBytes32 converts bytes slice into Bytes32. If b is larger than Bytes32 legnth, b will be cropped (from the left). If b is smaller than Bytes32 length, b will be extended (from the left).
func MustParseBytes32 ¶
MustParseBytes32 convert string presented into Bytes32 type, panic on error.
func ParseBytes32 ¶
ParseBytes32 convert string presented into Bytes32 type
func (Bytes32) AbbrevString ¶
AbbrevString returns abbrev string presentation.
func (Bytes32) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Bytes32) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Config ¶ added in v2.4.0
type Config struct {
BlockInterval uint64 `json:"blockInterval"` // time interval between two consecutive blocks.
EpochLength uint32 `json:"epochLength"` // number of blocks per epoch, also the number of blocks between two checkpoints.
SeederInterval uint32 `json:"seederInterval"` // blocks between two scheduler seeder epochs.
ValidatorEvictionThreshold uint32 `json:"validatorEvictionThreshold"` // the number of blocks after which offline validator will be evicted from the leader group (7 days)
EvictionCheckInterval uint32 `json:"evictionCheckInterval"` // blocks between two eviction function executions
// staker parameters
LowStakingPeriod uint32 `json:"lowStakingPeriod"`
MediumStakingPeriod uint32 `json:"mediumStakingPeriod"`
HighStakingPeriod uint32 `json:"highStakingPeriod"`
CooldownPeriod uint32 `json:"cooldownPeriod"`
HayabusaTP *uint32 `json:"hayabusaTP"`
}
type ForkConfig ¶
type ForkConfig struct {
VIP191 uint32
ETH_CONST uint32
BLOCKLIST uint32
ETH_IST uint32
VIP214 uint32
FINALITY uint32
HAYABUSA uint32 // Start of the Hayabusa Transition Period - PoA is still active until the transition period is over and 2/3 of the MBP have entered the PoS queue
GALACTICA uint32
}
nolint: revive ForkConfig config for a fork.
func GetForkConfig ¶
func GetForkConfig(genesisID Bytes32) *ForkConfig
GetForkConfig get fork config for the given genesis ID. Only works for the well-known networks.Custom network will get nil.
func (*ForkConfig) String ¶
func (fc *ForkConfig) String() string
type StorageSize ¶ added in v2.1.2
type StorageSize uint64
StorageSize describes storage size in bytes.
func (StorageSize) String ¶ added in v2.1.2
func (ss StorageSize) String() string