rename dummy to kvstore (#1223)
* remove accidental binary * docs: s/Dummy&dummy/KVStore&kvstore/g * glide update to abci * update abci import paths * dummy begone, hello kvstore * RequestInitChain needs genesisBytes * glide update
This commit is contained in:
parent
6270ecef8c
commit
2cc63069c6
|
@ -32,4 +32,4 @@ EXPOSE 46657
|
||||||
|
|
||||||
ENTRYPOINT ["tendermint"]
|
ENTRYPOINT ["tendermint"]
|
||||||
|
|
||||||
CMD ["node", "--moniker=`hostname`", "--proxy_app=dummy"]
|
CMD ["node", "--moniker=`hostname`", "--proxy_app=kvstore"]
|
||||||
|
|
|
@ -34,13 +34,13 @@ To get started developing applications, see the [application developers guide](h
|
||||||
|
|
||||||
# How to use this image
|
# How to use this image
|
||||||
|
|
||||||
## Start one instance of the Tendermint core with the `dummy` app
|
## Start one instance of the Tendermint core with the `kvstore` app
|
||||||
|
|
||||||
A very simple example of a built-in app and Tendermint core in one container.
|
A very simple example of a built-in app and Tendermint core in one container.
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init
|
docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init
|
||||||
docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app=dummy
|
docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app=kvstore
|
||||||
```
|
```
|
||||||
|
|
||||||
## mintnet-kubernetes
|
## mintnet-kubernetes
|
||||||
|
|
|
@ -14,7 +14,7 @@ if [ ! -d $DATA ]; then
|
||||||
echo "starting node"
|
echo "starting node"
|
||||||
tendermint node \
|
tendermint node \
|
||||||
--home $DATA \
|
--home $DATA \
|
||||||
--proxy_app dummy \
|
--proxy_app kvstore \
|
||||||
--p2p.laddr tcp://127.0.0.1:56656 \
|
--p2p.laddr tcp://127.0.0.1:56656 \
|
||||||
--rpc.laddr tcp://127.0.0.1:56657 \
|
--rpc.laddr tcp://127.0.0.1:56657 \
|
||||||
--log_level error &
|
--log_level error &
|
||||||
|
@ -35,7 +35,7 @@ cp -R $DATA $HOME1
|
||||||
echo "starting validator node"
|
echo "starting validator node"
|
||||||
tendermint node \
|
tendermint node \
|
||||||
--home $HOME1 \
|
--home $HOME1 \
|
||||||
--proxy_app dummy \
|
--proxy_app kvstore \
|
||||||
--p2p.laddr tcp://127.0.0.1:56656 \
|
--p2p.laddr tcp://127.0.0.1:56656 \
|
||||||
--rpc.laddr tcp://127.0.0.1:56657 \
|
--rpc.laddr tcp://127.0.0.1:56657 \
|
||||||
--log_level error &
|
--log_level error &
|
||||||
|
@ -48,7 +48,7 @@ cp $HOME1/genesis.json $HOME2
|
||||||
printf "starting downloader node"
|
printf "starting downloader node"
|
||||||
tendermint node \
|
tendermint node \
|
||||||
--home $HOME2 \
|
--home $HOME2 \
|
||||||
--proxy_app dummy \
|
--proxy_app kvstore \
|
||||||
--p2p.laddr tcp://127.0.0.1:56666 \
|
--p2p.laddr tcp://127.0.0.1:56666 \
|
||||||
--rpc.laddr tcp://127.0.0.1:56667 \
|
--rpc.laddr tcp://127.0.0.1:56667 \
|
||||||
--p2p.persistent_peers 127.0.0.1:56656 \
|
--p2p.persistent_peers 127.0.0.1:56656 \
|
||||||
|
|
|
@ -18,7 +18,7 @@ func AddNodeFlags(cmd *cobra.Command) {
|
||||||
cmd.Flags().Bool("fast_sync", config.FastSync, "Fast blockchain syncing")
|
cmd.Flags().Bool("fast_sync", config.FastSync, "Fast blockchain syncing")
|
||||||
|
|
||||||
// abci flags
|
// abci flags
|
||||||
cmd.Flags().String("proxy_app", config.ProxyApp, "Proxy app address, or 'nilapp' or 'dummy' for local testing.")
|
cmd.Flags().String("proxy_app", config.ProxyApp, "Proxy app address, or 'nilapp' or 'kvstore' for local testing.")
|
||||||
cmd.Flags().String("abci", config.ABCI, "Specify abci transport (socket | grpc)")
|
cmd.Flags().String("abci", config.ABCI, "Specify abci transport (socket | grpc)")
|
||||||
|
|
||||||
// rpc flags
|
// rpc flags
|
||||||
|
|
|
@ -158,7 +158,7 @@ func DefaultBaseConfig() BaseConfig {
|
||||||
func TestBaseConfig() BaseConfig {
|
func TestBaseConfig() BaseConfig {
|
||||||
conf := DefaultBaseConfig()
|
conf := DefaultBaseConfig()
|
||||||
conf.chainID = "tendermint_test"
|
conf.chainID = "tendermint_test"
|
||||||
conf.ProxyApp = "dummy"
|
conf.ProxyApp = "kvstore"
|
||||||
conf.FastSync = false
|
conf.FastSync = false
|
||||||
conf.DBBackend = "memdb"
|
conf.DBBackend = "memdb"
|
||||||
return conf
|
return conf
|
||||||
|
|
|
@ -26,7 +26,7 @@ import (
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/counter"
|
"github.com/tendermint/abci/example/counter"
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
|
|
||||||
"github.com/go-kit/kit/log/term"
|
"github.com/go-kit/kit/log/term"
|
||||||
)
|
)
|
||||||
|
@ -50,7 +50,7 @@ func ResetConfig(name string) *cfg.Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
// validator stub (a dummy consensus peer we control)
|
// validator stub (a kvstore consensus peer we control)
|
||||||
|
|
||||||
type validatorStub struct {
|
type validatorStub struct {
|
||||||
Index int // Validator index. NOTE: we don't assume validator set changes.
|
Index int // Validator index. NOTE: we don't assume validator set changes.
|
||||||
|
@ -488,7 +488,7 @@ func newCounter() abci.Application {
|
||||||
return counter.NewCounterApplication(true)
|
return counter.NewCounterApplication(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPersistentDummy() abci.Application {
|
func newPersistentKVStore() abci.Application {
|
||||||
dir, _ := ioutil.TempDir("/tmp", "persistent-dummy")
|
dir, _ := ioutil.TempDir("/tmp", "persistent-kvstore")
|
||||||
return dummy.NewPersistentDummyApplication(dir)
|
return kvstore.NewPersistentKVStoreApplication(dir)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
|
||||||
cfg "github.com/tendermint/tendermint/config"
|
cfg "github.com/tendermint/tendermint/config"
|
||||||
|
@ -127,7 +127,7 @@ func TestReactorProposalHeartbeats(t *testing.T) {
|
||||||
func TestReactorVotingPowerChange(t *testing.T) {
|
func TestReactorVotingPowerChange(t *testing.T) {
|
||||||
nVals := 4
|
nVals := 4
|
||||||
logger := log.TestingLogger()
|
logger := log.TestingLogger()
|
||||||
css := randConsensusNet(nVals, "consensus_voting_power_changes_test", newMockTickerFunc(true), newPersistentDummy)
|
css := randConsensusNet(nVals, "consensus_voting_power_changes_test", newMockTickerFunc(true), newPersistentKVStore)
|
||||||
reactors, eventChans, eventBuses := startConsensusNet(t, css, nVals)
|
reactors, eventChans, eventBuses := startConsensusNet(t, css, nVals)
|
||||||
defer stopConsensusNet(logger, reactors, eventBuses)
|
defer stopConsensusNet(logger, reactors, eventBuses)
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ func TestReactorVotingPowerChange(t *testing.T) {
|
||||||
logger.Debug("---------------------------- Testing changing the voting power of one validator a few times")
|
logger.Debug("---------------------------- Testing changing the voting power of one validator a few times")
|
||||||
|
|
||||||
val1PubKey := css[0].privValidator.GetPubKey()
|
val1PubKey := css[0].privValidator.GetPubKey()
|
||||||
updateValidatorTx := dummy.MakeValSetChangeTx(val1PubKey.Bytes(), 25)
|
updateValidatorTx := kvstore.MakeValSetChangeTx(val1PubKey.Bytes(), 25)
|
||||||
previousTotalVotingPower := css[0].GetRoundState().LastValidators.TotalVotingPower()
|
previousTotalVotingPower := css[0].GetRoundState().LastValidators.TotalVotingPower()
|
||||||
|
|
||||||
waitForAndValidateBlock(t, nVals, activeVals, eventChans, css, updateValidatorTx)
|
waitForAndValidateBlock(t, nVals, activeVals, eventChans, css, updateValidatorTx)
|
||||||
|
@ -158,7 +158,7 @@ func TestReactorVotingPowerChange(t *testing.T) {
|
||||||
t.Fatalf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[0].GetRoundState().LastValidators.TotalVotingPower())
|
t.Fatalf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[0].GetRoundState().LastValidators.TotalVotingPower())
|
||||||
}
|
}
|
||||||
|
|
||||||
updateValidatorTx = dummy.MakeValSetChangeTx(val1PubKey.Bytes(), 2)
|
updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKey.Bytes(), 2)
|
||||||
previousTotalVotingPower = css[0].GetRoundState().LastValidators.TotalVotingPower()
|
previousTotalVotingPower = css[0].GetRoundState().LastValidators.TotalVotingPower()
|
||||||
|
|
||||||
waitForAndValidateBlock(t, nVals, activeVals, eventChans, css, updateValidatorTx)
|
waitForAndValidateBlock(t, nVals, activeVals, eventChans, css, updateValidatorTx)
|
||||||
|
@ -170,7 +170,7 @@ func TestReactorVotingPowerChange(t *testing.T) {
|
||||||
t.Fatalf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[0].GetRoundState().LastValidators.TotalVotingPower())
|
t.Fatalf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[0].GetRoundState().LastValidators.TotalVotingPower())
|
||||||
}
|
}
|
||||||
|
|
||||||
updateValidatorTx = dummy.MakeValSetChangeTx(val1PubKey.Bytes(), 26)
|
updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKey.Bytes(), 26)
|
||||||
previousTotalVotingPower = css[0].GetRoundState().LastValidators.TotalVotingPower()
|
previousTotalVotingPower = css[0].GetRoundState().LastValidators.TotalVotingPower()
|
||||||
|
|
||||||
waitForAndValidateBlock(t, nVals, activeVals, eventChans, css, updateValidatorTx)
|
waitForAndValidateBlock(t, nVals, activeVals, eventChans, css, updateValidatorTx)
|
||||||
|
@ -186,7 +186,7 @@ func TestReactorVotingPowerChange(t *testing.T) {
|
||||||
func TestReactorValidatorSetChanges(t *testing.T) {
|
func TestReactorValidatorSetChanges(t *testing.T) {
|
||||||
nPeers := 7
|
nPeers := 7
|
||||||
nVals := 4
|
nVals := 4
|
||||||
css := randConsensusNetWithPeers(nVals, nPeers, "consensus_val_set_changes_test", newMockTickerFunc(true), newPersistentDummy)
|
css := randConsensusNetWithPeers(nVals, nPeers, "consensus_val_set_changes_test", newMockTickerFunc(true), newPersistentKVStore)
|
||||||
|
|
||||||
logger := log.TestingLogger()
|
logger := log.TestingLogger()
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ func TestReactorValidatorSetChanges(t *testing.T) {
|
||||||
logger.Info("---------------------------- Testing adding one validator")
|
logger.Info("---------------------------- Testing adding one validator")
|
||||||
|
|
||||||
newValidatorPubKey1 := css[nVals].privValidator.GetPubKey()
|
newValidatorPubKey1 := css[nVals].privValidator.GetPubKey()
|
||||||
newValidatorTx1 := dummy.MakeValSetChangeTx(newValidatorPubKey1.Bytes(), testMinPower)
|
newValidatorTx1 := kvstore.MakeValSetChangeTx(newValidatorPubKey1.Bytes(), testMinPower)
|
||||||
|
|
||||||
// wait till everyone makes block 2
|
// wait till everyone makes block 2
|
||||||
// ensure the commit includes all validators
|
// ensure the commit includes all validators
|
||||||
|
@ -234,7 +234,7 @@ func TestReactorValidatorSetChanges(t *testing.T) {
|
||||||
logger.Info("---------------------------- Testing changing the voting power of one validator")
|
logger.Info("---------------------------- Testing changing the voting power of one validator")
|
||||||
|
|
||||||
updateValidatorPubKey1 := css[nVals].privValidator.GetPubKey()
|
updateValidatorPubKey1 := css[nVals].privValidator.GetPubKey()
|
||||||
updateValidatorTx1 := dummy.MakeValSetChangeTx(updateValidatorPubKey1.Bytes(), 25)
|
updateValidatorTx1 := kvstore.MakeValSetChangeTx(updateValidatorPubKey1.Bytes(), 25)
|
||||||
previousTotalVotingPower := css[nVals].GetRoundState().LastValidators.TotalVotingPower()
|
previousTotalVotingPower := css[nVals].GetRoundState().LastValidators.TotalVotingPower()
|
||||||
|
|
||||||
waitForAndValidateBlock(t, nPeers, activeVals, eventChans, css, updateValidatorTx1)
|
waitForAndValidateBlock(t, nPeers, activeVals, eventChans, css, updateValidatorTx1)
|
||||||
|
@ -250,10 +250,10 @@ func TestReactorValidatorSetChanges(t *testing.T) {
|
||||||
logger.Info("---------------------------- Testing adding two validators at once")
|
logger.Info("---------------------------- Testing adding two validators at once")
|
||||||
|
|
||||||
newValidatorPubKey2 := css[nVals+1].privValidator.GetPubKey()
|
newValidatorPubKey2 := css[nVals+1].privValidator.GetPubKey()
|
||||||
newValidatorTx2 := dummy.MakeValSetChangeTx(newValidatorPubKey2.Bytes(), testMinPower)
|
newValidatorTx2 := kvstore.MakeValSetChangeTx(newValidatorPubKey2.Bytes(), testMinPower)
|
||||||
|
|
||||||
newValidatorPubKey3 := css[nVals+2].privValidator.GetPubKey()
|
newValidatorPubKey3 := css[nVals+2].privValidator.GetPubKey()
|
||||||
newValidatorTx3 := dummy.MakeValSetChangeTx(newValidatorPubKey3.Bytes(), testMinPower)
|
newValidatorTx3 := kvstore.MakeValSetChangeTx(newValidatorPubKey3.Bytes(), testMinPower)
|
||||||
|
|
||||||
waitForAndValidateBlock(t, nPeers, activeVals, eventChans, css, newValidatorTx2, newValidatorTx3)
|
waitForAndValidateBlock(t, nPeers, activeVals, eventChans, css, newValidatorTx2, newValidatorTx3)
|
||||||
waitForAndValidateBlockWithTx(t, nPeers, activeVals, eventChans, css, newValidatorTx2, newValidatorTx3)
|
waitForAndValidateBlockWithTx(t, nPeers, activeVals, eventChans, css, newValidatorTx2, newValidatorTx3)
|
||||||
|
@ -265,8 +265,8 @@ func TestReactorValidatorSetChanges(t *testing.T) {
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
logger.Info("---------------------------- Testing removing two validators at once")
|
logger.Info("---------------------------- Testing removing two validators at once")
|
||||||
|
|
||||||
removeValidatorTx2 := dummy.MakeValSetChangeTx(newValidatorPubKey2.Bytes(), 0)
|
removeValidatorTx2 := kvstore.MakeValSetChangeTx(newValidatorPubKey2.Bytes(), 0)
|
||||||
removeValidatorTx3 := dummy.MakeValSetChangeTx(newValidatorPubKey3.Bytes(), 0)
|
removeValidatorTx3 := kvstore.MakeValSetChangeTx(newValidatorPubKey3.Bytes(), 0)
|
||||||
|
|
||||||
waitForAndValidateBlock(t, nPeers, activeVals, eventChans, css, removeValidatorTx2, removeValidatorTx3)
|
waitForAndValidateBlock(t, nPeers, activeVals, eventChans, css, removeValidatorTx2, removeValidatorTx3)
|
||||||
waitForAndValidateBlockWithTx(t, nPeers, activeVals, eventChans, css, removeValidatorTx2, removeValidatorTx3)
|
waitForAndValidateBlockWithTx(t, nPeers, activeVals, eventChans, css, removeValidatorTx2, removeValidatorTx3)
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
crypto "github.com/tendermint/go-crypto"
|
crypto "github.com/tendermint/go-crypto"
|
||||||
wire "github.com/tendermint/go-wire"
|
wire "github.com/tendermint/go-wire"
|
||||||
|
@ -55,7 +55,7 @@ func startNewConsensusStateAndWaitForBlock(t *testing.T, lastBlockHeight int64,
|
||||||
logger := log.TestingLogger()
|
logger := log.TestingLogger()
|
||||||
state, _ := sm.LoadStateFromDBOrGenesisFile(stateDB, consensusReplayConfig.GenesisFile())
|
state, _ := sm.LoadStateFromDBOrGenesisFile(stateDB, consensusReplayConfig.GenesisFile())
|
||||||
privValidator := loadPrivValidator(consensusReplayConfig)
|
privValidator := loadPrivValidator(consensusReplayConfig)
|
||||||
cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, dummy.NewDummyApplication(), blockDB)
|
cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, kvstore.NewKVStoreApplication(), blockDB)
|
||||||
cs.SetLogger(logger)
|
cs.SetLogger(logger)
|
||||||
|
|
||||||
bytes, _ := ioutil.ReadFile(cs.config.WalFile())
|
bytes, _ := ioutil.ReadFile(cs.config.WalFile())
|
||||||
|
@ -141,7 +141,7 @@ LOOP:
|
||||||
state, _ := sm.MakeGenesisStateFromFile(consensusReplayConfig.GenesisFile())
|
state, _ := sm.MakeGenesisStateFromFile(consensusReplayConfig.GenesisFile())
|
||||||
privValidator := loadPrivValidator(consensusReplayConfig)
|
privValidator := loadPrivValidator(consensusReplayConfig)
|
||||||
blockDB := dbm.NewMemDB()
|
blockDB := dbm.NewMemDB()
|
||||||
cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, dummy.NewDummyApplication(), blockDB)
|
cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, kvstore.NewKVStoreApplication(), blockDB)
|
||||||
cs.SetLogger(logger)
|
cs.SetLogger(logger)
|
||||||
|
|
||||||
// start sending transactions
|
// start sending transactions
|
||||||
|
@ -351,8 +351,8 @@ func testHandshakeReplay(t *testing.T, nBlocks int, mode uint) {
|
||||||
latestAppHash := state.AppHash
|
latestAppHash := state.AppHash
|
||||||
|
|
||||||
// make a new client creator
|
// make a new client creator
|
||||||
dummyApp := dummy.NewPersistentDummyApplication(path.Join(config.DBDir(), "2"))
|
kvstoreApp := kvstore.NewPersistentKVStoreApplication(path.Join(config.DBDir(), "2"))
|
||||||
clientCreator2 := proxy.NewLocalClientCreator(dummyApp)
|
clientCreator2 := proxy.NewLocalClientCreator(kvstoreApp)
|
||||||
if nBlocks > 0 {
|
if nBlocks > 0 {
|
||||||
// run nBlocks against a new client to build up the app state.
|
// run nBlocks against a new client to build up the app state.
|
||||||
// use a throwaway tendermint state
|
// use a throwaway tendermint state
|
||||||
|
@ -412,9 +412,9 @@ func buildAppStateFromChain(proxyApp proxy.AppConns, stateDB dbm.DB,
|
||||||
}
|
}
|
||||||
defer proxyApp.Stop()
|
defer proxyApp.Stop()
|
||||||
|
|
||||||
validators := types.TM2PB.Validators(state.Validators)
|
|
||||||
// TODO: get the genesis bytes (https://github.com/tendermint/tendermint/issues/1224)
|
// TODO: get the genesis bytes (https://github.com/tendermint/tendermint/issues/1224)
|
||||||
var genesisBytes []byte
|
var genesisBytes []byte
|
||||||
|
validators := types.TM2PB.Validators(state.Validators)
|
||||||
if _, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{validators, genesisBytes}); err != nil {
|
if _, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{validators, genesisBytes}); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ func buildAppStateFromChain(proxyApp proxy.AppConns, stateDB dbm.DB,
|
||||||
}
|
}
|
||||||
|
|
||||||
if mode == 2 {
|
if mode == 2 {
|
||||||
// update the dummy height and apphash
|
// update the kvstore height and apphash
|
||||||
// as if we ran commit but not
|
// as if we ran commit but not
|
||||||
state = applyBlock(stateDB, state, chain[nBlocks-1], proxyApp)
|
state = applyBlock(stateDB, state, chain[nBlocks-1], proxyApp)
|
||||||
}
|
}
|
||||||
|
@ -442,16 +442,16 @@ func buildAppStateFromChain(proxyApp proxy.AppConns, stateDB dbm.DB,
|
||||||
|
|
||||||
func buildTMStateFromChain(config *cfg.Config, stateDB dbm.DB, state sm.State, chain []*types.Block, mode uint) sm.State {
|
func buildTMStateFromChain(config *cfg.Config, stateDB dbm.DB, state sm.State, chain []*types.Block, mode uint) sm.State {
|
||||||
// run the whole chain against this client to build up the tendermint state
|
// run the whole chain against this client to build up the tendermint state
|
||||||
clientCreator := proxy.NewLocalClientCreator(dummy.NewPersistentDummyApplication(path.Join(config.DBDir(), "1")))
|
clientCreator := proxy.NewLocalClientCreator(kvstore.NewPersistentKVStoreApplication(path.Join(config.DBDir(), "1")))
|
||||||
proxyApp := proxy.NewAppConns(clientCreator, nil) // sm.NewHandshaker(config, state, store, ReplayLastBlock))
|
proxyApp := proxy.NewAppConns(clientCreator, nil) // sm.NewHandshaker(config, state, store, ReplayLastBlock))
|
||||||
if err := proxyApp.Start(); err != nil {
|
if err := proxyApp.Start(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer proxyApp.Stop()
|
defer proxyApp.Stop()
|
||||||
|
|
||||||
validators := types.TM2PB.Validators(state.Validators)
|
|
||||||
// TODO: get the genesis bytes (https://github.com/tendermint/tendermint/issues/1224)
|
// TODO: get the genesis bytes (https://github.com/tendermint/tendermint/issues/1224)
|
||||||
var genesisBytes []byte
|
var genesisBytes []byte
|
||||||
|
validators := types.TM2PB.Validators(state.Validators)
|
||||||
if _, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{validators, genesisBytes}); err != nil {
|
if _, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{validators, genesisBytes}); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
bc "github.com/tendermint/tendermint/blockchain"
|
bc "github.com/tendermint/tendermint/blockchain"
|
||||||
cfg "github.com/tendermint/tendermint/config"
|
cfg "github.com/tendermint/tendermint/config"
|
||||||
"github.com/tendermint/tendermint/proxy"
|
"github.com/tendermint/tendermint/proxy"
|
||||||
|
@ -25,13 +25,13 @@ import (
|
||||||
|
|
||||||
// WALWithNBlocks generates a consensus WAL. It does this by spining up a
|
// WALWithNBlocks generates a consensus WAL. It does this by spining up a
|
||||||
// stripped down version of node (proxy app, event bus, consensus state) with a
|
// stripped down version of node (proxy app, event bus, consensus state) with a
|
||||||
// persistent dummy application and special consensus wal instance
|
// persistent kvstore application and special consensus wal instance
|
||||||
// (byteBufferWAL) and waits until numBlocks are created. Then it returns a WAL
|
// (byteBufferWAL) and waits until numBlocks are created. Then it returns a WAL
|
||||||
// content.
|
// content.
|
||||||
func WALWithNBlocks(numBlocks int) (data []byte, err error) {
|
func WALWithNBlocks(numBlocks int) (data []byte, err error) {
|
||||||
config := getConfig()
|
config := getConfig()
|
||||||
|
|
||||||
app := dummy.NewPersistentDummyApplication(filepath.Join(config.DBDir(), "wal_generator"))
|
app := kvstore.NewPersistentKVStoreApplication(filepath.Join(config.DBDir(), "wal_generator"))
|
||||||
|
|
||||||
logger := log.TestingLogger().With("wal_generator", "wal_generator")
|
logger := log.TestingLogger().With("wal_generator", "wal_generator")
|
||||||
logger.Info("generating WAL (last height msg excluded)", "numBlocks", numBlocks)
|
logger.Info("generating WAL (last height msg excluded)", "numBlocks", numBlocks)
|
||||||
|
|
|
@ -40,7 +40,7 @@ Now run ``abci-cli`` to see the list of commands:
|
||||||
console Start an interactive abci console for multiple commands
|
console Start an interactive abci console for multiple commands
|
||||||
counter ABCI demo example
|
counter ABCI demo example
|
||||||
deliver_tx Deliver a new tx to the application
|
deliver_tx Deliver a new tx to the application
|
||||||
dummy ABCI demo example
|
kvstore ABCI demo example
|
||||||
echo Have the application echo a message
|
echo Have the application echo a message
|
||||||
help Help about any command
|
help Help about any command
|
||||||
info Get some info about the application
|
info Get some info about the application
|
||||||
|
@ -56,7 +56,7 @@ Now run ``abci-cli`` to see the list of commands:
|
||||||
Use "abci-cli [command] --help" for more information about a command.
|
Use "abci-cli [command] --help" for more information about a command.
|
||||||
|
|
||||||
|
|
||||||
Dummy - First Example
|
KVStore - First Example
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
The ``abci-cli`` tool lets us send ABCI messages to our application, to
|
The ``abci-cli`` tool lets us send ABCI messages to our application, to
|
||||||
|
@ -66,8 +66,8 @@ The most important messages are ``deliver_tx``, ``check_tx``, and
|
||||||
``commit``, but there are others for convenience, configuration, and
|
``commit``, but there are others for convenience, configuration, and
|
||||||
information purposes.
|
information purposes.
|
||||||
|
|
||||||
We'll start a dummy application, which was installed at the same time as
|
We'll start a kvstore application, which was installed at the same time as
|
||||||
``abci-cli`` above. The dummy just stores transactions in a merkle tree.
|
``abci-cli`` above. The kvstore just stores transactions in a merkle tree.
|
||||||
|
|
||||||
Its code can be found `here <https://github.com/tendermint/abci/blob/master/cmd/abci-cli/abci-cli.go>`__ and looks like:
|
Its code can be found `here <https://github.com/tendermint/abci/blob/master/cmd/abci-cli/abci-cli.go>`__ and looks like:
|
||||||
|
|
||||||
|
@ -75,20 +75,20 @@ Its code can be found `here <https://github.com/tendermint/abci/blob/master/cmd/
|
||||||
|
|
||||||
.. container:: header
|
.. container:: header
|
||||||
|
|
||||||
**Show/Hide Dummy Example**
|
**Show/Hide KVStore Example**
|
||||||
|
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
func cmdDummy(cmd *cobra.Command, args []string) error {
|
func cmdKVStore(cmd *cobra.Command, args []string) error {
|
||||||
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||||
|
|
||||||
// Create the application - in memory or persisted to disk
|
// Create the application - in memory or persisted to disk
|
||||||
var app types.Application
|
var app types.Application
|
||||||
if flagPersist == "" {
|
if flagPersist == "" {
|
||||||
app = dummy.NewDummyApplication()
|
app = kvstore.NewKVStoreApplication()
|
||||||
} else {
|
} else {
|
||||||
app = dummy.NewPersistentDummyApplication(flagPersist)
|
app = kvstore.NewPersistentKVStoreApplication(flagPersist)
|
||||||
app.(*dummy.PersistentDummyApplication).SetLogger(logger.With("module", "dummy"))
|
app.(*kvstore.PersistentKVStoreApplication).SetLogger(logger.With("module", "kvstore"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the listener
|
// Start the listener
|
||||||
|
@ -113,7 +113,7 @@ Start by running:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
abci-cli dummy
|
abci-cli kvstore
|
||||||
|
|
||||||
And in another terminal, run
|
And in another terminal, run
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ Counter - Another Example
|
||||||
Now that we've got the hang of it, let's try another application, the
|
Now that we've got the hang of it, let's try another application, the
|
||||||
"counter" app.
|
"counter" app.
|
||||||
|
|
||||||
Like the dummy app, its code can be found `here <https://github.com/tendermint/abci/blob/master/cmd/abci-cli/abci-cli.go>`__ and looks like:
|
Like the kvstore app, its code can be found `here <https://github.com/tendermint/abci/blob/master/cmd/abci-cli/abci-cli.go>`__ and looks like:
|
||||||
|
|
||||||
.. container:: toggle
|
.. container:: toggle
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ other peers.
|
||||||
In this instance of the counter app, ``check_tx`` only allows
|
In this instance of the counter app, ``check_tx`` only allows
|
||||||
transactions whose integer is greater than the last committed one.
|
transactions whose integer is greater than the last committed one.
|
||||||
|
|
||||||
Let's kill the console and the dummy application, and start the counter
|
Let's kill the console and the kvstore application, and start the counter
|
||||||
app:
|
app:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
@ -328,7 +328,7 @@ In another window, start the ``abci-cli console``:
|
||||||
-> data.hex: 0x7B22686173686573223A302C22747873223A327D
|
-> data.hex: 0x7B22686173686573223A302C22747873223A327D
|
||||||
|
|
||||||
This is a very simple application, but between ``counter`` and
|
This is a very simple application, but between ``counter`` and
|
||||||
``dummy``, its easy to see how you can build out arbitrary application
|
``kvstore``, its easy to see how you can build out arbitrary application
|
||||||
states on top of the ABCI. `Hyperledger's
|
states on top of the ABCI. `Hyperledger's
|
||||||
Burrow <https://github.com/hyperledger/burrow>`__ also runs atop ABCI,
|
Burrow <https://github.com/hyperledger/burrow>`__ also runs atop ABCI,
|
||||||
bringing with it Ethereum-like accounts, the Ethereum virtual-machine,
|
bringing with it Ethereum-like accounts, the Ethereum virtual-machine,
|
||||||
|
|
|
@ -142,10 +142,10 @@ It is unlikely that you will need to implement a client. For details of
|
||||||
our client, see
|
our client, see
|
||||||
`here <https://github.com/tendermint/abci/tree/master/client>`__.
|
`here <https://github.com/tendermint/abci/tree/master/client>`__.
|
||||||
|
|
||||||
Most of the examples below are from `dummy application
|
Most of the examples below are from `kvstore application
|
||||||
<https://github.com/tendermint/abci/blob/master/example/dummy/dummy.go>`__,
|
<https://github.com/tendermint/abci/blob/master/example/kvstore/kvstore.go>`__,
|
||||||
which is a part of the abci repo. `persistent_dummy application
|
which is a part of the abci repo. `persistent_kvstore application
|
||||||
<https://github.com/tendermint/abci/blob/master/example/dummy/persistent_dummy.go>`__
|
<https://github.com/tendermint/abci/blob/master/example/kvstore/persistent_kvstore.go>`__
|
||||||
is used to show ``BeginBlock``, ``EndBlock`` and ``InitChain``
|
is used to show ``BeginBlock``, ``EndBlock`` and ``InitChain``
|
||||||
example implementations.
|
example implementations.
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ mempool state.
|
||||||
|
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
func (app *DummyApplication) CheckTx(tx []byte) types.Result {
|
func (app *KVStoreApplication) CheckTx(tx []byte) types.Result {
|
||||||
return types.OK
|
return types.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ merkle root of the data returned by the DeliverTx requests, or both.
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
// tx is either "key=value" or just arbitrary bytes
|
// tx is either "key=value" or just arbitrary bytes
|
||||||
func (app *DummyApplication) DeliverTx(tx []byte) types.Result {
|
func (app *KVStoreApplication) DeliverTx(tx []byte) types.Result {
|
||||||
parts := strings.Split(string(tx), "=")
|
parts := strings.Split(string(tx), "=")
|
||||||
if len(parts) == 2 {
|
if len(parts) == 2 {
|
||||||
app.state.Set([]byte(parts[0]), []byte(parts[1]))
|
app.state.Set([]byte(parts[0]), []byte(parts[1]))
|
||||||
|
@ -327,7 +327,7 @@ job of the `Handshake <#handshake>`__.
|
||||||
|
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
func (app *DummyApplication) Commit() types.Result {
|
func (app *KVStoreApplication) Commit() types.Result {
|
||||||
hash := app.state.Hash()
|
hash := app.state.Hash()
|
||||||
return types.NewResultOK(hash, "")
|
return types.NewResultOK(hash, "")
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ pick up from when it restarts. See information on the Handshake, below.
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
// Track the block hash and header information
|
// Track the block hash and header information
|
||||||
func (app *PersistentDummyApplication) BeginBlock(params types.RequestBeginBlock) {
|
func (app *PersistentKVStoreApplication) BeginBlock(params types.RequestBeginBlock) {
|
||||||
// update latest block info
|
// update latest block info
|
||||||
app.blockHeader = params.Header
|
app.blockHeader = params.Header
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ for details on how it tracks validators.
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
// Update the validator set
|
// Update the validator set
|
||||||
func (app *PersistentDummyApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
|
func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
|
||||||
return types.ResponseEndBlock{ValidatorUpdates: app.ValUpdates}
|
return types.ResponseEndBlock{ValidatorUpdates: app.ValUpdates}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ Note: these query formats are subject to change!
|
||||||
|
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
|
func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
|
||||||
if reqQuery.Prove {
|
if reqQuery.Prove {
|
||||||
value, proof, exists := app.state.Proof(reqQuery.Data)
|
value, proof, exists := app.state.Proof(reqQuery.Data)
|
||||||
resQuery.Index = -1 // TODO make Proof return index
|
resQuery.Index = -1 // TODO make Proof return index
|
||||||
|
@ -561,7 +561,7 @@ all blocks.
|
||||||
|
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
func (app *DummyApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
|
func (app *KVStoreApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
|
||||||
return types.ResponseInfo{Data: cmn.Fmt("{\"size\":%v}", app.state.Size())}
|
return types.ResponseInfo{Data: cmn.Fmt("{\"size\":%v}", app.state.Size())}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ consensus params.
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
// Save the validators in the merkle tree
|
// Save the validators in the merkle tree
|
||||||
func (app *PersistentDummyApplication) InitChain(params types.RequestInitChain) {
|
func (app *PersistentKVStoreApplication) InitChain(params types.RequestInitChain) {
|
||||||
for _, v := range params.Validators {
|
for _, v := range params.Validators {
|
||||||
r := app.updateValidator(v)
|
r := app.updateValidator(v)
|
||||||
if r.IsErr() {
|
if r.IsErr() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ Configuring a cluster is covered further below.
|
||||||
Start tendermint with a simple in-process application:
|
Start tendermint with a simple in-process application:
|
||||||
|
|
||||||
```
|
```
|
||||||
tendermint node --proxy_app=dummy
|
tendermint node --proxy_app=kvstore
|
||||||
```
|
```
|
||||||
|
|
||||||
and blocks will start to stream in:
|
and blocks will start to stream in:
|
||||||
|
@ -89,7 +89,7 @@ curl -s localhost:46657/status
|
||||||
|
|
||||||
### Sending Transactions
|
### Sending Transactions
|
||||||
|
|
||||||
With the dummy app running, we can send transactions:
|
With the kvstore app running, we can send transactions:
|
||||||
|
|
||||||
```
|
```
|
||||||
curl -s 'localhost:46657/broadcast_tx_commit?tx="abcd"'
|
curl -s 'localhost:46657/broadcast_tx_commit?tx="abcd"'
|
||||||
|
@ -131,10 +131,10 @@ This will install `go` and other dependencies, get the Tendermint source code, t
|
||||||
Next, `cd` into `docs/examples`. Each command below should be run from each node, in sequence:
|
Next, `cd` into `docs/examples`. Each command below should be run from each node, in sequence:
|
||||||
|
|
||||||
```
|
```
|
||||||
tendermint node --home ./node1 --proxy_app=dummy --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
tendermint node --home ./node1 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
||||||
tendermint node --home ./node2 --proxy_app=dummy --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
tendermint node --home ./node2 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
||||||
tendermint node --home ./node3 --proxy_app=dummy --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
tendermint node --home ./node3 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
||||||
tendermint node --home ./node4 --proxy_app=dummy --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
tendermint node --home ./node4 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that after the third node is started, blocks will start to stream in because >2/3 of validators (defined in the `genesis.json`) have come online. Seeds can also be specified in the `config.toml`. See [this PR](https://github.com/tendermint/tendermint/pull/792) for more information about configuration options.
|
Note that after the third node is started, blocks will start to stream in because >2/3 of validators (defined in the `genesis.json`) have come online. Seeds can also be specified in the `config.toml`. See [this PR](https://github.com/tendermint/tendermint/pull/792) for more information about configuration options.
|
||||||
|
|
|
@ -38,27 +38,27 @@ dependencies:
|
||||||
go install ./cmd/abci-cli
|
go install ./cmd/abci-cli
|
||||||
|
|
||||||
Now you should have the ``abci-cli`` installed; you'll see
|
Now you should have the ``abci-cli`` installed; you'll see
|
||||||
a couple of commands (``counter`` and ``dummy``) that are
|
a couple of commands (``counter`` and ``kvstore``) that are
|
||||||
example applications written in Go. See below for an application
|
example applications written in Go. See below for an application
|
||||||
written in JavaScript.
|
written in JavaScript.
|
||||||
|
|
||||||
Now, let's run some apps!
|
Now, let's run some apps!
|
||||||
|
|
||||||
Dummy - A First Example
|
KVStore - A First Example
|
||||||
-----------------------
|
-------------------------
|
||||||
|
|
||||||
The dummy app is a `Merkle
|
The kvstore app is a `Merkle
|
||||||
tree <https://en.wikipedia.org/wiki/Merkle_tree>`__ that just stores all
|
tree <https://en.wikipedia.org/wiki/Merkle_tree>`__ that just stores all
|
||||||
transactions. If the transaction contains an ``=``, e.g. ``key=value``,
|
transactions. If the transaction contains an ``=``, e.g. ``key=value``,
|
||||||
then the ``value`` is stored under the ``key`` in the Merkle tree.
|
then the ``value`` is stored under the ``key`` in the Merkle tree.
|
||||||
Otherwise, the full transaction bytes are stored as the key and the
|
Otherwise, the full transaction bytes are stored as the key and the
|
||||||
value.
|
value.
|
||||||
|
|
||||||
Let's start a dummy application.
|
Let's start a kvstore application.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
abci-cli dummy
|
abci-cli kvstore
|
||||||
|
|
||||||
In another terminal, we can start Tendermint. If you have never run
|
In another terminal, we can start Tendermint. If you have never run
|
||||||
Tendermint before, use:
|
Tendermint before, use:
|
||||||
|
@ -85,7 +85,7 @@ The ``-s`` just silences ``curl``. For nicer output, pipe the result
|
||||||
into a tool like `jq <https://stedolan.github.io/jq/>`__ or
|
into a tool like `jq <https://stedolan.github.io/jq/>`__ or
|
||||||
`jsonpp <https://github.com/jmhodges/jsonpp>`__.
|
`jsonpp <https://github.com/jmhodges/jsonpp>`__.
|
||||||
|
|
||||||
Now let's send some transactions to the dummy.
|
Now let's send some transactions to the kvstore.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ In this instance of the counter app, with ``serial=on``, ``CheckTx``
|
||||||
only allows transactions whose integer is greater than the last
|
only allows transactions whose integer is greater than the last
|
||||||
committed one.
|
committed one.
|
||||||
|
|
||||||
Let's kill the previous instance of ``tendermint`` and the ``dummy``
|
Let's kill the previous instance of ``tendermint`` and the ``kvstore``
|
||||||
application, and start the counter app. We can enable ``serial=on`` with
|
application, and start the counter app. We can enable ``serial=on`` with
|
||||||
a flag:
|
a flag:
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ Neat, eh?
|
||||||
Basecoin - A More Interesting Example
|
Basecoin - A More Interesting Example
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
We saved the best for last; the `Cosmos SDK <https://github.com/cosmos/cosmos-sdk>`__ is a general purpose framework for building cryptocurrencies. Unlike the ``dummy`` and ``counter``, which are strictly for example purposes. The reference implementation of Cosmos SDK is ``basecoin``, which demonstrates how to use the building blocks of the Cosmos SDK.
|
We saved the best for last; the `Cosmos SDK <https://github.com/cosmos/cosmos-sdk>`__ is a general purpose framework for building cryptocurrencies. Unlike the ``kvstore`` and ``counter``, which are strictly for example purposes. The reference implementation of Cosmos SDK is ``basecoin``, which demonstrates how to use the building blocks of the Cosmos SDK.
|
||||||
|
|
||||||
The default ``basecoin`` application is a multi-asset cryptocurrency
|
The default ``basecoin`` application is a multi-asset cryptocurrency
|
||||||
that supports inter-blockchain communication (IBC). For more details on how
|
that supports inter-blockchain communication (IBC). For more details on how
|
||||||
|
|
|
@ -5,7 +5,7 @@ Walk through example
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
We first create three connections (mempool, consensus and query) to the
|
We first create three connections (mempool, consensus and query) to the
|
||||||
application (locally running dummy in this case).
|
application (running ``kvstore`` locally in this case).
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
|
|
@ -107,4 +107,4 @@ To start a one-node blockchain with a simple in-process application:
|
||||||
::
|
::
|
||||||
|
|
||||||
tendermint init
|
tendermint init
|
||||||
tendermint node --proxy_app=dummy
|
tendermint node --proxy_app=kvstore
|
||||||
|
|
|
@ -41,18 +41,18 @@ To run a Tendermint node, use
|
||||||
tendermint node
|
tendermint node
|
||||||
|
|
||||||
By default, Tendermint will try to connect to an ABCI application on
|
By default, Tendermint will try to connect to an ABCI application on
|
||||||
`127.0.0.1:46658 <127.0.0.1:46658>`__. If you have the ``dummy`` ABCI
|
`127.0.0.1:46658 <127.0.0.1:46658>`__. If you have the ``kvstore`` ABCI
|
||||||
app installed, run it in another window. If you don't, kill Tendermint
|
app installed, run it in another window. If you don't, kill Tendermint
|
||||||
and run an in-process version with
|
and run an in-process version of the ``kvstore`` app:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
tendermint node --proxy_app=dummy
|
tendermint node --proxy_app=kvstore
|
||||||
|
|
||||||
After a few seconds you should see blocks start streaming in. Note that
|
After a few seconds you should see blocks start streaming in. Note that
|
||||||
blocks are produced regularly, even if there are no transactions. See *No Empty Blocks*, below, to modify this setting.
|
blocks are produced regularly, even if there are no transactions. See *No Empty Blocks*, below, to modify this setting.
|
||||||
|
|
||||||
Tendermint supports in-process versions of the dummy, counter, and nil
|
Tendermint supports in-process versions of the ``counter``, ``kvstore`` and ``nil``
|
||||||
apps that ship as examples in the `ABCI
|
apps that ship as examples in the `ABCI
|
||||||
repository <https://github.com/tendermint/abci>`__. It's easy to compile
|
repository <https://github.com/tendermint/abci>`__. It's easy to compile
|
||||||
your own app in-process with Tendermint if it's written in Go. If your
|
your own app in-process with Tendermint if it's written in Go. If your
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
hash: 322a0d4b9be08c59bf65df0e17e3be8d60762eaf9516f0c4126b50f9fd676f26
|
hash: d9b29e999de7d8a58f068ad5c2af77a030d55418873489ffab9a142df6c31eed
|
||||||
updated: 2018-02-21T03:31:35.382568482Z
|
updated: 2018-02-21T00:18:03.549434011-05:00
|
||||||
imports:
|
imports:
|
||||||
- name: github.com/btcsuite/btcd
|
- name: github.com/btcsuite/btcd
|
||||||
version: 50de9da05b50eb15658bb350f6ea24368a111ab7
|
version: 50de9da05b50eb15658bb350f6ea24368a111ab7
|
||||||
|
@ -97,12 +97,12 @@ imports:
|
||||||
- leveldb/table
|
- leveldb/table
|
||||||
- leveldb/util
|
- leveldb/util
|
||||||
- name: github.com/tendermint/abci
|
- name: github.com/tendermint/abci
|
||||||
version: 68592f4d8ee34e97db94b7a7976b1309efdb7eb9
|
version: 6d47f4afe2b68b20802aa4d049fd6b8c0f54f1a5
|
||||||
subpackages:
|
subpackages:
|
||||||
- client
|
- client
|
||||||
- example/code
|
- example/code
|
||||||
- example/counter
|
- example/counter
|
||||||
- example/dummy
|
- example/kvstore
|
||||||
- server
|
- server
|
||||||
- types
|
- types
|
||||||
- name: github.com/tendermint/ed25519
|
- name: github.com/tendermint/ed25519
|
||||||
|
|
|
@ -19,10 +19,10 @@ import:
|
||||||
- package: github.com/spf13/viper
|
- package: github.com/spf13/viper
|
||||||
version: v1.0.0
|
version: v1.0.0
|
||||||
- package: github.com/tendermint/abci
|
- package: github.com/tendermint/abci
|
||||||
version: 0.10.0
|
version: develop
|
||||||
subpackages:
|
subpackages:
|
||||||
- client
|
- client
|
||||||
- example/dummy
|
- example/kvstore
|
||||||
- types
|
- types
|
||||||
- package: github.com/tendermint/go-crypto
|
- package: github.com/tendermint/go-crypto
|
||||||
version: 0.4.1
|
version: 0.4.1
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
|
|
||||||
nm "github.com/tendermint/tendermint/node"
|
nm "github.com/tendermint/tendermint/node"
|
||||||
rpctest "github.com/tendermint/tendermint/rpc/test"
|
rpctest "github.com/tendermint/tendermint/rpc/test"
|
||||||
|
@ -14,7 +14,7 @@ var node *nm.Node
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
// start a tendermint node (and merkleeyes) in the background to test against
|
// start a tendermint node (and merkleeyes) in the background to test against
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
node = rpctest.StartTendermint(app)
|
node = rpctest.StartTendermint(app)
|
||||||
code := m.Run()
|
code := m.Run()
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/lite"
|
"github.com/tendermint/tendermint/lite"
|
||||||
certclient "github.com/tendermint/tendermint/lite/client"
|
certclient "github.com/tendermint/tendermint/lite/client"
|
||||||
|
@ -23,7 +23,7 @@ var node *nm.Node
|
||||||
// TODO fix tests!!
|
// TODO fix tests!!
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
|
|
||||||
node = rpctest.StartTendermint(app)
|
node = rpctest.StartTendermint(app)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func TestMain(m *testing.M) {
|
||||||
os.Exit(code)
|
os.Exit(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
func dummyTx(k, v []byte) []byte {
|
func kvstoreTx(k, v []byte) []byte {
|
||||||
return []byte(fmt.Sprintf("%s=%s", k, v))
|
return []byte(fmt.Sprintf("%s=%s", k, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func _TestAppProofs(t *testing.T) {
|
||||||
k := []byte("my-key")
|
k := []byte("my-key")
|
||||||
v := []byte("my-value")
|
v := []byte("my-value")
|
||||||
|
|
||||||
tx := dummyTx(k, v)
|
tx := kvstoreTx(k, v)
|
||||||
br, err := cl.BroadcastTxCommit(tx)
|
br, err := cl.BroadcastTxCommit(tx)
|
||||||
require.NoError(err, "%+v", err)
|
require.NoError(err, "%+v", err)
|
||||||
require.EqualValues(0, br.CheckTx.Code, "%#v", br.CheckTx)
|
require.EqualValues(0, br.CheckTx.Code, "%#v", br.CheckTx)
|
||||||
|
@ -107,7 +107,7 @@ func _TestTxProofs(t *testing.T) {
|
||||||
cl := client.NewLocal(node)
|
cl := client.NewLocal(node)
|
||||||
client.WaitForHeight(cl, 1, nil)
|
client.WaitForHeight(cl, 1, nil)
|
||||||
|
|
||||||
tx := dummyTx([]byte("key-a"), []byte("value-a"))
|
tx := kvstoreTx([]byte("key-a"), []byte("value-a"))
|
||||||
br, err := cl.BroadcastTxCommit(tx)
|
br, err := cl.BroadcastTxCommit(tx)
|
||||||
require.NoError(err, "%+v", err)
|
require.NoError(err, "%+v", err)
|
||||||
require.EqualValues(0, br.CheckTx.Code, "%#v", br.CheckTx)
|
require.EqualValues(0, br.CheckTx.Code, "%#v", br.CheckTx)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/counter"
|
"github.com/tendermint/abci/example/counter"
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
@ -73,7 +73,7 @@ func checkTxs(t *testing.T, mempool *Mempool, count int) types.Txs {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTxsAvailable(t *testing.T) {
|
func TestTxsAvailable(t *testing.T) {
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
cc := proxy.NewLocalClientCreator(app)
|
cc := proxy.NewLocalClientCreator(app)
|
||||||
mempool := newMempoolWithApp(cc)
|
mempool := newMempoolWithApp(cc)
|
||||||
mempool.EnableTxsAvailable()
|
mempool.EnableTxsAvailable()
|
||||||
|
@ -238,7 +238,7 @@ func TestMempoolCloseWAL(t *testing.T) {
|
||||||
// 3. Create the mempool
|
// 3. Create the mempool
|
||||||
wcfg := cfg.DefaultMempoolConfig()
|
wcfg := cfg.DefaultMempoolConfig()
|
||||||
wcfg.RootDir = rootDir
|
wcfg.RootDir = rootDir
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
cc := proxy.NewLocalClientCreator(app)
|
cc := proxy.NewLocalClientCreator(app)
|
||||||
appConnMem, _ := cc.NewABCIClient()
|
appConnMem, _ := cc.NewABCIClient()
|
||||||
mempool := NewMempool(wcfg, appConnMem, 10)
|
mempool := NewMempool(wcfg, appConnMem, 10)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
"github.com/go-kit/kit/log/term"
|
"github.com/go-kit/kit/log/term"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
|
||||||
cfg "github.com/tendermint/tendermint/config"
|
cfg "github.com/tendermint/tendermint/config"
|
||||||
|
@ -39,7 +39,7 @@ func makeAndConnectMempoolReactors(config *cfg.Config, N int) []*MempoolReactor
|
||||||
reactors := make([]*MempoolReactor, N)
|
reactors := make([]*MempoolReactor, N)
|
||||||
logger := mempoolLogger()
|
logger := mempoolLogger()
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
cc := proxy.NewLocalClientCreator(app)
|
cc := proxy.NewLocalClientCreator(app)
|
||||||
mempool := newMempoolWithApp(cc)
|
mempool := newMempoolWithApp(cc)
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@ import (
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dummyConn struct {
|
type kvstoreConn struct {
|
||||||
*io.PipeReader
|
*io.PipeReader
|
||||||
*io.PipeWriter
|
*io.PipeWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (drw dummyConn) Close() (err error) {
|
func (drw kvstoreConn) Close() (err error) {
|
||||||
err2 := drw.PipeWriter.CloseWithError(io.EOF)
|
err2 := drw.PipeWriter.CloseWithError(io.EOF)
|
||||||
err1 := drw.PipeReader.Close()
|
err1 := drw.PipeReader.Close()
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
|
@ -23,14 +23,14 @@ func (drw dummyConn) Close() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Each returned ReadWriteCloser is akin to a net.Connection
|
// Each returned ReadWriteCloser is akin to a net.Connection
|
||||||
func makeDummyConnPair() (fooConn, barConn dummyConn) {
|
func makeKVStoreConnPair() (fooConn, barConn kvstoreConn) {
|
||||||
barReader, fooWriter := io.Pipe()
|
barReader, fooWriter := io.Pipe()
|
||||||
fooReader, barWriter := io.Pipe()
|
fooReader, barWriter := io.Pipe()
|
||||||
return dummyConn{fooReader, fooWriter}, dummyConn{barReader, barWriter}
|
return kvstoreConn{fooReader, fooWriter}, kvstoreConn{barReader, barWriter}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeSecretConnPair(tb testing.TB) (fooSecConn, barSecConn *SecretConnection) {
|
func makeSecretConnPair(tb testing.TB) (fooSecConn, barSecConn *SecretConnection) {
|
||||||
fooConn, barConn := makeDummyConnPair()
|
fooConn, barConn := makeKVStoreConnPair()
|
||||||
fooPrvKey := crypto.GenPrivKeyEd25519().Wrap()
|
fooPrvKey := crypto.GenPrivKeyEd25519().Wrap()
|
||||||
fooPubKey := fooPrvKey.PubKey()
|
fooPubKey := fooPrvKey.PubKey()
|
||||||
barPrvKey := crypto.GenPrivKeyEd25519().Wrap()
|
barPrvKey := crypto.GenPrivKeyEd25519().Wrap()
|
||||||
|
@ -78,7 +78,7 @@ func TestSecretConnectionHandshake(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSecretConnectionReadWrite(t *testing.T) {
|
func TestSecretConnectionReadWrite(t *testing.T) {
|
||||||
fooConn, barConn := makeDummyConnPair()
|
fooConn, barConn := makeKVStoreConnPair()
|
||||||
fooWrites, barWrites := []string{}, []string{}
|
fooWrites, barWrites := []string{}, []string{}
|
||||||
fooReads, barReads := []string{}, []string{}
|
fooReads, barReads := []string{}, []string{}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ func TestSecretConnectionReadWrite(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// A helper that will run with (fooConn, fooWrites, fooReads) and vice versa
|
// A helper that will run with (fooConn, fooWrites, fooReads) and vice versa
|
||||||
genNodeRunner := func(nodeConn dummyConn, nodeWrites []string, nodeReads *[]string) func() {
|
genNodeRunner := func(nodeConn kvstoreConn, nodeWrites []string, nodeReads *[]string) func() {
|
||||||
return func() {
|
return func() {
|
||||||
// Node handskae
|
// Node handskae
|
||||||
nodePrvKey := crypto.GenPrivKeyEd25519().Wrap()
|
nodePrvKey := crypto.GenPrivKeyEd25519().Wrap()
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Returns an empty dummy peer
|
// Returns an empty kvstore peer
|
||||||
func randPeer() *peer {
|
func randPeer() *peer {
|
||||||
pubKey := crypto.GenPrivKeyEd25519().Wrap().PubKey()
|
pubKey := crypto.GenPrivKeyEd25519().Wrap().PubKey()
|
||||||
return &peer{
|
return &peer{
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
abcicli "github.com/tendermint/abci/client"
|
abcicli "github.com/tendermint/abci/client"
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
"github.com/tendermint/abci/server"
|
"github.com/tendermint/abci/server"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
|
@ -49,7 +49,7 @@ func TestEcho(t *testing.T) {
|
||||||
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
s := server.NewSocketServer(sockPath, kvstore.NewKVStoreApplication())
|
||||||
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
||||||
if err := s.Start(); err != nil {
|
if err := s.Start(); err != nil {
|
||||||
t.Fatalf("Error starting socket server: %v", err.Error())
|
t.Fatalf("Error starting socket server: %v", err.Error())
|
||||||
|
@ -83,7 +83,7 @@ func BenchmarkEcho(b *testing.B) {
|
||||||
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
s := server.NewSocketServer(sockPath, kvstore.NewKVStoreApplication())
|
||||||
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
||||||
if err := s.Start(); err != nil {
|
if err := s.Start(); err != nil {
|
||||||
b.Fatalf("Error starting socket server: %v", err.Error())
|
b.Fatalf("Error starting socket server: %v", err.Error())
|
||||||
|
@ -122,7 +122,7 @@ func TestInfo(t *testing.T) {
|
||||||
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true)
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication())
|
s := server.NewSocketServer(sockPath, kvstore.NewKVStoreApplication())
|
||||||
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
s.SetLogger(log.TestingLogger().With("module", "abci-server"))
|
||||||
if err := s.Start(); err != nil {
|
if err := s.Start(); err != nil {
|
||||||
t.Fatalf("Error starting socket server: %v", err.Error())
|
t.Fatalf("Error starting socket server: %v", err.Error())
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
abcicli "github.com/tendermint/abci/client"
|
abcicli "github.com/tendermint/abci/client"
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -64,10 +64,10 @@ func (r *remoteClientCreator) NewABCIClient() (abcicli.Client, error) {
|
||||||
|
|
||||||
func DefaultClientCreator(addr, transport, dbDir string) ClientCreator {
|
func DefaultClientCreator(addr, transport, dbDir string) ClientCreator {
|
||||||
switch addr {
|
switch addr {
|
||||||
case "dummy":
|
case "kvstore":
|
||||||
return NewLocalClientCreator(dummy.NewDummyApplication())
|
return NewLocalClientCreator(kvstore.NewKVStoreApplication())
|
||||||
case "persistent_dummy":
|
case "persistent_kvstore":
|
||||||
return NewLocalClientCreator(dummy.NewPersistentDummyApplication(dbDir))
|
return NewLocalClientCreator(kvstore.NewPersistentKVStoreApplication(dbDir))
|
||||||
case "nilapp":
|
case "nilapp":
|
||||||
return NewLocalClientCreator(types.NewBaseApplication())
|
return NewLocalClientCreator(types.NewBaseApplication())
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
nm "github.com/tendermint/tendermint/node"
|
nm "github.com/tendermint/tendermint/node"
|
||||||
rpctest "github.com/tendermint/tendermint/rpc/test"
|
rpctest "github.com/tendermint/tendermint/rpc/test"
|
||||||
)
|
)
|
||||||
|
@ -12,8 +12,8 @@ import (
|
||||||
var node *nm.Node
|
var node *nm.Node
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
// start a tendermint node (and dummy) in the background to test against
|
// start a tendermint node (and kvstore) in the background to test against
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
node = rpctest.StartTendermint(app)
|
node = rpctest.StartTendermint(app)
|
||||||
code := m.Run()
|
code := m.Run()
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
"github.com/tendermint/tendermint/rpc/client"
|
"github.com/tendermint/tendermint/rpc/client"
|
||||||
"github.com/tendermint/tendermint/rpc/client/mock"
|
"github.com/tendermint/tendermint/rpc/client/mock"
|
||||||
|
@ -156,7 +156,7 @@ func TestABCIRecorder(t *testing.T) {
|
||||||
|
|
||||||
func TestABCIApp(t *testing.T) {
|
func TestABCIApp(t *testing.T) {
|
||||||
assert, require := assert.New(t), require.New(t)
|
assert, require := assert.New(t), require.New(t)
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
m := mock.ABCIApp{app}
|
m := mock.ABCIApp{app}
|
||||||
|
|
||||||
// get some info
|
// get some info
|
||||||
|
|
|
@ -336,7 +336,7 @@ func TestTxSearch(t *testing.T) {
|
||||||
require.Nil(t, err, "%+v", err)
|
require.Nil(t, err, "%+v", err)
|
||||||
require.Len(t, results, 0)
|
require.Len(t, results, 0)
|
||||||
|
|
||||||
// we query using a tag (see dummy application)
|
// we query using a tag (see kvstore application)
|
||||||
results, err = c.TxSearch("app.creator='jae'", false)
|
results, err = c.TxSearch("app.creator='jae'", false)
|
||||||
require.Nil(t, err, "%+v", err)
|
require.Nil(t, err, "%+v", err)
|
||||||
if len(results) == 0 {
|
if len(results) == 0 {
|
||||||
|
|
|
@ -11,7 +11,7 @@ type broadcastAPI struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bapi *broadcastAPI) Ping(ctx context.Context, req *RequestPing) (*ResponsePing, error) {
|
func (bapi *broadcastAPI) Ping(ctx context.Context, req *RequestPing) (*ResponsePing, error) {
|
||||||
// dummy so we can check if the server is up
|
// kvstore so we can check if the server is up
|
||||||
return &ResponsePing{}, nil
|
return &ResponsePing{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,14 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
"github.com/tendermint/tendermint/rpc/grpc"
|
"github.com/tendermint/tendermint/rpc/grpc"
|
||||||
"github.com/tendermint/tendermint/rpc/test"
|
"github.com/tendermint/tendermint/rpc/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
// start a tendermint node in the background to test against
|
// start a tendermint node in the background to test against
|
||||||
app := dummy.NewDummyApplication()
|
app := kvstore.NewKVStoreApplication()
|
||||||
node := rpctest.StartTendermint(app)
|
node := rpctest.StartTendermint(app)
|
||||||
code := m.Run()
|
code := m.Run()
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ func makeHTTPDialer(remoteAddr string) (string, func(string, string) (net.Conn,
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace / with . for http requests (dummy domain)
|
// replace / with . for http requests (kvstore domain)
|
||||||
trimmedAddress := strings.Replace(address, "/", ".", -1)
|
trimmedAddress := strings.Replace(address, "/", ".", -1)
|
||||||
return trimmedAddress, func(proto, addr string) (net.Conn, error) {
|
return trimmedAddress, func(proto, addr string) (net.Conn, error) {
|
||||||
return net.Dial(protocol, address)
|
return net.Dial(protocol, address)
|
||||||
|
|
|
@ -79,7 +79,7 @@ func GetConfig() *cfg.Config {
|
||||||
globalConfig.P2P.ListenAddress = tm
|
globalConfig.P2P.ListenAddress = tm
|
||||||
globalConfig.RPC.ListenAddress = rpc
|
globalConfig.RPC.ListenAddress = rpc
|
||||||
globalConfig.RPC.GRPCListenAddress = grpc
|
globalConfig.RPC.GRPCListenAddress = grpc
|
||||||
globalConfig.TxIndex.IndexTags = "app.creator" // see dummy application
|
globalConfig.TxIndex.IndexTags = "app.creator" // see kvstore application
|
||||||
}
|
}
|
||||||
return globalConfig
|
return globalConfig
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/kvstore"
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
crypto "github.com/tendermint/go-crypto"
|
crypto "github.com/tendermint/go-crypto"
|
||||||
"github.com/tendermint/tendermint/proxy"
|
"github.com/tendermint/tendermint/proxy"
|
||||||
|
@ -25,7 +25,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApplyBlock(t *testing.T) {
|
func TestApplyBlock(t *testing.T) {
|
||||||
cc := proxy.NewLocalClientCreator(dummy.NewDummyApplication())
|
cc := proxy.NewLocalClientCreator(kvstore.NewKVStoreApplication())
|
||||||
proxyApp := proxy.NewAppConns(cc, nil)
|
proxyApp := proxy.NewAppConns(cc, nil)
|
||||||
err := proxyApp.Start()
|
err := proxyApp.Start()
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
@ -165,7 +165,7 @@ type testApp struct {
|
||||||
ByzantineValidators []abci.Evidence
|
ByzantineValidators []abci.Evidence
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDummyApplication() *testApp {
|
func NewKVStoreApplication() *testApp {
|
||||||
return &testApp{}
|
return &testApp{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,13 @@ and run the following tests in docker containers:
|
||||||
- go tests, with --race
|
- go tests, with --race
|
||||||
- includes test coverage
|
- includes test coverage
|
||||||
- app tests
|
- app tests
|
||||||
- dummy app over socket
|
- kvstore app over socket
|
||||||
- counter app over socket
|
- counter app over socket
|
||||||
- counter app over grpc
|
- counter app over grpc
|
||||||
- persistence tests
|
- persistence tests
|
||||||
- crash tendermint at each of many predefined points, restart, and ensure it syncs properly with the app
|
- crash tendermint at each of many predefined points, restart, and ensure it syncs properly with the app
|
||||||
- p2p tests
|
- p2p tests
|
||||||
- start a local dummy app testnet on a docker network (requires docker version 1.10+)
|
- start a local kvstore app testnet on a docker network (requires docker version 1.10+)
|
||||||
- send a tx on each node and ensure the state root is updated on all of them
|
- send a tx on each node and ensure the state root is updated on all of them
|
||||||
- crash and restart nodes one at a time and ensure they can sync back up (via fastsync)
|
- crash and restart nodes one at a time and ensure they can sync back up (via fastsync)
|
||||||
- crash and restart all nodes at once and ensure they can sync back up
|
- crash and restart all nodes at once and ensure they can sync back up
|
||||||
|
|
|
@ -7,7 +7,7 @@ function toHex() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# dummy with curl
|
# kvstore with curl
|
||||||
#####################
|
#####################
|
||||||
TESTNAME=$1
|
TESTNAME=$1
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#- dummy over socket, curl
|
#- kvstore over socket, curl
|
||||||
#- counter over socket, curl
|
#- counter over socket, curl
|
||||||
#- counter over grpc, curl
|
#- counter over grpc, curl
|
||||||
#- counter over grpc, grpc
|
#- counter over grpc, grpc
|
||||||
|
@ -10,38 +10,38 @@ set -e
|
||||||
|
|
||||||
export TMHOME=$HOME/.tendermint_app
|
export TMHOME=$HOME/.tendermint_app
|
||||||
|
|
||||||
function dummy_over_socket(){
|
function kvstore_over_socket(){
|
||||||
rm -rf $TMHOME
|
rm -rf $TMHOME
|
||||||
tendermint init
|
tendermint init
|
||||||
echo "Starting dummy_over_socket"
|
echo "Starting kvstore_over_socket"
|
||||||
abci-cli dummy > /dev/null &
|
abci-cli kvstore > /dev/null &
|
||||||
pid_dummy=$!
|
pid_kvstore=$!
|
||||||
tendermint node > tendermint.log &
|
tendermint node > tendermint.log &
|
||||||
pid_tendermint=$!
|
pid_tendermint=$!
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
echo "running test"
|
echo "running test"
|
||||||
bash dummy_test.sh "Dummy over Socket"
|
bash kvstore_test.sh "KVStore over Socket"
|
||||||
|
|
||||||
kill -9 $pid_dummy $pid_tendermint
|
kill -9 $pid_kvstore $pid_tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
# start tendermint first
|
# start tendermint first
|
||||||
function dummy_over_socket_reorder(){
|
function kvstore_over_socket_reorder(){
|
||||||
rm -rf $TMHOME
|
rm -rf $TMHOME
|
||||||
tendermint init
|
tendermint init
|
||||||
echo "Starting dummy_over_socket_reorder (ie. start tendermint first)"
|
echo "Starting kvstore_over_socket_reorder (ie. start tendermint first)"
|
||||||
tendermint node > tendermint.log &
|
tendermint node > tendermint.log &
|
||||||
pid_tendermint=$!
|
pid_tendermint=$!
|
||||||
sleep 2
|
sleep 2
|
||||||
abci-cli dummy > /dev/null &
|
abci-cli kvstore > /dev/null &
|
||||||
pid_dummy=$!
|
pid_kvstore=$!
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
echo "running test"
|
echo "running test"
|
||||||
bash dummy_test.sh "Dummy over Socket"
|
bash kvstore_test.sh "KVStore over Socket"
|
||||||
|
|
||||||
kill -9 $pid_dummy $pid_tendermint
|
kill -9 $pid_kvstore $pid_tendermint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,11 +98,11 @@ function counter_over_grpc_grpc() {
|
||||||
cd $GOPATH/src/github.com/tendermint/tendermint/test/app
|
cd $GOPATH/src/github.com/tendermint/tendermint/test/app
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"dummy_over_socket")
|
"kvstore_over_socket")
|
||||||
dummy_over_socket
|
kvstore_over_socket
|
||||||
;;
|
;;
|
||||||
"dummy_over_socket_reorder")
|
"kvstore_over_socket_reorder")
|
||||||
dummy_over_socket_reorder
|
kvstore_over_socket_reorder
|
||||||
;;
|
;;
|
||||||
"counter_over_socket")
|
"counter_over_socket")
|
||||||
counter_over_socket
|
counter_over_socket
|
||||||
|
@ -115,9 +115,9 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Running all"
|
echo "Running all"
|
||||||
dummy_over_socket
|
kvstore_over_socket
|
||||||
echo ""
|
echo ""
|
||||||
dummy_over_socket_reorder
|
kvstore_over_socket_reorder
|
||||||
echo ""
|
echo ""
|
||||||
counter_over_socket
|
counter_over_socket
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
@ -38,7 +38,7 @@ for i in $(seq 1 4); do
|
||||||
--name local_testnet_$i \
|
--name local_testnet_$i \
|
||||||
--entrypoint tendermint \
|
--entrypoint tendermint \
|
||||||
-e TMHOME=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$i/core \
|
-e TMHOME=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$i/core \
|
||||||
tendermint_tester node --p2p.persistent_peers 172.57.0.101:46656,172.57.0.102:46656,172.57.0.103:46656,172.57.0.104:46656 --proxy_app=dummy
|
tendermint_tester node --p2p.persistent_peers 172.57.0.101:46656,172.57.0.102:46656,172.57.0.103:46656,172.57.0.104:46656 --proxy_app=kvstore
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ set -eu
|
||||||
DOCKER_IMAGE=$1
|
DOCKER_IMAGE=$1
|
||||||
NETWORK_NAME=local_testnet
|
NETWORK_NAME=local_testnet
|
||||||
N=4
|
N=4
|
||||||
PROXY_APP=persistent_dummy
|
PROXY_APP=persistent_kvstore
|
||||||
|
|
||||||
cd "$GOPATH/src/github.com/tendermint/tendermint"
|
cd "$GOPATH/src/github.com/tendermint/tendermint"
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,17 @@ tendermint init
|
||||||
RPC_ADDR="$(pwd)/rpc.sock"
|
RPC_ADDR="$(pwd)/rpc.sock"
|
||||||
|
|
||||||
TM_CMD="tendermint node --log_level=debug --rpc.laddr=unix://$RPC_ADDR" # &> tendermint_${name}.log"
|
TM_CMD="tendermint node --log_level=debug --rpc.laddr=unix://$RPC_ADDR" # &> tendermint_${name}.log"
|
||||||
DUMMY_CMD="abci-cli dummy --persist $TMHOME/dummy" # &> dummy_${name}.log"
|
DUMMY_CMD="abci-cli kvstore --persist $TMHOME/kvstore" # &> kvstore_${name}.log"
|
||||||
|
|
||||||
|
|
||||||
function start_procs(){
|
function start_procs(){
|
||||||
name=$1
|
name=$1
|
||||||
indexToFail=$2
|
indexToFail=$2
|
||||||
echo "Starting persistent dummy and tendermint"
|
echo "Starting persistent kvstore and tendermint"
|
||||||
if [[ "$CIRCLECI" == true ]]; then
|
if [[ "$CIRCLECI" == true ]]; then
|
||||||
$DUMMY_CMD &
|
$DUMMY_CMD &
|
||||||
else
|
else
|
||||||
$DUMMY_CMD &> "dummy_${name}.log" &
|
$DUMMY_CMD &> "kvstore_${name}.log" &
|
||||||
fi
|
fi
|
||||||
PID_DUMMY=$!
|
PID_DUMMY=$!
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ tendermint init
|
||||||
|
|
||||||
function start_procs(){
|
function start_procs(){
|
||||||
name=$1
|
name=$1
|
||||||
echo "Starting persistent dummy and tendermint"
|
echo "Starting persistent kvstore and tendermint"
|
||||||
abci-cli dummy --persist $TMHOME/dummy &> "dummy_${name}.log" &
|
abci-cli kvstore --persist $TMHOME/kvstore &> "kvstore_${name}.log" &
|
||||||
PID_DUMMY=$!
|
PID_DUMMY=$!
|
||||||
tendermint node &> tendermint_${name}.log &
|
tendermint node &> tendermint_${name}.log &
|
||||||
PID_TENDERMINT=$!
|
PID_TENDERMINT=$!
|
||||||
|
|
Loading…
Reference in New Issue