2021-07-19 18:26:39 +00:00
|
|
|
package v1_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1"
|
2021-07-28 21:23:44 +00:00
|
|
|
statepb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
2021-07-19 18:26:39 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBeaconState_ValidatorAtIndexReadOnly_HandlesNilSlice(t *testing.T) {
|
2021-07-23 13:07:40 +00:00
|
|
|
st, err := v1.InitializeFromProtoUnsafe(&statepb.BeaconState{
|
2021-07-19 18:26:39 +00:00
|
|
|
Validators: nil,
|
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
_, err = st.ValidatorAtIndexReadOnly(0)
|
|
|
|
assert.Equal(t, v1.ErrNilValidatorsInState, err)
|
|
|
|
}
|