Browse Source

Merge pull request #323 from tendermint/release-0.7.4

Release 0.7.4: feature flag: pex reactor
pull/340/head v0.7.4
Ethan Buchman 8 years ago
committed by GitHub
parent
commit
55b47bcb8e
13 changed files with 86 additions and 42 deletions
  1. +29
    -16
      README.md
  2. +1
    -1
      blockchain/pool.go
  3. +10
    -0
      cmd/tendermint/flags.go
  4. +2
    -0
      config/tendermint/config.go
  5. +2
    -0
      config/tendermint_test/config.go
  6. +3
    -3
      glide.lock
  7. +3
    -1
      glide.yaml
  8. +9
    -0
      node/node.go
  9. +1
    -0
      rpc/core/blocks.go
  10. +2
    -8
      rpc/core/net.go
  11. +16
    -8
      rpc/core/routes.go
  12. +4
    -3
      scripts/glide/parse.sh
  13. +4
    -2
      test/test_libs.sh

+ 29
- 16
README.md View File

@ -1,5 +1,8 @@
# Tendermint
Simple, Secure, Scalable Blockchain Platform
[Byzantine-Fault Tolerant](https://en.wikipedia.org/wiki/Byzantine_fault_tolerance)
[State Machine Replication](https://en.wikipedia.org/wiki/State_machine_replication).
Or [Blockchain](https://en.wikipedia.org/wiki/Blockchain_(database)) for short.
[![version](https://img.shields.io/github/tag/tendermint/tendermint.svg)](https://github.com/tendermint/tendermint/releases/latest)
[![API Reference](
@ -16,26 +19,29 @@ master | [![CircleCI](https://circleci.com/gh/tendermint/tendermint/tree/mast
_NOTE: This is yet pre-alpha non-production-quality software._
Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state transition machine, written in any programming language,
and replicates it on many machines.
See the [application developers guide](https://github.com/tendermint/tendermint/wiki/Application-Developers) to get started.
and securely replicates it on many machines.
For more background, see the [introduction](https://tendermint.com/intro).
To get started developing applications, see the [application developers guide](https://tendermint.com/docs/guides/app-development).
## Install
`go get -u github.com/tendermint/tendermint/cmd/tendermint`
For more details (or if it fails), see the [install guide](https://tendermint.com/intro/getting-started/install).
## Contributing
Yay open source! Please see our [contributing guidelines](https://github.com/tendermint/tendermint/wiki/Contributing).
Yay open source! Please see our [contributing guidelines](https://tendermint.com/guides/contributing).
## Resources
### Tendermint Core
- [Introduction](https://github.com/tendermint/tendermint/wiki/Introduction)
- [Validators](https://github.com/tendermint/tendermint/wiki/Validators)
- [Byzantine Consensus Algorithm](https://github.com/tendermint/tendermint/wiki/Byzantine-Consensus-Algorithm)
- [Block Structure](https://github.com/tendermint/tendermint/wiki/Block-Structure)
- [RPC](https://github.com/tendermint/tendermint/wiki/RPC)
- [Genesis](https://github.com/tendermint/tendermint/wiki/Genesis)
- [Configuration](https://github.com/tendermint/tendermint/wiki/Configuration)
- [Light Client Protocol](https://github.com/tendermint/tendermint/wiki/Light-Client-Protocol)
- [Roadmap for V2](https://github.com/tendermint/tendermint/wiki/Roadmap-for-V2)
- [Introduction](https://tendermint.com/intro)
- [Docs](https://tendermint.com/docs)
- [Software using Tendermint](https://tendermint.com/ecosystem)
### Sub-projects
@ -45,8 +51,15 @@ Yay open source! Please see our [contributing guidelines](https://github.com/ten
* [Go-P2P](http://github.com/tendermint/go-p2p)
* [Go-Merkle](http://github.com/tendermint/go-merkle)
## Install
### Applications
`go get -u github.com/tendermint/tendermint/cmd/tendermint`
* [Ethermint](http://github.com/tendermint/ethermint)
* [Basecoin](http://github.com/tendermint/basecoin)
### More
* [Tendermint Blog](https://tendermint.com/blog)
* [Cosmos Blog](https://cosmos.network/blog)
* [Original Whitepaper (out-of-date)](http://www.the-blockchain.com/docs/Tendermint%20Consensus%20without%20Mining.pdf)
* [Master's Thesis on Tendermint](https://atrium.lib.uoguelph.ca/xmlui/handle/10214/9769)
For more details, see the [install guide](https://github.com/tendermint/tendermint/wiki/Installation).

+ 1
- 1
blockchain/pool.go View File

@ -5,8 +5,8 @@ import (
"sync"
"time"
flow "github.com/tendermint/flowcontrol"
. "github.com/tendermint/go-common"
flow "github.com/tendermint/go-flowrate/flowrate"
"github.com/tendermint/tendermint/types"
)


+ 10
- 0
cmd/tendermint/flags.go View File

@ -19,11 +19,15 @@ func parseFlags(config cfg.Config, args []string) {
logLevel string
proxyApp string
tmspTransport string
pex bool
)
// Declare flags
var flags = flag.NewFlagSet("main", flag.ExitOnError)
flags.BoolVar(&printHelp, "help", false, "Print this help message.")
// configuration options
flags.StringVar(&moniker, "moniker", config.GetString("moniker"), "Node Name")
flags.StringVar(&nodeLaddr, "node_laddr", config.GetString("node_laddr"), "Node listen address. (0.0.0.0:0 means any interface, any port)")
flags.StringVar(&seeds, "seeds", config.GetString("seeds"), "Comma delimited host:port seed nodes")
@ -34,6 +38,10 @@ func parseFlags(config cfg.Config, args []string) {
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)")
// feature flags
flags.BoolVar(&pex, "pex", config.GetBool("pex_reactor"), "Enable Peer-Exchange (dev feature)")
flags.Parse(args)
if printHelp {
flags.PrintDefaults()
@ -50,4 +58,6 @@ func parseFlags(config cfg.Config, args []string) {
config.Set("log_level", logLevel)
config.Set("proxy_app", proxyApp)
config.Set("tmsp", tmspTransport)
config.Set("pex_reactor", pex)
}

+ 2
- 0
config/tendermint/config.go View File

@ -61,6 +61,8 @@ func GetConfig(rootDir string) cfg.Config {
mapConfig.SetDefault("fast_sync", true)
mapConfig.SetDefault("skip_upnp", false)
mapConfig.SetDefault("addrbook_file", rootDir+"/addrbook.json")
mapConfig.SetDefault("addrbook_strict", true) // disable to allow connections locally
mapConfig.SetDefault("pex_reactor", false) // enable for peer exchange
mapConfig.SetDefault("priv_validator_file", rootDir+"/priv_validator.json")
mapConfig.SetDefault("db_backend", "leveldb")
mapConfig.SetDefault("db_dir", rootDir+"/data")


+ 2
- 0
config/tendermint_test/config.go View File

@ -74,6 +74,8 @@ func ResetConfig(localPath string) cfg.Config {
mapConfig.SetDefault("fast_sync", false)
mapConfig.SetDefault("skip_upnp", true)
mapConfig.SetDefault("addrbook_file", rootDir+"/addrbook.json")
mapConfig.SetDefault("addrbook_strict", true) // disable to allow connections locally
mapConfig.SetDefault("pex_reactor", false) // enable for peer exchange
mapConfig.SetDefault("priv_validator_file", rootDir+"/priv_validator.json")
mapConfig.SetDefault("db_backend", "memdb")
mapConfig.SetDefault("db_dir", rootDir+"/data")


+ 3
- 3
glide.lock View File

@ -49,8 +49,8 @@ imports:
subpackages:
- edwards25519
- extra25519
- name: github.com/tendermint/flowcontrol
version: 84d9671090430e8ec80e35b339907e0579b999eb
- name: github.com/tendermint/go-flowrate
version: a20c98e61957faa93b4014fbd902f20ab9317a6a
- name: github.com/tendermint/go-clist
version: 3baa390bbaf7634251c42ad69a8682e7e3990552
- name: github.com/tendermint/go-common
@ -70,7 +70,7 @@ imports:
- name: github.com/tendermint/go-merkle
version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8
- name: github.com/tendermint/go-p2p
version: 1eb390680d33299ba0e3334490eca587efd18414
version: eab2baa363de01b052b88c559e803776cd2c7dd6
subpackages:
- upnp
- name: github.com/tendermint/go-rpc


+ 3
- 1
glide.yaml View File

@ -6,7 +6,6 @@ import:
- package: github.com/gorilla/websocket
- package: github.com/spf13/pflag
- package: github.com/tendermint/ed25519
- package: github.com/tendermint/flowcontrol
- package: github.com/tendermint/go-clist
- package: github.com/tendermint/go-common
- package: github.com/tendermint/go-config
@ -34,3 +33,6 @@ import:
- package: golang.org/x/crypto
subpackages:
- ripemd160
- package: github.com/tendermint/go-flowrate
subpackages:
- flowrate

+ 9
- 0
node/node.go View File

@ -115,6 +115,15 @@ func NewNode(config cfg.Config, privValidator *types.PrivValidator, clientCreato
sw.AddReactor("BLOCKCHAIN", bcReactor)
sw.AddReactor("CONSENSUS", consensusReactor)
// Optionally, start the pex reactor
// TODO: this is a dev feature, it needs some love
if config.GetBool("pex_reactor") {
addrBook := p2p.NewAddrBook(config.GetString("addrbook_file"), config.GetBool("addrbook_strict"))
addrBook.Start()
pexReactor := p2p.NewPEXReactor(addrBook)
sw.AddReactor("PEX", pexReactor)
}
// filter peers by addr or pubkey with a tmsp query.
// if the query return code is OK, add peer
// XXX: query format subject to change


+ 1
- 0
rpc/core/blocks.go View File

@ -9,6 +9,7 @@ import (
//-----------------------------------------------------------------------------
// TODO: limit/permission on (max - min)
func BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) {
if maxHeight == 0 {
maxHeight = blockStore.Height()


+ 2
- 8
rpc/core/net.go View File

@ -1,8 +1,6 @@
package core
import (
"fmt"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
@ -31,12 +29,8 @@ func NetInfo() (*ctypes.ResultNetInfo, error) {
//-----------------------------------------------------------------------------
// Dial given list of seeds if we have no outbound peers
func DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
outbound, _, _ := p2pSwitch.NumPeers()
if outbound != 0 {
return nil, fmt.Errorf("Already have some outbound peers")
}
// Dial given list of seeds
func UnsafeDialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
// starts go routines to dial each seed after random delays
p2pSwitch.DialSeeds(seeds)
return &ctypes.ResultDialSeeds{}, nil


+ 16
- 8
rpc/core/routes.go View File

@ -6,30 +6,38 @@ import (
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
// TODO: better system than "unsafe" prefix
var Routes = map[string]*rpc.RPCFunc{
// subscribe/unsubscribe are reserved for websocket events.
"subscribe": rpc.NewWSRPCFunc(SubscribeResult, "event"),
"unsubscribe": rpc.NewWSRPCFunc(UnsubscribeResult, "event"),
// info API
"status": rpc.NewRPCFunc(StatusResult, ""),
"net_info": rpc.NewRPCFunc(NetInfoResult, ""),
"dial_seeds": rpc.NewRPCFunc(DialSeedsResult, "seeds"),
"blockchain": rpc.NewRPCFunc(BlockchainInfoResult, "minHeight,maxHeight"),
"genesis": rpc.NewRPCFunc(GenesisResult, ""),
"block": rpc.NewRPCFunc(BlockResult, "height"),
"validators": rpc.NewRPCFunc(ValidatorsResult, ""),
"dump_consensus_state": rpc.NewRPCFunc(DumpConsensusStateResult, ""),
"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommitResult, "tx"),
"broadcast_tx_sync": rpc.NewRPCFunc(BroadcastTxSyncResult, "tx"),
"broadcast_tx_async": rpc.NewRPCFunc(BroadcastTxAsyncResult, "tx"),
"unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxsResult, ""),
"num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxsResult, ""),
// broadcast API
"broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommitResult, "tx"),
"broadcast_tx_sync": rpc.NewRPCFunc(BroadcastTxSyncResult, "tx"),
"broadcast_tx_async": rpc.NewRPCFunc(BroadcastTxAsyncResult, "tx"),
// tmsp API
"tmsp_query": rpc.NewRPCFunc(TMSPQueryResult, "query"),
"tmsp_info": rpc.NewRPCFunc(TMSPInfoResult, ""),
"unsafe_flush_mempool": rpc.NewRPCFunc(UnsafeFlushMempool, ""),
"unsafe_set_config": rpc.NewRPCFunc(UnsafeSetConfigResult, "type,key,value"),
// control API
"dial_seeds": rpc.NewRPCFunc(UnsafeDialSeedsResult, "seeds"),
"unsafe_flush_mempool": rpc.NewRPCFunc(UnsafeFlushMempool, ""),
"unsafe_set_config": rpc.NewRPCFunc(UnsafeSetConfigResult, "type,key,value"),
// profiler API
"unsafe_start_cpu_profiler": rpc.NewRPCFunc(UnsafeStartCPUProfilerResult, "filename"),
"unsafe_stop_cpu_profiler": rpc.NewRPCFunc(UnsafeStopCPUProfilerResult, ""),
"unsafe_write_heap_profile": rpc.NewRPCFunc(UnsafeWriteHeapProfileResult, "filename"),
@ -67,8 +75,8 @@ func NetInfoResult() (ctypes.TMResult, error) {
}
}
func DialSeedsResult(seeds []string) (ctypes.TMResult, error) {
if r, err := DialSeeds(seeds); err != nil {
func UnsafeDialSeedsResult(seeds []string) (ctypes.TMResult, error) {
if r, err := UnsafeDialSeeds(seeds); err != nil {
return nil, err
} else {
return r, nil


+ 4
- 3
scripts/glide/parse.sh View File

@ -1,10 +1,11 @@
#! /bin/bash
set -euo pipefail
LIB=$1
if [[ "$GLIDE" == "" ]]; then
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
fi
set -euo pipefail
LIB=$1
cat $GLIDE | grep -A1 $LIB | grep -v $LIB | awk '{print $2}'

+ 4
- 2
test/test_libs.sh View File

@ -1,4 +1,5 @@
#! /bin/bash
set -e
# set glide.lock path
if [[ "$GLIDE" == "" ]]; then
@ -28,10 +29,11 @@ for lib in "${LIBS_GO_TEST[@]}"; do
done
for lib in "${LIBS_MAKE_TEST[@]}"; do
getDep $lib
# checkout vendored version of lib
bash scripts/glide/checkout.sh $GLIDE $lib
echo "Testing $lib ..."
cd $GOPATH/src/github.com/tendermint/$lib
make test
if [[ "$?" != 0 ]]; then
echo "FAIL"


Loading…
Cancel
Save