Revert "Revert "spectests""

This reverts commit 39c271ae6b.
This commit is contained in:
rkapka
2022-04-07 13:46:14 +02:00
parent 45f08cf28d
commit 19ba8cf95c
6 changed files with 12 additions and 12 deletions

View File

@@ -273,7 +273,7 @@ func (s *Service) Stop() error {
// ClearPreGenesisData clears out the stored chainstart deposits and beacon state.
func (s *Service) ClearPreGenesisData() {
s.chainStartData.ChainstartDeposits = []*ethpb.Deposit{}
if features.Get().EnableNativeState {
if !features.Get().EnableNativeState {
s.preGenesisState = &native.BeaconState{}
} else {
s.preGenesisState = &v1.BeaconState{}

View File

@@ -25,7 +25,7 @@ import (
// InitializeFromProto the beacon state from a protobuf representation.
func InitializeFromProto(st *ethpb.BeaconState) (state.BeaconState, error) {
if features.Get().EnableNativeState {
if !features.Get().EnableNativeState {
return statenative.InitializeFromProtoPhase0(proto.Clone(st).(*ethpb.BeaconState))
}
return InitializeFromProtoUnsafe(proto.Clone(st).(*ethpb.BeaconState))
@@ -34,7 +34,7 @@ func InitializeFromProto(st *ethpb.BeaconState) (state.BeaconState, error) {
// InitializeFromProtoUnsafe directly uses the beacon state protobuf pointer
// and sets it as the inner state of the BeaconState type.
func InitializeFromProtoUnsafe(st *ethpb.BeaconState) (state.BeaconState, error) {
if features.Get().EnableNativeState {
if !features.Get().EnableNativeState {
return statenative.InitializeFromProtoUnsafePhase0(st)
}

View File

@@ -25,7 +25,7 @@ import (
// InitializeFromProto the beacon state from a protobuf representation.
func InitializeFromProto(st *ethpb.BeaconStateAltair) (state.BeaconStateAltair, error) {
if features.Get().EnableNativeState {
if !features.Get().EnableNativeState {
return statenative.InitializeFromProtoAltair(proto.Clone(st).(*ethpb.BeaconStateAltair))
}
return InitializeFromProtoUnsafe(proto.Clone(st).(*ethpb.BeaconStateAltair))
@@ -34,7 +34,7 @@ func InitializeFromProto(st *ethpb.BeaconStateAltair) (state.BeaconStateAltair,
// InitializeFromProtoUnsafe directly uses the beacon state protobuf pointer
// and sets it as the inner state of the BeaconState type.
func InitializeFromProtoUnsafe(st *ethpb.BeaconStateAltair) (state.BeaconStateAltair, error) {
if features.Get().EnableNativeState {
if !features.Get().EnableNativeState {
return statenative.InitializeFromProtoUnsafeAltair(st)
}

View File

@@ -25,7 +25,7 @@ import (
// InitializeFromProto the beacon state from a protobuf representation.
func InitializeFromProto(st *ethpb.BeaconStateBellatrix) (state.BeaconStateBellatrix, error) {
if features.Get().EnableNativeState {
if !features.Get().EnableNativeState {
return statenative.InitializeFromProtoBellatrix(proto.Clone(st).(*ethpb.BeaconStateBellatrix))
}
return InitializeFromProtoUnsafe(proto.Clone(st).(*ethpb.BeaconStateBellatrix))
@@ -34,7 +34,7 @@ func InitializeFromProto(st *ethpb.BeaconStateBellatrix) (state.BeaconStateBella
// InitializeFromProtoUnsafe directly uses the beacon state protobuf pointer
// and sets it as the inner state of the BeaconState type.
func InitializeFromProtoUnsafe(st *ethpb.BeaconStateBellatrix) (state.BeaconStateBellatrix, error) {
if features.Get().EnableNativeState {
if !features.Get().EnableNativeState {
return statenative.InitializeFromProtoUnsafeBellatrix(st)
}

View File

@@ -10,7 +10,7 @@ go_library(
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/transition:go_default_library",
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/v1:go_default_library",
"//beacon-chain/state/state-native:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/wrapper:go_default_library",
"//testing/require:go_default_library",

View File

@@ -9,7 +9,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1"
state_native "github.com/prysmaticlabs/prysm/beacon-chain/state/state-native"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
"github.com/prysmaticlabs/prysm/testing/require"
@@ -41,7 +41,7 @@ func RunFinalityTest(t *testing.T, config string) {
require.NoError(t, err, "Failed to decompress")
beaconStateBase := &ethpb.BeaconState{}
require.NoError(t, beaconStateBase.UnmarshalSSZ(preBeaconStateSSZ), "Failed to unmarshal")
beaconState, err := v1.InitializeFromProto(beaconStateBase)
beaconState, err := state_native.InitializeFromProtoPhase0(beaconStateBase)
require.NoError(t, err)
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
@@ -64,7 +64,7 @@ func RunFinalityTest(t *testing.T, config string) {
require.NoError(t, err)
processedState, err = transition.ExecuteStateTransition(context.Background(), beaconState, wsb)
require.NoError(t, err)
beaconState, ok = processedState.(*v1.BeaconState)
beaconState, ok = processedState.(*state_native.BeaconState)
require.Equal(t, true, ok)
}
@@ -74,7 +74,7 @@ func RunFinalityTest(t *testing.T, config string) {
require.NoError(t, err, "Failed to decompress")
postBeaconState := &ethpb.BeaconState{}
require.NoError(t, postBeaconState.UnmarshalSSZ(postBeaconStateSSZ), "Failed to unmarshal")
pbState, err := v1.ProtobufBeaconState(beaconState.InnerStateUnsafe())
pbState, err := state_native.ProtobufBeaconStatePhase0(beaconState.InnerStateUnsafe())
require.NoError(t, err)
if !proto.Equal(pbState, postBeaconState) {
diff, _ := messagediff.PrettyDiff(beaconState.InnerStateUnsafe(), postBeaconState)