give deneb it's own field count config value (#12806)

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
kasey 2023-08-25 18:33:05 -05:00 committed by Preston Van Loon
parent b335eba625
commit d0ae692f4c
6 changed files with 8 additions and 4 deletions

View File

@ -34,7 +34,7 @@ func ComputeFieldRootsWithHasher(ctx context.Context, state *BeaconState) ([][]b
case version.Capella: case version.Capella:
fieldRoots = make([][]byte, params.BeaconConfig().BeaconStateCapellaFieldCount) fieldRoots = make([][]byte, params.BeaconConfig().BeaconStateCapellaFieldCount)
case version.Deneb: case version.Deneb:
fieldRoots = make([][]byte, params.BeaconConfig().BeaconStateCapellaFieldCount) // Deneb has the same state field count as Capella. fieldRoots = make([][]byte, params.BeaconConfig().BeaconStateDenebFieldCount)
} }
// Genesis time root. // Genesis time root.

View File

@ -512,7 +512,7 @@ func InitializeFromProtoUnsafeDeneb(st *ethpb.BeaconStateDeneb) (state.BeaconSta
mixes[i] = bytesutil.ToBytes32(m) mixes[i] = bytesutil.ToBytes32(m)
} }
fieldCount := params.BeaconConfig().BeaconStateCapellaFieldCount fieldCount := params.BeaconConfig().BeaconStateDenebFieldCount
b := &BeaconState{ b := &BeaconState{
version: version.Deneb, version: version.Deneb,
genesisTime: st.GenesisTime, genesisTime: st.GenesisTime,
@ -600,7 +600,7 @@ func (b *BeaconState) Copy() state.BeaconState {
case version.Capella: case version.Capella:
fieldCount = params.BeaconConfig().BeaconStateCapellaFieldCount fieldCount = params.BeaconConfig().BeaconStateCapellaFieldCount
case version.Deneb: case version.Deneb:
fieldCount = params.BeaconConfig().BeaconStateCapellaFieldCount fieldCount = params.BeaconConfig().BeaconStateDenebFieldCount
} }
dst := &BeaconState{ dst := &BeaconState{
@ -756,7 +756,7 @@ func (b *BeaconState) initializeMerkleLayers(ctx context.Context) error {
case version.Capella: case version.Capella:
b.dirtyFields = make(map[types.FieldIndex]bool, params.BeaconConfig().BeaconStateCapellaFieldCount) b.dirtyFields = make(map[types.FieldIndex]bool, params.BeaconConfig().BeaconStateCapellaFieldCount)
case version.Deneb: case version.Deneb:
b.dirtyFields = make(map[types.FieldIndex]bool, params.BeaconConfig().BeaconStateCapellaFieldCount) b.dirtyFields = make(map[types.FieldIndex]bool, params.BeaconConfig().BeaconStateDenebFieldCount)
} }
return nil return nil

View File

@ -141,6 +141,7 @@ type BeaconChainConfig struct {
BeaconStateAltairFieldCount int // BeaconStateAltairFieldCount defines how many fields are in the beacon state post upgrade to Altair. BeaconStateAltairFieldCount int // BeaconStateAltairFieldCount defines how many fields are in the beacon state post upgrade to Altair.
BeaconStateBellatrixFieldCount int // BeaconStateBellatrixFieldCount defines how many fields are in beacon state post upgrade to Bellatrix. BeaconStateBellatrixFieldCount int // BeaconStateBellatrixFieldCount defines how many fields are in beacon state post upgrade to Bellatrix.
BeaconStateCapellaFieldCount int // BeaconStateCapellaFieldCount defines how many fields are in beacon state post upgrade to Capella. BeaconStateCapellaFieldCount int // BeaconStateCapellaFieldCount defines how many fields are in beacon state post upgrade to Capella.
BeaconStateDenebFieldCount int // BeaconStateDenebFieldCount defines how many fields are in beacon state post upgrade to Deneb.
// Slasher constants. // Slasher constants.
WeakSubjectivityPeriod primitives.Epoch // WeakSubjectivityPeriod defines the time period expressed in number of epochs were proof of stake network should validate block headers and attestations for slashable events. WeakSubjectivityPeriod primitives.Epoch // WeakSubjectivityPeriod defines the time period expressed in number of epochs were proof of stake network should validate block headers and attestations for slashable events.

View File

@ -162,6 +162,7 @@ func compareConfigs(t *testing.T, expected, actual *BeaconChainConfig) {
require.DeepEqual(t, expected.BeaconStateAltairFieldCount, actual.BeaconStateAltairFieldCount) require.DeepEqual(t, expected.BeaconStateAltairFieldCount, actual.BeaconStateAltairFieldCount)
require.DeepEqual(t, expected.BeaconStateBellatrixFieldCount, actual.BeaconStateBellatrixFieldCount) require.DeepEqual(t, expected.BeaconStateBellatrixFieldCount, actual.BeaconStateBellatrixFieldCount)
require.DeepEqual(t, expected.BeaconStateCapellaFieldCount, actual.BeaconStateCapellaFieldCount) require.DeepEqual(t, expected.BeaconStateCapellaFieldCount, actual.BeaconStateCapellaFieldCount)
require.DeepEqual(t, expected.BeaconStateDenebFieldCount, actual.BeaconStateDenebFieldCount)
require.DeepEqual(t, expected.WeakSubjectivityPeriod, actual.WeakSubjectivityPeriod) require.DeepEqual(t, expected.WeakSubjectivityPeriod, actual.WeakSubjectivityPeriod)
require.DeepEqual(t, expected.PruneSlasherStoragePeriod, actual.PruneSlasherStoragePeriod) require.DeepEqual(t, expected.PruneSlasherStoragePeriod, actual.PruneSlasherStoragePeriod)
require.DeepEqual(t, expected.SlashingProtectionPruningEpochs, actual.SlashingProtectionPruningEpochs) require.DeepEqual(t, expected.SlashingProtectionPruningEpochs, actual.SlashingProtectionPruningEpochs)

View File

@ -199,6 +199,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
BeaconStateAltairFieldCount: 24, BeaconStateAltairFieldCount: 24,
BeaconStateBellatrixFieldCount: 25, BeaconStateBellatrixFieldCount: 25,
BeaconStateCapellaFieldCount: 28, BeaconStateCapellaFieldCount: 28,
BeaconStateDenebFieldCount: 28,
// Slasher related values. // Slasher related values.
WeakSubjectivityPeriod: 54000, WeakSubjectivityPeriod: 54000,

View File

@ -127,6 +127,7 @@ func compareConfigs(t *testing.T, expected, actual *params.BeaconChainConfig) {
require.DeepEqual(t, expected.BeaconStateAltairFieldCount, actual.BeaconStateAltairFieldCount) require.DeepEqual(t, expected.BeaconStateAltairFieldCount, actual.BeaconStateAltairFieldCount)
require.DeepEqual(t, expected.BeaconStateBellatrixFieldCount, actual.BeaconStateBellatrixFieldCount) require.DeepEqual(t, expected.BeaconStateBellatrixFieldCount, actual.BeaconStateBellatrixFieldCount)
require.DeepEqual(t, expected.BeaconStateCapellaFieldCount, actual.BeaconStateCapellaFieldCount) require.DeepEqual(t, expected.BeaconStateCapellaFieldCount, actual.BeaconStateCapellaFieldCount)
require.DeepEqual(t, expected.BeaconStateDenebFieldCount, actual.BeaconStateDenebFieldCount)
require.DeepEqual(t, expected.WeakSubjectivityPeriod, actual.WeakSubjectivityPeriod) require.DeepEqual(t, expected.WeakSubjectivityPeriod, actual.WeakSubjectivityPeriod)
require.DeepEqual(t, expected.PruneSlasherStoragePeriod, actual.PruneSlasherStoragePeriod) require.DeepEqual(t, expected.PruneSlasherStoragePeriod, actual.PruneSlasherStoragePeriod)
require.DeepEqual(t, expected.SlashingProtectionPruningEpochs, actual.SlashingProtectionPruningEpochs) require.DeepEqual(t, expected.SlashingProtectionPruningEpochs, actual.SlashingProtectionPruningEpochs)