Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KMS functionality #417

Merged
merged 20 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix to use correct chainID when executing show-validator subcommand
  • Loading branch information
torao committed Jun 9, 2022
commit 0352eafcc02073d638afe4944890015e3f0477f6
80 changes: 0 additions & 80 deletions cmd/ostracon/commands/run_node_test.go

This file was deleted.

19 changes: 17 additions & 2 deletions cmd/ostracon/commands/show_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ var ShowValidatorCmd = &cobra.Command{

func showValidator(cmd *cobra.Command, args []string, config *cfg.Config) error {
tnasu marked this conversation as resolved.
Show resolved Hide resolved
var pv types.PrivValidator
var err error
if config.PrivValidatorListenAddr != "" {
chainID := "" // currently not in use
chainID, err := loadChainID(config)
pv, err = node.CreateAndStartPrivValidatorSocketClient(config.PrivValidatorListenAddr, chainID, logger)
tnasu marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return err
Expand All @@ -54,3 +53,19 @@ func showValidator(cmd *cobra.Command, args []string, config *cfg.Config) error
fmt.Println(string(bz))
return nil
}

func loadChainID(config *cfg.Config) (string, error) {
stateDB, err := node.DefaultDBProvider(&node.DBContext{ID: "state", Config: config})
if err != nil {
return "", err
}
defer func() {
var _ = stateDB.Close()
}()
genesisDocProvider := node.DefaultGenesisDocProviderFunc(config)
_, genDoc, err := node.LoadStateFromDBOrGenesisDocProvider(stateDB, genesisDocProvider)
if err != nil {
return "", err
}
return genDoc.ChainID, nil
}
6 changes: 2 additions & 4 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import (
"testing"
"time"

dbm "github.com/line/tm-db/v2"
tnasu marked this conversation as resolved.
Show resolved Hide resolved
"github.com/line/tm-db/v2/memdb"
tnasu marked this conversation as resolved.
Show resolved Hide resolved
"github.com/ory/dockertest"
"github.com/ory/dockertest/docker"

"github.com/line/tm-db/v2/memdb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/line/tm-db/v2"

"github.com/line/ostracon/abci/example/kvstore"
cfg "github.com/line/ostracon/config"
"github.com/line/ostracon/crypto/ed25519"
Expand Down