cosmos-sdk/x/staking/testutil/validator.go
mergify[bot] 46be66ed42
refactor: remove global valaddress bech32 codec calls (1/2) (backport #17098) (#17149)
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
2023-07-27 00:55:11 +02:00

20 lines
534 B
Go

package testutil
import (
"testing"
"github.com/stretchr/testify/require"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"
)
// NewValidator is a testing helper method to create validators in tests
func NewValidator(tb testing.TB, operator sdk.ValAddress, pubKey cryptotypes.PubKey) types.Validator {
tb.Helper()
v, err := types.NewValidator(operator.String(), pubKey, types.Description{})
require.NoError(tb, err)
return v
}