2021-07-19 18:26:39 +00:00
|
|
|
package v1_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1"
|
2021-07-29 21:45:17 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
2021-09-23 18:53:46 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/testing/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
2021-07-19 18:26:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestBeaconState_ValidatorAtIndexReadOnly_HandlesNilSlice(t *testing.T) {
|
2021-07-29 21:45:17 +00:00
|
|
|
st, err := v1.InitializeFromProtoUnsafe(ðpb.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)
|
|
|
|
}
|