Documentation ¶
Overview ¶
Package params defines important constants that are essential to eth2 services.
Index ¶
- func LoadChainConfigFile(chainConfigFileName string)
- func OverrideBeaconConfig(c *BeaconChainConfig)
- func OverrideBeaconNetworkConfig(cfg *NetworkConfig)
- func SetupTestConfigCleanup(t testing.TB)
- func UseAltonaConfig()
- func UseAltonaNetworkConfig()
- func UseE2EConfig()
- func UseMainnetConfig()
- func UseMedallaConfig()
- func UseMedallaNetworkConfig()
- func UseMinimalConfig()
- func UseOnyxConfig()
- func UseOnyxNetworkConfig()
- func UseSpadinaConfig()
- func UseSpadinaNetworkConfig()
- func UseZinkenConfig()
- func UseZinkenNetworkConfig()
- type BeaconChainConfig
- func AltonaConfig() *BeaconChainConfig
- func BeaconConfig() *BeaconChainConfig
- func E2ETestConfig() *BeaconChainConfig
- func MainnetConfig() *BeaconChainConfig
- func MedallaConfig() *BeaconChainConfig
- func MinimalSpecConfig() *BeaconChainConfig
- func SpadinaConfig() *BeaconChainConfig
- func ZinkenConfig() *BeaconChainConfig
- type IoConfig
- type NetworkConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadChainConfigFile ¶ added in v1.0.0
func LoadChainConfigFile(chainConfigFileName string)
LoadChainConfigFile load, convert hex values into valid param yaml format, unmarshal , and apply beacon chain config file.
func OverrideBeaconConfig ¶
func OverrideBeaconConfig(c *BeaconChainConfig)
OverrideBeaconConfig by replacing the config. The preferred pattern is to call BeaconConfig(), change the specific parameters, and then call OverrideBeaconConfig(c). Any subsequent calls to params.BeaconConfig() will return this new configuration.
func OverrideBeaconNetworkConfig ¶ added in v1.0.0
func OverrideBeaconNetworkConfig(cfg *NetworkConfig)
OverrideBeaconNetworkConfig will override the network config with the added argument.
func SetupTestConfigCleanup ¶ added in v1.0.0
SetupTestConfigCleanup preserves configurations allowing to modify them within tests without any restrictions, everything is restored after the test.
func UseAltonaConfig ¶
func UseAltonaConfig()
UseAltonaConfig sets the main beacon chain config for altona.
func UseAltonaNetworkConfig ¶
func UseAltonaNetworkConfig()
UseAltonaNetworkConfig uses the Altona specific network config.
func UseMedallaConfig ¶
func UseMedallaConfig()
UseMedallaConfig sets the main beacon chain config for medalla.
func UseMedallaNetworkConfig ¶
func UseMedallaNetworkConfig()
UseMedallaNetworkConfig uses the Medalla specific network config.
func UseOnyxConfig ¶
func UseOnyxConfig()
UseOnyxConfig for beacon chain services. Currently, Onyx uses the unchanged mainnet configuration.
func UseOnyxNetworkConfig ¶
func UseOnyxNetworkConfig()
UseOnyxNetworkConfig uses the Onyx specific network config.
func UseSpadinaConfig ¶
func UseSpadinaConfig()
UseSpadinaConfig sets the main beacon chain config for Spadina.
func UseSpadinaNetworkConfig ¶
func UseSpadinaNetworkConfig()
UseSpadinaNetworkConfig uses the Spadina specific network config.
func UseZinkenConfig ¶
func UseZinkenConfig()
UseZinkenConfig sets the main beacon chain config for Zinken.
func UseZinkenNetworkConfig ¶
func UseZinkenNetworkConfig()
UseZinkenNetworkConfig uses the Zinken specific network config.
Types ¶
type BeaconChainConfig ¶
type BeaconChainConfig struct { // Constants (non-configurable) GenesisSlot uint64 `yaml:"GENESIS_SLOT"` // GenesisSlot represents the first canonical slot number of the beacon chain. GenesisEpoch uint64 `yaml:"GENESIS_EPOCH"` // GenesisEpoch represents the first canonical epoch number of the beacon chain. FarFutureEpoch uint64 `yaml:"FAR_FUTURE_EPOCH"` // FarFutureEpoch represents a epoch extremely far away in the future used as the default penalization slot for validators. BaseRewardsPerEpoch uint64 `yaml:"BASE_REWARDS_PER_EPOCH"` // BaseRewardsPerEpoch is used to calculate the per epoch rewards. DepositContractTreeDepth uint64 `yaml:"DEPOSIT_CONTRACT_TREE_DEPTH"` // DepositContractTreeDepth depth of the Merkle trie of deposits in the validator deposit contract on the PoW chain. JustificationBitsLength uint64 `yaml:"JUSTIFICATION_BITS_LENGTH"` // JustificationBitsLength defines number of epochs to track when implementing k-finality in Casper FFG. // Misc constants. TargetCommitteeSize uint64 `yaml:"TARGET_COMMITTEE_SIZE"` // TargetCommitteeSize is the number of validators in a committee when the chain is healthy. MaxValidatorsPerCommittee uint64 `yaml:"MAX_VALIDATORS_PER_COMMITTEE"` // MaxValidatorsPerCommittee defines the upper bound of the size of a committee. MaxCommitteesPerSlot uint64 `yaml:"MAX_COMMITTEES_PER_SLOT"` // MaxCommitteesPerSlot defines the max amount of committee in a single slot. MinPerEpochChurnLimit uint64 `yaml:"MIN_PER_EPOCH_CHURN_LIMIT"` // MinPerEpochChurnLimit is the minimum amount of churn allotted for validator rotations. ChurnLimitQuotient uint64 `yaml:"CHURN_LIMIT_QUOTIENT"` // ChurnLimitQuotient is used to determine the limit of how many validators can rotate per epoch. ShuffleRoundCount uint64 `yaml:"SHUFFLE_ROUND_COUNT"` // ShuffleRoundCount is used for retrieving the permuted index. MinGenesisActiveValidatorCount uint64 `yaml:"MIN_GENESIS_ACTIVE_VALIDATOR_COUNT"` // MinGenesisActiveValidatorCount defines how many validator deposits needed to kick off beacon chain. MinGenesisTime uint64 `yaml:"MIN_GENESIS_TIME"` // MinGenesisTime is the time that needed to pass before kicking off beacon chain. TargetAggregatorsPerCommittee uint64 `yaml:"TARGET_AGGREGATORS_PER_COMMITTEE"` // TargetAggregatorsPerCommittee defines the number of aggregators inside one committee. HysteresisQuotient uint64 `yaml:"HYSTERESIS_QUOTIENT"` // HysteresisQuotient defines the hysteresis quotient for effective balance calculations. HysteresisDownwardMultiplier uint64 `yaml:"HYSTERESIS_DOWNWARD_MULTIPLIER"` // HysteresisDownwardMultiplier defines the hysteresis downward multiplier for effective balance calculations. HysteresisUpwardMultiplier uint64 `yaml:"HYSTERESIS_UPWARD_MULTIPLIER"` // HysteresisUpwardMultiplier defines the hysteresis upward multiplier for effective balance calculations. // Gwei value constants. MinDepositAmount uint64 `yaml:"MIN_DEPOSIT_AMOUNT"` // MinDepositAmount is the minimum amount of Gwei a validator can send to the deposit contract at once (lower amounts will be reverted). MaxEffectiveBalance uint64 `yaml:"MAX_EFFECTIVE_BALANCE"` // MaxEffectiveBalance is the maximal amount of Gwei that is effective for staking. EjectionBalance uint64 `yaml:"EJECTION_BALANCE"` // EjectionBalance is the minimal GWei a validator needs to have before ejected. EffectiveBalanceIncrement uint64 `yaml:"EFFECTIVE_BALANCE_INCREMENT"` // EffectiveBalanceIncrement is used for converting the high balance into the low balance for validators. // Initial value constants. BLSWithdrawalPrefixByte byte `yaml:"BLS_WITHDRAWAL_PREFIX"` // BLSWithdrawalPrefixByte is used for BLS withdrawal and it's the first byte. ZeroHash [32]byte // ZeroHash is used to represent a zeroed out 32 byte array. // Time parameters constants. GenesisDelay uint64 `yaml:"GENESIS_DELAY"` // GenesisDelay is the minimum number of seconds to delay starting the ETH2 genesis. Must be at least 1 second. MinAttestationInclusionDelay uint64 `yaml:"MIN_ATTESTATION_INCLUSION_DELAY"` // MinAttestationInclusionDelay defines how many slots validator has to wait to include attestation for beacon block. SecondsPerSlot uint64 `yaml:"SECONDS_PER_SLOT"` // SecondsPerSlot is how many seconds are in a single slot. SlotsPerEpoch uint64 `yaml:"SLOTS_PER_EPOCH"` // SlotsPerEpoch is the number of slots in an epoch. MinSeedLookahead uint64 `yaml:"MIN_SEED_LOOKAHEAD"` // MinSeedLookahead is the duration of randao look ahead seed. MaxSeedLookahead uint64 `yaml:"MAX_SEED_LOOKAHEAD"` // MaxSeedLookahead is the duration a validator has to wait for entry and exit in epoch. EpochsPerEth1VotingPeriod uint64 `yaml:"EPOCHS_PER_ETH1_VOTING_PERIOD"` // EpochsPerEth1VotingPeriod defines how often the merkle root of deposit receipts get updated in beacon node on per epoch basis. SlotsPerHistoricalRoot uint64 `yaml:"SLOTS_PER_HISTORICAL_ROOT"` // SlotsPerHistoricalRoot defines how often the historical root is saved. MinValidatorWithdrawabilityDelay uint64 `yaml:"MIN_VALIDATOR_WITHDRAWABILITY_DELAY"` // MinValidatorWithdrawabilityDelay is the shortest amount of time a validator has to wait to withdraw. ShardCommitteePeriod uint64 `yaml:"SHARD_COMMITTEE_PERIOD"` // ShardCommitteePeriod is the minimum amount of epochs a validator must participate before exiting. MinEpochsToInactivityPenalty uint64 `yaml:"MIN_EPOCHS_TO_INACTIVITY_PENALTY"` // MinEpochsToInactivityPenalty defines the minimum amount of epochs since finality to begin penalizing inactivity. Eth1FollowDistance uint64 `yaml:"ETH1_FOLLOW_DISTANCE"` // Eth1FollowDistance is the number of eth1.0 blocks to wait before considering a new deposit for voting. This only applies after the chain as been started. SafeSlotsToUpdateJustified uint64 `yaml:"SAFE_SLOTS_TO_UPDATE_JUSTIFIED"` // SafeSlotsToUpdateJustified is the minimal slots needed to update justified check point. SecondsPerETH1Block uint64 `yaml:"SECONDS_PER_ETH1_BLOCK"` // SecondsPerETH1Block is the approximate time for a single eth1 block to be produced. // State list lengths EpochsPerHistoricalVector uint64 `yaml:"EPOCHS_PER_HISTORICAL_VECTOR"` // EpochsPerHistoricalVector defines max length in epoch to store old historical stats in beacon state. EpochsPerSlashingsVector uint64 `yaml:"EPOCHS_PER_SLASHINGS_VECTOR"` // EpochsPerSlashingsVector defines max length in epoch to store old stats to recompute slashing witness. HistoricalRootsLimit uint64 `yaml:"HISTORICAL_ROOTS_LIMIT"` // HistoricalRootsLimit defines max historical roots that can be saved in state before roll over. ValidatorRegistryLimit uint64 `yaml:"VALIDATOR_REGISTRY_LIMIT"` // ValidatorRegistryLimit defines the upper bound of validators can participate in eth2. // Reward and penalty quotients constants. BaseRewardFactor uint64 `yaml:"BASE_REWARD_FACTOR"` // BaseRewardFactor is used to calculate validator per-slot interest rate. WhistleBlowerRewardQuotient uint64 `yaml:"WHISTLEBLOWER_REWARD_QUOTIENT"` // WhistleBlowerRewardQuotient is used to calculate whistle blower reward. ProposerRewardQuotient uint64 `yaml:"PROPOSER_REWARD_QUOTIENT"` // ProposerRewardQuotient is used to calculate the reward for proposers. InactivityPenaltyQuotient uint64 `yaml:"INACTIVITY_PENALTY_QUOTIENT"` // InactivityPenaltyQuotient is used to calculate the penalty for a validator that is offline. MinSlashingPenaltyQuotient uint64 `yaml:"MIN_SLASHING_PENALTY_QUOTIENT"` // MinSlashingPenaltyQuotient is used to calculate the minimum penalty to prevent DoS attacks. ProportionalSlashingMultiplier uint64 `yaml:"PROPORTIONAL_SLASHING_MULTIPLIER"` // ProportionalSlashingMultiplier is used as a multiplier on slashed penalties. // Max operations per block constants. MaxProposerSlashings uint64 `yaml:"MAX_PROPOSER_SLASHINGS"` // MaxProposerSlashings defines the maximum number of slashings of proposers possible in a block. MaxAttesterSlashings uint64 `yaml:"MAX_ATTESTER_SLASHINGS"` // MaxAttesterSlashings defines the maximum number of casper FFG slashings possible in a block. MaxAttestations uint64 `yaml:"MAX_ATTESTATIONS"` // MaxAttestations defines the maximum allowed attestations in a beacon block. MaxDeposits uint64 `yaml:"MAX_DEPOSITS"` // MaxDeposits defines the maximum number of validator deposits in a block. MaxVoluntaryExits uint64 `yaml:"MAX_VOLUNTARY_EXITS"` // MaxVoluntaryExits defines the maximum number of validator exits in a block. // BLS domain values. DomainBeaconProposer [4]byte `yaml:"DOMAIN_BEACON_PROPOSER"` // DomainBeaconProposer defines the BLS signature domain for beacon proposal verification. DomainRandao [4]byte `yaml:"DOMAIN_RANDAO"` // DomainRandao defines the BLS signature domain for randao verification. DomainBeaconAttester [4]byte `yaml:"DOMAIN_BEACON_ATTESTER"` // DomainBeaconAttester defines the BLS signature domain for attestation verification. DomainDeposit [4]byte `yaml:"DOMAIN_DEPOSIT"` // DomainDeposit defines the BLS signature domain for deposit verification. DomainVoluntaryExit [4]byte `yaml:"DOMAIN_VOLUNTARY_EXIT"` // DomainVoluntaryExit defines the BLS signature domain for exit verification. DomainSelectionProof [4]byte `yaml:"DOMAIN_SELECTION_PROOF"` // DomainSelectionProof defines the BLS signature domain for selection proof. DomainAggregateAndProof [4]byte `yaml:"DOMAIN_AGGREGATE_AND_PROOF"` // DomainAggregateAndProof defines the BLS signature domain for aggregate and proof. // Prysm constants. GweiPerEth uint64 // GweiPerEth is the amount of gwei corresponding to 1 eth. BLSSecretKeyLength int // BLSSecretKeyLength defines the expected length of BLS secret keys in bytes. BLSPubkeyLength int // BLSPubkeyLength defines the expected length of BLS public keys in bytes. BLSSignatureLength int // BLSSignatureLength defines the expected length of BLS signatures in bytes. DefaultBufferSize int // DefaultBufferSize for channels across the Prysm repository. ValidatorPrivkeyFileName string // ValidatorPrivKeyFileName specifies the string name of a validator private key file. WithdrawalPrivkeyFileName string // WithdrawalPrivKeyFileName specifies the string name of a withdrawal private key file. RPCSyncCheck time.Duration // Number of seconds to query the sync service, to find out if the node is synced or not. EmptySignature [96]byte // EmptySignature is used to represent a zeroed out BLS Signature. DefaultPageSize int // DefaultPageSize defines the default page size for RPC server request. MaxPeersToSync int // MaxPeersToSync describes the limit for number of peers in round robin sync. SlotsPerArchivedPoint uint64 // SlotsPerArchivedPoint defines the number of slots per one archived point. GenesisCountdownInterval time.Duration // How often to log the countdown until the genesis time is reached. NetworkName string // NetworkName for allowing an easy human-readable way of knowing what chain is being used. // Slasher constants. WeakSubjectivityPeriod uint64 // WeakSubjectivityPeriod defines the time period expressed in number of epochs were proof of stake network should validate block headers and attestations for slashable events. PruneSlasherStoragePeriod uint64 // PruneSlasherStoragePeriod defines the time period expressed in number of epochs were proof of stake network should prune attestation and block header store. // Fork-related values. GenesisForkVersion []byte `yaml:"GENESIS_FORK_VERSION"` // GenesisForkVersion is used to track fork version between state transitions. NextForkVersion []byte `yaml:"NEXT_FORK_VERSION"` // NextForkVersion is used to track the upcoming fork version, if any. NextForkEpoch uint64 `yaml:"NEXT_FORK_EPOCH"` // NextForkEpoch is used to track the epoch of the next fork, if any. ForkVersionSchedule map[uint64][]byte // Schedule of fork versions by epoch number. // Weak subjectivity values. SafetyDecay uint64 // SafetyDecay is defined as the loss in the 1/3 consensus safety margin of the casper FFG mechanism. }
BeaconChainConfig contains constant configs for node to participate in beacon chain.
func AltonaConfig ¶
func AltonaConfig() *BeaconChainConfig
AltonaConfig defines the config for the altona testnet.
func BeaconConfig ¶
func BeaconConfig() *BeaconChainConfig
BeaconConfig retrieves beacon chain config.
func E2ETestConfig ¶ added in v1.0.0
func E2ETestConfig() *BeaconChainConfig
E2ETestConfig retrieves the configurations made specifically for E2E testing. Warning: This config is only for testing, it is not meant for use outside of E2E.
func MainnetConfig ¶
func MainnetConfig() *BeaconChainConfig
MainnetConfig returns the configuration to be used in the main network.
func MedallaConfig ¶
func MedallaConfig() *BeaconChainConfig
MedallaConfig defines the config for the medalla testnet.
func MinimalSpecConfig ¶
func MinimalSpecConfig() *BeaconChainConfig
MinimalSpecConfig retrieves the minimal config used in spec tests.
func SpadinaConfig ¶
func SpadinaConfig() *BeaconChainConfig
SpadinaConfig defines the config for the Spadina testnet.
func ZinkenConfig ¶
func ZinkenConfig() *BeaconChainConfig
ZinkenConfig defines the config for the Zinken testnet.
func (*BeaconChainConfig) Copy ¶ added in v1.0.0
func (c *BeaconChainConfig) Copy() *BeaconChainConfig
Copy returns a copy of the config object.
type IoConfig ¶ added in v1.0.0
type IoConfig struct { ReadWritePermissions os.FileMode ReadWriteExecutePermissions os.FileMode BoltTimeout time.Duration }
IoConfig defines the shared io parameters.
func BeaconIoConfig ¶ added in v1.0.0
func BeaconIoConfig() *IoConfig
BeaconIoConfig returns the current io config for the beacon chain.
type NetworkConfig ¶ added in v1.0.0
type NetworkConfig struct { GossipMaxSize uint64 `yaml:"GOSSIP_MAX_SIZE"` // GossipMaxSize is the maximum allowed size of uncompressed gossip messages. MaxChunkSize uint64 `yaml:"MAX_CHUNK_SIZE"` // MaxChunkSize is the the maximum allowed size of uncompressed req/resp chunked responses. AttestationSubnetCount uint64 `yaml:"ATTESTATION_SUBNET_COUNT"` // AttestationSubnetCount is the number of attestation subnets used in the gossipsub protocol. AttestationPropagationSlotRange uint64 `yaml:"ATTESTATION_PROPAGATION_SLOT_RANGE"` // AttestationPropagationSlotRange is the maximum number of slots during which an attestation can be propagated. RandomSubnetsPerValidator uint64 `yaml:"RANDOM_SUBNETS_PER_VALIDATOR"` // RandomSubnetsPerValidator specifies the amount of subnets a validator has to be subscribed to at one time. EpochsPerRandomSubnetSubscription uint64 `yaml:"EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION"` // EpochsPerRandomSubnetSubscription specifies the minimum duration a validator is connected to their subnet. MaxRequestBlocks uint64 `yaml:"MAX_REQUEST_BLOCKS"` // MaxRequestBlocks is the maximum number of blocks in a single request. TtfbTimeout time.Duration `yaml:"TTFB_TIMEOUT"` // TtfbTimeout is the maximum time to wait for first byte of request response (time-to-first-byte). RespTimeout time.Duration `yaml:"RESP_TIMEOUT"` // RespTimeout is the maximum time for complete response transfer. MaximumGossipClockDisparity time.Duration `yaml:"MAXIMUM_GOSSIP_CLOCK_DISPARITY"` // MaximumGossipClockDisparity is the maximum milliseconds of clock disparity assumed between honest nodes. MessageDomainInvalidSnappy [4]byte `yaml:"MESSAGE_DOMAIN_INVALID_SNAPPY"` // MessageDomainInvalidSnappy is the 4-byte domain for gossip message-id isolation of invalid snappy messages. MessageDomainValidSnappy [4]byte `yaml:"MESSAGE_DOMAIN_VALID_SNAPPY"` // MessageDomainValidSnappy is the 4-byte domain for gossip message-id isolation of valid snappy messages. // DiscoveryV5 Config ETH2Key string // ETH2Key is the ENR key of the eth2 object in an enr. AttSubnetKey string // AttSubnetKey is the ENR key of the subnet bitfield in the enr. // Chain Network Config ContractDeploymentBlock uint64 // ContractDeploymentBlock is the eth1 block in which the deposit contract is deployed. DepositContractAddress string // DepositContractAddress is the address of the deposit contract. ChainID uint64 // ChainID of the eth1 network. This used for replay protection. NetworkID uint64 // NetworkID of the eth1 network. This used for replay protection. BootstrapNodes []string // BootstrapNodes are the addresses of the bootnodes. }
NetworkConfig defines the spec based network parameters.
func BeaconNetworkConfig ¶ added in v1.0.0
func BeaconNetworkConfig() *NetworkConfig
BeaconNetworkConfig returns the current network config for the beacon chain.
func (*NetworkConfig) Copy ¶ added in v1.0.0
func (c *NetworkConfig) Copy() *NetworkConfig
Copy returns Copy of the config object.