Browse Source

Merge branch 'develop' into jae/literefactor4

jae/literefactor6
Ethan Buchman 7 years ago
parent
commit
5453aa6169
332 changed files with 16233 additions and 830 deletions
  1. +1
    -1
      .github/ISSUE_TEMPLATE
  2. +45
    -13
      CHANGELOG.md
  3. +4
    -4
      CONTRIBUTING.md
  4. +22
    -21
      Gopkg.lock
  5. +7
    -11
      Gopkg.toml
  6. +6
    -9
      README.md
  7. +1
    -1
      abci/client/client.go
  8. +1
    -1
      abci/client/grpc_client.go
  9. +1
    -1
      abci/client/local_client.go
  10. +1
    -1
      abci/client/socket_client.go
  11. +2
    -2
      abci/cmd/abci-cli/abci-cli.go
  12. +1
    -1
      abci/example/counter/counter.go
  13. +2
    -2
      abci/example/example_test.go
  14. +1
    -1
      abci/example/kvstore/helpers.go
  15. +2
    -2
      abci/example/kvstore/kvstore.go
  16. +2
    -2
      abci/example/kvstore/kvstore_test.go
  17. +3
    -3
      abci/example/kvstore/persistent_kvstore.go
  18. +1
    -1
      abci/server/grpc_server.go
  19. +1
    -1
      abci/server/server.go
  20. +1
    -1
      abci/server/socket_server.go
  21. +1
    -1
      abci/tests/benchmarks/parallel/parallel.go
  22. +1
    -1
      abci/tests/benchmarks/simple/simple.go
  23. +1
    -1
      abci/tests/server/client.go
  24. +1
    -1
      abci/tests/test_app/app.go
  25. +1
    -1
      abci/types/messages_test.go
  26. +1
    -1
      abci/types/types.pb.go
  27. +1
    -1
      abci/types/util.go
  28. +1
    -1
      benchmarks/codec_test.go
  29. +1
    -1
      benchmarks/map_test.go
  30. +1
    -1
      benchmarks/os_test.go
  31. +1
    -1
      benchmarks/simu/counter.go
  32. +3
    -3
      blockchain/pool.go
  33. +2
    -2
      blockchain/pool_test.go
  34. +2
    -2
      blockchain/reactor.go
  35. +3
    -3
      blockchain/reactor_test.go
  36. +2
    -2
      blockchain/store.go
  37. +7
    -7
      blockchain/store_test.go
  38. +2
    -2
      cmd/priv_val_server/main.go
  39. +1
    -1
      cmd/tendermint/commands/gen_node_key.go
  40. +4
    -3
      cmd/tendermint/commands/init.go
  41. +1
    -1
      cmd/tendermint/commands/lite.go
  42. +1
    -1
      cmd/tendermint/commands/reset_priv_validator.go
  43. +3
    -3
      cmd/tendermint/commands/root.go
  44. +2
    -2
      cmd/tendermint/commands/root_test.go
  45. +1
    -1
      cmd/tendermint/commands/run_node.go
  46. +1
    -1
      cmd/tendermint/commands/testnet.go
  47. +1
    -1
      cmd/tendermint/main.go
  48. +25
    -28
      config/config.go
  49. +12
    -8
      config/toml.go
  50. +1
    -1
      consensus/byzantine_test.go
  51. +3
    -3
      consensus/common_test.go
  52. +1
    -1
      consensus/mempool_test.go
  53. +2
    -2
      consensus/reactor.go
  54. +2
    -2
      consensus/reactor_test.go
  55. +4
    -4
      consensus/replay.go
  56. +3
    -3
      consensus/replay_file.go
  57. +4
    -4
      consensus/replay_test.go
  58. +15
    -13
      consensus/state.go
  59. +2
    -2
      consensus/state_test.go
  60. +2
    -2
      consensus/ticker.go
  61. +1
    -1
      consensus/types/height_vote_set.go
  62. +1
    -1
      consensus/types/height_vote_set_test.go
  63. +1
    -1
      consensus/types/peer_round_state.go
  64. +1
    -1
      consensus/types/round_state.go
  65. +1
    -1
      consensus/types/round_state_test.go
  66. +1
    -1
      consensus/version.go
  67. +2
    -2
      consensus/wal.go
  68. +4
    -4
      consensus/wal_generator.go
  69. +1
    -1
      consensus/wal_test.go
  70. +1
    -1
      crypto/merkle/doc.go
  71. +1
    -1
      crypto/merkle/simple_map.go
  72. +4
    -4
      crypto/merkle/simple_tree.go
  73. +3
    -3
      crypto/merkle/simple_tree_test.go
  74. +11
    -7
      crypto/pub_key.go
  75. +1
    -1
      crypto/random.go
  76. +4
    -2
      crypto/signature.go
  77. +1
    -1
      crypto/symmetric.go
  78. +23
    -9
      docs/README.md
  79. +0
    -17
      docs/_static/custom_collapsible_code.css
  80. +0
    -10
      docs/_static/custom_collapsible_code.js
  81. +0
    -20
      docs/_templates/layout.html
  82. +2
    -2
      docs/abci-cli.md
  83. +4
    -4
      docs/app-development.md
  84. +1
    -1
      docs/deploy-testnets.md
  85. +6
    -6
      docs/getting-started.md
  86. +5
    -5
      docs/how-to-read-logs.md
  87. +4
    -62
      docs/index.rst
  88. +1
    -1
      docs/running-in-production.md
  89. +24
    -19
      docs/spec/blockchain/encoding.md
  90. +6
    -123
      docs/spec/scripts/crypto.go
  91. +0
    -21
      docs/specification.rst
  92. +4
    -5
      docs/specification/configuration.md
  93. +3
    -3
      docs/using-tendermint.md
  94. +3
    -3
      evidence/pool.go
  95. +1
    -1
      evidence/pool_test.go
  96. +2
    -2
      evidence/reactor.go
  97. +2
    -2
      evidence/reactor_test.go
  98. +1
    -1
      evidence/store.go
  99. +1
    -1
      evidence/store_test.go
  100. +1
    -1
      evidence/wire.go

+ 1
- 1
.github/ISSUE_TEMPLATE View File

