Documentation
¶
Index ¶
- Constants
- Variables
- func MainnetSetCodeAuthorityBlackList() []string
- func MainnetSetCodeAuthorityBlackListRemoval() []string
- func SetGenesisTimestamp(ts int64)
- func Timestamp() int64
- func WithGenesisContext(ctx context.Context, g Genesis) context.Context
- type Account
- type Blockchain
- func (g *Blockchain) BlockGasLimitByHeight(height uint64) uint64
- func (g *Blockchain) IsAleutian(height uint64) bool
- func (g *Blockchain) IsBering(height uint64) bool
- func (g *Blockchain) IsCook(height uint64) bool
- func (g *Blockchain) IsDardanelles(height uint64) bool
- func (g *Blockchain) IsDaytona(height uint64) bool
- func (g *Blockchain) IsEaster(height uint64) bool
- func (g *Blockchain) IsFairbank(height uint64) bool
- func (g *Blockchain) IsFbkMigration(height uint64) bool
- func (g *Blockchain) IsGreenland(height uint64) bool
- func (g *Blockchain) IsHawaii(height uint64) bool
- func (g *Blockchain) IsIceland(height uint64) bool
- func (g *Blockchain) IsJutland(height uint64) bool
- func (g *Blockchain) IsKamchatka(height uint64) bool
- func (g *Blockchain) IsLordHowe(height uint64) bool
- func (g *Blockchain) IsMidway(height uint64) bool
- func (g *Blockchain) IsNewfoundland(height uint64) bool
- func (g *Blockchain) IsOkhotsk(height uint64) bool
- func (g *Blockchain) IsPacific(height uint64) bool
- func (g *Blockchain) IsPalau(height uint64) bool
- func (g *Blockchain) IsQuebec(height uint64) bool
- func (g *Blockchain) IsRedsea(height uint64) bool
- func (g *Blockchain) IsSumatra(height uint64) bool
- func (g *Blockchain) IsToBeEnabled(height uint64) bool
- func (g *Blockchain) IsTsunami(height uint64) bool
- func (g *Blockchain) IsUpernavik(height uint64) bool
- func (g *Blockchain) IsVanuatu(height uint64) bool
- func (g *Blockchain) IsWake(height uint64) bool
- func (g *Blockchain) IsXingu(height uint64) bool
- func (g *Blockchain) IsXinguBeta(height uint64) bool
- func (g *Blockchain) IsYap(height uint64) bool
- func (g *Blockchain) IsYapBeta(height uint64) bool
- func (g *Blockchain) IsZanzibar(height uint64) bool
- func (g *Blockchain) IsZanzibarBeta(height uint64) bool
- func (g *Blockchain) IsZanzibarGamma(height uint64) bool
- type BootstrapCandidate
- type Delegate
- type Genesis
- type GrantRecipient
- type Poll
- type RegistrationConsts
- type Rewarding
- func (r *Rewarding) AleutianEpochReward() *big.Int
- func (r *Rewarding) BlockReward() *big.Int
- func (r *Rewarding) DardanellesBlockReward() *big.Int
- func (r *Rewarding) EpochReward() *big.Int
- func (r *Rewarding) ExemptAddrsFromEpochReward() []address.Address
- func (r *Rewarding) FoundationBonus() *big.Int
- func (r *Rewarding) InitBalance() *big.Int
- func (r *Rewarding) WakeBlockReward() *big.Int
- type Staking
- type TestnetGrant
- type VoteWeightCalConsts
Constants ¶
const MainnetSetCodeAuthorityBlackListActiveHeight uint64 = 45404174
MainnetSetCodeAuthorityBlackListActiveHeight is the height from which MainNet enforces MainnetSetCodeAuthorityBlackList.
const MaxBalanceBits = 256
MaxBalanceBits is the width of the balance field in the Erigon secondary store, which holds it as a uint256. Every other path that moves balance conserves supply, so no account can approach the bound; a grant mints, so it is the one place a configured number can cross it. Past the bound the write panics in uint256.MustFromBig rather than failing, which takes the node down instead of rejecting the block -- hence the check here and the one in account.Protocol.CreatePreStates for the sum.
Variables ¶
var (
// Default contains the default genesis config
Default = defaultConfig()
)
Functions ¶
func MainnetSetCodeAuthorityBlackList ¶ added in v2.5.2
func MainnetSetCodeAuthorityBlackList() []string
MainnetSetCodeAuthorityBlackList returns the accounts MainNet refuses as the authority of an EIP-7702 authorization.
func MainnetSetCodeAuthorityBlackListRemoval ¶ added in v2.5.2
func MainnetSetCodeAuthorityBlackListRemoval() []string
MainnetSetCodeAuthorityBlackListRemoval returns the accounts of MainnetSetCodeAuthorityBlackList that MainNet stops refusing at Zanzibar.
func SetGenesisTimestamp ¶
func SetGenesisTimestamp(ts int64)
SetGenesisTimestamp sets the genesis timestamp
Types ¶
type Account ¶
type Account struct {
// InitBalanceMap is the address and initial balance mapping before the first block.
InitBalanceMap map[string]string `yaml:"initBalances"`
// ReplayDeployerWhitelist is the whitelist address for unprotected (pre-EIP155) transaction
ReplayDeployerWhitelist []string `yaml:"replayDeployerWhitelist"`
// TestnetGrants credits balance to a set of addresses at a given height
// on a chain that is already running, so a test network that has lost
// its delegate owner keys can fund a replacement set without restarting
// the chain. Rejected on mainnet, see ValidateTestnetGrants.
//
// A scheduled grant is consensus state: every node needs the same
// genesis file before the activation height, or it will fail the delta
// state digest check on that block and stop. Roll one out as a hard fork.
TestnetGrants []TestnetGrant `yaml:"testnetGrants"`
}
Account contains the configs for account protocol
func (*Account) GrantsAtHeight ¶ added in v2.5.0
GrantsAtHeight returns the grant scheduled at the given height in configured order, or nil when there is none. It returns an error rather than panicking on unparsable values -- ValidateTestnetGrants has already walked them, but this runs mid-block, where a panic takes the node down instead of rejecting a block.
func (*Account) InitBalances ¶
InitBalances returns the address that have initial balances and the corresponding amounts. The i-th amount is the i-th address' balance.
type Blockchain ¶
type Blockchain struct {
// Timestamp is the timestamp of the genesis block
Timestamp int64
// BlockGasLimit is the total gas limit could be consumed in a block
BlockGasLimit uint64 `yaml:"blockGasLimit"`
// TsunamiBlockGasLimit is the block gas limit starting Tsunami height (raised to 50M by default)
TsunamiBlockGasLimit uint64 `yaml:"tsunamiBlockGasLimit"`
// WakeBlockGasLimit is the block gas limit starting Wake height (reduced to 30M by default)
WakeBlockGasLimit uint64 `yaml:"wakeBlockGasLimit"`
// ActionGasLimit is the per action gas limit cap
ActionGasLimit uint64 `yaml:"actionGasLimit"`
// BlockInterval is the interval between two blocks
BlockInterval time.Duration `yaml:"blockInterval"`
// NumSubEpochs is the number of sub epochs in one epoch of block production
NumSubEpochs uint64 `yaml:"numSubEpochs"`
// DardanellesNumSubEpochs is the number of sub epochs starts from dardanelles height in one epoch of block production
DardanellesNumSubEpochs uint64 `yaml:"dardanellesNumSubEpochs"`
// WakeNumSubEpochs is the number of sub epochs starts from wake height in one epoch of block production
WakeNumSubEpochs uint64 `yaml:"wakeNumSubEpochs"`
// NumDelegates is the number of delegates that participate into one epoch of block production
NumDelegates uint64 `yaml:"numDelegates"`
// NumCandidateDelegates is the number of candidate delegates, who may be selected as a delegate via roll dpos
NumCandidateDelegates uint64 `yaml:"numCandidateDelegates"`
// TimeBasedRotation is the flag to enable rotating delegates' time slots on a block height
TimeBasedRotation bool `yaml:"timeBasedRotation"`
// MinBlocksForBlobRetention is the minimum number of blocks for blob retention
MinBlocksForBlobRetention uint64 `yaml:"minBlocksForBlobRetention"`
// PacificBlockHeight is the start height of using the logic of Pacific version
// TODO: PacificBlockHeight is not added into protobuf definition for backward compatibility
PacificBlockHeight uint64 `yaml:"pacificHeight"`
// AleutianBlockHeight is the start height of adding bloom filter of all events into block header
AleutianBlockHeight uint64 `yaml:"aleutianHeight"`
// BeringBlockHeight is the start height of evm upgrade
BeringBlockHeight uint64 `yaml:"beringHeight"`
// CookBlockHeight is the start height of native staking
CookBlockHeight uint64 `yaml:"cookHeight"`
// DardanellesBlockHeight is the start height of 5s block internal
DardanellesBlockHeight uint64 `yaml:"dardanellesHeight"`
// DaytonaBlockHeight is the height to fix low gas for read native staking contract
DaytonaBlockHeight uint64 `yaml:"daytonaBlockHeight"`
// EasterBlockHeight is the start height of probation for slashing
EasterBlockHeight uint64 `yaml:"easterHeight"`
// FbkMigrationBlockHeight is the start height for fairbank migration
FbkMigrationBlockHeight uint64 `yaml:"fbkMigrationHeight"`
// FairbankBlockHeight is the start height to switch to native staking V2
FairbankBlockHeight uint64 `yaml:"fairbankHeight"`
// GreenlandBlockHeight is the start height of storing latest 720 block meta and rewarding/staking bucket pool
GreenlandBlockHeight uint64 `yaml:"greenlandHeight"`
// HawaiiBlockHeight is the start height to
// 1. fix GetBlockHash in EVM
// 2. add revert message to log
// 3. fix change to same candidate in staking protocol
// 4. fix sorted map in StateDBAdapter
// 5. use pending nonce in EVM
HawaiiBlockHeight uint64 `yaml:"hawaiiHeight"`
// IcelandBlockHeight is the start height to support chainID opcode and EVM Istanbul
IcelandBlockHeight uint64 `yaml:"icelandHeight"`
// JutlandBlockHeight is the start height to
// 1. report more EVM error codes
// 2. enable the opCall fix
JutlandBlockHeight uint64 `yaml:"jutlandHeight"`
// KamchatkaBlockHeight is the start height to
// 1. fix EVM snapshot order
// 2. extend foundation bonus
KamchatkaBlockHeight uint64 `yaml:"kamchatkaHeight"`
// LordHoweBlockHeight is the start height to
// 1. recover the smart contracts affected by snapshot order
// 2. clear snapshots in Revert()
LordHoweBlockHeight uint64 `yaml:"lordHoweHeight"`
// MidwayBlockHeight is the start height to
// 1. allow correct and default ChainID
// 2. fix GetHashFunc in EVM
// 3. correct tx/log index for transaction receipt and EVM log
// 4. revert logs upon tx reversion in EVM
MidwayBlockHeight uint64 `yaml:"midwayHeight"`
// NewfoundlandBlockHeight is the start height to
// 1. use correct chainID
// 2. check legacy address
// 3. enable web3 staking transaction
NewfoundlandBlockHeight uint64 `yaml:"newfoundlandHeight"`
// OkhotskBlockHeight is the start height to
// 1. enable London EVM
// 2. create zero-nonce account
// 3. fix gas and nonce update
// 4. fix unproductive delegates in staking protocol
OkhotskBlockHeight uint64 `yaml:"okhotskHeight"`
// PalauBlockHeight is the start height to
// 1. enable rewarding action via web3
// 2. broadcast node info into the p2p network
PalauBlockHeight uint64 `yaml:"palauHeight"`
// QuebecBlockHeight is the start height to
// 1. enforce using correct chainID only
// 2. enable IIP-13 liquidity staking
// 3. valiate system action layout
QuebecBlockHeight uint64 `yaml:"quebecHeight"`
// RedseaBlockHeight is the start height to
// 1. upgrade go-ethereum to Bellatrix release
// 2. correct weighted votes for contract staking bucket
RedseaBlockHeight uint64 `yaml:"redseaHeight"`
// SumatraBlockHeight is the start height to enable Shanghai EVM
SumatraBlockHeight uint64 `yaml:"sumatraHeight"`
// TsunamiBlockHeight is the start height to
// 1. enable delegate endorsement
// 2. raise block gas limit to 50M
TsunamiBlockHeight uint64 `yaml:"tsunamiHeight"`
// 1. enable new NFT staking contract
// 2. migrate native staking bucket to NFT staking
// 3. delegate ownership transfer
// 4. send EVM transaction in general container format
// 5. generate transaction log for SelfDestruct() call in EVM
// 6. add address in claim reward action
UpernavikBlockHeight uint64 `yaml:"upernavikHeight"`
// VanuatuBlockHeight is the start height to
// 1. enable Cancun EVM
// 2. enable dynamic fee tx
VanuatuBlockHeight uint64 `yaml:"vanuatuHeight"`
// WakeBlockHeight is the start height to
// 1. enable 3s block interval
WakeBlockHeight uint64 `yaml:"wakeHeight"`
// XinguBlockHeight is the start height to
// 1. enable IIP-50 slash delegates
// 2. enable candidate BLS pubkey registration and update
// 3. enable contract staking buckets storage in trie
XinguBlockHeight uint64 `yaml:"xinguHeight"`
// XinguBetaBlockHeight is the start height to
// 1. slash candidate by operator
XinguBetaBlockHeight uint64 `yaml:"xinguBetaHeight"`
// YapBlockHeight is the start height of Yap hardfork
// 1. enable evm Prague upgrade
// 2. enable state candidate with identity
// 3. enable candidate exit queue
YapBlockHeight uint64 `yaml:"yapHeight"`
// YapBetaBlockHeight is the start height to enable slashing candidate by identity
YapBetaBlockHeight uint64 `yaml:"yapBetaHeight"`
// ZanzibarBlockHeight is the start height of IIP-59 protocol-native
// voter reward distribution and of the BLS proof-of-possession
// requirement at candidate register / update.
ZanzibarBlockHeight uint64 `yaml:"zanzibarHeight"`
// ZanzibarBetaBlockHeight is the start height of the corrections to
// what Zanzibar turned on. They need a height of their own because a
// chain that has already activated Zanzibar is running the
// pre-correction behaviour, and changing what Zanzibar selects would
// rewrite the semantics of blocks that chain has already committed.
//
// Set this EQUAL to ZanzibarBlockHeight on any chain that has not
// activated Zanzibar yet. A later height is only for a chain that has,
// where it is forced, and it costs something real: it schedules a
// window in which the chain knowingly runs behaviour already found to
// be wrong, and one of the corrections cannot take effect at all.
//
// RequireProfileForHermesMigration guards migrateHermesRewardOptIn,
// which runs in exactly one block -- the one at ZanzibarBlockHeight --
// and never again. If this height is later than that block, the guard
// reads false there, the migration runs unguarded, and no later height
// brings it back. On such a chain the flag is permanently inert.
ZanzibarBetaBlockHeight uint64 `yaml:"zanzibarBetaHeight"`
// ZanzibarGammaBlockHeight is the start height of the corrections found
// after Zanzibar Beta was scheduled. It exists for the same reason Beta
// does, one level up: a chain that has already activated Beta is running
// the pre-correction behaviour, and folding these into Beta would
// rewrite the semantics of blocks that chain has committed.
//
// Set this EQUAL to ZanzibarBetaBlockHeight on any chain that has not
// activated Beta yet. A later height is only for a chain that has, and
// it carries the same cost: a window in which the chain knowingly runs
// behaviour already found to be wrong.
//
// One such window is not avoidable. EnforceBLSPoP rides Zanzibar, and
// candidate register writes its self-stake bucket before it verifies the
// proof, so on a chain where Gamma trails Zanzibar a rejected proof
// leaves that bucket behind until Gamma activates.
ZanzibarGammaBlockHeight uint64 `yaml:"zanzibarGammaHeight"`
// ToBeEnabledBlockHeight is a fake height that acts as a gating factor for WIP features
// upon next release, change IsToBeEnabled() to IsNextHeight() for features to be released
ToBeEnabledBlockHeight uint64 `yaml:"toBeEnabledHeight"`
// PersistStakingPatchBlock is the height from which the candidate center's name/operator
// maps are persisted to (and read back from) the staking patch file
PersistStakingPatchBlock uint64 `yaml:"persistStakingPatchBlock"`
// FixAliasForNonStopHeight is the height at which the candidate center's name/operator maps
// are rebuilt, so a node that never restarted ends up with the same maps as one that did
FixAliasForNonStopHeight uint64 `yaml:"fixAliasForNonStopHeight"`
// AutoDepositContractAddress is the IoTeX bech32 address of the
// AutoDeposit contract from which IIP-59 reads per-voter compound
// preferences at epoch reward distribution time. Empty means
// compound routing is inactive and every voter share is credited
// to the voter's unclaimed balance for pull-claim.
AutoDepositContractAddress string `yaml:"autoDepositContractAddress"`
// SetCodeAuthorityBlackList lists the accounts that cannot be the authority
// of an EIP-7702 authorization on a chain other than MainNet, whose list
// is fixed in code. See SetCodeAuthorityBlackListParams.
SetCodeAuthorityBlackList []string `yaml:"setCodeAuthorityBlackList"`
// SetCodeAuthorityBlackListActiveHeight is the height from which
// SetCodeAuthorityBlackList is enforced (0 means always enforced)
SetCodeAuthorityBlackListActiveHeight uint64 `yaml:"setCodeAuthorityBlackListActiveHeight"`
// SetCodeAuthorityBlackListRemoval lists the accounts of
// SetCodeAuthorityBlackList that stop being blacklisted from
// ZanzibarBlockHeight onwards
SetCodeAuthorityBlackListRemoval []string `yaml:"setCodeAuthorityBlackListRemoval"`
}
Blockchain contains blockchain level configs
func (*Blockchain) BlockGasLimitByHeight ¶
func (g *Blockchain) BlockGasLimitByHeight(height uint64) uint64
BlockGasLimitByHeight returns the block gas limit by height
func (*Blockchain) IsAleutian ¶
func (g *Blockchain) IsAleutian(height uint64) bool
IsAleutian checks whether height is equal to or larger than aleutian height
func (*Blockchain) IsBering ¶
func (g *Blockchain) IsBering(height uint64) bool
IsBering checks whether height is equal to or larger than bering height
func (*Blockchain) IsCook ¶
func (g *Blockchain) IsCook(height uint64) bool
IsCook checks whether height is equal to or larger than cook height
func (*Blockchain) IsDardanelles ¶
func (g *Blockchain) IsDardanelles(height uint64) bool
IsDardanelles checks whether height is equal to or larger than dardanelles height
func (*Blockchain) IsDaytona ¶
func (g *Blockchain) IsDaytona(height uint64) bool
IsDaytona checks whether height is equal to or larger than daytona height
func (*Blockchain) IsEaster ¶
func (g *Blockchain) IsEaster(height uint64) bool
IsEaster checks whether height is equal to or larger than easter height
func (*Blockchain) IsFairbank ¶
func (g *Blockchain) IsFairbank(height uint64) bool
IsFairbank checks whether height is equal to or larger than fairbank height
func (*Blockchain) IsFbkMigration ¶
func (g *Blockchain) IsFbkMigration(height uint64) bool
IsFbkMigration checks whether height is equal to or larger than fbk migration height
func (*Blockchain) IsGreenland ¶
func (g *Blockchain) IsGreenland(height uint64) bool
IsGreenland checks whether height is equal to or larger than greenland height
func (*Blockchain) IsHawaii ¶
func (g *Blockchain) IsHawaii(height uint64) bool
IsHawaii checks whether height is equal to or larger than hawaii height
func (*Blockchain) IsIceland ¶
func (g *Blockchain) IsIceland(height uint64) bool
IsIceland checks whether height is equal to or larger than iceland height
func (*Blockchain) IsJutland ¶
func (g *Blockchain) IsJutland(height uint64) bool
IsJutland checks whether height is equal to or larger than jutland height
func (*Blockchain) IsKamchatka ¶
func (g *Blockchain) IsKamchatka(height uint64) bool
IsKamchatka checks whether height is equal to or larger than kamchatka height
func (*Blockchain) IsLordHowe ¶
func (g *Blockchain) IsLordHowe(height uint64) bool
IsLordHowe checks whether height is equal to or larger than lordHowe height
func (*Blockchain) IsMidway ¶
func (g *Blockchain) IsMidway(height uint64) bool
IsMidway checks whether height is equal to or larger than midway height
func (*Blockchain) IsNewfoundland ¶
func (g *Blockchain) IsNewfoundland(height uint64) bool
IsNewfoundland checks whether height is equal to or larger than newfoundland height
func (*Blockchain) IsOkhotsk ¶
func (g *Blockchain) IsOkhotsk(height uint64) bool
IsOkhotsk checks whether height is equal to or larger than okhotsk height
func (*Blockchain) IsPacific ¶
func (g *Blockchain) IsPacific(height uint64) bool
IsPacific checks whether height is equal to or larger than pacific height
func (*Blockchain) IsPalau ¶
func (g *Blockchain) IsPalau(height uint64) bool
IsPalau checks whether height is equal to or larger than palau height
func (*Blockchain) IsQuebec ¶
func (g *Blockchain) IsQuebec(height uint64) bool
IsQuebec checks whether height is equal to or larger than quebec height
func (*Blockchain) IsRedsea ¶
func (g *Blockchain) IsRedsea(height uint64) bool
IsRedsea checks whether height is equal to or larger than redsea height
func (*Blockchain) IsSumatra ¶
func (g *Blockchain) IsSumatra(height uint64) bool
IsSumatra checks whether height is equal to or larger than sumatra height
func (*Blockchain) IsToBeEnabled ¶
func (g *Blockchain) IsToBeEnabled(height uint64) bool
IsToBeEnabled checks whether height is equal to or larger than toBeEnabled height
func (*Blockchain) IsTsunami ¶
func (g *Blockchain) IsTsunami(height uint64) bool
IsTsunami checks whether height is equal to or larger than tsunami height
func (*Blockchain) IsUpernavik ¶
func (g *Blockchain) IsUpernavik(height uint64) bool
IsUpernavik checks whether height is equal to or larger than upernavik height
func (*Blockchain) IsVanuatu ¶
func (g *Blockchain) IsVanuatu(height uint64) bool
IsVanuatu checks whether height is equal to or larger than vanuatu height
func (*Blockchain) IsWake ¶ added in v2.2.0
func (g *Blockchain) IsWake(height uint64) bool
IsWake checks whether height is equal to or larger than wake height
func (*Blockchain) IsXingu ¶ added in v2.3.0
func (g *Blockchain) IsXingu(height uint64) bool
IsXingu checks whether height is equal to or larger than xingu height
func (*Blockchain) IsXinguBeta ¶ added in v2.3.0
func (g *Blockchain) IsXinguBeta(height uint64) bool
IsXinguBeta checks whether height is equal to or larger than xingu beta height
func (*Blockchain) IsYap ¶ added in v2.4.0
func (g *Blockchain) IsYap(height uint64) bool
IsYap checks whether height is equal to or larger than yap height
func (*Blockchain) IsYapBeta ¶ added in v2.4.0
func (g *Blockchain) IsYapBeta(height uint64) bool
IsYapBeta checks whether height is equal to or larger than yap beta height
func (*Blockchain) IsZanzibar ¶ added in v2.5.0
func (g *Blockchain) IsZanzibar(height uint64) bool
IsZanzibar checks whether height is equal to or larger than zanzibar height
func (*Blockchain) IsZanzibarBeta ¶ added in v2.5.0
func (g *Blockchain) IsZanzibarBeta(height uint64) bool
IsZanzibarBeta checks whether height is equal to or larger than zanzibar beta height
func (*Blockchain) IsZanzibarGamma ¶ added in v2.5.0
func (g *Blockchain) IsZanzibarGamma(height uint64) bool
IsZanzibarGamma checks whether height is equal to or larger than zanzibar gamma height
type BootstrapCandidate ¶
type BootstrapCandidate struct {
OwnerAddress string `yaml:"ownerAddress"`
OperatorAddress string `yaml:"operatorAddress"`
RewardAddress string `yaml:"rewardAddress"`
Name string `yaml:"name"`
SelfStakingTokens string `yaml:"selfStakingTokens"`
}
BootstrapCandidate is the candidate data need to be provided to bootstrap candidate.
type Delegate ¶
type Delegate struct {
// OperatorAddrStr is the address who will operate the node
OperatorAddrStr string `yaml:"operatorAddr"`
// RewardAddrStr is the address who will get the reward when operator produces blocks
RewardAddrStr string `yaml:"rewardAddr"`
// VotesStr is the score for the operator to rank and weight for rewardee to split epoch reward
VotesStr string `yaml:"votes"`
}
Delegate defines a delegate with address and votes
func (*Delegate) OperatorAddr ¶
OperatorAddr is the address of operator
func (*Delegate) RewardAddr ¶
RewardAddr is the address of rewardee, which is allowed to be nil
type Genesis ¶
type Genesis struct {
Blockchain `yaml:"blockchain"`
Account `yaml:"account"`
Poll `yaml:"poll"`
Rewarding `yaml:"rewarding"`
Staking `yaml:"staking"`
}
Genesis is the root level of genesis config. Genesis config is the network-wide blockchain config. All the nodes participating into the same network should use EXACTLY SAME genesis config.
func ExtractGenesisContext ¶
ExtractGenesisContext extracts genesis from context if available
func MustExtractGenesisContext ¶
MustExtractGenesisContext extracts genesis from context if available, else panic
func New ¶
New constructs a genesis config. It loads the default values, and could be overwritten by values defined in the yaml config files
func (*Genesis) IsMainnet ¶ added in v2.5.0
IsMainnet reports whether this is the mainnet genesis config.
func (*Genesis) SetCodeAuthorityBlackListParams ¶ added in v2.5.2
func (g *Genesis) SetCodeAuthorityBlackListParams() (blackList []string, activeHeight uint64, removal []string)
SetCodeAuthorityBlackListParams returns the blacklist that the EIP-7702 authority check in block execution enforces: the accounts, the height from which they are refused, and the subset no longer refused from ZanzibarBlockHeight onwards.
The check decides whether an authorization is applied, so every node must see the same values. MainNet's are therefore fixed in code rather than read from node or genesis config, and validate() rejects a MainNet genesis that tries to set them. Other chains take them from genesis, empty by default.
func (*Genesis) ValidateTestnetGrants ¶ added in v2.5.0
ValidateTestnetGrants rejects a grant list that is unusable or does not belong on this network. It is separate from validate() because a Genesis built as a literal never reaches validate(), so chainservice re-runs it at build time.
type GrantRecipient ¶ added in v2.5.0
GrantRecipient is one address/amount pair of a TestnetGrant. Amount is in Rau and is added to whatever the address already holds.
type Poll ¶
type Poll struct {
// PollMode is different based on chain type or poll input data source
PollMode string `yaml:"pollMode"`
// EnableGravityChainVoting is a flag whether read voting from gravity chain
EnableGravityChainVoting bool `yaml:"enableGravityChainVoting"`
// GravityChainStartHeight is the height in gravity chain where the init poll result stored
GravityChainStartHeight uint64 `yaml:"gravityChainStartHeight"`
// GravityChainCeilingHeight is the height in gravity chain where the poll is no longer needed
GravityChainCeilingHeight uint64 `yaml:"gravityChainCeilingHeight"`
// GravityChainHeightInterval the height interval on gravity chain to pull delegate information
GravityChainHeightInterval uint64 `yaml:"gravityChainHeightInterval"`
// RegisterContractAddress is the address of register contract
RegisterContractAddress string `yaml:"registerContractAddress"`
// StakingContractAddress is the address of staking contract
StakingContractAddress string `yaml:"stakingContractAddress"`
// NativeStakingContractAddress is the address of native staking contract
NativeStakingContractAddress string `yaml:"nativeStakingContractAddress"`
// NativeStakingContractCode is the code of native staking contract
NativeStakingContractCode string `yaml:"nativeStakingContractCode"`
// ConsortiumCommitteeContractCode is the code of consortiumCommittee contract
ConsortiumCommitteeContractCode string `yaml:"consortiumCommitteeContractCode"`
// VoteThreshold is the vote threshold amount in decimal string format
VoteThreshold string `yaml:"voteThreshold"`
// ScoreThreshold is the score threshold amount in decimal string format
ScoreThreshold string `yaml:"scoreThreshold"`
// SelfStakingThreshold is self-staking vote threshold amount in decimal string format
SelfStakingThreshold string `yaml:"selfStakingThreshold"`
// Delegates is a list of delegates with votes
Delegates []Delegate `yaml:"delegates"`
// ProbationEpochPeriod is a duration of probation after delegate's productivity is lower than threshold
ProbationEpochPeriod uint64 `yaml:"probationEpochPeriod"`
// ProbationIntensityRate is a intensity rate of probation range from [0, 100], where 100 is hard-probation
ProbationIntensityRate uint32 `yaml:"probationIntensityRate"`
// UnproductiveDelegateMaxCacheSize is a max cache size of upd which is stored into state DB (probationEpochPeriod <= UnproductiveDelegateMaxCacheSize)
UnproductiveDelegateMaxCacheSize uint64 `yaml:"unproductiveDelegateMaxCacheSize"`
// SystemStakingContractAddress is the address of system staking contract
SystemStakingContractAddress string `yaml:"systemStakingContractAddress"`
// SystemStakingContractHeight is the height of system staking contract
SystemStakingContractHeight uint64 `yaml:"systemStakingContractHeight"`
// deprecated
SystemSGDContractAddress string `yaml:"systemSGDContractAddress"`
// deprecated
SystemSGDContractHeight uint64 `yaml:"systemSGDContractHeight"`
// SystemStakingContractV2Address is the address of system staking contract
SystemStakingContractV2Address string `yaml:"systemStakingContractV2Address"`
// SystemStakingContractV2Height is the height of system staking contract
SystemStakingContractV2Height uint64 `yaml:"systemStakingContractV2Height"`
// SystemStakingContractV3Address is the address of system staking contract
SystemStakingContractV3Address string `yaml:"systemStakingContractV3Address"`
// SystemStakingContractV3Height is the height of system staking contract
SystemStakingContractV3Height uint64 `yaml:"systemStakingContractV3Height"`
// DelegateProfileContractAddress is the bech32 address of the on-chain
// DelegateProfile contract from which IIP-59 reads per-delegate voter-take
// portions at PutPollResult. Empty ⇒ IIP-59 commission-rate freeze is
// inactive and the rewarding protocol falls back to the legacy Hermes
// distribution path. Populated per-network in the mainnet/testnet YAML.
DelegateProfileContractAddress string `yaml:"delegateProfileContractAddress"`
}
Poll contains the configs for poll protocol
type RegistrationConsts ¶
type RegistrationConsts struct {
Fee string `yaml:"fee"`
MinSelfStake string `yaml:"minSelfStake"`
}
RegistrationConsts contains the configs for candidate registration
type Rewarding ¶
type Rewarding struct {
// InitBalanceStr is the initial balance of the rewarding protocol in decimal string format
InitBalanceStr string `yaml:"initBalance"`
// BlockRewardStr is the block reward amount in decimal string format
BlockRewardStr string `yaml:"blockReward"`
// DardanellesBlockRewardStr is the block reward amount starts from dardanelles height in decimal string format
DardanellesBlockRewardStr string `yaml:"dardanellesBlockReward"`
// EpochRewardStr is the epoch reward amount in decimal string format
EpochRewardStr string `yaml:"epochReward"`
// AleutianEpochRewardStr is the epoch reward amount in decimal string format after aleutian fork
AleutianEpochRewardStr string `yaml:"aleutianEpochReward"`
// NumDelegatesForEpochReward is the number of top candidates that will share a epoch reward
NumDelegatesForEpochReward uint64 `yaml:"numDelegatesForEpochReward"`
// ExemptAddrStrsFromEpochReward is the list of addresses in encoded string format that exempt from epoch reward
ExemptAddrStrsFromEpochReward []string `yaml:"exemptAddrsFromEpochReward"`
// FoundationBonusStr is the bootstrap bonus in decimal string format
FoundationBonusStr string `yaml:"foundationBonus"`
// NumDelegatesForFoundationBonus is the number of top candidate that will get the bootstrap bonus
NumDelegatesForFoundationBonus uint64 `yaml:"numDelegatesForFoundationBonus"`
// FoundationBonusLastEpoch is the last epoch number that bootstrap bonus will be granted
FoundationBonusLastEpoch uint64 `yaml:"foundationBonusLastEpoch"`
// FoundationBonusP2StartEpoch is the start epoch number for part 2 foundation bonus
FoundationBonusP2StartEpoch uint64 `yaml:"foundationBonusP2StartEpoch"`
// FoundationBonusP2EndEpoch is the end epoch number for part 2 foundation bonus
FoundationBonusP2EndEpoch uint64 `yaml:"foundationBonusP2EndEpoch"`
// ProductivityThreshold is the percentage number that a delegate's productivity needs to reach not to get probation
ProductivityThreshold uint64 `yaml:"productivityThreshold"`
// WakeBlockRewardStr is the block reward amount, in decimal string format, effective from the Wake height
WakeBlockRewardStr string `yaml:"wakeBlockRewardStr"`
// EpochsPerRewardEra is the number of epochs per IIP-59 voter reward era. Era boundaries are epochs where
// epochNum%EpochsPerRewardEra==0. Only consulted when the IIP-59 voter reward distribution feature is active.
EpochsPerRewardEra uint64 `yaml:"epochsPerRewardEra"`
// VoterBudgetPerBlock is the maximum number of voters credited per block during the era-boundary chunked
// credit path (IIP-59 Phase 2). 0 falls back to a single-block drain, preserving pre-IIP-59 behavior for
// tests that never touch the field.
VoterBudgetPerBlock uint64 `yaml:"voterBudgetPerBlock"`
// HermesRewardVaultAddresses lists legacy reward addresses whose delegates are
// automatically migrated to protocol-native reward distribution at IIP-59 activation.
HermesRewardVaultAddresses []string `yaml:"hermesRewardVaultAddresses"`
}
Rewarding contains the configs for rewarding protocol
func (*Rewarding) AleutianEpochReward ¶
AleutianEpochReward returns the epoch reward amount after Aleutian fork
func (*Rewarding) BlockReward ¶
BlockReward returns the block reward amount
func (*Rewarding) DardanellesBlockReward ¶
DardanellesBlockReward returns the block reward amount after dardanelles fork
func (*Rewarding) EpochReward ¶
EpochReward returns the epoch reward amount
func (*Rewarding) ExemptAddrsFromEpochReward ¶
ExemptAddrsFromEpochReward returns the list of addresses that exempt from epoch reward
func (*Rewarding) FoundationBonus ¶
FoundationBonus returns the bootstrap bonus amount rewarded per epoch
func (*Rewarding) InitBalance ¶
InitBalance returns the init balance of the rewarding fund
func (*Rewarding) WakeBlockReward ¶ added in v2.2.0
WakeBlockReward returns the block reward amount after wake fork
type Staking ¶
type Staking struct {
VoteWeightCalConsts VoteWeightCalConsts `yaml:"voteWeightCalConsts"`
RegistrationConsts RegistrationConsts `yaml:"registrationConsts"`
WithdrawWaitingPeriod time.Duration `yaml:"withdrawWaitingPeriod"`
MinStakeAmount string `yaml:"minStakeAmount"`
BootstrapCandidates []BootstrapCandidate `yaml:"bootstrapCandidates"`
EndorsementWithdrawWaitingBlocks uint64 `yaml:"endorsementWithdrawWaitingBlocks"`
MinSelfStakeToBeActive string `yaml:"minSelfStakeToBeActive"`
ExitAdmissionInterval uint64 `yaml:"exitAdmissionInterval"`
ExitUnboundingDuration uint64 `yaml:"exitUnbondingDuration"`
}
Staking contains the configs for staking protocol
type TestnetGrant ¶ added in v2.5.0
type TestnetGrant struct {
// Height is applied before any action in that block. Must be non-zero;
// balances that exist from the start of the chain go in InitBalanceMap.
Height uint64 `yaml:"height"`
Recipients []GrantRecipient `yaml:"recipients"`
}
TestnetGrant is one scheduled batch of balance credits. Recipients is a list rather than a map because the apply order is part of consensus.
type VoteWeightCalConsts ¶
type VoteWeightCalConsts struct {
DurationLg float64 `yaml:"durationLg"`
AutoStake float64 `yaml:"autoStake"`
SelfStake float64 `yaml:"selfStake"`
}
VoteWeightCalConsts contains the configs for calculating vote weight