2022-02-11 06:48:29 +00:00
|
|
|
package testing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-08-16 12:20:13 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/testing/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/testing/require"
|
2022-02-11 06:48:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type getState func() (state.BeaconState, error)
|
|
|
|
|
2022-03-15 18:32:09 +00:00
|
|
|
func VerifyBeaconStateValidatorAtIndexReadOnlyHandlesNilSlice(t *testing.T, factory getState) {
|
2022-02-11 06:48:29 +00:00
|
|
|
st, err := factory()
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
_, err = st.ValidatorAtIndexReadOnly(0)
|
|
|
|
assert.Equal(t, state.ErrNilValidatorsInState, err)
|
|
|
|
}
|