mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
update for a new ABCI API
This commit is contained in:
parent
e1792c1ea5
commit
91dc87e7c4
@ -388,6 +388,7 @@ func newMockProxyApp(appHash []byte, abciResponses *sm.ABCIResponses) proxy.AppC
|
||||
abciResponses: abciResponses,
|
||||
})
|
||||
cli, _ := clientCreator.NewABCIClient()
|
||||
cli.Start()
|
||||
return proxy.NewAppConnConsensus(cli)
|
||||
}
|
||||
|
||||
|
17
glide.lock
generated
17
glide.lock
generated
@ -1,12 +1,10 @@
|
||||
hash: 9caff08aa026986b239e4aeb9d876bdddfacadc64a660ee8109e77a211e53436
|
||||
updated: 2017-05-15T07:32:38.823266751Z
|
||||
updated: 2017-05-16T16:19:50.278000355Z
|
||||
imports:
|
||||
- name: github.com/btcsuite/btcd
|
||||
version: 1ae306021e323ae11c71ffb8546fbd9019e6cb6f
|
||||
subpackages:
|
||||
- btcec
|
||||
- name: github.com/clipperhouse/typewriter
|
||||
version: c1a48da378ebb7db1db9f35981b5cc24bf2e5b85
|
||||
- name: github.com/davecgh/go-spew
|
||||
version: 04cdfd42973bb9c8589fd6a731800cf222fde1a9
|
||||
subpackages:
|
||||
@ -104,7 +102,7 @@ imports:
|
||||
- leveldb/table
|
||||
- leveldb/util
|
||||
- name: github.com/tendermint/abci
|
||||
version: b662bc7d3439b3c2cce615e8c3502b762e133dbf
|
||||
version: 5dabeffb35c027d7087a12149685daa68989168b
|
||||
subpackages:
|
||||
- client
|
||||
- example/counter
|
||||
@ -117,9 +115,9 @@ imports:
|
||||
- edwards25519
|
||||
- extra25519
|
||||
- name: github.com/tendermint/go-crypto
|
||||
version: e71bbb2509b586f0b24f120b6ba57f32aefa1579
|
||||
version: 438b16f1f84ef002d7408ecd6fc3a3974cbc9559
|
||||
- name: github.com/tendermint/go-wire
|
||||
version: 8b47d1a9dd4e94ee0e099216c382847342405ab9
|
||||
version: 97beaedf0f4dbc035309157c92be3b30cc6e5d74
|
||||
subpackages:
|
||||
- data
|
||||
- data/base58
|
||||
@ -131,7 +129,7 @@ imports:
|
||||
- iavl
|
||||
- testutil
|
||||
- name: github.com/tendermint/tmlibs
|
||||
version: 4fdeaa70afa2556360a396faaa82e640b9912b0c
|
||||
version: 812d9f9b84d1dfe4cb46ce021b3a2d97b48d1292
|
||||
subpackages:
|
||||
- autofile
|
||||
- cli
|
||||
@ -175,11 +173,6 @@ imports:
|
||||
- transform
|
||||
- unicode/bidi
|
||||
- unicode/norm
|
||||
- name: golang.org/x/tools
|
||||
version: 144c6642b5d832d6c44a53dad6ee61665dd432ce
|
||||
subpackages:
|
||||
- go/ast/astutil
|
||||
- imports
|
||||
- name: google.golang.org/genproto
|
||||
version: 411e09b969b1170a9f0c467558eb4c4c110d9c77
|
||||
subpackages:
|
||||
|
@ -18,7 +18,15 @@ func TestSerialReap(t *testing.T) {
|
||||
app.SetOption("serial", "on")
|
||||
cc := proxy.NewLocalClientCreator(app)
|
||||
appConnMem, _ := cc.NewABCIClient()
|
||||
appConnMem.SetLogger(log.TestingLogger().With("module", "abci-client", "connection", "mempool"))
|
||||
if _, err := appConnMem.Start(); err != nil {
|
||||
t.Fatalf("Error starting ABCI client: %v", err.Error())
|
||||
}
|
||||
appConnCon, _ := cc.NewABCIClient()
|
||||
appConnCon.SetLogger(log.TestingLogger().With("module", "abci-client", "connection", "consensus"))
|
||||
if _, err := appConnCon.Start(); err != nil {
|
||||
t.Fatalf("Error starting ABCI client: %v", err.Error())
|
||||
}
|
||||
mempool := NewMempool(config.Mempool, appConnMem)
|
||||
mempool.SetLogger(log.TestingLogger())
|
||||
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
"github.com/tendermint/tmlibs/log"
|
||||
)
|
||||
|
||||
//----------------------------------------
|
||||
@ -48,16 +49,23 @@ func TestEcho(t *testing.T) {
|
||||
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
||||
|
||||
// Start server
|
||||
s, err := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
||||
if err != nil {
|
||||
cmn.Exit(err.Error())
|
||||
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
||||
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
||||
if _, err := s.Start(); err != nil {
|
||||
t.Fatalf("Error starting socket server: %v", err.Error())
|
||||
}
|
||||
defer s.Stop()
|
||||
|
||||
// Start client
|
||||
cli, err := clientCreator.NewABCIClient()
|
||||
if err != nil {
|
||||
cmn.Exit(err.Error())
|
||||
t.Fatalf("Error creating ABCI client: %v", err.Error())
|
||||
}
|
||||
cli.SetLogger(log.TestingLogger().With("module", "abci-client"))
|
||||
if _, err := cli.Start(); err != nil {
|
||||
t.Fatalf("Error starting ABCI client: %v", err.Error())
|
||||
}
|
||||
|
||||
proxy := NewAppConnTest(cli)
|
||||
t.Log("Connected")
|
||||
|
||||
@ -71,17 +79,25 @@ func BenchmarkEcho(b *testing.B) {
|
||||
b.StopTimer() // Initialize
|
||||
sockPath := cmn.Fmt("unix:///tmp/echo_%v.sock", cmn.RandStr(6))
|
||||
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
||||
|
||||
// Start server
|
||||
s, err := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
||||
if err != nil {
|
||||
cmn.Exit(err.Error())
|
||||
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
||||
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
||||
if _, err := s.Start(); err != nil {
|
||||
b.Fatalf("Error starting socket server: %v", err.Error())
|
||||
}
|
||||
defer s.Stop()
|
||||
|
||||
// Start client
|
||||
cli, err := clientCreator.NewABCIClient()
|
||||
if err != nil {
|
||||
cmn.Exit(err.Error())
|
||||
b.Fatalf("Error creating ABCI client: %v", err.Error())
|
||||
}
|
||||
cli.SetLogger(log.TestingLogger().With("module", "abci-client"))
|
||||
if _, err := cli.Start(); err != nil {
|
||||
b.Fatalf("Error starting ABCI client: %v", err.Error())
|
||||
}
|
||||
|
||||
proxy := NewAppConnTest(cli)
|
||||
b.Log("Connected")
|
||||
echoString := strings.Repeat(" ", 200)
|
||||
@ -100,17 +116,25 @@ func BenchmarkEcho(b *testing.B) {
|
||||
func TestInfo(t *testing.T) {
|
||||
sockPath := cmn.Fmt("unix:///tmp/echo_%v.sock", cmn.RandStr(6))
|
||||
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
||||
|
||||
// Start server
|
||||
s, err := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
||||
if err != nil {
|
||||
cmn.Exit(err.Error())
|
||||
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
||||
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
||||
if _, err := s.Start(); err != nil {
|
||||
t.Fatalf("Error starting socket server: %v", err.Error())
|
||||
}
|
||||
defer s.Stop()
|
||||
|
||||
// Start client
|
||||
cli, err := clientCreator.NewABCIClient()
|
||||
if err != nil {
|
||||
cmn.Exit(err.Error())
|
||||
t.Fatalf("Error creating ABCI client: %v", err.Error())
|
||||
}
|
||||
cli.SetLogger(log.TestingLogger().With("module", "abci-client"))
|
||||
if _, err := cli.Start(); err != nil {
|
||||
t.Fatalf("Error starting ABCI client: %v", err.Error())
|
||||
}
|
||||
|
||||
proxy := NewAppConnTest(cli)
|
||||
t.Log("Connected")
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
abcicli "github.com/tendermint/abci/client"
|
||||
"github.com/tendermint/abci/example/dummy"
|
||||
"github.com/tendermint/abci/types"
|
||||
@ -51,10 +52,9 @@ func NewRemoteClientCreator(addr, transport string, mustConnect bool) ClientCrea
|
||||
}
|
||||
|
||||
func (r *remoteClientCreator) NewABCIClient() (abcicli.Client, error) {
|
||||
// Run forever in a loop
|
||||
remoteApp, err := abcicli.NewClient(r.addr, r.transport, r.mustConnect)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to connect to proxy: %v", err)
|
||||
return nil, errors.Wrap(err, "Failed to connect to proxy")
|
||||
}
|
||||
return remoteApp, nil
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
)
|
||||
|
||||
@ -70,25 +72,34 @@ func (app *multiAppConn) Query() AppConnQuery {
|
||||
func (app *multiAppConn) OnStart() error {
|
||||
// query connection
|
||||
querycli, err := app.clientCreator.NewABCIClient()
|
||||
querycli.SetLogger(app.Logger.With("module", "abci-client", "connection", "query"))
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "Error creating ABCI client (query connection)")
|
||||
}
|
||||
querycli.SetLogger(app.Logger.With("module", "abci-client", "connection", "query"))
|
||||
if _, err := querycli.Start(); err != nil {
|
||||
return errors.Wrap(err, "Error starting ABCI client (query connection)")
|
||||
}
|
||||
app.queryConn = NewAppConnQuery(querycli)
|
||||
|
||||
// mempool connection
|
||||
memcli, err := app.clientCreator.NewABCIClient()
|
||||
memcli.SetLogger(app.Logger.With("module", "abci-client", "connection", "mempool"))
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "Error creating ABCI client (mempool connection)")
|
||||
}
|
||||
memcli.SetLogger(app.Logger.With("module", "abci-client", "connection", "mempool"))
|
||||
if _, err := memcli.Start(); err != nil {
|
||||
return errors.Wrap(err, "Error starting ABCI client (mempool connection)")
|
||||
}
|
||||
app.mempoolConn = NewAppConnMempool(memcli)
|
||||
|
||||
// consensus connection
|
||||
concli, err := app.clientCreator.NewABCIClient()
|
||||
concli.SetLogger(app.Logger.With("module", "abci-client", "connection", "consensus"))
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "Error creating ABCI client (consensus connection)")
|
||||
}
|
||||
concli.SetLogger(app.Logger.With("module", "abci-client", "connection", "consensus"))
|
||||
if _, err := concli.Start(); err != nil {
|
||||
return errors.Wrap(err, "Error starting ABCI client (consensus connection)")
|
||||
}
|
||||
app.consensusConn = NewAppConnConsensus(concli)
|
||||
|
||||
@ -96,5 +107,6 @@ func (app *multiAppConn) OnStart() error {
|
||||
if app.handshaker != nil {
|
||||
return app.handshaker.Handshake(app)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user