diff --git a/client/context/context.go b/client/context/context.go index 8e56cfa1ae..a2ef0a30e6 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -11,6 +11,7 @@ import ( "github.com/spf13/viper" "github.com/tendermint/tendermint/libs/cli" + "github.com/tendermint/tendermint/libs/log" tmlite "github.com/tendermint/tendermint/lite" tmliteProxy "github.com/tendermint/tendermint/lite/proxy" rpcclient "github.com/tendermint/tendermint/rpc/client" @@ -36,7 +37,7 @@ type CLIContext struct { Async bool JSON bool PrintResponse bool - Certifier tmlite.Certifier + Verifier tmlite.Verifier DryRun bool } @@ -63,12 +64,12 @@ func NewCLIContext() CLIContext { Async: viper.GetBool(client.FlagAsync), JSON: viper.GetBool(client.FlagJson), PrintResponse: viper.GetBool(client.FlagPrintResponse), - Certifier: createCertifier(), + Verifier: createVerifier(), DryRun: viper.GetBool(client.FlagDryRun), } } -func createCertifier() tmlite.Certifier { +func createVerifier() tmlite.Verifier { trustNode := viper.GetBool(client.FlagTrustNode) if trustNode { return nil @@ -91,11 +92,13 @@ func createCertifier() tmlite.Certifier { if errMsg.Len() != 0 { panic(fmt.Errorf("can't create certifier for distrust mode, empty values from these options: %s", errMsg.String())) } - certifier, err := tmliteProxy.GetCertifier(chainID, home, nodeURI) + node := rpcclient.NewHTTP(nodeURI, "/websocket") + // TODO Utilize ctx.Logger correctly + verifier, err := tmliteProxy.NewVerifier(chainID, home, node, log.NewNopLogger()) if err != nil { panic(err) } - return certifier + return verifier } // WithCodec returns a copy of the context with an updated codec. @@ -156,9 +159,9 @@ func (ctx CLIContext) WithUseLedger(useLedger bool) CLIContext { return ctx } -// WithCertifier - return a copy of the context with an updated Certifier -func (ctx CLIContext) WithCertifier(certifier tmlite.Certifier) CLIContext { - ctx.Certifier = certifier +// WithVerifier - return a copy of the context with an updated Verifier +func (ctx CLIContext) WithVerifier(verifier tmlite.Verifier) CLIContext { + ctx.Verifier = verifier return ctx } diff --git a/client/context/query.go b/client/context/query.go index 4c1cad8777..58dca639af 100644 --- a/client/context/query.go +++ b/client/context/query.go @@ -325,8 +325,8 @@ func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, err erro // verifyProof perform response proof verification func (ctx CLIContext) verifyProof(path string, resp abci.ResponseQuery) error { - if ctx.Certifier == nil { - return fmt.Errorf("missing valid certifier to verify data from untrusted node") + if ctx.Verifier == nil { + return fmt.Errorf("missing valid verifier to verify data from untrusted node") } node, err := ctx.GetNode() @@ -335,7 +335,7 @@ func (ctx CLIContext) verifyProof(path string, resp abci.ResponseQuery) error { } // AppHash for height H is in header H+1 - commit, err := tmliteProxy.GetCertifiedCommit(resp.Height+1, node, ctx.Certifier) + commit, err := tmliteProxy.GetCertifiedCommit(resp.Height+1, node, ctx.Verifier) if err != nil { return err } diff --git a/client/lcd/test_helpers.go b/client/lcd/test_helpers.go index 7d9a46403c..6ed80aa45d 100644 --- a/client/lcd/test_helpers.go +++ b/client/lcd/test_helpers.go @@ -33,6 +33,7 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" nm "github.com/tendermint/tendermint/node" + "github.com/tendermint/tendermint/p2p" pvm "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/proxy" tmrpc "github.com/tendermint/tendermint/rpc/lib/server" @@ -218,9 +219,14 @@ func startTM( ) (*nm.Node, error) { genDocProvider := func() (*tmtypes.GenesisDoc, error) { return genDoc, nil } dbProvider := func(*nm.DBContext) (dbm.DB, error) { return dbm.NewMemDB(), nil } + nodeKey, err := p2p.LoadOrGenNodeKey(tmcfg.NodeKeyFile()) + if err != nil { + return nil, err + } node, err := nm.NewNode( tmcfg, privVal, + nodeKey, proxy.NewLocalClientCreator(app), genDocProvider, dbProvider,