mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 20:43:57 -05:00
@@ -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{}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 := ðpb.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 := ðpb.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)
|
||||
|
||||
Reference in New Issue
Block a user