diff --git a/cmd/neofs-ir/main.go b/cmd/neofs-ir/main.go index 33a6031e4..89ad6b499 100644 --- a/cmd/neofs-ir/main.go +++ b/cmd/neofs-ir/main.go @@ -100,7 +100,7 @@ func main() { log.Info("application stopped") } -func parsePublicKeysFromString(argument string) ([]keys.PublicKey, error) { +func parsePublicKeysFromString(argument string) (keys.PublicKeys, error) { publicKeysString := strings.Split(argument, ",") return innerring.ParsePublicKeysFromStrings(publicKeysString) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 8a569ddfa..5f6cb9491 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -62,7 +62,7 @@ type ( key *ecdsa.PrivateKey pubKey []byte contracts *contracts - predefinedValidators []keys.PublicKey + predefinedValidators keys.PublicKeys workers []func(context.Context) @@ -664,7 +664,7 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) { return result, nil } -func parsePredefinedValidators(cfg *viper.Viper) ([]keys.PublicKey, error) { +func parsePredefinedValidators(cfg *viper.Viper) (keys.PublicKeys, error) { publicKeyStrings := cfg.GetStringSlice("morph.validators") return ParsePublicKeysFromStrings(publicKeyStrings) @@ -672,8 +672,8 @@ func parsePredefinedValidators(cfg *viper.Viper) ([]keys.PublicKey, error) { // ParsePublicKeysFromStrings returns slice of neo public keys from slice // of hex encoded strings. -func ParsePublicKeysFromStrings(pubKeys []string) ([]keys.PublicKey, error) { - publicKeys := make([]keys.PublicKey, 0, len(pubKeys)) +func ParsePublicKeysFromStrings(pubKeys []string) (keys.PublicKeys, error) { + publicKeys := make(keys.PublicKeys, 0, len(pubKeys)) for i := range pubKeys { key, err := keys.NewPublicKeyFromString(pubKeys[i]) @@ -681,7 +681,7 @@ func ParsePublicKeysFromStrings(pubKeys []string) ([]keys.PublicKey, error) { return nil, errors.Wrap(err, "can't decode public key") } - publicKeys = append(publicKeys, *key) + publicKeys = append(publicKeys, key) } return publicKeys, nil diff --git a/pkg/innerring/invoke/alphabet.go b/pkg/innerring/invoke/alphabet.go index 935241a50..615de3c7e 100644 --- a/pkg/innerring/invoke/alphabet.go +++ b/pkg/innerring/invoke/alphabet.go @@ -22,15 +22,10 @@ func AlphabetEmit(cli *client.Client, con util.Uint160) error { } // AlphabetVote invokes vote method on alphabet contract. -func AlphabetVote(cli *client.Client, con util.Uint160, epoch uint64, keys []keys.PublicKey) error { +func AlphabetVote(cli *client.Client, con util.Uint160, epoch uint64, keys keys.PublicKeys) error { if cli == nil { return client.ErrNilClient } - binaryKeys := make([][]byte, 0, len(keys)) - for i := range keys { - binaryKeys = append(binaryKeys, keys[i].Bytes()) - } - - return cli.NotaryInvoke(con, voteMethod, int64(epoch), binaryKeys) + return cli.NotaryInvoke(con, voteMethod, int64(epoch), keys) } diff --git a/pkg/innerring/state.go b/pkg/innerring/state.go index 1a7a3a491..612a958b7 100644 --- a/pkg/innerring/state.go +++ b/pkg/innerring/state.go @@ -65,7 +65,7 @@ func (s *Server) AlphabetIndex() int { return int(index) } -func (s *Server) voteForSidechainValidator(validators []keys.PublicKey) error { +func (s *Server) voteForSidechainValidator(validators keys.PublicKeys) error { index := s.InnerRingIndex() if s.contracts.alphabet.indexOutOfRange(index) { s.log.Info("ignore validator vote: node not in alphabet range") @@ -96,7 +96,7 @@ func (s *Server) voteForSidechainValidator(validators []keys.PublicKey) error { // InitAndVoteForSidechainValidator is a public function to use outside of // inner ring daemon execution. It initialize inner ring structure with data // from blockchain and then calls vote method on corresponding alphabet contract. -func (s *Server) InitAndVoteForSidechainValidator(validators []keys.PublicKey) error { +func (s *Server) InitAndVoteForSidechainValidator(validators keys.PublicKeys) error { err := s.initConfigFromBlockchain() if err != nil { return err