Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	cmd/tendermint/flags.go
	glide.lock
	glide.yaml
	node/node.go
	rpc/core/routes.go
	version/version.go
  • Loading branch information
ebuchman committed Jan 13, 2017
2 parents c195252 + c3a3cc7 commit f347143
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 39 deletions.
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -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](
Expand All @@ -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

Expand All @@ -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).
10 changes: 10 additions & 0 deletions cmd/tendermint/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ func parseFlags(config cfg.Config, args []string) {
logLevel string
proxyApp string
abciTransport 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")
Expand All @@ -36,6 +40,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(&abciTransport, "abci", config.GetString("abci"), "Specify abci 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()
Expand All @@ -53,4 +61,6 @@ func parseFlags(config cfg.Config, args []string) {
config.Set("log_level", logLevel)
config.Set("proxy_app", proxyApp)
config.Set("abci", abciTransport)

config.Set("pex_reactor", pex)
}
2 changes: 2 additions & 0 deletions config/tendermint/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,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")
Expand Down
2 changes: 2 additions & 0 deletions config/tendermint_test/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,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")
Expand Down
2 changes: 2 additions & 0 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ import:
- package: golang.org/x/crypto
subpackages:
- ripemd160
- package: github.com/tendermint/go-flowrate
subpackages:
- flowrate
9 changes: 9 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,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 abci query.
// if the query return code is OK, add peer
// XXX: query format subject to change
Expand Down
1 change: 1 addition & 0 deletions rpc/core/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 2 additions & 8 deletions rpc/core/net.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package core

import (
"fmt"

ctypes "github.com/tendermint/tendermint/rpc/core/types"
)

Expand Down Expand Up @@ -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
Expand Down
24 changes: 16 additions & 8 deletions rpc/core/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),

// abci API
"abci_query": rpc.NewRPCFunc(ABCIQueryResult, "query"),
"abci_info": rpc.NewRPCFunc(ABCIInfoResult, ""),

"unsafe_flush_mempool": rpc.NewRPCFunc(UnsafeFlushMempool, ""),
"unsafe_set_config": rpc.NewRPCFunc(UnsafeSetConfigResult, "type,key,value"),
// 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"),
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions scripts/glide/parse.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#! /bin/bash
set -euo pipefail

LIB=$1

set +u
if [[ "$GLIDE" == "" ]]; then
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
fi
set -u

set -euo pipefail

LIB=$1

cat $GLIDE | grep -A1 $LIB | grep -v $LIB | awk '{print $2}'
6 changes: 4 additions & 2 deletions test/test_libs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#! /bin/bash
set -e

# set glide.lock path
if [[ "$GLIDE" == "" ]]; then
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package version

const Maj = "0"
const Min = "7" // abci useability (protobuf, unix); optimizations; broadcast_tx_commit
const Fix = "3" // fixes to event safety, mempool deadlock, hvs race, replay non-empty blocks
const Min = "7" // tmsp useability (protobuf, unix); optimizations; broadcast_tx_commit
const Fix = "4" // --pex flag and less restricted /dial_seeds

const Version = Maj + "." + Min + "." + Fix

0 comments on commit f347143

Please sign in to comment.