prysm-pulse/beacon-chain/state/state-native/v1/setters_attestation_test.go

23 lines
754 B
Go
Raw Normal View History

package v1
import (
"testing"
types "github.com/prysmaticlabs/eth2-types"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/testing/require"
)
func TestBeaconState_RotateAttestations(t *testing.T) {
st, err := InitializeFromProto(&ethpb.BeaconState{
Slot: 1,
CurrentEpochAttestations: []*ethpb.PendingAttestation{{Data: &ethpb.AttestationData{Slot: 456}}},
PreviousEpochAttestations: []*ethpb.PendingAttestation{{Data: &ethpb.AttestationData{Slot: 123}}},
})
require.NoError(t, err)
require.NoError(t, st.RotateAttestations())
2022-01-24 10:24:38 +00:00
require.Equal(t, 0, len(st.currentEpochAttestationsVal()))
require.Equal(t, types.Slot(456), st.previousEpochAttestationsVal()[0].Data.Slot)
}