mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-15 14:38:20 +00:00
3c76cc3af5
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
27 lines
872 B
Go
27 lines
872 B
Go
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(ðpb.BeaconState{
|
|
Slot: 1,
|
|
CurrentEpochAttestations: []*ethpb.PendingAttestation{{Data: ðpb.AttestationData{Slot: 456}}},
|
|
PreviousEpochAttestations: []*ethpb.PendingAttestation{{Data: ðpb.AttestationData{Slot: 123}}},
|
|
})
|
|
require.NoError(t, err)
|
|
|
|
require.NoError(t, st.RotateAttestations())
|
|
currEpochAtts, err := st.CurrentEpochAttestations()
|
|
require.NoError(t, err)
|
|
require.Equal(t, 0, len(currEpochAtts))
|
|
prevEpochAtts, err := st.PreviousEpochAttestations()
|
|
require.NoError(t, err)
|
|
require.Equal(t, types.Slot(456), prevEpochAtts[0].Data.Slot)
|
|
}
|