Skip to content

Commit

Permalink
apply lint
Browse files Browse the repository at this point in the history
  • Loading branch information
torao committed May 20, 2022
1 parent b814a15 commit 1da6733
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion cmd/ostracon/commands/show_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"fmt"

"github.com/line/ostracon/node"
"github.com/line/ostracon/types"
"github.com/spf13/cobra"
Expand All @@ -24,7 +25,7 @@ func showValidator(cmd *cobra.Command, args []string) error {
var pv types.PrivValidator
var err error
if config.PrivValidatorListenAddr != "" {
chainID := "" // currently not in use
chainID := "" // currently not in use
pv, err = node.CreateAndStartPrivValidatorSocketClient(config.PrivValidatorListenAddr, chainID, logger)
if err != nil {
return err
Expand Down
22 changes: 11 additions & 11 deletions test/kms/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const VrfOutputSize = 64
func main() {
logger := log.NewOCLogger(log.NewSyncWriter(os.Stdout))

chainId := "test-chain"
chainID := "test-chain"
protocol, address := tmnet.ProtocolAndAddress("tcp://0.0.0.0:45666")
ln, err := net.Listen(protocol, address)
NoError(err)
listener := privval.NewTCPListener(ln, ed25519.GenPrivKeyFromSecret([]byte("🏺")))
endpoint := privval.NewSignerListenerEndpoint(logger, listener)
client, err := privval.NewSignerClient(endpoint, chainId)
client, err := privval.NewSignerClient(endpoint, chainID)
NoError(err)

// Ping
Expand All @@ -51,7 +51,7 @@ func main() {
}

// SignVote
blockId := types.BlockID{
blockID := types.BlockID{
Hash: make([]byte, 32),
PartSetHeader: types.PartSetHeader{
Total: 10,
Expand All @@ -62,24 +62,24 @@ func main() {
Type: types2.PrevoteType,
Height: 1,
Round: 0,
BlockID: blockId,
BlockID: blockID,
Timestamp: time.Now(),
ValidatorAddress: pubKey.Address(),
ValidatorIndex: 0,
Signature: nil,
}
pv := vote.ToProto()
err = client.SignVote(chainId, pv)
err = client.SignVote(chainID, pv)
NoError(err)
logger.Info("✅ SignVote: call")
if len(pv.Signature) != ed25519.SignatureSize {
logger.Error(fmt.Sprintf("❌ SignVote: signature size = %d != %d", len(pv.Signature), ed25519.SignatureSize))
} else {
logger.Info(fmt.Sprintf("✅ SignVote: signature size = %d", len(pv.Signature)))
}
bytes := types.VoteSignBytes(chainId, pv)
bytes := types.VoteSignBytes(chainID, pv)
if !pubKey.VerifySignature(bytes, pv.Signature) {
logger.Error(fmt.Sprintf("❌ SignVote: signature verification"))
logger.Error("❌ SignVote: signature verification")
} else {
logger.Info("✅ SignVote: signature verification")
}
Expand All @@ -90,22 +90,22 @@ func main() {
Height: 1,
Round: 0,
POLRound: -1,
BlockID: blockId,
BlockID: blockID,
Timestamp: time.Now(),
Signature: nil,
}
pp := proposal.ToProto()
err = client.SignProposal(chainId, pp)
err = client.SignProposal(chainID, pp)
NoError(err)
logger.Info("✅ SignProposal: call")
if len(pp.Signature) != ed25519.SignatureSize {
logger.Error(fmt.Sprintf("❌ SignProposal: signature size = %d != %d", len(pp.Signature), ed25519.SignatureSize))
} else {
logger.Info(fmt.Sprintf("✅ SignProposal: signature size = %d", len(pp.Signature)))
}
bytes = types.ProposalSignBytes(chainId, pp)
bytes = types.ProposalSignBytes(chainID, pp)
if !pubKey.VerifySignature(bytes, pp.Signature) {
logger.Error(fmt.Sprintf("❌ SignProposal: signature verification"))
logger.Error("❌ SignProposal: signature verification")
} else {
logger.Info("✅ SignProposal: signature verification")
}
Expand Down

0 comments on commit 1da6733

Please sign in to comment.