prysm-pulse/shared/params/mainnet_config.go
terence tsao 15704053e1
Add Altair configs (#9150)
* Add altair configs

* Update minimal_config.go

* Update workspace and config tests

* Revert workspace changes

* Update WORKSPACE

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2021-07-18 16:18:43 +00:00

224 lines
9.6 KiB
Go

package params
import (
"math"
"time"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
)
// MainnetConfig returns the configuration to be used in the main network.
func MainnetConfig() *BeaconChainConfig {
return mainnetBeaconConfig
}
// UseMainnetConfig for beacon chain services.
func UseMainnetConfig() {
beaconConfig = MainnetConfig()
}
const (
// Altair Fork Epoch for mainnet config.
// Placeholder until fork epoch is decided.
mainnetAltairForkEpoch = math.MaxUint64
)
var mainnetNetworkConfig = &NetworkConfig{
GossipMaxSize: 1 << 20, // 1 MiB
MaxChunkSize: 1 << 20, // 1 MiB
AttestationSubnetCount: 64,
AttestationPropagationSlotRange: 32,
MaxRequestBlocks: 1 << 10, // 1024
TtfbTimeout: 5 * time.Second,
RespTimeout: 10 * time.Second,
MaximumGossipClockDisparity: 500 * time.Millisecond,
MessageDomainInvalidSnappy: [4]byte{00, 00, 00, 00},
MessageDomainValidSnappy: [4]byte{01, 00, 00, 00},
ETH2Key: "eth2",
AttSubnetKey: "attnets",
SyncCommsSubnetKey: "syncnets",
MinimumPeersInSubnet: 4,
MinimumPeersInSubnetSearch: 20,
ContractDeploymentBlock: 11184524, // Note: contract was deployed in block 11052984 but no transactions were sent until 11184524.
BootstrapNodes: []string{
// Teku team's bootnode
"enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-e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_3kax86YPheFUSLXPRs98vvYsoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDZBrP2Jc2VjcDI1NmsxoQM6jr8Rb1ktLEsVcKAPa08wCsKUmvoQ8khiOl_SLozf9IN1ZHCCIyg",
},
}
var mainnetBeaconConfig = &BeaconChainConfig{
// Constants (Non-configurable)
FarFutureEpoch: 1<<64 - 1,
FarFutureSlot: 1<<64 - 1,
BaseRewardsPerEpoch: 4,
DepositContractTreeDepth: 32,
GenesisDelay: 604800, // 1 week.
// Misc constant.
TargetCommitteeSize: 128,
MaxValidatorsPerCommittee: 2048,
MaxCommitteesPerSlot: 64,
MinPerEpochChurnLimit: 4,
ChurnLimitQuotient: 1 << 16,
ShuffleRoundCount: 90,
MinGenesisActiveValidatorCount: 16384,
MinGenesisTime: 1606824000, // Dec 1, 2020, 12pm UTC.
TargetAggregatorsPerCommittee: 16,
HysteresisQuotient: 4,
HysteresisDownwardMultiplier: 1,
HysteresisUpwardMultiplier: 5,
// Gwei value constants.
MinDepositAmount: 1 * 1e9,
MaxEffectiveBalance: 32 * 1e9,
EjectionBalance: 16 * 1e9,
EffectiveBalanceIncrement: 1 * 1e9,
// Initial value constants.
BLSWithdrawalPrefixByte: byte(0),
ZeroHash: [32]byte{},
// Time parameter constants.
MinAttestationInclusionDelay: 1,
SecondsPerSlot: 12,
SlotsPerEpoch: 32,
MinSeedLookahead: 1,
MaxSeedLookahead: 4,
EpochsPerEth1VotingPeriod: 64,
SlotsPerHistoricalRoot: 8192,
MinValidatorWithdrawabilityDelay: 256,
ShardCommitteePeriod: 256,
MinEpochsToInactivityPenalty: 4,
Eth1FollowDistance: 2048,
SafeSlotsToUpdateJustified: 8,
// Ethereum PoW parameters.
DepositChainID: 1, // Chain ID of eth1 mainnet.
DepositNetworkID: 1, // Network ID of eth1 mainnet.
DepositContractAddress: "0x00000000219ab540356cBB839Cbe05303d7705Fa",
// Validator params.
RandomSubnetsPerValidator: 1 << 0,
EpochsPerRandomSubnetSubscription: 1 << 8,
// While eth1 mainnet block times are closer to 13s, we must conform with other clients in
// order to vote on the correct eth1 blocks.
//
// Additional context: https://github.com/ethereum/eth2.0-specs/issues/2132
// Bug prompting this change: https://github.com/prysmaticlabs/prysm/issues/7856
// Future optimization: https://github.com/prysmaticlabs/prysm/issues/7739
SecondsPerETH1Block: 14,
// State list length constants.
EpochsPerHistoricalVector: 65536,
EpochsPerSlashingsVector: 8192,
HistoricalRootsLimit: 16777216,
ValidatorRegistryLimit: 1099511627776,
// Reward and penalty quotients constants.
BaseRewardFactor: 64,
WhistleBlowerRewardQuotient: 512,
ProposerRewardQuotient: 8,
InactivityPenaltyQuotient: 67108864,
MinSlashingPenaltyQuotient: 128,
ProportionalSlashingMultiplier: 1,
// Max operations per block constants.
MaxProposerSlashings: 16,
MaxAttesterSlashings: 2,
MaxAttestations: 128,
MaxDeposits: 16,
MaxVoluntaryExits: 16,
// BLS domain values.
DomainBeaconProposer: bytesutil.ToBytes4(bytesutil.Bytes4(0)),
DomainBeaconAttester: bytesutil.ToBytes4(bytesutil.Bytes4(1)),
DomainRandao: bytesutil.ToBytes4(bytesutil.Bytes4(2)),
DomainDeposit: bytesutil.ToBytes4(bytesutil.Bytes4(3)),
DomainVoluntaryExit: bytesutil.ToBytes4(bytesutil.Bytes4(4)),
DomainSelectionProof: bytesutil.ToBytes4(bytesutil.Bytes4(5)),
DomainAggregateAndProof: bytesutil.ToBytes4(bytesutil.Bytes4(6)),
DomainSyncCommittee: bytesutil.ToBytes4(bytesutil.Bytes4(7)),
DomainSyncCommitteeSelectionProof: bytesutil.ToBytes4(bytesutil.Bytes4(8)),
DomainContributionAndProof: bytesutil.ToBytes4(bytesutil.Bytes4(9)),
// Prysm constants.
GweiPerEth: 1000000000,
BLSSecretKeyLength: 32,
BLSPubkeyLength: 48,
BLSSignatureLength: 96,
DefaultBufferSize: 10000,
WithdrawalPrivkeyFileName: "/shardwithdrawalkey",
ValidatorPrivkeyFileName: "/validatorprivatekey",
RPCSyncCheck: 1,
EmptySignature: [96]byte{},
DefaultPageSize: 250,
MaxPeersToSync: 15,
SlotsPerArchivedPoint: 2048,
GenesisCountdownInterval: time.Minute,
ConfigName: ConfigNames[Mainnet],
BeaconStateFieldCount: 21,
BeaconStateAltairFieldCount: 24,
// Slasher related values.
WeakSubjectivityPeriod: 54000,
PruneSlasherStoragePeriod: 10,
SlashingProtectionPruningEpochs: 512,
// Weak subjectivity values.
SafetyDecay: 10,
// Fork related values.
GenesisForkVersion: []byte{0, 0, 0, 0},
AltairForkVersion: []byte{1, 0, 0, 0},
NextForkVersion: []byte{1, 0, 0, 0}, // Set to altair fork version.
AltairForkEpoch: mainnetAltairForkEpoch,
NextForkEpoch: mainnetAltairForkEpoch, // Set to altair fork epoch.
ForkVersionSchedule: map[types.Epoch][]byte{
// TODO(): To be updated for Altair.
},
// New values introduced in Altair hard fork 1.
// Participation flag indices.
TimelySourceFlagIndex: 0,
TimelyTargetFlagIndex: 1,
TimelyHeadFlagIndex: 2,
// Incentivization weight values.
TimelySourceWeight: 14,
TimelyTargetWeight: 26,
TimelyHeadWeight: 14,
SyncRewardWeight: 2,
ProposerWeight: 8,
WeightDenominator: 64,
// Validator related values.
TargetAggregatorsPerSyncSubcommittee: 4,
SyncCommitteeSubnetCount: 4,
// Misc values.
SyncCommitteeSize: 512,
InactivityScoreBias: 4,
InactivityScoreRecoveryRate: 16,
EpochsPerSyncCommitteePeriod: 256,
// Updated penalty values.
InactivityPenaltyQuotientAltair: 3 * 1 << 24, //50331648
MinSlashingPenaltyQuotientAltair: 64,
ProportionalSlashingMultiplierAltair: 2,
}