2021-11-22 17:37:55 +00:00
|
|
|
package v3_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-01-18 08:19:20 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state"
|
2022-02-08 09:30:06 +00:00
|
|
|
v3 "github.com/prysmaticlabs/prysm/beacon-chain/state/v3"
|
2021-11-22 17:37:55 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
|
|
"github.com/prysmaticlabs/prysm/testing/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBeaconState_ValidatorAtIndexReadOnly_HandlesNilSlice(t *testing.T) {
|
2022-02-08 09:30:06 +00:00
|
|
|
st, err := v3.InitializeFromProtoUnsafe(ðpb.BeaconStateBellatrix{
|
2021-11-22 17:37:55 +00:00
|
|
|
Validators: nil,
|
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
_, err = st.ValidatorAtIndexReadOnly(0)
|
2022-01-18 08:19:20 +00:00
|
|
|
assert.Equal(t, state.ErrNilValidatorsInState, err)
|
2021-11-22 17:37:55 +00:00
|
|
|
}
|