2022-02-11 06:48:29 +00:00
|
|
|
package testing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-03-17 18:52:56 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/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)
|
|
|
|
}
|