Browse Source

Merge pull request #365 from tendermint/rename

Rename
pull/369/head
Ethan Buchman 8 years ago
committed by GitHub
parent
commit
7075a8ed81
42 changed files with 253 additions and 253 deletions
  1. +1
    -1
      README.md
  2. +3
    -3
      cmd/tendermint/flags.go
  3. +1
    -1
      config/tendermint/config.go
  4. +1
    -1
      config/tendermint_test/config.go
  5. +12
    -12
      consensus/common_test.go
  6. +20
    -20
      consensus/mempool_test.go
  7. +1
    -1
      consensus/reactor_test.go
  8. +1
    -1
      consensus/state.go
  9. +11
    -11
      glide.lock
  10. +1
    -1
      glide.yaml
  11. +15
    -15
      mempool/mempool.go
  12. +13
    -13
      mempool/mempool_test.go
  13. +2
    -2
      mempool/reactor.go
  14. +2
    -2
      node/node.go
  15. +23
    -23
      proxy/app_conn.go
  16. +11
    -11
      proxy/app_conn_test.go
  17. +11
    -11
      proxy/client.go
  18. +5
    -5
      proxy/multi_app_conn.go
  19. +4
    -4
      rpc/core/abci.go
  20. +19
    -19
      rpc/core/mempool.go
  21. +2
    -2
      rpc/core/pipe.go
  22. +6
    -6
      rpc/core/routes.go
  23. +11
    -11
      rpc/core/types/responses.go
  24. +1
    -1
      rpc/grpc/api.go
  25. +4
    -4
      rpc/grpc/types.pb.go
  26. +2
    -2
      rpc/grpc/types.proto
  27. +16
    -16
      rpc/test/client_test.go
  28. +2
    -2
      rpc/test/grpc_test.go
  29. +13
    -0
      scripts/install_abci_apps.sh
  30. +0
    -13
      scripts/install_tmsp_apps.sh
  31. +17
    -17
      state/execution.go
  32. +1
    -1
      state/execution_test.go
  33. +1
    -1
      test/app/counter_test.sh
  34. +8
    -8
      test/app/dummy_test.sh
  35. +4
    -4
      test/app/test.sh
  36. +1
    -1
      test/docker/Dockerfile
  37. +1
    -1
      test/p2p/data/app/init.sh
  38. +1
    -1
      test/p2p/data/core/init.sh
  39. +1
    -1
      test/test_libs.sh
  40. +2
    -2
      types/events.go
  41. +1
    -1
      types/protobuf.go
  42. +1
    -1
      version/version.go

+ 1
- 1
README.md View File

