mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-31 13:16:59 +00:00
TMSP -> ABCI
This commit is contained in:
@@ -4,18 +4,18 @@ import (
|
||||
"flag"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/server"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address")
|
||||
tmspPtr := flag.String("tmsp", "socket", "socket | grpc")
|
||||
abciPtr := flag.String("abci", "socket", "socket | grpc")
|
||||
flag.Parse()
|
||||
|
||||
// Start the listener
|
||||
srv, err := server.NewServer(*addrPtr, *tmspPtr, NewChainAwareApplication())
|
||||
srv, err := server.NewServer(*addrPtr, *abciPtr, NewChainAwareApplication())
|
||||
if err != nil {
|
||||
Exit(err.Error())
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/client"
|
||||
"github.com/tendermint/tmsp/server"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/client"
|
||||
"github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func TestChainAware(t *testing.T) {
|
||||
@@ -23,7 +23,7 @@ func TestChainAware(t *testing.T) {
|
||||
defer srv.Stop()
|
||||
|
||||
// Connect to the socket
|
||||
client, err := tmspcli.NewSocketClient("unix://test.sock", false)
|
||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||
if err != nil {
|
||||
Exit(Fmt("Error starting socket client: %v", err.Error()))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/binary"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type CounterApplication struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ The app has no replay protection (other than what the mempool provides).
|
||||
The PersistentDummyApplication wraps the DummyApplication
|
||||
and provides two additional features:
|
||||
|
||||
1) persistence of state across app restarts (using Tendermint's TMSP-Handshake mechanism)
|
||||
1) persistence of state across app restarts (using Tendermint's ABCI-Handshake mechanism)
|
||||
2) validator set changes
|
||||
|
||||
The state is persisted in leveldb along with the last block committed,
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type DummyApplication struct {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func testDummy(t *testing.T, dummy types.Application, tx []byte, key, value string) {
|
||||
@@ -49,7 +49,7 @@ func TestDummyKV(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPersistentDummyKV(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("/tmp", "tmsp-dummy-test") // TODO
|
||||
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func TestPersistentDummyKV(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPersistentDummyInfo(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("/tmp", "tmsp-dummy-test") // TODO
|
||||
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -96,7 +96,7 @@ func TestPersistentDummyInfo(t *testing.T) {
|
||||
|
||||
// add a validator, remove a validator, update a validator
|
||||
func TestValSetChanges(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("/tmp", "tmsp-dummy-test") // TODO
|
||||
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
dbm "github.com/tendermint/go-db"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/client"
|
||||
"github.com/tendermint/tmsp/example/dummy"
|
||||
nilapp "github.com/tendermint/tmsp/example/nil"
|
||||
"github.com/tendermint/tmsp/server"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/client"
|
||||
"github.com/tendermint/abci/example/dummy"
|
||||
nilapp "github.com/tendermint/abci/example/nil"
|
||||
"github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func TestDummy(t *testing.T) {
|
||||
@@ -45,7 +45,7 @@ func testStream(t *testing.T, app types.Application) {
|
||||
defer server.Stop()
|
||||
|
||||
// Connect to the socket
|
||||
client, err := tmspcli.NewSocketClient("unix://test.sock", false)
|
||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||
if err != nil {
|
||||
Exit(Fmt("Error starting socket client: %v", err.Error()))
|
||||
}
|
||||
@@ -124,7 +124,7 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
client := types.NewTMSPApplicationClient(conn)
|
||||
client := types.NewABCIApplicationClient(conn)
|
||||
|
||||
// Write requests
|
||||
for counter := 0; counter < numDeliverTxs; counter++ {
|
||||
|
||||
@@ -1 +1 @@
|
||||
This example has been moved here: https://github.com/tendermint/js-tmsp/tree/master/example
|
||||
This example has been moved here: https://github.com/tendermint/js-abci/tree/master/example
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package nilapp
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type NilApplication struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ message_types = {
|
||||
0x25: "rm_listener",
|
||||
}
|
||||
|
||||
# return the decoded arguments of tmsp messages
|
||||
# return the decoded arguments of abci messages
|
||||
|
||||
class RequestDecoder():
|
||||
|
||||
@@ -26,9 +26,9 @@ class Connection():
|
||||
raise IOError("dead connection")
|
||||
this.recBuf.write(data)
|
||||
|
||||
# TMSP server responds to messges by calling methods on the app
|
||||
# ABCI server responds to messges by calling methods on the app
|
||||
|
||||
class TMSPServer():
|
||||
class ABCIServer():
|
||||
|
||||
def __init__(self, app, port=5410):
|
||||
self.app = app
|
||||
@@ -1,8 +1,8 @@
|
||||
import sys
|
||||
|
||||
from tmsp.wire import hex2bytes, decode_big_endian, encode_big_endian
|
||||
from tmsp.server import TMSPServer
|
||||
from tmsp.reader import BytesBuffer
|
||||
from abci.wire import hex2bytes, decode_big_endian, encode_big_endian
|
||||
from abci.server import ABCIServer
|
||||
from abci.reader import BytesBuffer
|
||||
|
||||
|
||||
class CounterApplication():
|
||||
@@ -75,8 +75,8 @@ if __name__ == '__main__':
|
||||
print "too many arguments"
|
||||
quit()
|
||||
|
||||
print 'TMSP Demo APP (Python)'
|
||||
print 'ABCI Demo APP (Python)'
|
||||
|
||||
app = CounterApplication()
|
||||
server = TMSPServer(app, port)
|
||||
server = ABCIServer(app, port)
|
||||
server.main_loop()
|
||||
|
||||
@@ -13,7 +13,7 @@ message_types = {
|
||||
0x25: "rm_listener",
|
||||
}
|
||||
|
||||
# return the decoded arguments of tmsp messages
|
||||
# return the decoded arguments of abci messages
|
||||
|
||||
class RequestDecoder():
|
||||
|
||||
@@ -29,9 +29,9 @@ class Connection():
|
||||
raise IOError("dead connection")
|
||||
this.recBuf.write(data)
|
||||
|
||||
# TMSP server responds to messges by calling methods on the app
|
||||
# ABCI server responds to messges by calling methods on the app
|
||||
|
||||
class TMSPServer():
|
||||
class ABCIServer():
|
||||
|
||||
def __init__(self, app, port=5410):
|
||||
self.app = app
|
||||
@@ -1,8 +1,8 @@
|
||||
import sys
|
||||
|
||||
from tmsp.wire import hex2bytes, decode_big_endian, encode_big_endian
|
||||
from tmsp.server import TMSPServer
|
||||
from tmsp.reader import BytesBuffer
|
||||
from abci.wire import hex2bytes, decode_big_endian, encode_big_endian
|
||||
from abci.server import ABCIServer
|
||||
from abci.reader import BytesBuffer
|
||||
|
||||
|
||||
class CounterApplication():
|
||||
@@ -75,8 +75,8 @@ if __name__ == '__main__':
|
||||
print("too many arguments")
|
||||
quit()
|
||||
|
||||
print('TMSP Demo APP (Python)')
|
||||
print('ABCI Demo APP (Python)')
|
||||
|
||||
app = CounterApplication()
|
||||
server = TMSPServer(app, port)
|
||||
server = ABCIServer(app, port)
|
||||
server.main_loop()
|
||||
|
||||
Reference in New Issue
Block a user