Remove ShardingForkVersion/Epoch from config (#11868)

* remove ShardingForkVersion/Epoch from config

* update magic value counting config params

* skip the sharding params, which we disavow

we wanted to remove these upstream and may well do some day but right
now it's too big of a mess to untangle.

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
kasey
2023-01-13 11:11:33 -06:00
committed by GitHub
parent cf71dbdf97
commit eb6b811071
13 changed files with 4 additions and 31 deletions

View File

@@ -50,8 +50,6 @@ func TestGetSpec(t *testing.T) {
config.AltairForkEpoch = 100
config.BellatrixForkVersion = []byte("BellatrixForkVersion")
config.BellatrixForkEpoch = 101
config.ShardingForkVersion = []byte("ShardingForkVersion")
config.ShardingForkEpoch = 102
config.CapellaForkVersion = []byte("CapellaForkVersion")
config.CapellaForkEpoch = 103
config.BLSWithdrawalPrefixByte = byte('b')
@@ -139,7 +137,7 @@ func TestGetSpec(t *testing.T) {
resp, err := server.GetSpec(context.Background(), &emptypb.Empty{})
require.NoError(t, err)
assert.Equal(t, 105, len(resp.Data))
assert.Equal(t, 103, len(resp.Data))
for k, v := range resp.Data {
switch k {
case "CONFIG_NAME":
@@ -204,10 +202,6 @@ func TestGetSpec(t *testing.T) {
assert.Equal(t, "0x"+hex.EncodeToString([]byte("BellatrixForkVersion")), v)
case "BELLATRIX_FORK_EPOCH":
assert.Equal(t, "101", v)
case "SHARDING_FORK_VERSION":
assert.Equal(t, "0x"+hex.EncodeToString([]byte("ShardingForkVersion")), v)
case "SHARDING_FORK_EPOCH":
assert.Equal(t, "102", v)
case "CAPELLA_FORK_VERSION":
assert.Equal(t, "0x"+hex.EncodeToString([]byte("CapellaForkVersion")), v)
case "CAPELLA_FORK_EPOCH":

View File

@@ -149,8 +149,6 @@ type BeaconChainConfig struct {
AltairForkEpoch types.Epoch `yaml:"ALTAIR_FORK_EPOCH" spec:"true"` // AltairForkEpoch is used to represent the assigned fork epoch for altair.
BellatrixForkVersion []byte `yaml:"BELLATRIX_FORK_VERSION" spec:"true"` // BellatrixForkVersion is used to represent the fork version for bellatrix.
BellatrixForkEpoch types.Epoch `yaml:"BELLATRIX_FORK_EPOCH" spec:"true"` // BellatrixForkEpoch is used to represent the assigned fork epoch for bellatrix.
ShardingForkVersion []byte `yaml:"SHARDING_FORK_VERSION" spec:"true"` // ShardingForkVersion is used to represent the fork version for sharding.
ShardingForkEpoch types.Epoch `yaml:"SHARDING_FORK_EPOCH" spec:"true"` // ShardingForkEpoch is used to represent the assigned fork epoch for sharding.
CapellaForkVersion []byte `yaml:"CAPELLA_FORK_VERSION" spec:"true"` // CapellaForkVersion is used to represent the fork version for capella.
CapellaForkEpoch types.Epoch `yaml:"CAPELLA_FORK_EPOCH" spec:"true"` // CapellaForkEpoch is used to represent the assigned fork epoch for capella.

View File

@@ -170,8 +170,6 @@ func compareConfigs(t *testing.T, expected, actual *BeaconChainConfig) {
require.DeepEqual(t, expected.AltairForkEpoch, actual.AltairForkEpoch)
require.DeepEqual(t, expected.BellatrixForkVersion, actual.BellatrixForkVersion)
require.DeepEqual(t, expected.BellatrixForkEpoch, actual.BellatrixForkEpoch)
require.DeepEqual(t, expected.ShardingForkVersion, actual.ShardingForkVersion)
require.DeepEqual(t, expected.ShardingForkEpoch, actual.ShardingForkEpoch)
require.DeepEqual(t, expected.ForkVersionSchedule, actual.ForkVersionSchedule)
require.DeepEqual(t, expected.SafetyDecay, actual.SafetyDecay)
require.DeepEqual(t, expected.TimelySourceFlagIndex, actual.TimelySourceFlagIndex)

View File

@@ -10,7 +10,6 @@ func InteropConfig() *BeaconChainConfig {
c.AltairForkVersion = []byte{1, 0, 0, 235}
c.BellatrixForkVersion = []byte{2, 0, 0, 235}
c.CapellaForkVersion = []byte{3, 0, 0, 235}
c.ShardingForkVersion = []byte{4, 0, 0, 235}
c.InitializeForkSchedule()
return c

View File

@@ -199,8 +199,6 @@ func ConfigToYaml(cfg *BeaconChainConfig) []byte {
fmt.Sprintf("CAPELLA_FORK_VERSION: %#x", cfg.CapellaForkVersion),
fmt.Sprintf("BELLATRIX_FORK_EPOCH: %d", cfg.BellatrixForkEpoch),
fmt.Sprintf("BELLATRIX_FORK_VERSION: %#x", cfg.BellatrixForkVersion),
fmt.Sprintf("SHARDING_FORK_EPOCH: %d", cfg.ShardingForkEpoch),
fmt.Sprintf("SHARDING_FORK_VERSION: %#x", cfg.ShardingForkVersion),
fmt.Sprintf("INACTIVITY_SCORE_BIAS: %d", cfg.InactivityScoreBias),
fmt.Sprintf("INACTIVITY_SCORE_RECOVERY_RATE: %d", cfg.InactivityScoreRecoveryRate),
fmt.Sprintf("TERMINAL_TOTAL_DIFFICULTY: %s", cfg.TerminalTotalDifficulty),

View File

@@ -326,6 +326,9 @@ func fieldsFromYamls(t *testing.T, fps []string) []string {
require.NoError(t, yaml.Unmarshal(yamlFile, &m))
for k := range m {
if k == "SHARDING_FORK_VERSION" || k == "SHARDING_FORK_EPOCH" {
continue
}
keys = append(keys, k)
}

View File

@@ -210,8 +210,6 @@ var mainnetBeaconConfig = &BeaconChainConfig{
BellatrixForkEpoch: mainnetBellatrixForkEpoch,
CapellaForkVersion: []byte{3, 0, 0, 0},
CapellaForkEpoch: math.MaxUint64,
ShardingForkVersion: []byte{4, 0, 0, 0},
ShardingForkEpoch: math.MaxUint64,
// New values introduced in Altair hard fork 1.
// Participation flag indices.
@@ -280,17 +278,14 @@ func FillTestVersions(c *BeaconChainConfig, b byte) {
c.AltairForkVersion = make([]byte, fieldparams.VersionLength)
c.BellatrixForkVersion = make([]byte, fieldparams.VersionLength)
c.CapellaForkVersion = make([]byte, fieldparams.VersionLength)
c.ShardingForkVersion = make([]byte, fieldparams.VersionLength)
c.GenesisForkVersion[fieldparams.VersionLength-1] = b
c.AltairForkVersion[fieldparams.VersionLength-1] = b
c.BellatrixForkVersion[fieldparams.VersionLength-1] = b
c.CapellaForkVersion[fieldparams.VersionLength-1] = b
c.ShardingForkVersion[fieldparams.VersionLength-1] = b
c.GenesisForkVersion[0] = 0
c.AltairForkVersion[0] = 1
c.BellatrixForkVersion[0] = 2
c.CapellaForkVersion[0] = 3
c.ShardingForkVersion[0] = 4
}

View File

@@ -89,8 +89,6 @@ func MinimalSpecConfig() *BeaconChainConfig {
minimalConfig.BellatrixForkEpoch = math.MaxUint64
minimalConfig.CapellaForkVersion = []byte{3, 0, 0, 1}
minimalConfig.CapellaForkEpoch = math.MaxUint64
minimalConfig.ShardingForkVersion = []byte{4, 0, 0, 1}
minimalConfig.ShardingForkEpoch = math.MaxUint64
minimalConfig.SyncCommitteeSize = 32
minimalConfig.InactivityScoreBias = 4

View File

@@ -41,9 +41,6 @@ BELLATRIX_FORK_EPOCH: 8
# Capella
CAPELLA_FORK_VERSION: 0x030000fd
CAPELLA_FORK_EPOCH: 18446744073709551615
# Sharding
SHARDING_FORK_VERSION: 0x040000fd
SHARDING_FORK_EPOCH: 18446744073709551615
# Time parameters

View File

@@ -135,8 +135,6 @@ func compareConfigs(t *testing.T, expected, actual *params.BeaconChainConfig) {
require.DeepEqual(t, expected.AltairForkEpoch, actual.AltairForkEpoch)
require.DeepEqual(t, expected.BellatrixForkVersion, actual.BellatrixForkVersion)
require.DeepEqual(t, expected.BellatrixForkEpoch, actual.BellatrixForkEpoch)
require.DeepEqual(t, expected.ShardingForkVersion, actual.ShardingForkVersion)
require.DeepEqual(t, expected.ShardingForkEpoch, actual.ShardingForkEpoch)
require.DeepEqual(t, expected.ForkVersionSchedule, actual.ForkVersionSchedule)
require.DeepEqual(t, expected.SafetyDecay, actual.SafetyDecay)
require.DeepEqual(t, expected.TimelySourceFlagIndex, actual.TimelySourceFlagIndex)

View File

@@ -44,7 +44,6 @@ func E2ETestConfig() *BeaconChainConfig {
e2eConfig.AltairForkVersion = []byte{1, 0, 0, 253}
e2eConfig.BellatrixForkVersion = []byte{2, 0, 0, 253}
e2eConfig.CapellaForkVersion = []byte{3, 0, 0, 253}
e2eConfig.ShardingForkVersion = []byte{4, 0, 0, 253}
e2eConfig.InitializeForkSchedule()
return e2eConfig
@@ -83,7 +82,6 @@ func E2EMainnetTestConfig() *BeaconChainConfig {
e2eConfig.AltairForkVersion = []byte{1, 0, 0, 254}
e2eConfig.BellatrixForkVersion = []byte{2, 0, 0, 254}
e2eConfig.CapellaForkVersion = []byte{3, 0, 0, 254}
e2eConfig.ShardingForkVersion = []byte{4, 0, 0, 254}
e2eConfig.InitializeForkSchedule()
return e2eConfig

View File

@@ -37,7 +37,6 @@ func PraterConfig() *BeaconChainConfig {
cfg.AltairForkEpoch = 36660
cfg.AltairForkVersion = []byte{0x1, 0x0, 0x10, 0x20}
cfg.CapellaForkVersion = []byte{0x3, 0x0, 0x10, 0x20}
cfg.ShardingForkVersion = []byte{0x4, 0x0, 0x10, 0x20}
cfg.BellatrixForkEpoch = 112260
cfg.BellatrixForkVersion = []byte{0x2, 0x0, 0x10, 0x20}
cfg.TerminalTotalDifficulty = "10790000"

View File

@@ -185,8 +185,6 @@ func TestRetrieveForkDataFromDigest(t *testing.T) {
cfg.AltairForkEpoch = 10
cfg.BellatrixForkVersion = []byte{'A', 'B', 'C', 'Z'}
cfg.BellatrixForkEpoch = 100
cfg.ShardingForkVersion = []byte{'A', 'B', 'C', 'Y'}
cfg.ShardingForkEpoch = 1000
cfg.InitializeForkSchedule()
params.OverrideBeaconConfig(cfg)
genValRoot := [32]byte{'A', 'B', 'C', 'D'}