@ -39,7 +39,7 @@ Yay open source! Please see our [contributing guidelines](https://github.com/ten
### Sub-projects
* [TMSP](http://github.com/tendermint/tmsp)
* [ABCI](http://github.com/tendermint/abci)
* [Mintnet](http://github.com/tendermint/mintnet)
* [Go-Wire](http://github.com/tendermint/go-wire)
* [Go-P2P](http://github.com/tendermint/go-p2p)


+ 3
- 3
cmd/tendermint/flags.go View File

@ -19,7 +19,7 @@ func parseFlags(config cfg.Config, args []string) {
grpcLaddr string
logLevel string
proxyApp string
tmspTransport string
abciTransport string
)
// Declare flags
@ -35,7 +35,7 @@ func parseFlags(config cfg.Config, args []string) {
flags.StringVar(&logLevel, "log_level", config.GetString("log_level"), "Log level")
flags.StringVar(&proxyApp, "proxy_app", config.GetString("proxy_app"),
"Proxy app address, or 'nilapp' or 'dummy' for local testing.")
flags.StringVar(&tmspTransport, "tmsp", config.GetString("tmsp"), "Specify tmsp transport (socket | grpc)")
flags.StringVar(&abciTransport, "abci", config.GetString("abci"), "Specify abci transport (socket | grpc)")
flags.Parse(args)
if printHelp {
flags.PrintDefaults()
@ -52,5 +52,5 @@ func parseFlags(config cfg.Config, args []string) {
config.Set("grpc_laddr", grpcLaddr)
config.Set("log_level", logLevel)
config.Set("proxy_app", proxyApp)
config.Set("tmsp", tmspTransport)
config.Set("abci", abciTransport)
}

+ 1
- 1
config/tendermint/config.go View File

@ -54,7 +54,7 @@ func GetConfig(rootDir string) cfg.Config {
mapConfig.SetRequired("chain_id") // blows up if you try to use it before setting.
mapConfig.SetDefault("genesis_file", rootDir+"/genesis.json")
mapConfig.SetDefault("proxy_app", "tcp://127.0.0.1:46658")
mapConfig.SetDefault("tmsp", "socket")
mapConfig.SetDefault("abci", "socket")
mapConfig.SetDefault("moniker", "anonymous")
mapConfig.SetDefault("node_laddr", "tcp://0.0.0.0:46656")
mapConfig.SetDefault("seeds", "")


+ 1
- 1
config/tendermint_test/config.go View File

@ -70,7 +70,7 @@ func ResetConfig(localPath string) cfg.Config {
mapConfig.SetDefault("chain_id", "tendermint_test")
mapConfig.SetDefault("genesis_file", rootDir+"/genesis.json")
mapConfig.SetDefault("proxy_app", "dummy")
mapConfig.SetDefault("tmsp", "socket")
mapConfig.SetDefault("abci", "socket")
mapConfig.SetDefault("moniker", "anonymous")
mapConfig.SetDefault("node_laddr", "tcp://0.0.0.0:36656")
mapConfig.SetDefault("fast_sync", false)


+ 12
- 12
consensus/common_test.go View File

@ -20,11 +20,11 @@ import (
mempl "github.com/tendermint/tendermint/mempool"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
tmspcli "github.com/tendermint/tmsp/client"
tmsp "github.com/tendermint/tmsp/types"
abcicli "github.com/tendermint/abci/client"
abci "github.com/tendermint/abci/types"
"github.com/tendermint/tmsp/example/counter"
"github.com/tendermint/tmsp/example/dummy"
"github.com/tendermint/abci/example/counter"
"github.com/tendermint/abci/example/dummy"
)
var config cfg.Config // NOTE: must be reset for each _test.go file
@ -229,19 +229,19 @@ func readVotes(ch chan interface{}, reads int) chan struct{} {
//-------------------------------------------------------------------------------
// consensus states
func newConsensusState(state *sm.State, pv *types.PrivValidator, app tmsp.Application) *ConsensusState {
func newConsensusState(state *sm.State, pv *types.PrivValidator, app abci.Application) *ConsensusState {
return newConsensusStateWithConfig(config, state, pv, app)
}
func newConsensusStateWithConfig(thisConfig cfg.Config, state *sm.State, pv *types.PrivValidator, app tmsp.Application) *ConsensusState {
func newConsensusStateWithConfig(thisConfig cfg.Config, state *sm.State, pv *types.PrivValidator, app abci.Application) *ConsensusState {
// Get BlockStore
blockDB := dbm.NewMemDB()
blockStore := bc.NewBlockStore(blockDB)
// one for mempool, one for consensus
mtx := new(sync.Mutex)
proxyAppConnMem := tmspcli.NewLocalClient(mtx, app)
proxyAppConnCon := tmspcli.NewLocalClient(mtx, app)
proxyAppConnMem := abcicli.NewLocalClient(mtx, app)
proxyAppConnCon := abcicli.NewLocalClient(mtx, app)
// Make Mempool
mempool := mempl.NewMempool(thisConfig, proxyAppConnMem)
@ -312,7 +312,7 @@ func ensureNoNewStep(stepCh chan interface{}) {
//-------------------------------------------------------------------------------
// consensus nets
func randConsensusNet(nValidators int, testName string, tickerFunc func() TimeoutTicker, appFunc func() tmsp.Application) []*ConsensusState {
func randConsensusNet(nValidators int, testName string, tickerFunc func() TimeoutTicker, appFunc func() abci.Application) []*ConsensusState {
genDoc, privVals := randGenesisDoc(nValidators, false, 10)
css := make([]*ConsensusState, nValidators)
for i := 0; i < nValidators; i++ {
@ -328,7 +328,7 @@ func randConsensusNet(nValidators int, testName string, tickerFunc func() Timeou
}
// nPeers = nValidators + nNotValidator
func randConsensusNetWithPeers(nValidators, nPeers int, testName string, tickerFunc func() TimeoutTicker, appFunc func() tmsp.Application) []*ConsensusState {
func randConsensusNetWithPeers(nValidators, nPeers int, testName string, tickerFunc func() TimeoutTicker, appFunc func() abci.Application) []*ConsensusState {
genDoc, privVals := randGenesisDoc(nValidators, false, int64(testMinPower))
css := make([]*ConsensusState, nPeers)
for i := 0; i < nPeers; i++ {
@ -440,11 +440,11 @@ func (m *mockTicker) Chan() <-chan timeoutInfo {
//------------------------------------
func newCounter() tmsp.Application {
func newCounter() abci.Application {
return counter.NewCounterApplication(true)
}
func newPersistentDummy() tmsp.Application {
func newPersistentDummy() abci.Application {
dir, _ := ioutil.TempDir("/tmp", "persistent-dummy")
return dummy.NewPersistentDummyApplication(dir)
}

+ 20
- 20
consensus/mempool_test.go View File

@ -7,7 +7,7 @@ import (
"github.com/tendermint/tendermint/config/tendermint_test"
"github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
)
@ -23,8 +23,8 @@ func TestTxConcurrentWithCommit(t *testing.T) {
height, round := cs.Height, cs.Round
newBlockCh := subscribeToEvent(cs.evsw, "tester", types.EventStringNewBlock(), 1)
appendTxsRange := func(start, end int) {
// Append some txs.
deliverTxsRange := func(start, end int) {
// Deliver some txs.
for i := start; i < end; i++ {
txBytes := make([]byte, 8)
binary.BigEndian.PutUint64(txBytes, uint64(i))
@ -37,7 +37,7 @@ func TestTxConcurrentWithCommit(t *testing.T) {
}
NTxs := 10000
go appendTxsRange(0, NTxs)
go deliverTxsRange(0, NTxs)
startTestRound(cs, height, round)
ticker := time.NewTicker(time.Second * 20)
@ -59,17 +59,17 @@ func TestRmBadTx(t *testing.T) {
// increment the counter by 1
txBytes := make([]byte, 8)
binary.BigEndian.PutUint64(txBytes, uint64(0))
app.AppendTx(txBytes)
app.DeliverTx(txBytes)
app.Commit()
ch := make(chan struct{})
cbCh := make(chan struct{})
go func() {
// Try to send the tx through the mempool.
// CheckTx should not err, but the app should return a bad tmsp code
// CheckTx should not err, but the app should return a bad abci code
// and the tx should get removed from the pool
err := cs.mempool.CheckTx(txBytes, func(r *tmsp.Response) {
if r.GetCheckTx().Code != tmsp.CodeType_BadNonce {
err := cs.mempool.CheckTx(txBytes, func(r *abci.Response) {
if r.GetCheckTx().Code != abci.CodeType_BadNonce {
t.Fatalf("expected checktx to return bad nonce, got %v", r)
}
cbCh <- struct{}{}
@ -122,45 +122,45 @@ func NewCounterApplication() *CounterApplication {
return &CounterApplication{}
}
func (app *CounterApplication) Info() tmsp.ResponseInfo {
return tmsp.ResponseInfo{Data: Fmt("txs:%v", app.txCount)}
func (app *CounterApplication) Info() abci.ResponseInfo {
return abci.ResponseInfo{Data: Fmt("txs:%v", app.txCount)}
}
func (app *CounterApplication) SetOption(key string, value string) (log string) {
return ""
}
func (app *CounterApplication) AppendTx(tx []byte) tmsp.Result {
func (app *CounterApplication) DeliverTx(tx []byte) abci.Result {
return runTx(tx, &app.txCount)
}
func (app *CounterApplication) CheckTx(tx []byte) tmsp.Result {
func (app *CounterApplication) CheckTx(tx []byte) abci.Result {
return runTx(tx, &app.mempoolTxCount)
}
func runTx(tx []byte, countPtr *int) tmsp.Result {
func runTx(tx []byte, countPtr *int) abci.Result {
count := *countPtr
tx8 := make([]byte, 8)
copy(tx8[len(tx8)-len(tx):], tx)
txValue := binary.BigEndian.Uint64(tx8)
if txValue != uint64(count) {
return tmsp.ErrBadNonce.AppendLog(Fmt("Invalid nonce. Expected %v, got %v", count, txValue))
return abci.ErrBadNonce.AppendLog(Fmt("Invalid nonce. Expected %v, got %v", count, txValue))
}
*countPtr += 1
return tmsp.OK
return abci.OK
}
func (app *CounterApplication) Commit() tmsp.Result {
func (app *CounterApplication) Commit() abci.Result {
app.mempoolTxCount = app.txCount
if app.txCount == 0 {
return tmsp.OK
return abci.OK
} else {
hash := make([]byte, 8)
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return tmsp.NewResultOK(hash, "")
return abci.NewResultOK(hash, "")
}
}
func (app *CounterApplication) Query(query []byte) tmsp.Result {
return tmsp.NewResultOK(nil, Fmt("Query is not supported"))
func (app *CounterApplication) Query(query []byte) abci.Result {
return abci.NewResultOK(nil, Fmt("Query is not supported"))
}

+ 1
- 1
consensus/reactor_test.go View File

@ -11,7 +11,7 @@ import (
"github.com/tendermint/go-events"
"github.com/tendermint/go-p2p"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tmsp/example/dummy"
"github.com/tendermint/abci/example/dummy"
)
func init() {


+ 1
- 1
consensus/state.go View File

@ -354,7 +354,7 @@ func (cs *ConsensusState) OnStart() error {
return err
}
// If the latest block was applied in the tmsp handshake,
// If the latest block was applied in the abci handshake,
// we may not have written the current height to the wal,
// so check here and write it if not found.
// TODO: remove this and run the handhsake/replay


+ 11
- 11
glide.lock View File

@ -1,5 +1,5 @@
hash: 8e2e970c04c55b02740daa62647bb637964504a65c45cf274ffed5b0b1930ae4
updated: 2017-01-12T14:56:02.152843341-05:00
hash: 0655af0148909b2311f54b5ad1bf7c299583d675fc6b79774020ae2b6f26a12c
updated: 2017-01-12T16:12:19.790522242-05:00
imports:
- name: github.com/btcsuite/btcd
version: afec1bd1245a4a19e6dfe1306974b733e7cbb9b8
@ -48,6 +48,15 @@ imports:
- leveldb/storage
- leveldb/table
- leveldb/util
- name: github.com/tendermint/abci
version: 624dca61b31ee9d7a49fe2a9343018913eee3f11
subpackages:
- client
- example/counter
- example/dummy
- example/nil
- server
- types
- name: github.com/tendermint/ed25519
version: 1f52c6f8b8a5c7908aff4497c186af344b428925
subpackages:
@ -93,15 +102,6 @@ imports:
version: ae0f3d6450da9eac7074b439c8e1c3cabf0d5ce6
subpackages:
- term
- name: github.com/tendermint/tmsp
version: f8167872d8ddd3a2362452ef1414991b5afa8862
subpackages:
- client
- example/counter
- example/dummy
- example/nil
- server
- types
- name: golang.org/x/crypto
version: ede567c8e044a5913dad1d1af3696d9da953104c
subpackages:


+ 1
- 1
glide.yaml View File

@ -28,7 +28,7 @@ import:
- package: github.com/tendermint/go-wire
version: develop
- package: github.com/tendermint/log15
- package: github.com/tendermint/tmsp
- package: github.com/tendermint/abci
version: develop
- package: golang.org/x/crypto
subpackages:


+ 15
- 15
mempool/mempool.go View File

@ -13,7 +13,7 @@ import (
cfg "github.com/tendermint/go-config"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
)
/*
@ -40,7 +40,7 @@ Garbage collection of old elements from mempool.txs is handlde via
the DetachPrev() call, which makes old elements not reachable by
peer broadcastTxRoutine() automatically garbage collected.
TODO: Better handle tmsp client errors. (make it automatically handle connection errors)
TODO: Better handle abci client errors. (make it automatically handle connection errors)
*/
@ -139,17 +139,17 @@ func (mem *Mempool) TxsFrontWait() *clist.CElement {
// cb: A callback from the CheckTx command.
// It gets called from another goroutine.
// CONTRACT: Either cb will get called, or err returned.
func (mem *Mempool) CheckTx(tx types.Tx, cb func(*tmsp.Response)) (err error) {
func (mem *Mempool) CheckTx(tx types.Tx, cb func(*abci.Response)) (err error) {
mem.proxyMtx.Lock()
defer mem.proxyMtx.Unlock()
// CACHE
if mem.cache.Exists(tx) {
if cb != nil {
cb(&tmsp.Response{
Value: &tmsp.Response_CheckTx{
&tmsp.ResponseCheckTx{
Code: tmsp.CodeType_BadNonce, // TODO or duplicate tx
cb(&abci.Response{
Value: &abci.Response_CheckTx{
&abci.ResponseCheckTx{
Code: abci.CodeType_BadNonce, // TODO or duplicate tx
Log: "Duplicate transaction (ignored)",
},
},
@ -180,8 +180,8 @@ func (mem *Mempool) CheckTx(tx types.Tx, cb func(*tmsp.Response)) (err error) {
return nil
}
// TMSP callback function
func (mem *Mempool) resCb(req *tmsp.Request, res *tmsp.Response) {
// ABCI callback function
func (mem *Mempool) resCb(req *abci.Request, res *abci.Response) {
if mem.recheckCursor == nil {
mem.resCbNormal(req, res)
} else {
@ -189,10 +189,10 @@ func (mem *Mempool) resCb(req *tmsp.Request, res *tmsp.Response) {
}
}
func (mem *Mempool) resCbNormal(req *tmsp.Request, res *tmsp.Response) {
func (mem *Mempool) resCbNormal(req *abci.Request, res *abci.Response) {
switch r := res.Value.(type) {
case *tmsp.Response_CheckTx:
if r.CheckTx.Code == tmsp.CodeType_OK {
case *abci.Response_CheckTx:
if r.CheckTx.Code == abci.CodeType_OK {
mem.counter++
memTx := &mempoolTx{
counter: mem.counter,
@ -214,15 +214,15 @@ func (mem *Mempool) resCbNormal(req *tmsp.Request, res *tmsp.Response) {
}
}
func (mem *Mempool) resCbRecheck(req *tmsp.Request, res *tmsp.Response) {
func (mem *Mempool) resCbRecheck(req *abci.Request, res *abci.Response) {
switch r := res.Value.(type) {
case *tmsp.Response_CheckTx:
case *abci.Response_CheckTx:
memTx := mem.recheckCursor.Value.(*mempoolTx)
if !bytes.Equal(req.GetCheckTx().Tx, memTx.tx) {
PanicSanity(Fmt("Unexpected tx response from proxy during recheck\n"+
"Expected %X, got %X", r.CheckTx.Data, memTx.tx))
}
if r.CheckTx.Code == tmsp.CodeType_OK {
if r.CheckTx.Code == abci.CodeType_OK {
// Good, nothing to do.
} else {
// Tx became invalidated due to newly committed block.


+ 13
- 13
mempool/mempool_test.go View File

@ -7,7 +7,7 @@ import (
"github.com/tendermint/tendermint/config/tendermint_test"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tmsp/example/counter"
"github.com/tendermint/abci/example/counter"
)
func TestSerialReap(t *testing.T) {
@ -16,12 +16,12 @@ func TestSerialReap(t *testing.T) {
app := counter.NewCounterApplication(true)
app.SetOption("serial", "on")
cc := proxy.NewLocalClientCreator(app)
appConnMem, _ := cc.NewTMSPClient()
appConnCon, _ := cc.NewTMSPClient()
appConnMem, _ := cc.NewABCIClient()
appConnCon, _ := cc.NewABCIClient()
mempool := NewMempool(config, appConnMem)
appendTxsRange := func(start, end int) {
// Append some txs.
deliverTxsRange := func(start, end int) {
// Deliver some txs.
for i := start; i < end; i++ {
// This will succeed
@ -61,11 +61,11 @@ func TestSerialReap(t *testing.T) {
}
commitRange := func(start, end int) {
// Append some txs.
// Deliver some txs.
for i := start; i < end; i++ {
txBytes := make([]byte, 8)
binary.BigEndian.PutUint64(txBytes, uint64(i))
res := appConnCon.AppendTxSync(txBytes)
res := appConnCon.DeliverTxSync(txBytes)
if !res.IsOK() {
t.Errorf("Error committing tx. Code:%v result:%X log:%v",
res.Code, res.Data, res.Log)
@ -79,8 +79,8 @@ func TestSerialReap(t *testing.T) {
//----------------------------------------
// Append some txs.
appendTxsRange(0, 100)
// Deliver some txs.
deliverTxsRange(0, 100)
// Reap the txs.
reapCheck(100)
@ -88,9 +88,9 @@ func TestSerialReap(t *testing.T) {
// Reap again. We should get the same amount
reapCheck(100)
// Append 0 to 999, we should reap 900 new txs
// Deliver 0 to 999, we should reap 900 new txs
// because 100 were already counted.
appendTxsRange(0, 1000)
deliverTxsRange(0, 1000)
// Reap the txs.
reapCheck(1000)
@ -105,8 +105,8 @@ func TestSerialReap(t *testing.T) {
// We should have 500 left.
reapCheck(500)
// Append 100 invalid txs and 100 valid txs
appendTxsRange(900, 1100)
// Deliver 100 invalid txs and 100 valid txs
deliverTxsRange(900, 1100)
// We should have 600 now.
reapCheck(600)


+ 2
- 2
mempool/reactor.go View File

@ -12,7 +12,7 @@ import (
"github.com/tendermint/go-p2p"
"github.com/tendermint/go-wire"
"github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
)
const (
@ -85,7 +85,7 @@ func (memR *MempoolReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte) {
}
// Just an alias for CheckTx since broadcasting happens in peer routines
func (memR *MempoolReactor) BroadcastTx(tx types.Tx, cb func(*tmsp.Response)) error {
func (memR *MempoolReactor) BroadcastTx(tx types.Tx, cb func(*abci.Response)) error {
return memR.Mempool.CheckTx(tx, cb)
}


+ 2
- 2
node/node.go View File

@ -113,7 +113,7 @@ func NewNode(config cfg.Config, privValidator *types.PrivValidator, clientCreato
sw.AddReactor("BLOCKCHAIN", bcReactor)
sw.AddReactor("CONSENSUS", consensusReactor)
// filter peers by addr or pubkey with a tmsp query.
// filter peers by addr or pubkey with a abci query.
// if the query return code is OK, add peer
// XXX: query format subject to change
if config.GetBool("filter_peers") {
@ -311,7 +311,7 @@ func makeNodeInfo(config cfg.Config, sw *p2p.Switch, privKey crypto.PrivKeyEd255
// Users wishing to:
// * use an external signer for their validators
// * supply an in-proc tmsp app
// * supply an in-proc abci app
// should fork tendermint/tendermint and implement RunNode to
// call NewNode with their custom priv validator and/or custom
// proxy.ClientCreator interface


+ 23
- 23
proxy/app_conn.go View File

@ -1,32 +1,32 @@
package proxy
import (
tmspcli "github.com/tendermint/tmsp/client"
"github.com/tendermint/tmsp/types"
abcicli "github.com/tendermint/abci/client"
"github.com/tendermint/abci/types"
)
//----------------------------------------------------------------------------------------
// Enforce which tmsp msgs can be sent on a connection at the type level
// Enforce which abci msgs can be sent on a connection at the type level
type AppConnConsensus interface {
SetResponseCallback(tmspcli.Callback)
SetResponseCallback(abcicli.Callback)
Error() error
InitChainSync(validators []*types.Validator) (err error)
BeginBlockSync(hash []byte, header *types.Header) (err error)
AppendTxAsync(tx []byte) *tmspcli.ReqRes
DeliverTxAsync(tx []byte) *abcicli.ReqRes
EndBlockSync(height uint64) (types.ResponseEndBlock, error)
CommitSync() (res types.Result)
}
type AppConnMempool interface {
SetResponseCallback(tmspcli.Callback)
SetResponseCallback(abcicli.Callback)
Error() error
CheckTxAsync(tx []byte) *tmspcli.ReqRes
CheckTxAsync(tx []byte) *abcicli.ReqRes
FlushAsync() *tmspcli.ReqRes
FlushAsync() *abcicli.ReqRes
FlushSync() error
}
@ -41,19 +41,19 @@ type AppConnQuery interface {
}
//-----------------------------------------------------------------------------------------
// Implements AppConnConsensus (subset of tmspcli.Client)
// Implements AppConnConsensus (subset of abcicli.Client)
type appConnConsensus struct {
appConn tmspcli.Client
appConn abcicli.Client
}
func NewAppConnConsensus(appConn tmspcli.Client) *appConnConsensus {
func NewAppConnConsensus(appConn abcicli.Client) *appConnConsensus {
return &appConnConsensus{
appConn: appConn,
}
}
func (app *appConnConsensus) SetResponseCallback(cb tmspcli.Callback) {
func (app *appConnConsensus) SetResponseCallback(cb abcicli.Callback) {
app.appConn.SetResponseCallback(cb)
}
@ -69,8 +69,8 @@ func (app *appConnConsensus) BeginBlockSync(hash []byte, header *types.Header) (
return app.appConn.BeginBlockSync(hash, header)
}
func (app *appConnConsensus) AppendTxAsync(tx []byte) *tmspcli.ReqRes {
return app.appConn.AppendTxAsync(tx)
func (app *appConnConsensus) DeliverTxAsync(tx []byte) *abcicli.ReqRes {
return app.appConn.DeliverTxAsync(tx)
}
func (app *appConnConsensus) EndBlockSync(height uint64) (types.ResponseEndBlock, error) {
@ -82,19 +82,19 @@ func (app *appConnConsensus) CommitSync() (res types.Result) {
}
//------------------------------------------------
// Implements AppConnMempool (subset of tmspcli.Client)
// Implements AppConnMempool (subset of abcicli.Client)
type appConnMempool struct {
appConn tmspcli.Client
appConn abcicli.Client
}
func NewAppConnMempool(appConn tmspcli.Client) *appConnMempool {
func NewAppConnMempool(appConn abcicli.Client) *appConnMempool {
return &appConnMempool{
appConn: appConn,
}
}
func (app *appConnMempool) SetResponseCallback(cb tmspcli.Callback) {
func (app *appConnMempool) SetResponseCallback(cb abcicli.Callback) {
app.appConn.SetResponseCallback(cb)
}
@ -102,7 +102,7 @@ func (app *appConnMempool) Error() error {
return app.appConn.Error()
}
func (app *appConnMempool) FlushAsync() *tmspcli.ReqRes {
func (app *appConnMempool) FlushAsync() *abcicli.ReqRes {
return app.appConn.FlushAsync()
}
@ -110,18 +110,18 @@ func (app *appConnMempool) FlushSync() error {
return app.appConn.FlushSync()
}
func (app *appConnMempool) CheckTxAsync(tx []byte) *tmspcli.ReqRes {
func (app *appConnMempool) CheckTxAsync(tx []byte) *abcicli.ReqRes {
return app.appConn.CheckTxAsync(tx)
}
//------------------------------------------------
// Implements AppConnQuery (subset of tmspcli.Client)
// Implements AppConnQuery (subset of abcicli.Client)
type appConnQuery struct {
appConn tmspcli.Client
appConn abcicli.Client
}
func NewAppConnQuery(appConn tmspcli.Client) *appConnQuery {
func NewAppConnQuery(appConn abcicli.Client) *appConnQuery {
return &appConnQuery{
appConn: appConn,
}


+ 11
- 11
proxy/app_conn_test.go View File

@ -5,29 +5,29 @@ import (
"testing"
. "github.com/tendermint/go-common"
tmspcli "github.com/tendermint/tmsp/client"
"github.com/tendermint/tmsp/example/dummy"
"github.com/tendermint/tmsp/server"
"github.com/tendermint/tmsp/types"
abcicli "github.com/tendermint/abci/client"
"github.com/tendermint/abci/example/dummy"
"github.com/tendermint/abci/server"
"github.com/tendermint/abci/types"
)
//----------------------------------------
type AppConnTest interface {
EchoAsync(string) *tmspcli.ReqRes
EchoAsync(string) *abcicli.ReqRes
FlushSync() error
InfoSync() (types.ResponseInfo, error)
}
type appConnTest struct {
appConn tmspcli.Client
appConn abcicli.Client
}
func NewAppConnTest(appConn tmspcli.Client) AppConnTest {
func NewAppConnTest(appConn abcicli.Client) AppConnTest {
return &appConnTest{appConn}
}
func (app *appConnTest) EchoAsync(msg string) *tmspcli.ReqRes {
func (app *appConnTest) EchoAsync(msg string) *abcicli.ReqRes {
return app.appConn.EchoAsync(msg)
}
@ -54,7 +54,7 @@ func TestEcho(t *testing.T) {
}
defer s.Stop()
// Start client
cli, err := clientCreator.NewTMSPClient()
cli, err := clientCreator.NewABCIClient()
if err != nil {
Exit(err.Error())
}
@ -78,7 +78,7 @@ func BenchmarkEcho(b *testing.B) {
}
defer s.Stop()
// Start client
cli, err := clientCreator.NewTMSPClient()
cli, err := clientCreator.NewABCIClient()
if err != nil {
Exit(err.Error())
}
@ -107,7 +107,7 @@ func TestInfo(t *testing.T) {
}
defer s.Stop()
// Start client
cli, err := clientCreator.NewTMSPClient()
cli, err := clientCreator.NewABCIClient()
if err != nil {
Exit(err.Error())
}


+ 11
- 11
proxy/client.go View File

@ -5,15 +5,15 @@ import (
"sync"
cfg "github.com/tendermint/go-config"
tmspcli "github.com/tendermint/tmsp/client"
"github.com/tendermint/tmsp/example/dummy"
nilapp "github.com/tendermint/tmsp/example/nil"
"github.com/tendermint/tmsp/types"
abcicli "github.com/tendermint/abci/client"
"github.com/tendermint/abci/example/dummy"
nilapp "github.com/tendermint/abci/example/nil"
"github.com/tendermint/abci/types"
)
// NewTMSPClient returns newly connected client
// NewABCIClient returns newly connected client
type ClientCreator interface {
NewTMSPClient() (tmspcli.Client, error)
NewABCIClient() (abcicli.Client, error)
}
//----------------------------------------------------
@ -31,8 +31,8 @@ func NewLocalClientCreator(app types.Application) ClientCreator {
}
}
func (l *localClientCreator) NewTMSPClient() (tmspcli.Client, error) {
return tmspcli.NewLocalClient(l.mtx, l.app), nil
func (l *localClientCreator) NewABCIClient() (abcicli.Client, error) {
return abcicli.NewLocalClient(l.mtx, l.app), nil
}
//---------------------------------------------------------------
@ -52,9 +52,9 @@ func NewRemoteClientCreator(addr, transport string, mustConnect bool) ClientCrea
}
}
func (r *remoteClientCreator) NewTMSPClient() (tmspcli.Client, error) {
func (r *remoteClientCreator) NewABCIClient() (abcicli.Client, error) {
// Run forever in a loop
remoteApp, err := tmspcli.NewClient(r.addr, r.transport, r.mustConnect)
remoteApp, err := abcicli.NewClient(r.addr, r.transport, r.mustConnect)
if err != nil {
return nil, fmt.Errorf("Failed to connect to proxy: %v", err)
}
@ -66,7 +66,7 @@ func (r *remoteClientCreator) NewTMSPClient() (tmspcli.Client, error) {
func DefaultClientCreator(config cfg.Config) ClientCreator {
addr := config.GetString("proxy_app")
transport := config.GetString("tmsp")
transport := config.GetString("abci")
switch addr {
case "dummy":


+ 5
- 5
proxy/multi_app_conn.go View File

@ -28,7 +28,7 @@ type Handshaker interface {
}
// a multiAppConn is made of a few appConns (mempool, consensus, query)
// and manages their underlying tmsp clients, including the handshake
// and manages their underlying abci clients, including the handshake
// which ensures the app and tendermint are synced.
// TODO: on app restart, clients must reboot together
type multiAppConn struct {
@ -45,7 +45,7 @@ type multiAppConn struct {
clientCreator ClientCreator
}
// Make all necessary tmsp connections to the application
// Make all necessary abci connections to the application
func NewMultiAppConn(config cfg.Config, clientCreator ClientCreator, handshaker Handshaker) *multiAppConn {
multiAppConn := &multiAppConn{
config: config,
@ -75,21 +75,21 @@ func (app *multiAppConn) OnStart() error {
app.BaseService.OnStart()
// query connection
querycli, err := app.clientCreator.NewTMSPClient()
querycli, err := app.clientCreator.NewABCIClient()
if err != nil {
return err
}
app.queryConn = NewAppConnQuery(querycli)
// mempool connection
memcli, err := app.clientCreator.NewTMSPClient()
memcli, err := app.clientCreator.NewABCIClient()
if err != nil {
return err
}
app.mempoolConn = NewAppConnMempool(memcli)
// consensus connection
concli, err := app.clientCreator.NewTMSPClient()
concli, err := app.clientCreator.NewABCIClient()
if err != nil {
return err
}


rpc/core/tmsp.go → rpc/core/abci.go View File


+ 19
- 19
rpc/core/mempool.go View File

@ -6,7 +6,7 @@ import (
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
)
//-----------------------------------------------------------------------------
@ -23,8 +23,8 @@ func BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
// Returns with the response from CheckTx
func BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
resCh := make(chan *tmsp.Response, 1)
err := mempool.CheckTx(tx, func(res *tmsp.Response) {
resCh := make(chan *abci.Response, 1)
err := mempool.CheckTx(tx, func(res *abci.Response) {
resCh <- res
})
if err != nil {
@ -41,19 +41,19 @@ func BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
// CONTRACT: only returns error if mempool.BroadcastTx errs (ie. problem with the app)
// or if we timeout waiting for tx to commit.
// If CheckTx or AppendTx fail, no error will be returned, but the returned result
// will contain a non-OK TMSP code.
// If CheckTx or DeliverTx fail, no error will be returned, but the returned result
// will contain a non-OK ABCI code.
func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
// subscribe to tx being committed in block
appendTxResCh := make(chan types.EventDataTx, 1)
deliverTxResCh := make(chan types.EventDataTx, 1)
types.AddListenerForEvent(eventSwitch, "rpc", types.EventStringTx(tx), func(data types.TMEventData) {
appendTxResCh <- data.(types.EventDataTx)
deliverTxResCh <- data.(types.EventDataTx)
})
// broadcast the tx and register checktx callback
checkTxResCh := make(chan *tmsp.Response, 1)
err := mempool.CheckTx(tx, func(res *tmsp.Response) {
checkTxResCh := make(chan *abci.Response, 1)
err := mempool.CheckTx(tx, func(res *abci.Response) {
checkTxResCh <- res
})
if err != nil {
@ -62,11 +62,11 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
}
checkTxRes := <-checkTxResCh
checkTxR := checkTxRes.GetCheckTx()
if checkTxR.Code != tmsp.CodeType_OK {
if checkTxR.Code != abci.CodeType_OK {
// CheckTx failed!
return &ctypes.ResultBroadcastTxCommit{
CheckTx: checkTxR,
AppendTx: nil,
DeliverTx: nil,
}, nil
}
@ -75,23 +75,23 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
// TODO: configureable?
timer := time.NewTimer(60 * 2 * time.Second)
select {
case appendTxRes := <-appendTxResCh:
case deliverTxRes := <-deliverTxResCh:
// The tx was included in a block.
appendTxR := &tmsp.ResponseAppendTx{
Code: appendTxRes.Code,
Data: appendTxRes.Data,
Log: appendTxRes.Log,
deliverTxR := &abci.ResponseDeliverTx{
Code: deliverTxRes.Code,
Data: deliverTxRes.Data,
Log: deliverTxRes.Log,
}
log.Notice("AppendTx passed ", "tx", []byte(tx), "response", appendTxR)
log.Notice("DeliverTx passed ", "tx", []byte(tx), "response", deliverTxR)
return &ctypes.ResultBroadcastTxCommit{
CheckTx: checkTxR,
AppendTx: appendTxR,
DeliverTx: deliverTxR,
}, nil
case <-timer.C:
log.Error("failed to include tx")
return &ctypes.ResultBroadcastTxCommit{
CheckTx: checkTxR,
AppendTx: nil,
DeliverTx: nil,
}, fmt.Errorf("Timed out waiting for transaction to be included in a block")
}


+ 2
- 2
rpc/core/pipe.go View File

@ -8,7 +8,7 @@ import (
"github.com/tendermint/tendermint/consensus"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
)
//-----------------------------------------------------
@ -28,7 +28,7 @@ type Consensus interface {
type Mempool interface {
Size() int
CheckTx(types.Tx, func(*tmsp.Response)) error
CheckTx(types.Tx, func(*abci.Response)) error
Reap(int) []types.Tx
Flush()
}


+ 6
- 6
rpc/core/routes.go View File

@ -25,8 +25,8 @@ var Routes = map[string]*rpc.RPCFunc{
"unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxsResult, ""),
"num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxsResult, ""),
"tmsp_query": rpc.NewRPCFunc(TMSPQueryResult, "query"),
"tmsp_info": rpc.NewRPCFunc(TMSPInfoResult, ""),
"abci_query": rpc.NewRPCFunc(ABCIQueryResult, "query"),
"abci_info": rpc.NewRPCFunc(ABCIInfoResult, ""),
"unsafe_flush_mempool": rpc.NewRPCFunc(UnsafeFlushMempool, ""),
"unsafe_set_config": rpc.NewRPCFunc(UnsafeSetConfigResult, "type,key,value"),
@ -155,16 +155,16 @@ func BroadcastTxAsyncResult(tx []byte) (ctypes.TMResult, error) {
}
}
func TMSPQueryResult(query []byte) (ctypes.TMResult, error) {
if r, err := TMSPQuery(query); err != nil {
func ABCIQueryResult(query []byte) (ctypes.TMResult, error) {
if r, err := ABCIQuery(query); err != nil {
return nil, err
} else {
return r, nil
}
}
func TMSPInfoResult() (ctypes.TMResult, error) {
if r, err := TMSPInfo(); err != nil {
func ABCIInfoResult() (ctypes.TMResult, error) {
if r, err := ABCIInfo(); err != nil {
return nil, err
} else {
return r, nil


+ 11
- 11
rpc/core/types/responses.go View File

@ -6,7 +6,7 @@ import (
"github.com/tendermint/go-rpc/types"
"github.com/tendermint/go-wire"
"github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
)
type ResultBlockchainInfo struct {
@ -58,14 +58,14 @@ type ResultDumpConsensusState struct {
}
type ResultBroadcastTx struct {
Code tmsp.CodeType `json:"code"`
Code abci.CodeType `json:"code"`
Data []byte `json:"data"`
Log string `json:"log"`
}
type ResultBroadcastTxCommit struct {
CheckTx *tmsp.ResponseCheckTx `json:"check_tx"`
AppendTx *tmsp.ResponseAppendTx `json:"append_tx"`
CheckTx *abci.ResponseCheckTx `json:"check_tx"`
DeliverTx *abci.ResponseDeliverTx `json:"deliver_tx"`
}
type ResultUnconfirmedTxs struct {
@ -73,15 +73,15 @@ type ResultUnconfirmedTxs struct {
Txs []types.Tx `json:"txs"`
}
type ResultTMSPInfo struct {
type ResultABCIInfo struct {
Data string `json:"data"`
Version string `json:"version"`
LastBlockHeight uint64 `json:"last_block_height"`
LastBlockAppHash []byte `json:"last_block_app_hash"`
}
type ResultTMSPQuery struct {
Result tmsp.Result `json:"result"`
type ResultABCIQuery struct {
Result abci.Result `json:"result"`
}
type ResultUnsafeFlushMempool struct{}
@ -125,8 +125,8 @@ const (
ResultTypeBroadcastTxCommit = byte(0x62)
// 0x7 bytes are for querying the application
ResultTypeTMSPQuery = byte(0x70)
ResultTypeTMSPInfo = byte(0x71)
ResultTypeABCIQuery = byte(0x70)
ResultTypeABCIInfo = byte(0x71)
// 0x8 bytes are for events
ResultTypeSubscribe = byte(0x80)
@ -167,6 +167,6 @@ var _ = wire.RegisterInterface(
wire.ConcreteType{&ResultUnsafeProfile{}, ResultTypeUnsafeStopCPUProfiler},
wire.ConcreteType{&ResultUnsafeProfile{}, ResultTypeUnsafeWriteHeapProfile},
wire.ConcreteType{&ResultUnsafeFlushMempool{}, ResultTypeUnsafeFlushMempool},
wire.ConcreteType{&ResultTMSPQuery{}, ResultTypeTMSPQuery},
wire.ConcreteType{&ResultTMSPInfo{}, ResultTypeTMSPInfo},
wire.ConcreteType{&ResultABCIQuery{}, ResultTypeABCIQuery},
wire.ConcreteType{&ResultABCIInfo{}, ResultTypeABCIInfo},
)

+ 1
- 1
rpc/grpc/api.go View File

@ -14,5 +14,5 @@ func (bapi *broadcastAPI) BroadcastTx(ctx context.Context, req *RequestBroadcast
if err != nil {
return nil, err
}
return &ResponseBroadcastTx{res.CheckTx, res.AppendTx}, nil
return &ResponseBroadcastTx{res.CheckTx, res.DeliverTx}, nil
}

+ 4
- 4
rpc/grpc/types.pb.go View File

@ -17,7 +17,7 @@ package core_grpc
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import types "github.com/tendermint/tmsp/types"
import types "github.com/tendermint/abci/types"
import (
context "golang.org/x/net/context"
@ -53,7 +53,7 @@ func (m *RequestBroadcastTx) GetTx() []byte {
type ResponseBroadcastTx struct {
CheckTx *types.ResponseCheckTx `protobuf:"bytes,1,opt,name=check_tx,json=checkTx" json:"check_tx,omitempty"`
AppendTx *types.ResponseAppendTx `protobuf:"bytes,2,opt,name=append_tx,json=appendTx" json:"append_tx,omitempty"`
DeliverTx *types.ResponseDeliverTx `protobuf:"bytes,2,opt,name=deliver_tx,json=deliverTx" json:"deliver_tx,omitempty"`
}
func (m *ResponseBroadcastTx) Reset() { *m = ResponseBroadcastTx{} }
@ -68,9 +68,9 @@ func (m *ResponseBroadcastTx) GetCheckTx() *types.ResponseCheckTx {
return nil
}
func (m *ResponseBroadcastTx) GetAppendTx() *types.ResponseAppendTx {
func (m *ResponseBroadcastTx) GetDeliverTx() *types.ResponseDeliverTx {
if m != nil {
return m.AppendTx
return m.DeliverTx
}
return nil
}


+ 2
- 2
rpc/grpc/types.proto View File

@ -1,7 +1,7 @@
syntax = "proto3";
package core_grpc;
import "github.com/tendermint/tmsp/types/types.proto";
import "github.com/tendermint/abci/types/types.proto";
//----------------------------------------
// Message types
@ -18,7 +18,7 @@ message RequestBroadcastTx {
message ResponseBroadcastTx{
types.ResponseCheckTx check_tx = 1;
types.ResponseAppendTx append_tx = 2;
types.ResponseDeliverTx deliver_tx = 2;
}
//----------------------------------------


+ 16
- 16
rpc/test/client_test.go View File

@ -12,8 +12,8 @@ import (
"github.com/tendermint/go-wire"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tmsp/example/dummy"
tmsp "github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/example/dummy"
abci "github.com/tendermint/abci/types"
)
//--------------------------------------------------------------------------------
@ -92,7 +92,7 @@ func TestJSONBroadcastTxSync(t *testing.T) {
func testBroadcastTxSync(t *testing.T, resI interface{}, tx []byte) {
tmRes := resI.(*ctypes.TMResult)
res := (*tmRes).(*ctypes.ResultBroadcastTx)
if res.Code != tmsp.CodeType_OK {
if res.Code != abci.CodeType_OK {
panic(Fmt("BroadcastTxSync got non-zero exit code: %v. %X; %s", res.Code, res.Data, res.Log))
}
mem := node.MempoolReactor().Mempool
@ -130,30 +130,30 @@ func sendTx() ([]byte, []byte) {
return k, v
}
func TestURITMSPQuery(t *testing.T) {
func TestURIABCIQuery(t *testing.T) {
k, v := sendTx()
time.Sleep(time.Second)
tmResult := new(ctypes.TMResult)
_, err := clientURI.Call("tmsp_query", map[string]interface{}{"query": k}, tmResult)
_, err := clientURI.Call("abci_query", map[string]interface{}{"query": k}, tmResult)
if err != nil {
panic(err)
}
testTMSPQuery(t, tmResult, v)
testABCIQuery(t, tmResult, v)
}
func TestJSONTMSPQuery(t *testing.T) {
func TestJSONABCIQuery(t *testing.T) {
k, v := sendTx()
tmResult := new(ctypes.TMResult)
_, err := clientJSON.Call("tmsp_query", []interface{}{k}, tmResult)
_, err := clientJSON.Call("abci_query", []interface{}{k}, tmResult)
if err != nil {
panic(err)
}
testTMSPQuery(t, tmResult, v)
testABCIQuery(t, tmResult, v)
}
func testTMSPQuery(t *testing.T, statusI interface{}, value []byte) {
func testABCIQuery(t *testing.T, statusI interface{}, value []byte) {
tmRes := statusI.(*ctypes.TMResult)
query := (*tmRes).(*ctypes.ResultTMSPQuery)
query := (*tmRes).(*ctypes.ResultABCIQuery)
if query.Result.IsErr() {
panic(Fmt("Query returned an err: %v", query))
}
@ -195,12 +195,12 @@ func testBroadcastTxCommit(t *testing.T, resI interface{}, tx []byte) {
tmRes := resI.(*ctypes.TMResult)
res := (*tmRes).(*ctypes.ResultBroadcastTxCommit)
checkTx := res.CheckTx
if checkTx.Code != tmsp.CodeType_OK {
if checkTx.Code != abci.CodeType_OK {
panic(Fmt("BroadcastTxCommit got non-zero exit code from CheckTx: %v. %X; %s", checkTx.Code, checkTx.Data, checkTx.Log))
}
appendTx := res.AppendTx
if appendTx.Code != tmsp.CodeType_OK {
panic(Fmt("BroadcastTxCommit got non-zero exit code from CheckTx: %v. %X; %s", appendTx.Code, appendTx.Data, appendTx.Log))
deliverTx := res.DeliverTx
if deliverTx.Code != abci.CodeType_OK {
panic(Fmt("BroadcastTxCommit got non-zero exit code from CheckTx: %v. %X; %s", deliverTx.Code, deliverTx.Data, deliverTx.Log))
}
mem := node.MempoolReactor().Mempool
if mem.Size() != 0 {
@ -295,7 +295,7 @@ func TestWSTxEvent(t *testing.T) {
if bytes.Compare([]byte(evt.Tx), tx) != 0 {
t.Error("Event returned different tx")
}
if evt.Code != tmsp.CodeType_OK {
if evt.Code != abci.CodeType_OK {
t.Error("Event returned tx error code", evt.Code)
}
return nil


+ 2
- 2
rpc/test/grpc_test.go View File

@ -18,7 +18,7 @@ func TestBroadcastTx(t *testing.T) {
if res.CheckTx.Code != 0 {
t.Fatalf("Non-zero check tx code: %d", res.CheckTx.Code)
}
if res.AppendTx.Code != 0 {
t.Fatalf("Non-zero append tx code: %d", res.AppendTx.Code)
if res.DeliverTx.Code != 0 {
t.Fatalf("Non-zero append tx code: %d", res.DeliverTx.Code)
}
}

+ 13
- 0
scripts/install_abci_apps.sh View File

@ -0,0 +1,13 @@
#! /bin/bash
go get github.com/tendermint/abci/...
# get the abci commit used by tendermint
COMMIT=`bash scripts/glide/parse.sh abci`
echo "Checking out vendored commit for abci: $COMMIT"
cd $GOPATH/src/github.com/tendermint/abci
git checkout $COMMIT
glide install
go install ./cmd/...

+ 0
- 13
scripts/install_tmsp_apps.sh View File

@ -1,13 +0,0 @@
#! /bin/bash
go get github.com/tendermint/tmsp/...
# get the tmsp commit used by tendermint
COMMIT=`bash scripts/glide/parse.sh tmsp`
echo "Checking out vendored commit for tmsp: $COMMIT"
cd $GOPATH/src/github.com/tendermint/tmsp
git checkout $COMMIT
glide install
go install ./cmd/...

+ 17
- 17
state/execution.go View File

@ -11,7 +11,7 @@ import (
"github.com/tendermint/go-crypto"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
)
//--------------------------------------------------
@ -66,31 +66,31 @@ func (s *State) ExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnC
// Executes block's transactions on proxyAppConn.
// Returns a list of updates to the validator set
// TODO: Generate a bitmap or otherwise store tx validity in state.
func execBlockOnProxyApp(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block) ([]*tmsp.Validator, error) {
func execBlockOnProxyApp(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block) ([]*abci.Validator, error) {
var validTxs, invalidTxs = 0, 0
// Execute transactions and get hash
proxyCb := func(req *tmsp.Request, res *tmsp.Response) {
proxyCb := func(req *abci.Request, res *abci.Response) {
switch r := res.Value.(type) {
case *tmsp.Response_AppendTx:
case *abci.Response_DeliverTx:
// TODO: make use of res.Log
// TODO: make use of this info
// Blocks may include invalid txs.
// reqAppendTx := req.(tmsp.RequestAppendTx)
// reqDeliverTx := req.(abci.RequestDeliverTx)
txError := ""
apTx := r.AppendTx
if apTx.Code == tmsp.CodeType_OK {
apTx := r.DeliverTx
if apTx.Code == abci.CodeType_OK {
validTxs += 1
} else {
log.Debug("Invalid tx", "code", r.AppendTx.Code, "log", r.AppendTx.Log)
log.Debug("Invalid tx", "code", r.DeliverTx.Code, "log", r.DeliverTx.Log)
invalidTxs += 1
txError = apTx.Code.String()
}
// NOTE: if we count we can access the tx from the block instead of
// pulling it from the req
event := types.EventDataTx{
Tx: req.GetAppendTx().Tx,
Tx: req.GetDeliverTx().Tx,
Data: apTx.Data,
Code: apTx.Code,
Log: apTx.Log,
@ -113,7 +113,7 @@ func execBlockOnProxyApp(eventCache types.Fireable, proxyAppConn proxy.AppConnCo
// Run txs of block
for _, tx := range block.Txs {
fail.FailRand(len(block.Txs)) // XXX
proxyAppConn.AppendTxAsync(tx)
proxyAppConn.DeliverTxAsync(tx)
if err := proxyAppConn.Error(); err != nil {
return nil, err
}
@ -132,12 +132,12 @@ func execBlockOnProxyApp(eventCache types.Fireable, proxyAppConn proxy.AppConnCo
log.Info("Executed block", "height", block.Height, "valid txs", validTxs, "invalid txs", invalidTxs)
if len(respEndBlock.Diffs) > 0 {
log.Info("Update to validator set", "updates", tmsp.ValidatorsString(respEndBlock.Diffs))
log.Info("Update to validator set", "updates", abci.ValidatorsString(respEndBlock.Diffs))
}
return respEndBlock.Diffs, nil
}
func updateValidators(validators *types.ValidatorSet, changedValidators []*tmsp.Validator) error {
func updateValidators(validators *types.ValidatorSet, changedValidators []*abci.Validator) error {
// TODO: prevent change of 1/3+ at once
for _, v := range changedValidators {
@ -321,7 +321,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error {
blockHeight := int(res.LastBlockHeight) // XXX: beware overflow
appHash := res.LastBlockAppHash
log.Notice("TMSP Handshake", "appHeight", blockHeight, "appHash", appHash)
log.Notice("ABCI Handshake", "appHeight", blockHeight, "appHash", appHash)
// TODO: check version
@ -344,7 +344,7 @@ func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int, appConnCon
storeBlockHeight := h.store.Height()
stateBlockHeight := h.state.LastBlockHeight
log.Notice("TMSP Replay Blocks", "appHeight", appBlockHeight, "storeHeight", storeBlockHeight, "stateHeight", stateBlockHeight)
log.Notice("ABCI Replay Blocks", "appHeight", appBlockHeight, "storeHeight", storeBlockHeight, "stateHeight", stateBlockHeight)
if storeBlockHeight == 0 {
return nil
@ -355,20 +355,20 @@ func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int, appConnCon
} else if storeBlockHeight == appBlockHeight {
// We ran Commit, but if we crashed before state.Save(),
// load the intermediate state and update the state.AppHash.
// NOTE: If TMSP allowed rollbacks, we could just replay the
// NOTE: If ABCI allowed rollbacks, we could just replay the
// block even though it's been committed
stateAppHash := h.state.AppHash
lastBlockAppHash := h.store.LoadBlock(storeBlockHeight).AppHash
if bytes.Equal(stateAppHash, appHash) {
// we're all synced up
log.Debug("TMSP RelpayBlocks: Already synced")
log.Debug("ABCI RelpayBlocks: Already synced")
} else if bytes.Equal(stateAppHash, lastBlockAppHash) {
// we crashed after commit and before saving state,
// so load the intermediate state and update the hash
h.state.LoadIntermediate()
h.state.AppHash = appHash
log.Debug("TMSP RelpayBlocks: Loaded intermediate state and updated state.AppHash")
log.Debug("ABCI RelpayBlocks: Loaded intermediate state and updated state.AppHash")
} else {
PanicSanity(Fmt("Unexpected state.AppHash: state.AppHash %X; app.AppHash %X, lastBlock.AppHash %X", stateAppHash, appHash, lastBlockAppHash))


+ 1
- 1
state/execution_test.go View File

@ -13,7 +13,7 @@ import (
dbm "github.com/tendermint/go-db"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tmsp/example/dummy"
"github.com/tendermint/abci/example/dummy"
)
var (


+ 1
- 1
test/app/counter_test.sh View File

@ -50,7 +50,7 @@ function sendTx() {
if [[ "$IS_JSON" != "0" ]]; then
ERROR="$RESPONSE"
fi
APPEND_TX_RESPONSE=`echo $RESPONSE | jq .append_tx`
APPEND_TX_RESPONSE=`echo $RESPONSE | jq .deliver_tx`
APPEND_TX_CODE=`getCode "$APPEND_TX_RESPONSE"`
CHECK_TX_RESPONSE=`echo $RESPONSE | jq .check_tx`
CHECK_TX_CODE=`getCode "$CHECK_TX_RESPONSE"`


+ 8
- 8
test/app/dummy_test.sh View File

@ -21,13 +21,13 @@ echo ""
###########################
# test using the tmsp-cli
# test using the abci-cli
###########################
echo "... testing query with tmsp-cli"
echo "... testing query with abci-cli"
# we should be able to look up the key
RESPONSE=`tmsp-cli query \"$KEY\"`
RESPONSE=`abci-cli query \"$KEY\"`
set +e
A=`echo $RESPONSE | grep '"exists":true'`
@ -39,7 +39,7 @@ fi
set -e
# we should not be able to look up the value
RESPONSE=`tmsp-cli query \"$VALUE\"`
RESPONSE=`abci-cli query \"$VALUE\"`
set +e
A=`echo $RESPONSE | grep '"exists":true'`
if [[ $? == 0 ]]; then
@ -50,13 +50,13 @@ fi
set -e
#############################
# test using the /tmsp_query
# test using the /abci_query
#############################
echo "... testing query with /tmsp_query"
echo "... testing query with /abci_query"
# we should be able to look up the key
RESPONSE=`curl -s 127.0.0.1:46657/tmsp_query?query=$(toHex $KEY)`
RESPONSE=`curl -s 127.0.0.1:46657/abci_query?query=$(toHex $KEY)`
RESPONSE=`echo $RESPONSE | jq .result[1].result.Data | xxd -r -p`
set +e
@ -69,7 +69,7 @@ fi
set -e
# we should not be able to look up the value
RESPONSE=`curl -s 127.0.0.1:46657/tmsp_query?query=\"$(toHex $VALUE)\"`
RESPONSE=`curl -s 127.0.0.1:46657/abci_query?query=\"$(toHex $VALUE)\"`
RESPONSE=`echo $RESPONSE | jq .result[1].result.Data | xxd -r -p`
set +e
A=`echo $RESPONSE | grep '"exists":true'`


+ 4
- 4
test/app/test.sh View File

@ -65,9 +65,9 @@ function counter_over_grpc() {
rm -rf $TMROOT
tendermint init
echo "Starting counter_over_grpc"
counter --serial --tmsp grpc > /dev/null &
counter --serial --abci grpc > /dev/null &
pid_counter=$!
tendermint node --tmsp grpc > tendermint.log &
tendermint node --abci grpc > tendermint.log &
pid_tendermint=$!
sleep 5
@ -81,11 +81,11 @@ function counter_over_grpc_grpc() {
rm -rf $TMROOT
tendermint init
echo "Starting counter_over_grpc_grpc (ie. with grpc broadcast_tx)"
counter --serial --tmsp grpc > /dev/null &
counter --serial --abci grpc > /dev/null &
pid_counter=$!
sleep 1
GRPC_PORT=36656
tendermint node --tmsp grpc --grpc_laddr tcp://localhost:$GRPC_PORT > tendermint.log &
tendermint node --abci grpc --grpc_laddr tcp://localhost:$GRPC_PORT > tendermint.log &
pid_tendermint=$!
sleep 5


+ 1
- 1
test/docker/Dockerfile View File

@ -19,7 +19,7 @@ RUN make get_vendor_deps
COPY . $REPO
RUN go install ./cmd/tendermint
RUN bash scripts/install_tmsp_apps.sh
RUN bash scripts/install_abci_apps.sh
# expose the volume for debugging
VOLUME $REPO


+ 1
- 1
test/p2p/data/app/init.sh View File

@ -1,5 +1,5 @@
#! /bin/bash
# This is a sample bash script for a TMSP application
# This is a sample bash script for a ABCI application
cd app/
git clone https://github.com/tendermint/nomnomcoin.git


+ 1
- 1
test/p2p/data/core/init.sh View File

@ -8,7 +8,7 @@ BRANCH="master"
go get -d $TMREPO/cmd/tendermint
### DEPENDENCIES (example)
# cd $GOPATH/src/github.com/tendermint/tmsp
# cd $GOPATH/src/github.com/tendermint/abci
# git fetch origin $BRANCH
# git checkout $BRANCH
### DEPENDENCIES END


+ 1
- 1
test/test_libs.sh View File

@ -12,7 +12,7 @@ fi
####################
LIBS_GO_TEST=(go-clist go-common go-config go-crypto go-db go-events go-merkle go-p2p)
LIBS_MAKE_TEST=(go-rpc go-wire tmsp)
LIBS_MAKE_TEST=(go-rpc go-wire abci)
for lib in "${LIBS_GO_TEST[@]}"; do


+ 2
- 2
types/events.go View File

@ -5,7 +5,7 @@ import (
. "github.com/tendermint/go-common"
"github.com/tendermint/go-events"
"github.com/tendermint/go-wire"
tmsp "github.com/tendermint/tmsp/types"
abci "github.com/tendermint/abci/types"
)
// Functions to generate eventId strings
@ -76,7 +76,7 @@ type EventDataTx struct {
Tx Tx `json:"tx"`
Data []byte `json:"data"`
Log string `json:"log"`
Code tmsp.CodeType `json:"code"`
Code abci.CodeType `json:"code"`
Error string `json:"error"` // this is redundant information for now
}


+ 1
- 1
types/protobuf.go View File

@ -1,7 +1,7 @@
package types
import (
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
)
// Convert tendermint types to protobuf types


+ 1
- 1
version/version.go View File

@ -1,7 +1,7 @@
package version
const Maj = "0"
const Min = "7" // tmsp useability (protobuf, unix); optimizations; broadcast_tx_commit
const Min = "7" // abci useability (protobuf, unix); optimizations; broadcast_tx_commit
const Fix = "3" // fixes to event safety, mempool deadlock, hvs race, replay non-empty blocks
const Version = Maj + "." + Min + "." + Fix

Loading…
Cancel
Save