@ -33,7 +33,7 @@ in a case of bug.
**How to reproduce it** (as minimally and precisely as possible):
**Logs (you can paste a part showing an error or attach the whole file)**:
**Logs (you can paste a small part showing an error or link a pastebin, gist, etc. containing more of the log file)**:
**Config (you can paste only the changes you've made)**:


+ 45
- 13
CHANGELOG.md View File

@ -1,14 +1,53 @@
# Changelog
## TBD
## 0.23.0
BUG FIXES:
*TBD*
## 0.22.0
*July 2nd, 2018*
BREAKING CHANGES:
- [config] Rename `skip_upnp` to `upnp`, and turn it off by default.
- [types] Update Amino to v0.10.1
* Amino is now fully proto3 compatible for the basic types
* JSON-encoded types now use the type name instead of the prefix bytes
* Integers are encoded as strings
- [crypto] Update go-crypto to v0.10.0 and merge into `crypto`
* privKey.Sign returns error.
* ed25519 address changed to the first 20-bytes of the SHA256 of the raw pubkey bytes
* `tmlibs/merkle` -> `crypto/merkle`. Uses SHA256 instead of RIPEMD160
- [tmlibs] Update to v0.9.0 and merge into `libs`
* remove `merkle` package (moved to `crypto/merkle`)
- [rpc] `syncing` is now called `catching_up`.
FEATURES
- [cmd] Added metrics (served under `/metrics` using a Prometheus client;
disabled by default). See the new `instrumentation` section in the config and
[metrics](https://tendermint.readthedocs.io/projects/tools/en/develop/metrics.html)
guide.
- [p2p] Add IPv6 support to peering.
- [p2p] Add `external_address` to config to allow specifying the address for
peers to dial
- [rpc] limited number of HTTP/WebSocket connections
IMPROVEMENT
- [rpc/client] Supports https and wss now.
- [crypto] Make public key size into public constants
- [mempool] Log tx hash, not entire tx
- [abci] Merged in github.com/tendermint/abci
- [crypto] Merged in github.com/tendermint/go-crypto
- [libs] Merged in github.com/tendermint/tmlibs
- [docs] Move from .rst to .md
BUG FIXES:
- [rpc] Limit maximum number of HTTP/WebSocket connections
(`rpc.max_open_connections`) and gRPC connections
(`rpc.grpc_max_open_connections`). Check out [Running In
Production](https://tendermint.readthedocs.io/en/master/running-in-production.html)
guide if you want to increase them.
(`rpc.grpc_max_open_connections`). Check out "Running In Production" guide if
you want to increase them.
- [rpc] Limit maximum request body size to 1MB (header is limited to 1MB).
- [consensus] Fix a halting bug where `create_empty_blocks=false`
- [p2p] Fix panic in seed mode
## 0.21.0
@ -25,13 +64,6 @@ IMPROVEMENT
- [pubsub] Set default capacity to 0
- [docs] Various improvements
FEATURES
- [main] added metrics (served under `/metrics` using a Prometheus client;
disabled by default). See the new `instrumentation` section in the config and
[metrics](https://tendermint.readthedocs.io/projects/tools/en/v0.21.0/metrics.html)
guide.
BUG FIXES
- [consensus] Fix an issue where we don't make blocks after `fast_sync` when `create_empty_blocks=false`


+ 4
- 4
CONTRIBUTING.md View File

@ -17,7 +17,7 @@ Instead, we use `git remote` to add the fork as a new remote for the original re
For instance, to create a fork and work on a branch of it, I would:
* Create the fork on github, using the fork button.
* Go to the original repo checked out locally (ie. `$GOPATH/src/github.com/tendermint/tendermint`)
* Go to the original repo checked out locally (i.e. `$GOPATH/src/github.com/tendermint/tendermint`)
* `git remote rename origin upstream`
* `git remote add origin git@github.com:ebuchman/basecoin.git`
@ -47,7 +47,7 @@ get_vendor_deps`). Even for dependencies under our control, dep helps us to
keep multiple repos in sync as they evolve. Anything with an executable, such
as apps, tools, and the core, should use dep.
Run `dep status` to get a list of vendored dependencies that may not be
Run `dep status` to get a list of vendor dependencies that may not be
up-to-date.
## Vagrant
@ -85,7 +85,7 @@ especially `go-p2p` and `go-rpc`, as their versions are referenced in tendermint
- the latest state of development is on `develop`
- `develop` must never fail `make test`
- no --force onto `develop` (except when reverting a broken commit, which should seldom happen)
- create a development branch either on github.com/tendermint/tendermint, or your fork (using `git add origin`)
- create a development branch either on github.com/tendermint/tendermint, or your fork (using `git remote add origin`)
- before submitting a pull request, begin `git rebase` on top of `develop`
### Pull Merge Procedure:
@ -110,7 +110,7 @@ especially `go-p2p` and `go-rpc`, as their versions are referenced in tendermint
- make the required changes
- these changes should be small and an absolute necessity
- add a note to CHANGELOG.md
- bumb versions
- bump versions
- push to hotfix-vX.X.X to run the extended integration tests on the CI
- merge hotfix-vX.X.X to master
- merge hotfix-vX.X.X to develop


+ 22
- 21
Gopkg.lock View File

@ -16,7 +16,10 @@
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcutil"
packages = ["base58"]
packages = [
"base58",
"bech32"
]
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
[[projects]]
@ -113,7 +116,6 @@
".",
"hcl/ast",
"hcl/parser",
"hcl/printer",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
@ -211,7 +213,7 @@
"nfs",
"xfs"
]
revision = "94663424ae5ae9856b40a9f170762b4197024661"
revision = "40f013a808ec4fa79def444a1a56de4d1727efcb"
[[projects]]
branch = "master"
@ -237,8 +239,8 @@
[[projects]]
name = "github.com/spf13/cobra"
packages = ["."]
revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385"
version = "v0.0.3"
revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b"
version = "v0.0.1"
[[projects]]
branch = "master"
@ -255,8 +257,8 @@
[[projects]]
name = "github.com/spf13/viper"
packages = ["."]
revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736"
version = "v1.0.2"
revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7"
version = "v1.0.0"
[[projects]]
name = "github.com/stretchr/testify"
@ -305,17 +307,9 @@
[[projects]]
name = "github.com/tendermint/tmlibs"
packages = [
"autofile",
"cli",
"cli/flags",
"clist",
"common",
"db",
"flowrate",
"log",
"merkle",
"merkle/tmhash",
"test"
"log"
]
revision = "49596e0a1f48866603813df843c9409fc19805c6"
version = "v0.9.0"
@ -330,6 +324,7 @@
"curve25519",
"hkdf",
"internal/chacha20",
"internal/subtle",
"nacl/box",
"nacl/secretbox",
"openpgp/armor",
@ -338,7 +333,7 @@
"ripemd160",
"salsa20/salsa"
]
revision = "8ac0e0d97ce45cd83d1d7243c060cb8461dda5e9"
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
[[projects]]
branch = "master"
@ -362,7 +357,7 @@
"cpu",
"unix"
]
revision = "a9e25c09b96b8870693763211309e213c6ef299d"
revision = "7138fd3d9dc8335c567ca206f4333fb75eb05d56"
[[projects]]
name = "golang.org/x/text"
@ -395,9 +390,13 @@
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"codes",
"connectivity",
"credentials",
"encoding",
"encoding/proto",
"grpclb/grpc_lb_v1/messages",
"grpclog",
"internal",
@ -406,13 +405,15 @@
"naming",
"peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap",
"transport"
]
revision = "5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e"
version = "v1.7.5"
revision = "d11072e7ca9811b1100b80ca0269ac831f06d024"
version = "v1.11.3"
[[projects]]
name = "gopkg.in/yaml.v2"
@ -423,6 +424,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "c25289282b94abc7f0c390e592e5e1636b7f26cb4773863ac39cde7fdc7b5bdf"
inputs-digest = "304d47a4914b47a821cc79c2186e198a98321a52d5932a2df988f02849f1924d"
solver-name = "gps-cdcl"
solver-version = 1

+ 7
- 11
Gopkg.toml View File

@ -35,15 +35,15 @@
[[constraint]]
name = "github.com/go-kit/kit"
version = "~0.6.0"
version = "=0.6.0"
[[constraint]]
name = "github.com/gogo/protobuf"
version = "~1.0.0"
version = "=1.0.0"
[[constraint]]
name = "github.com/golang/protobuf"
version = "~1.0.0"
version = "=1.0.0"
[[constraint]]
name = "github.com/gorilla/websocket"
@ -51,7 +51,7 @@
[[constraint]]
name = "github.com/pkg/errors"
version = "~0.8.0"
version = "=0.8.0"
[[constraint]]
name = "github.com/rcrowley/go-metrics"
@ -59,11 +59,11 @@
[[constraint]]
name = "github.com/spf13/cobra"
version = "~0.0.1"
version = "=0.0.1"
[[constraint]]
name = "github.com/spf13/viper"
version = "~1.0.0"
version = "=1.0.0"
[[constraint]]
name = "github.com/stretchr/testify"
@ -73,13 +73,9 @@
name = "github.com/tendermint/go-amino"
version = "~0.10.1"
[[override]]
name = "github.com/tendermint/tmlibs"
version = "~0.9.0"
[[constraint]]
name = "google.golang.org/grpc"
version = "~1.7.3"
version = "~1.11.3"
# this got updated and broke, so locked to an old working commit ...
[[override]]


+ 6
- 9
README.md View File

@ -50,13 +50,13 @@ Go version | Go1.9 or higher
## Install
See the [install instructions](/docs/install.rst)
See the [install instructions](/docs/install.md)
## Quick Start
- [Single node](/docs/using-tendermint.rst)
- [Single node](/docs/using-tendermint.md)
- [Local cluster using docker-compose](/networks/local)
- [Remote cluster using terraform and ansible](/docs/terraform-and-ansible.rst)
- [Remote cluster using terraform and ansible](/docs/terraform-and-ansible.md)
- [Join the public testnet](https://cosmos.network/testnet)
## Resources
@ -72,10 +72,7 @@ Additional information about some - and eventually all - of the sub-projects bel
### Sub-projects
* [ABCI](http://github.com/tendermint/abci), the Application Blockchain Interface
* [Go-Wire](http://github.com/tendermint/go-wire), a deterministic serialization library
* [Go-Crypto](http://github.com/tendermint/tendermint/crypto), an elliptic curve cryptography library
* [TmLibs](http://github.com/tendermint/tmlibs), an assortment of Go libraries used internally
* [Amino](http://github.com/tendermint/go-amino), a reflection-based improvement on proto3
* [IAVL](http://github.com/tendermint/iavl), Merkleized IAVL+ Tree implementation
### Tools
@ -119,8 +116,8 @@ CHANGELOG even if they don't lead to MINOR version bumps:
- node
Exported objects in these packages that are not covered by the versioning scheme
are explicitly marked by `// UNSTABLE` in their go doc comment and may change at any time.
Functions, types, and values in any other package may also change at any time.
are explicitly marked by `// UNSTABLE` in their go doc comment and may change at any
time without notice. Functions, types, and values in any other package may also change at any time.
### Upgrades


+ 1
- 1
abci/client/client.go View File

@ -5,7 +5,7 @@ import (
"sync"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
const (


+ 1
- 1
abci/client/grpc_client.go View File

@ -10,7 +10,7 @@ import (
grpc "google.golang.org/grpc"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
var _ Client = (*grpcClient)(nil)


+ 1
- 1
abci/client/local_client.go View File

@ -4,7 +4,7 @@ import (
"sync"
types "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
var _ Client = (*localClient)(nil)


+ 1
- 1
abci/client/socket_client.go View File

@ -11,7 +11,7 @@ import (
"time"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
const reqQueueSize = 256 // TODO make configurable


+ 2
- 2
abci/cmd/abci-cli/abci-cli.go View File

@ -11,8 +11,8 @@ import (
"github.com/spf13/cobra"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/example/code"


+ 1
- 1
abci/example/counter/counter.go View File

@ -6,7 +6,7 @@ import (
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
type CounterApplication struct {


+ 2
- 2
abci/example/example_test.go View File

@ -11,8 +11,8 @@ import (
"golang.org/x/net/context"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/example/code"


+ 1
- 1
abci/example/kvstore/helpers.go View File

@ -2,7 +2,7 @@ package kvstore
import (
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
// RandVal creates one random validator, with a key derived


+ 2
- 2
abci/example/kvstore/kvstore.go View File

@ -8,8 +8,8 @@ import (
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
)
var (


+ 2
- 2
abci/example/kvstore/kvstore_test.go View File

@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/example/code"


+ 3
- 3
abci/example/kvstore/persistent_kvstore.go View File

@ -9,9 +9,9 @@ import (
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
)
const (


+ 1
- 1
abci/server/grpc_server.go View File

@ -6,7 +6,7 @@ import (
"google.golang.org/grpc"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
type GRPCServer struct {


+ 1
- 1
abci/server/server.go View File

@ -13,7 +13,7 @@ import (
"fmt"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func NewServer(protoAddr, transport string, app types.Application) (cmn.Service, error) {


+ 1
- 1
abci/server/socket_server.go View File

@ -8,7 +8,7 @@ import (
"sync"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
// var maxNumberConnections = 2


+ 1
- 1
abci/tests/benchmarks/parallel/parallel.go View File

@ -6,7 +6,7 @@ import (
"log"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func main() {


+ 1
- 1
abci/tests/benchmarks/simple/simple.go View File

@ -8,7 +8,7 @@ import (
"reflect"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func main() {


+ 1
- 1
abci/tests/server/client.go View File

@ -7,7 +7,7 @@ import (
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func InitChain(client abcicli.Client) error {


+ 1
- 1
abci/tests/test_app/app.go View File

@ -7,7 +7,7 @@ import (
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/tendermint/libs/log"
)
func startClient(abciType string) abcicli.Client {


+ 1
- 1
abci/types/messages_test.go View File

@ -8,7 +8,7 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func TestMarshalJSON(t *testing.T) {


+ 1
- 1
abci/types/types.pb.go View File

@ -50,7 +50,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import common "github.com/tendermint/tmlibs/common"
import common "github.com/tendermint/tendermint/libs/common"
import context "golang.org/x/net/context"
import grpc "google.golang.org/grpc"


+ 1
- 1
abci/types/util.go View File

@ -5,7 +5,7 @@ import (
"encoding/json"
"sort"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
//------------------------------------------------------------------------------


+ 1
- 1
benchmarks/codec_test.go View File

@ -6,8 +6,8 @@ import (
"github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/crypto"
proto "github.com/tendermint/tendermint/benchmarks/proto"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/p2p"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)


+ 1
- 1
benchmarks/map_test.go View File

@ -3,7 +3,7 @@ package benchmarks
import (
"testing"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func BenchmarkSomething(b *testing.B) {


+ 1
- 1
benchmarks/os_test.go View File

@ -4,7 +4,7 @@ import (
"os"
"testing"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func BenchmarkFileWrite(b *testing.B) {


+ 1
- 1
benchmarks/simu/counter.go View File

@ -7,7 +7,7 @@ import (
"time"
rpcclient "github.com/tendermint/tendermint/rpc/lib/client"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func main() {


+ 3
- 3
blockchain/pool.go View File

@ -8,9 +8,9 @@ import (
"sync/atomic"
"time"
cmn "github.com/tendermint/tmlibs/common"
flow "github.com/tendermint/tmlibs/flowrate"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
flow "github.com/tendermint/tendermint/libs/flowrate"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"


+ 2
- 2
blockchain/pool_test.go View File

@ -5,8 +5,8 @@ import (
"testing"
"time"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"


+ 2
- 2
blockchain/reactor.go View File

@ -9,8 +9,8 @@ import (
"github.com/tendermint/tendermint/p2p"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
)
const (


+ 3
- 3
blockchain/reactor_test.go View File

@ -4,9 +4,9 @@ import (
"net"
"testing"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"


+ 2
- 2
blockchain/store.go View File

@ -4,8 +4,8 @@ import (
"fmt"
"sync"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/types"
)


+ 7
- 7
blockchain/store_test.go View File

@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/types"
)
@ -153,14 +153,14 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
parts: validPartSet,
seenCommit: seenCommit1,
corruptCommitInDB: true, // Corrupt the DB's commit entry
wantPanic: "Error reading block commit",
wantPanic: "unmarshal to types.Commit failed",
},
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
wantPanic: "Error reading block",
wantPanic: "unmarshal to types.BlockMeta failed",
corruptBlockInDB: true, // Corrupt the DB's block entry
},
@ -179,7 +179,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
seenCommit: seenCommit1,
corruptSeenCommitInDB: true,
wantPanic: "Error reading block seen commit",
wantPanic: "unmarshal to types.Commit failed",
},
{
@ -287,7 +287,7 @@ func TestLoadBlockPart(t *testing.T) {
db.Set(calcBlockPartKey(height, index), []byte("Tendermint"))
res, _, panicErr = doFn(loadPart)
require.NotNil(t, panicErr, "expecting a non-nil panic")
require.Contains(t, fmt.Sprintf("%#v", panicErr), "Error reading block part")
require.Contains(t, panicErr.Error(), "unmarshal to types.Part failed")
// 3. A good block serialized and saved to the DB should be retrievable
db.Set(calcBlockPartKey(height, index), cdc.MustMarshalBinaryBare(part1))
@ -316,7 +316,7 @@ func TestLoadBlockMeta(t *testing.T) {
db.Set(calcBlockMetaKey(height), []byte("Tendermint-Meta"))
res, _, panicErr = doFn(loadMeta)
require.NotNil(t, panicErr, "expecting a non-nil panic")
require.Contains(t, fmt.Sprintf("%#v", panicErr), "Error reading block meta")
require.Contains(t, panicErr.Error(), "unmarshal to types.BlockMeta")
// 3. A good blockMeta serialized and saved to the DB should be retrievable
meta := &types.BlockMeta{}


+ 2
- 2
cmd/priv_val_server/main.go View File

@ -5,8 +5,8 @@ import (
"os"
crypto "github.com/tendermint/tendermint/crypto"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/privval"
)


+ 1
- 1
cmd/tendermint/commands/gen_node_key.go View File

@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/p2p"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
// GenNodeKeyCmd allows the generation of a node key. It prints node's ID to


+ 4
- 3
cmd/tendermint/commands/init.go View File

@ -9,7 +9,7 @@ import (
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
// InitFilesCmd initialises a fresh Tendermint Core instance.
@ -52,8 +52,9 @@ func initFilesWithConfig(config *cfg.Config) error {
logger.Info("Found genesis file", "path", genFile)
} else {
genDoc := types.GenesisDoc{
ChainID: cmn.Fmt("test-chain-%v", cmn.RandStr(6)),
GenesisTime: time.Now(),
ChainID: cmn.Fmt("test-chain-%v", cmn.RandStr(6)),
GenesisTime: time.Now(),
ConsensusParams: types.DefaultConsensusParams(),
}
genDoc.Validators = []types.GenesisValidator{{
PubKey: pv.GetPubKey(),


+ 1
- 1
cmd/tendermint/commands/lite.go View File

@ -6,9 +6,9 @@ import (
"github.com/spf13/cobra"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/lite/proxy"
rpcclient "github.com/tendermint/tendermint/rpc/client"
cmn "github.com/tendermint/tmlibs/common"
)
// LiteCmd represents the base command when called without any subcommands


+ 1
- 1
cmd/tendermint/commands/reset_priv_validator.go View File

@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/tendermint/libs/log"
)
// ResetAllCmd removes the database of this Tendermint core


+ 3
- 3
cmd/tendermint/commands/root.go View File

@ -7,9 +7,9 @@ import (
"github.com/spf13/viper"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tmlibs/cli"
tmflags "github.com/tendermint/tmlibs/cli/flags"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/tendermint/libs/cli"
tmflags "github.com/tendermint/tendermint/libs/cli/flags"
"github.com/tendermint/tendermint/libs/log"
)
var (


+ 2
- 2
cmd/tendermint/commands/root_test.go View File

@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tmlibs/cli"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tendermint/libs/cli"
cmn "github.com/tendermint/tendermint/libs/common"
)
var (


+ 1
- 1
cmd/tendermint/commands/run_node.go View File

@ -33,7 +33,7 @@ func AddNodeFlags(cmd *cobra.Command) {
cmd.Flags().String("p2p.laddr", config.P2P.ListenAddress, "Node listen address. (0.0.0.0:0 means any interface, any port)")
cmd.Flags().String("p2p.seeds", config.P2P.Seeds, "Comma-delimited ID@host:port seed nodes")
cmd.Flags().String("p2p.persistent_peers", config.P2P.PersistentPeers, "Comma-delimited ID@host:port persistent peers")
cmd.Flags().Bool("p2p.skip_upnp", config.P2P.SkipUPNP, "Skip UPNP configuration")
cmd.Flags().Bool("p2p.upnp", config.P2P.UPNP, "Enable/disable UPNP port forwarding")
cmd.Flags().Bool("p2p.pex", config.P2P.PexReactor, "Enable/disable Peer-Exchange")
cmd.Flags().Bool("p2p.seed_mode", config.P2P.SeedMode, "Enable/disable seed mode")
cmd.Flags().String("p2p.private_peer_ids", config.P2P.PrivatePeerIDs, "Comma-delimited private peer IDs")


+ 1
- 1
cmd/tendermint/commands/testnet.go View File

@ -14,7 +14,7 @@ import (
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
var (


+ 1
- 1
cmd/tendermint/main.go View File

@ -4,7 +4,7 @@ import (
"os"
"path/filepath"
"github.com/tendermint/tmlibs/cli"
"github.com/tendermint/tendermint/libs/cli"
cmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
cfg "github.com/tendermint/tendermint/config"


+ 25
- 28
config/config.go View File

@ -276,6 +276,9 @@ type P2PConfig struct {
// Address to listen for incoming connections
ListenAddress string `mapstructure:"laddr"`
// Address to advertise to peers for them to dial
ExternalAddress string `mapstructure:"external_address"`
// Comma separated list of seed nodes to connect to
// We only use these if we can’t connect to peers in the addrbook
Seeds string `mapstructure:"seeds"`
@ -284,8 +287,8 @@ type P2PConfig struct {
// Do not add private peers to this list if you don't want them advertised
PersistentPeers string `mapstructure:"persistent_peers"`
// Skip UPNP port forwarding
SkipUPNP bool `mapstructure:"skip_upnp"`
// UPNP port forwarding
UPNP bool `mapstructure:"upnp"`
// Path to address book
AddrBook string `mapstructure:"addr_book_file"`
@ -299,9 +302,8 @@ type P2PConfig struct {
// Time to wait before flushing messages out on the connection, in ms
FlushThrottleTimeout int `mapstructure:"flush_throttle_timeout"`
// Maximum size of a message packet, in bytes
// Includes a header, which is ~13 bytes
MaxPacketMsgSize int `mapstructure:"max_packet_msg_size"`
// Maximum size of a message packet payload, in bytes
MaxPacketMsgPayloadSize int `mapstructure:"max_packet_msg_payload_size"`
// Rate at which packets can be sent, in bytes/second
SendRate int64 `mapstructure:"send_rate"`
@ -340,22 +342,24 @@ type P2PConfig struct {
// DefaultP2PConfig returns a default configuration for the peer-to-peer layer
func DefaultP2PConfig() *P2PConfig {
return &P2PConfig{
ListenAddress: "tcp://0.0.0.0:26656",
AddrBook: defaultAddrBookPath,
AddrBookStrict: true,
MaxNumPeers: 50,
FlushThrottleTimeout: 100,
MaxPacketMsgSize: 1024, // 1 kB
SendRate: 512000, // 500 kB/s
RecvRate: 512000, // 500 kB/s
PexReactor: true,
SeedMode: false,
AllowDuplicateIP: true, // so non-breaking yet
HandshakeTimeout: 20 * time.Second,
DialTimeout: 3 * time.Second,
TestDialFail: false,
TestFuzz: false,
TestFuzzConfig: DefaultFuzzConnConfig(),
ListenAddress: "tcp://0.0.0.0:26656",
ExternalAddress: "",
UPNP: false,
AddrBook: defaultAddrBookPath,
AddrBookStrict: true,
MaxNumPeers: 50,
FlushThrottleTimeout: 100,
MaxPacketMsgPayloadSize: 1024, // 1 kB
SendRate: 512000, // 500 kB/s
RecvRate: 512000, // 500 kB/s
PexReactor: true,
SeedMode: false,
AllowDuplicateIP: true, // so non-breaking yet
HandshakeTimeout: 20 * time.Second,
DialTimeout: 3 * time.Second,
TestDialFail: false,
TestFuzz: false,
TestFuzzConfig: DefaultFuzzConnConfig(),
}
}
@ -363,7 +367,6 @@ func DefaultP2PConfig() *P2PConfig {
func TestP2PConfig() *P2PConfig {
cfg := DefaultP2PConfig()
cfg.ListenAddress = "tcp://0.0.0.0:36656"
cfg.SkipUPNP = true
cfg.FlushThrottleTimeout = 10
cfg.AllowDuplicateIP = true
return cfg
@ -454,10 +457,6 @@ type ConsensusConfig struct {
// Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
SkipTimeoutCommit bool `mapstructure:"skip_timeout_commit"`
// BlockSize
MaxBlockSizeTxs int `mapstructure:"max_block_size_txs"`
MaxBlockSizeBytes int `mapstructure:"max_block_size_bytes"`
// EmptyBlocks mode and possible interval between empty blocks in seconds
CreateEmptyBlocks bool `mapstructure:"create_empty_blocks"`
CreateEmptyBlocksInterval int `mapstructure:"create_empty_blocks_interval"`
@ -479,8 +478,6 @@ func DefaultConsensusConfig() *ConsensusConfig {
TimeoutPrecommitDelta: 500,
TimeoutCommit: 1000,
SkipTimeoutCommit: false,
MaxBlockSizeTxs: 10000,
MaxBlockSizeBytes: 1, // TODO
CreateEmptyBlocks: true,
CreateEmptyBlocksInterval: 0,
PeerGossipSleepDuration: 100,


+ 12
- 8
config/toml.go View File

@ -6,7 +6,7 @@ import (
"path/filepath"
"text/template"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
var configTemplate *template.Template
@ -142,6 +142,12 @@ max_open_connections = {{ .RPC.MaxOpenConnections }}
# Address to listen for incoming connections
laddr = "{{ .P2P.ListenAddress }}"
# Address to advertise to peers for them to dial
# If empty, will use the same port as the laddr,
# and will introspect on the listener or use UPnP
# to figure out the address.
external_address = "{{ .P2P.ExternalAddress }}"
# Comma separated list of seed nodes to connect to
seeds = "{{ .P2P.Seeds }}"
@ -149,6 +155,9 @@ seeds = "{{ .P2P.Seeds }}"
# Do not add private peers to this list if you don't want them advertised
persistent_peers = "{{ .P2P.PersistentPeers }}"
# UPNP port forwarding
upnp = {{ .P2P.UPNP }}
# Path to address book
addr_book_file = "{{ js .P2P.AddrBook }}"
@ -161,9 +170,8 @@ flush_throttle_timeout = {{ .P2P.FlushThrottleTimeout }}
# Maximum number of peers to connect to
max_num_peers = {{ .P2P.MaxNumPeers }}
# Maximum size of a message packet, in bytes
# Includes a header, which is ~13 bytes
max_packet_msg_size = {{ .P2P.MaxPacketMsgSize }}
# Maximum size of a message packet payload, in bytes
max_packet_msg_payload_size = {{ .P2P.MaxPacketMsgPayloadSize }}
# Rate at which packets can be sent, in bytes/second
send_rate = {{ .P2P.SendRate }}
@ -214,10 +222,6 @@ timeout_commit = {{ .Consensus.TimeoutCommit }}
# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
skip_timeout_commit = {{ .Consensus.SkipTimeoutCommit }}
# BlockSize
max_block_size_txs = {{ .Consensus.MaxBlockSizeTxs }}
max_block_size_bytes = {{ .Consensus.MaxBlockSizeBytes }}
# EmptyBlocks mode and possible interval between empty blocks in seconds
create_empty_blocks = {{ .Consensus.CreateEmptyBlocks }}
create_empty_blocks_interval = {{ .Consensus.CreateEmptyBlocksInterval }}


+ 1
- 1
consensus/byzantine_test.go View File

@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func init() {


+ 3
- 3
consensus/common_test.go View File

@ -23,9 +23,9 @@ import (
"github.com/tendermint/tendermint/privval"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/abci/example/counter"
"github.com/tendermint/tendermint/abci/example/kvstore"


+ 1
- 1
consensus/mempool_test.go View File

@ -10,7 +10,7 @@ import (
"github.com/tendermint/tendermint/abci/example/code"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/types"
)


+ 2
- 2
consensus/reactor.go View File

@ -9,8 +9,8 @@ import (
"github.com/pkg/errors"
amino "github.com/tendermint/go-amino"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
cstypes "github.com/tendermint/tendermint/consensus/types"
tmevents "github.com/tendermint/tendermint/libs/events"


+ 2
- 2
consensus/reactor_test.go View File

@ -11,8 +11,8 @@ import (
"time"
"github.com/tendermint/tendermint/abci/example/kvstore"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"


+ 4
- 4
consensus/replay.go View File

@ -11,10 +11,10 @@ import (
"time"
abci "github.com/tendermint/tendermint/abci/types"
//auto "github.com/tendermint/tmlibs/autofile"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
//auto "github.com/tendermint/tendermint/libs/autofile"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"


+ 3
- 3
consensus/replay_file.go View File

@ -16,9 +16,9 @@ import (
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
)
const (


+ 4
- 4
consensus/replay_test.go View File

@ -19,16 +19,16 @@ import (
"github.com/tendermint/tendermint/abci/example/kvstore"
abci "github.com/tendermint/tendermint/abci/types"
crypto "github.com/tendermint/tendermint/crypto"
auto "github.com/tendermint/tmlibs/autofile"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
auto "github.com/tendermint/tendermint/libs/autofile"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/tendermint/libs/log"
)
var consensusReplayConfig *cfg.Config


+ 15
- 13
consensus/state.go View File

@ -10,8 +10,8 @@ import (
"time"
fail "github.com/ebuchman/fail-test"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
cfg "github.com/tendermint/tendermint/config"
cstypes "github.com/tendermint/tendermint/consensus/types"
@ -328,10 +328,7 @@ func (cs *ConsensusState) OnStop() {
cs.timeoutTicker.Stop()
// Make BaseService.Wait() wait until cs.wal.Wait()
if cs.IsRunning() {
cs.wal.Wait()
}
cs.wal.Stop()
}
// Wait waits for the the main routine to return.
@ -632,7 +629,7 @@ func (cs *ConsensusState) handleMsg(mi msgInfo) {
err = cs.setProposal(msg.Proposal)
case *BlockPartMessage:
// if the proposal is complete, we'll enterPrevote or tryFinalizeCommit
_, err = cs.addProposalBlockPart(msg.Height, msg.Part)
_, err = cs.addProposalBlockPart(msg, peerID)
if err != nil && msg.Round != cs.Round {
cs.Logger.Debug("Received block part from wrong round", "height", cs.Height, "csRound", cs.Round, "blockRound", msg.Round)
err = nil
@ -940,7 +937,7 @@ func (cs *ConsensusState) createProposalBlock() (block *types.Block, blockParts
}
// Mempool validated transactions
txs := cs.mempool.Reap(cs.config.MaxBlockSizeTxs)
txs := cs.mempool.Reap(cs.state.ConsensusParams.BlockSize.MaxTxs)
block, parts := cs.state.MakeBlock(cs.Height, txs, commit)
evidence := cs.evpool.PendingEvidence()
block.AddEvidence(evidence)
@ -1409,17 +1406,22 @@ func (cs *ConsensusState) defaultSetProposal(proposal *types.Proposal) error {
// NOTE: block is not necessarily valid.
// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block.
func (cs *ConsensusState) addProposalBlockPart(height int64, part *types.Part) (added bool, err error) {
func (cs *ConsensusState) addProposalBlockPart(msg *BlockPartMessage, peerID p2p.ID) (added bool, err error) {
height, round, part := msg.Height, msg.Round, msg.Part
// Blocks might be reused, so round mismatch is OK
if cs.Height != height {
cs.Logger.Debug("Received block part from wrong height", "height", height)
cs.Logger.Debug("Received block part from wrong height", "height", height, "round", round)
return false, nil
}
// We're not expecting a block part.
if cs.ProposalBlockParts == nil {
cs.Logger.Info("Received a block part when we're not expecting any", "height", height)
return false, nil // TODO: bad peer? Return error?
// NOTE: this can happen when we've gone to a higher round and
// then receive parts from the previous round - not necessarily a bad peer.
cs.Logger.Info("Received a block part when we're not expecting any",
"height", height, "round", round, "index", part.Index, "peer", peerID)
return false, nil
}
added, err = cs.ProposalBlockParts.AddPart(part)
@ -1453,7 +1455,7 @@ func (cs *ConsensusState) addProposalBlockPart(height int64, part *types.Part) (
// procedure at this point.
}
if cs.Step == cstypes.RoundStepPropose && cs.isProposalComplete() {
if cs.Step <= cstypes.RoundStepPropose && cs.isProposalComplete() {
// Move onto the next step
cs.enterPrevote(height, cs.Round)
} else if cs.Step == cstypes.RoundStepCommit {


+ 2
- 2
consensus/state_test.go View File

@ -10,8 +10,8 @@ import (
cstypes "github.com/tendermint/tendermint/consensus/types"
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
)
func init() {


+ 2
- 2
consensus/ticker.go View File

@ -3,8 +3,8 @@ package consensus
import (
"time"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
)
var (


+ 1
- 1
consensus/types/height_vote_set.go View File

@ -8,7 +8,7 @@ import (
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
type RoundVoteSet struct {


+ 1
- 1
consensus/types/height_vote_set_test.go View File

@ -6,7 +6,7 @@ import (
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
var config *cfg.Config // NOTE: must be reset for each _test.go file


+ 1
- 1
consensus/types/peer_round_state.go View File

@ -5,7 +5,7 @@ import (
"time"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
//-----------------------------------------------------------------------------


+ 1
- 1
consensus/types/round_state.go View File

@ -6,7 +6,7 @@ import (
"time"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
//-----------------------------------------------------------------------------


+ 1
- 1
consensus/types/round_state_test.go View File

@ -7,7 +7,7 @@ import (
"github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
func BenchmarkRoundStateDeepCopy(b *testing.B) {


+ 1
- 1
consensus/version.go View File

@ -1,7 +1,7 @@
package consensus
import (
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
// kind of arbitrary


+ 2
- 2
consensus/wal.go View File

@ -12,8 +12,8 @@ import (
amino "github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/types"
auto "github.com/tendermint/tmlibs/autofile"
cmn "github.com/tendermint/tmlibs/common"
auto "github.com/tendermint/tendermint/libs/autofile"
cmn "github.com/tendermint/tendermint/libs/common"
)
const (


+ 4
- 4
consensus/wal_generator.go View File

@ -17,10 +17,10 @@ import (
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
auto "github.com/tendermint/tmlibs/autofile"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
auto "github.com/tendermint/tendermint/libs/autofile"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
)
// WALWithNBlocks generates a consensus WAL. It does this by spining up a


+ 1
- 1
consensus/wal_test.go View File

@ -9,7 +9,7 @@ import (
"github.com/tendermint/tendermint/consensus/types"
tmtypes "github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"


+ 1
- 1
crypto/merkle/doc.go View File

@ -28,4 +28,4 @@ https://bitcointalk.org/?topic=102395
TODO(ismail): add 2nd pre-image protection or clarify further on how we use this and why this secure.
*/
package merkle
package merkle

+ 1
- 1
crypto/merkle/simple_map.go View File

@ -2,7 +2,7 @@ package merkle
import (
"github.com/tendermint/tendermint/crypto/tmhash"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
)
// Merkle tree from a map.


+ 4
- 4
crypto/merkle/simple_tree.go View File

@ -9,12 +9,12 @@ func SimpleHashFromTwoHashes(left, right []byte) []byte {
var hasher = tmhash.New()
err := encodeByteSlice(hasher, left)
if err != nil {
panic(err)
}
panic(err)
}
err = encodeByteSlice(hasher, right)
if err != nil {
panic(err)
}
panic(err)
}
return hasher.Sum(nil)
}


+ 3
- 3
crypto/merkle/simple_tree_test.go View File

@ -3,11 +3,11 @@ package merkle
import (
"bytes"
cmn "github.com/tendermint/tmlibs/common"
. "github.com/tendermint/tmlibs/test"
cmn "github.com/tendermint/tendermint/libs/common"
. "github.com/tendermint/tendermint/libs/test"
"testing"
"github.com/tendermint/tendermint/crypto/tmhash"
"testing"
)
type testItem []byte


+ 11
- 7
crypto/pub_key.go View File

@ -12,7 +12,7 @@ import (
"github.com/tendermint/ed25519"
"github.com/tendermint/ed25519/extra25519"
cmn "github.com/tendermint/tmlibs/common"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/crypto/tmhash"
)
@ -40,8 +40,10 @@ type PubKey interface {
var _ PubKey = PubKeyEd25519{}
const PubKeyEd25519Size = 32
// Implements PubKeyInner
type PubKeyEd25519 [32]byte
type PubKeyEd25519 [PubKeyEd25519Size]byte
// Address is the SHA256-20 of the raw pubkey bytes.
func (pubKey PubKeyEd25519) Address() Address {
@ -62,15 +64,15 @@ func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ Signature) bool {
if !ok {
return false
}
pubKeyBytes := [32]byte(pubKey)
sigBytes := [64]byte(sig)
pubKeyBytes := [PubKeyEd25519Size]byte(pubKey)
sigBytes := [SignatureEd25519Size]byte(sig)
return ed25519.Verify(&pubKeyBytes, msg, &sigBytes)
}
// For use with golang/crypto/nacl/box
// If error, returns nil.
func (pubKey PubKeyEd25519) ToCurve25519() *[32]byte {
keyCurve25519, pubKeyBytes := new([32]byte), [32]byte(pubKey)
func (pubKey PubKeyEd25519) ToCurve25519() *[PubKeyEd25519Size]byte {
keyCurve25519, pubKeyBytes := new([PubKeyEd25519Size]byte), [PubKeyEd25519Size]byte(pubKey)
ok := extra25519.PublicKeyToCurve25519(keyCurve25519, &pubKeyBytes)
if !ok {
return nil
@ -94,10 +96,12 @@ func (pubKey PubKeyEd25519) Equals(other PubKey) bool {
var _ PubKey = PubKeySecp256k1{}
const PubKeySecp256k1Size = 33
// Implements PubKey.
// Compressed pubkey (just the x-cord),
// prefixed with 0x02 or 0x03, depending on the y-cord.
type PubKeySecp256k1 [33]byte
type PubKeySecp256k1 [PubKeySecp256k1Size]byte
// Implements Bitcoin style addresses: RIPEMD160(SHA256(pubkey))
func (pubKey PubKeySecp256k1) Address() Address {


+ 1
- 1
crypto/random.go View File

@ -9,7 +9,7 @@ import (
"io"
"sync"
. "github.com/tendermint/tmlibs/common"
. "github.com/tendermint/tendermint/libs/common"
)
var gRandInfo *randInfo


+ 4
- 2
crypto/signature.go View File

@ -5,7 +5,7 @@ import (
"crypto/subtle"
. "github.com/tendermint/tmlibs/common"
. "github.com/tendermint/tendermint/libs/common"
)
func SignatureFromBytes(pubKeyBytes []byte) (pubKey Signature, err error) {
@ -25,8 +25,10 @@ type Signature interface {
var _ Signature = SignatureEd25519{}
const SignatureEd25519Size = 64
// Implements Signature
type SignatureEd25519 [64]byte
type SignatureEd25519 [SignatureEd25519Size]byte
func (sig SignatureEd25519) Bytes() []byte {
bz, err := cdc.MarshalBinaryBare(sig)


+ 1
- 1
crypto/symmetric.go View File

@ -3,7 +3,7 @@ package crypto
import (
"errors"
. "github.com/tendermint/tmlibs/common"
. "github.com/tendermint/tendermint/libs/common"
"golang.org/x/crypto/nacl/secretbox"
)


+ 23
- 9
docs/README.md View File

@ -1,14 +1,28 @@
Here lies our documentation. After making edits, run:
# Tendermint
```
pip install -r requirements.txt
make html
```
Welcome to the Tendermint Core documentation! The introduction below provides
an overview to help you navigate to your area of interest.
to build the docs locally then open the file `_build/html/index.html` in your browser.
## Introduction
**WARNING:** This documentation is intended to be viewed at:
Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state
transition machine - written in any programming language - and securely
replicates it on many machines. In other words, a blockchain.
https://tendermint.readthedocs.io
Tendermint requires an application running over the Application Blockchain
Interface (ABCI) - and comes packaged with an example application to do so.
Follow the [installation instructions](./install) to get up and running
quickly. For more details on [using tendermint](./using-tendermint) see that
and the following sections.
and may contain broken internal links when viewed from Github.
## Networks
Testnets can be setup manually on one or more machines, or automatically on one
or more machine, using a variety of methods described in the [deploy testnets
section](./deploy-testnets). For more information (and to join) about the
Cosmos Network testnets, see [here](/getting-started/full-node.md).
## Application Development
The first step to building application on Tendermint is to [install
ABCI-CLI](./getting-started) and play with the example applications.

+ 0
- 17
docs/_static/custom_collapsible_code.css View File

@ -1,17 +0,0 @@
.toggle {
padding-bottom: 1em ;
}
.toggle .header {
display: block;
clear: both;
cursor: pointer;
}
.toggle .header:after {
content: " ▼";
}
.toggle .header.open:after {
content: " ▲";
}

+ 0
- 10
docs/_static/custom_collapsible_code.js View File

@ -1,10 +0,0 @@
let makeCodeBlocksCollapsible = function() {
$(".toggle > *").hide();
$(".toggle .header").show();
$(".toggle .header").click(function() {
$(this).parent().children().not(".header").toggle({"duration": 400});
$(this).parent().children(".header").toggleClass("open");
});
};
// we could use the }(); way if we would have access to jQuery in HEAD, i.e. we would need to force the theme
// to load jQuery before our custom scripts

+ 0
- 20
docs/_templates/layout.html View File

@ -1,20 +0,0 @@
{% extends "!layout.html" %}
{% set css_files = css_files + ["_static/custom_collapsible_code.css"] %}
# sadly, I didn't find a css style way to add custom JS to a list that is automagically added to head like CSS (above) #}
{% block extrahead %}
<script type="text/javascript" src="_static/custom_collapsible_code.js"></script>
{% endblock %}
{% block footer %}
<script type="text/javascript">
$(document).ready(function() {
// using this approach as we don't have access to the jQuery selectors
// when executing the function on load in HEAD
makeCodeBlocksCollapsible();
});
</script>
{% endblock %}

+ 2
- 2
docs/abci-cli.md View File

@ -323,6 +323,6 @@ connects to the app using three separate connections, each with its own
pattern of messages.
For more information, see the [application developers
guide](./app-development.html). For examples of running an ABCI app with
Tendermint, see the [getting started guide](./getting-started.html).
guide](./app-development.md). For examples of running an ABCI app with
Tendermint, see the [getting started guide](./getting-started.md).
Next is the ABCI specification.

+ 4
- 4
docs/app-development.md View File

@ -394,13 +394,13 @@ serialize each query as a single byte array. Additionally, certain
instance about which peers to connect to.
Tendermint Core currently uses the Query connection to filter peers upon
connecting, according to IP address or public key. For instance,
connecting, according to IP address or node ID. For instance,
returning non-OK ABCI response to either of the following queries will
cause Tendermint to not connect to the corresponding peer:
- `p2p/filter/addr/<addr>`, where `<addr>` is an IP address.
- `p2p/filter/pubkey/<pubkey>`, where `<pubkey>` is the hex-encoded
ED25519 key of the node (not it's validator key)
- `p2p/filter/addr/<ip addr>`, where `<ip addr>` is an IP address.
- `p2p/filter/id/<id>`, where `<is>` is the hex-encoded node ID (the hash of
the node's p2p pubkey).
Note: these query formats are subject to change!


+ 1
- 1
docs/deploy-testnets.md View File

@ -35,7 +35,7 @@ Here are the steps to setting up a testnet manually:
After a few seconds, all the nodes should connect to each other and
start making blocks! For more information, see the Tendermint Networks
section of [the guide to using Tendermint](using-tendermint.html).
section of [the guide to using Tendermint](./using-tendermint.md).
But wait! Steps 3 and 4 are quite manual. Instead, use [this
script](https://github.com/tendermint/tendermint/blob/develop/docs/examples/init_testnet.sh),


+ 6
- 6
docs/getting-started.md View File

@ -7,7 +7,7 @@ application you want to run. So, to run a complete blockchain that does
something useful, you must start two programs: one is Tendermint Core,
the other is your application, which can be written in any programming
language. Recall from [the intro to
ABCI](introduction.html#ABCI-Overview) that Tendermint Core handles all
ABCI](./introduction.md#ABCI-Overview) that Tendermint Core handles all
the p2p and consensus stuff, and just forwards transactions to the
application when they need to be validated, or when they're ready to be
committed to a block.
@ -58,7 +58,7 @@ Tendermint before, use:
If you have used Tendermint, you may want to reset the data for a new
blockchain by running `tendermint unsafe_reset_all`. Then you can run
`tendermint node` to start Tendermint, and connect to the app. For more
details, see [the guide on using Tendermint](./using-tendermint.html).
details, see [the guide on using Tendermint](./using-tendermint.md).
You should see Tendermint making blocks! We can get the status of our
Tendermint node as follows:
@ -125,8 +125,8 @@ The result should look like:
Note the `value` in the result (`YWJjZA==`); this is the base64-encoding
of the ASCII of `abcd`. You can verify this in a python 2 shell by
running `"61626364".decode('base64')` or in python 3 shell by running
`import codecs; codecs.decode("61626364", 'base64').decode('ascii')`.
running `"YWJjZA==".decode('base64')` or in python 3 shell by running
`import codecs; codecs.decode("YWJjZA==", 'base64').decode('ascii')`.
Stay tuned for a future release that [makes this output more
human-readable](https://github.com/tendermint/tendermint/issues/1794).
@ -224,7 +224,7 @@ But if we send a `1`, it works again:
}
For more details on the `broadcast_tx` API, see [the guide on using
Tendermint](./using-tendermint.html).
Tendermint](./using-tendermint.md).
## CounterJS - Example in Another Language
@ -243,7 +243,7 @@ devs, we keep all our code under the `$GOPATH`, so run:
Kill the previous `counter` and `tendermint` processes. Now run the app:
node example/app.js
node example/counter.js
In another window, reset and start `tendermint`:


+ 5
- 5
docs/how-to-read-logs.md View File

@ -53,8 +53,8 @@ Next follows a standard block creation cycle, where we enter a new
round, propose a block, receive more than 2/3 of prevotes, then
precommits and finally have a chance to commit a block. For details,
please refer to [Consensus
Overview](introduction.html#consensus-overview) or [Byzantine Consensus
Algorithm](specification.html).
Overview](./introduction.md#consensus-overview) or [Byzantine Consensus
Algorithm](./spec/consensus).
I[10-04|13:54:30.393] enterNewRound(91/0). Current: 91/0/RoundStepNewHeight module=consensus
I[10-04|13:54:30.393] enterPropose(91/0). Current: 91/0/RoundStepNewRound module=consensus
@ -100,7 +100,7 @@ Algorithm](specification.html).
Here is the list of modules you may encounter in Tendermint's log and a
little overview what they do.
- `abci-client` As mentioned in [Application Development Guide](app-development.md#abci-design), Tendermint acts as an ABCI
- `abci-client` As mentioned in [Application Development Guide](./app-development.md), Tendermint acts as an ABCI
client with respect to the application and maintains 3 connections:
mempool, consensus and query. The code used by Tendermint Core can
be found [here](https://github.com/tendermint/tendermint/tree/develop/abci/client).
@ -115,13 +115,13 @@ little overview what they do.
found
[here](https://github.com/tendermint/tendermint/blob/master/types/events.go).
You can subscribe to them by calling `subscribe` RPC method. Refer
to [RPC docs](specification/rpc.html) for additional information.
to [RPC docs](./specification/rpc.md) for additional information.
- `mempool` Mempool module handles all incoming transactions, whenever
they are coming from peers or the application.
- `p2p` Provides an abstraction around peer-to-peer communication. For
more details, please check out the
[README](https://github.com/tendermint/tendermint/blob/master/p2p/README.md).
- `rpc` [Tendermint's RPC](specification/rpc.html).
- `rpc` [Tendermint's RPC](./specification/rpc.md).
- `rpc-server` RPC server. For implementation details, please read the
[README](https://github.com/tendermint/tendermint/blob/master/rpc/lib/README.md).
- `state` Represents the latest state and execution submodule, which


+ 4
- 62
docs/index.rst View File

@ -6,68 +6,10 @@
Welcome to Tendermint!
======================
This location for our documentation has been deprecated, please see:
.. image:: assets/tmint-logo-blue.png
:height: 200px
:width: 200px
:align: center
- https://tendermint.com/docs
Introduction
------------
The last version built by Read The Docs will still be available at:
.. toctree::
:maxdepth: 1
introduction.md
install.md
getting-started.md
using-tendermint.md
deploy-testnets.md
ecosystem.md
Tendermint Tools
----------------
.. the tools/ files are pulled in from the tools repo
.. see the bottom of conf.py
.. toctree::
:maxdepth: 1
tools/docker.md
terraform-and-ansible.md
tools/benchmarking.md
tools/monitoring.md
ABCI, Apps, Logging, Etc
------------------------
.. toctree::
:maxdepth: 1
abci-cli.md
abci-spec.md
app-architecture.md
app-development.md
subscribing-to-events-via-websocket.md
indexing-transactions.md
how-to-read-logs.md
running-in-production.md
metrics.md
Research & Specification
------------------------
.. toctree::
:maxdepth: 1
determinism.md
transactional-semantics.md
.. specification.md ## keep this file for legacy purpose. needs to be fixed though
* For a deeper dive, see `this thesis <https://atrium.lib.uoguelph.ca/xmlui/handle/10214/9769>`__.
* There is also the `original whitepaper <https://tendermint.com/static/docs/tendermint.pdf>`__, though it is now quite outdated.
* Readers might also be interested in the `Cosmos Whitepaper <https://cosmos.network/whitepaper>`__ which describes Tendermint, ABCI, and how to build a scalable, heterogeneous, cryptocurrency network.
* For example applications and related software built by the Tendermint team and other, see the `software ecosystem <https://tendermint.com/ecosystem>`__.
Join the `community <https://cosmos.network/community>`__ to ask questions and discuss projects.
- https://tendermint.readthedocs.io/projects/tools/en/v0.21.0/

+ 1
- 1
docs/running-in-production.md View File

@ -21,7 +21,7 @@ to prevent Denial-of-service attacks. You can read more about it
### P2P
The core of the Tendermint peer-to-peer system is `MConnection`. Each
connection has `MaxPacketMsgSize`, which is the maximum packet
connection has `MaxPacketMsgPayloadSize`, which is the maximum packet
size and bounded send & receive queues. One can impose restrictions on
send & receive rate per connection (`SendRate`, `RecvRate`).


+ 24
- 19
docs/spec/blockchain/encoding.md View File

@ -54,17 +54,15 @@ familiar with amino encoding.
You can simply use below table and concatenate Prefix || Length (of raw bytes) || raw bytes
( while || stands for byte concatenation here).
| Type | Name | Prefix | Length |
| ---- | ---- | ------ | ----- |
| PubKeyEd25519 | tendermint/PubKeyEd25519 | 0x1624DE62 | 0x20 |
| PubKeyLedgerEd25519 | tendermint/PubKeyLedgerEd25519 | 0x5C3453B2 | 0x20 |
| PubKeySecp256k1 | tendermint/PubKeySecp256k1 | 0xEB5AE982 | 0x21 |
| PrivKeyEd25519 | tendermint/PrivKeyEd25519 | 0xA3288912 | 0x40 |
| PrivKeySecp256k1 | tendermint/PrivKeySecp256k1 | 0xE1B0F79A | 0x20 |
| PrivKeyLedgerSecp256k1 | tendermint/PrivKeyLedgerSecp256k1 | 0x10CAB393 | variable |
| PrivKeyLedgerEd25519 | tendermint/PrivKeyLedgerEd25519 | 0x0CFEEF9B | variable |
| SignatureEd25519 | tendermint/SignatureKeyEd25519 | 0x3DA1DB2A | 0x40 |
| SignatureSecp256k1 | tendermint/SignatureKeySecp256k1 | 0x16E1FEEA | variable |
| Type | Name | Prefix | Length | Notes |
| ---- | ---- | ------ | ----- | ------ |
| PubKeyEd25519 | tendermint/PubKeyEd25519 | 0x1624DE64 | 0x20 | |
| PubKeySecp256k1 | tendermint/PubKeySecp256k1 | 0xEB5AE987 | 0x21 | |
| PrivKeyEd25519 | tendermint/PrivKeyEd25519 | 0xA3288910 | 0x40 | |
| PrivKeySecp256k1 | tendermint/PrivKeySecp256k1 | 0xE1B0F79B | 0x20 | |
| SignatureEd25519 | tendermint/SignatureEd25519 | 0x2031EA53 | 0x40 | |
| SignatureSecp256k1 | tendermint/SignatureSecp256k1 | 0x7FC4A495 | variable |
|
### Examples
@ -84,14 +82,13 @@ Addresses for each public key types are computed as follows:
#### Ed25519
RIPEMD160 hash of the Amino encoded public key:
First 20-bytes of the SHA256 hash of the raw 32-byte public key:
```
address = RIPEMD160(AMINO(pubkey))
address = SHA256(pubkey)[:20]
```
NOTE: this will soon change to the truncated 20-bytes of the SHA256 of the raw
public key
NOTE: before v0.22.0, this was the RIPEMD160 of the Amino encoded public key.
#### Secp256k1
@ -154,7 +151,15 @@ func MakeParts(obj interface{}, partSize int) []Part
Simple Merkle trees are used in numerous places in Tendermint to compute a cryptographic digest of a data structure.
RIPEMD160 is always used as the hashing function.
Tendermint always uses the `TMHASH` hash function, which is the first 20-bytes
of the SHA256:
```
func TMHASH(bz []byte) []byte {
shasum := SHA256(bz)
return shasum[:20]
}
```
### Simple Merkle Root
@ -177,7 +182,7 @@ func SimpleMerkleRoot(hashes [][]byte) []byte{
func SimpleConcatHash(left, right []byte) []byte{
left = encodeByteSlice(left)
right = encodeByteSlice(right)
return RIPEMD160 (append(left, right))
return TMHASH(append(left, right))
}
```
@ -185,8 +190,8 @@ Note that the leaves are Amino encoded as byte-arrays (ie. simple Uvarint length
prefix) before being concatenated together and hashed.
Note: we will abuse notion and invoke `SimpleMerkleRoot` with arguments of type `struct` or type `[]struct`.
For `struct` arguments, we compute a `[][]byte` by sorting elements of the `struct` according to
field name and then hashing them.
For `struct` arguments, we compute a `[][]byte` containing the hash of each
field in the struct sorted by the hash of the field name.
For `[]struct` arguments, we compute a `[][]byte` by hashing the individual `struct` elements.
### Simple Merkle Proof


+ 6
- 123
docs/spec/scripts/crypto.go View File

@ -2,132 +2,15 @@ package main
import (
"fmt"
"os"
"github.com/tendermint/tendermint/crypto"
amino "github.com/tendermint/go-amino"
crypto "github.com/tendermint/tendermint/crypto"
)
// SECRET
var SECRET = []byte("some secret")
func printEd() {
priv := crypto.GenPrivKeyEd25519FromSecret(SECRET)
pub := priv.PubKey().(crypto.PubKeyEd25519)
sigV, err := priv.Sign([]byte("hello"))
if err != nil {
fmt.Println("Unexpected error:", err)
}
sig := sigV.(crypto.SignatureEd25519)
name := "tendermint/PubKeyEd25519"
length := len(pub[:])
fmt.Println("### PubKeyEd25519")
fmt.Println("")
fmt.Println("```")
fmt.Printf("// Name: %s\n", name)
fmt.Printf("// PrefixBytes: 0x%X \n", pub.Bytes()[:4])
fmt.Printf("// Length: 0x%X \n", length)
fmt.Println("// Notes: raw 32-byte Ed25519 pubkey")
fmt.Println("type PubKeyEd25519 [32]byte")
fmt.Println("")
fmt.Println(`func (pubkey PubKeyEd25519) Address() []byte {
// NOTE: hash of the Amino encoded bytes!
return RIPEMD160(AminoEncode(pubkey))
}`)
fmt.Println("```")
fmt.Println("")
fmt.Printf("For example, the 32-byte Ed25519 pubkey `%X` would be encoded as `%X`.\n\n", pub[:], pub.Bytes())
fmt.Printf("The address would then be `RIPEMD160(0x%X)` or `%X`\n", pub.Bytes(), pub.Address())
fmt.Println("")
name = "tendermint/SignatureKeyEd25519"
length = len(sig[:])
fmt.Println("### SignatureEd25519")
fmt.Println("")
fmt.Println("```")
fmt.Printf("// Name: %s\n", name)
fmt.Printf("// PrefixBytes: 0x%X \n", sig.Bytes()[:4])
fmt.Printf("// Length: 0x%X \n", length)
fmt.Println("// Notes: raw 64-byte Ed25519 signature")
fmt.Println("type SignatureEd25519 [64]byte")
fmt.Println("```")
fmt.Println("")
fmt.Printf("For example, the 64-byte Ed25519 signature `%X` would be encoded as `%X`\n", sig[:], sig.Bytes())
fmt.Println("")
name = "tendermint/PrivKeyEd25519"
fmt.Println("### PrivKeyEd25519")
fmt.Println("")
fmt.Println("```")
fmt.Println("// Name:", name)
fmt.Println("// Notes: raw 32-byte priv key concatenated to raw 32-byte pub key")
fmt.Println("type PrivKeyEd25519 [64]byte")
fmt.Println("```")
}
func printSecp() {
priv := crypto.GenPrivKeySecp256k1FromSecret(SECRET)
pub := priv.PubKey().(crypto.PubKeySecp256k1)
sigV, err := priv.Sign([]byte("hello"))
if err != nil {
fmt.Println("Unexpected error:", err)
}
sig := sigV.(crypto.SignatureSecp256k1)
name := "tendermint/PubKeySecp256k1"
length := len(pub[:])
fmt.Println("### PubKeySecp256k1")
fmt.Println("")
fmt.Println("```")
fmt.Printf("// Name: %s\n", name)
fmt.Printf("// PrefixBytes: 0x%X \n", pub.Bytes()[:4])
fmt.Printf("// Length: 0x%X \n", length)
fmt.Println("// Notes: OpenSSL compressed pubkey prefixed with 0x02 or 0x03")
fmt.Println("type PubKeySecp256k1 [33]byte")
fmt.Println("")
fmt.Println(`func (pubkey PubKeySecp256k1) Address() []byte {
// NOTE: hash of the raw pubkey bytes (not Amino encoded!).
// Compatible with Bitcoin addresses.
return RIPEMD160(SHA256(pubkey[:]))
}`)
fmt.Println("```")
fmt.Println("")
fmt.Printf("For example, the 33-byte Secp256k1 pubkey `%X` would be encoded as `%X`\n\n", pub[:], pub.Bytes())
fmt.Printf("The address would then be `RIPEMD160(SHA256(0x%X))` or `%X`\n", pub[:], pub.Address())
fmt.Println("")
name = "tendermint/SignatureKeySecp256k1"
fmt.Println("### SignatureSecp256k1")
fmt.Println("")
fmt.Println("```")
fmt.Printf("// Name: %s\n", name)
fmt.Printf("// PrefixBytes: 0x%X \n", sig.Bytes()[:4])
fmt.Printf("// Length: Variable\n")
fmt.Printf("// Encoding prefix: Variable\n")
fmt.Println("// Notes: raw bytes of the Secp256k1 signature")
fmt.Println("type SignatureSecp256k1 []byte")
fmt.Println("```")
fmt.Println("")
fmt.Printf("For example, the Secp256k1 signature `%X` would be encoded as `%X`\n", []byte(sig[:]), sig.Bytes())
fmt.Println("")
name = "tendermint/PrivKeySecp256k1"
fmt.Println("### PrivKeySecp256k1")
fmt.Println("")
fmt.Println("```")
fmt.Println("// Name:", name)
fmt.Println("// Notes: raw 32-byte priv key")
fmt.Println("type PrivKeySecp256k1 [32]byte")
fmt.Println("```")
}
func main() {
printEd()
cdc := amino.NewCodec()
crypto.RegisterAmino(cdc)
cdc.PrintTypes(os.Stdout)
fmt.Println("")
printSecp()
}

+ 0
- 21
docs/specification.rst View File

@ -1,21 +0,0 @@
#############
Specification
#############
Here you'll find details of the Tendermint specification. Tendermint's types are produced by `godoc <https://godoc.org/github.com/tendermint/tendermint/types>`__.
.. toctree::
:maxdepth: 2
specification/block-structure.rst
specification/byzantine-consensus-algorithm.rst
specification/configuration.rst
specification/corruption.rst
specification/fast-sync.rst
specification/genesis.rst
specification/light-client-protocol.rst
specification/merkle.rst
specification/rpc.rst
specification/secure-p2p.rst
specification/validators.rst
specification/wire-protocol.rst

+ 4
- 5
docs/specification/configuration.md View File

@ -103,6 +103,9 @@ seeds = ""
# Do not add private peers to this list if you don't want them advertised
persistent_peers = ""
# UPNP port forwarding
upnp = false
# Path to address book
addr_book_file = "addrbook.json"
@ -116,7 +119,7 @@ flush_throttle_timeout = 100
max_num_peers = 50
# Maximum size of a message packet payload, in bytes
max_msg_packet_payload_size = 1024
max_packet_msg_payload_size = 1024
# Rate at which packets can be sent, in bytes/second
send_rate = 512000
@ -167,10 +170,6 @@ timeout_commit = 1000
# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
skip_timeout_commit = false
# BlockSize
max_block_size_txs = 10000
max_block_size_bytes = 1
# EmptyBlocks mode and possible interval between empty blocks in seconds
create_empty_blocks = true
create_empty_blocks_interval = 0


+ 3
- 3
docs/using-tendermint.md View File

@ -129,7 +129,7 @@ new blockchain will not make any blocks.
## Configuration
Tendermint uses a `config.toml` for configuration. For details, see [the
config specification](./specification/configuration.html).
config specification](./specification/configuration.md).
Notable options include the socket address of the application
(`proxy_app`), the listening address of the Tendermint peer
@ -260,7 +260,7 @@ but must be positive, thus the range is: 0 through 9223372036854775807.
Because of how the current proposer selection algorithm works, we do not
recommend having voting powers greater than 10\^12 (ie. 1 trillion) (see
[Proposals section of Byzantine Consensus
Algorithm](./specification/byzantine-consensus-algorithm.html#proposals)
Algorithm](./specification/byzantine-consensus-algorithm.md#proposals)
for details).
If we want to add more nodes to the network, we have two choices: we can
@ -398,7 +398,7 @@ failing, you need at least four validator nodes (e.g., 2/3).
Updating validators in a live network is supported but must be
explicitly programmed by the application developer. See the [application
developers guide](./app-development.html) for more details.
developers guide](./app-development.md) for more details.
### Local Network


+ 3
- 3
evidence/pool.go View File

@ -4,9 +4,9 @@ import (
"fmt"
"sync"
clist "github.com/tendermint/tmlibs/clist"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
clist "github.com/tendermint/tendermint/libs/clist"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"


+ 1
- 1
evidence/pool_test.go View File

@ -9,7 +9,7 @@ import (
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tmlibs/db"
dbm "github.com/tendermint/tendermint/libs/db"
)
var mockState = sm.State{}


+ 2
- 2
evidence/reactor.go View File

@ -6,8 +6,8 @@ import (
"time"
"github.com/tendermint/go-amino"
clist "github.com/tendermint/tmlibs/clist"
"github.com/tendermint/tmlibs/log"
clist "github.com/tendermint/tendermint/libs/clist"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"


+ 2
- 2
evidence/reactor_test.go View File

@ -10,8 +10,8 @@ import (
"github.com/go-kit/kit/log/term"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"


+ 1
- 1
evidence/store.go View File

@ -4,7 +4,7 @@ import (
"fmt"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tmlibs/db"
dbm "github.com/tendermint/tendermint/libs/db"
)
/*


+ 1
- 1
evidence/store_test.go View File

@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tmlibs/db"
dbm "github.com/tendermint/tendermint/libs/db"
)
//-------------------------------------------


+ 1
- 1
evidence/wire.go View File

@ -2,8 +2,8 @@ package evidence
import (
"github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/types"
)
var cdc = amino.NewCodec()


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save