Compare commits

...

3002 Commits

Author SHA1 Message Date
Ethan Buchman
5ff65274b8 Merge pull request #1935 from tendermint/release/v0.22.2
Release/v0.22.2
2018-07-10 10:01:55 -04:00
Ethan Buchman
ac3b764b52 update changelog 2018-07-10 09:55:15 -04:00
Ethan Buchman
223095d12f remove Wait from consensus reactor OnStop 2018-07-10 09:48:01 -04:00
Ethan Buchman
af697d3c4a changelog, version 2018-07-10 09:47:40 -04:00
Ethan Buchman
7c06a98b71 Merge branch 'master' into develop 2018-07-10 09:46:31 -04:00
Ethan Buchman
ce824d0b70 Merge pull request #1915 from tendermint/release/v0.22.1
Release/v0.22.1
2018-07-10 09:11:46 -04:00
Anton Kaliaev
4de9d42e4c limit the number of requests in flights for Prometheus server (#1927)
* limit the number of requests in flights for Prometheus server

Closes #1804

Default to 1 because usually there's just one collector.

* config: Up default for prom connections
2018-07-10 15:49:48 +04:00
Alexander Simmerl
ce33914f70 Merge pull request #1928 from tendermint/646-decode-msg
Unexport DecodeMessage
2018-07-10 12:50:33 +02:00
Alexander Simmerl
1cd7d862fa Merge pull request #1929 from tendermint/1901-changelog-2
Add missing changelog entry
2018-07-09 19:48:08 +02:00
Anton Kaliaev
22133ef97a add missing changelog entry
Refs #1901
2018-07-09 13:54:32 +04:00
Peng Zhong
0030a8e697 Peng/deprecate aib data (#1926)
* include ecosystem.json

* update changelog

* also include zarko's interview
2018-07-09 13:19:45 +04:00
Anton Kaliaev
a19e857f2e [pex] switch to MustMarshalBinaryBare and UnmarshalBinaryBare
Refs #646
2018-07-09 13:11:41 +04:00
Anton Kaliaev
9120fd5d14 unexport DecodeMessage functions
Refs #646
2018-07-09 13:01:23 +04:00
Alexander Simmerl
523d29256e Merge pull request #1911 from tendermint/1901-changelog
Add missing changelog entry
2018-07-07 15:14:43 +02:00
Alexander Simmerl
397d89e40b Merge pull request #1906 from tendermint/zach/1793-repo-consolidation
clean up abci/libs directories
2018-07-07 11:53:58 +02:00
Anton Kaliaev
ed01638076 remove doc. about no longer existing config option 2018-07-07 11:50:34 +02:00
Anton Kaliaev
7b153bde31 add missing changelog entry
Closes #1901
2018-07-07 11:50:31 +02:00
Alexander Simmerl
f93798f72d Merge branch 'master' into release/v0.22.1 2018-07-07 11:45:20 +02:00
Alexander Simmerl
8d2d94c1c0 Merge pull request #1922 from tendermint/zach/fix-md
docs: md fixes & latest tm-bench/monitor
2018-07-07 11:43:16 +02:00
Zach Ramsay
bef04114ef docs: md fixes & latest tm-bench/monitor 2018-07-06 14:25:04 -04:00
Alexander Simmerl
0e85ae6179 Merge pull request #1918 from tendermint/docs-staging
Re-organize docs into directories
2018-07-06 19:53:15 +02:00
Zach Ramsay
539722c02d ports 2018-07-06 13:31:39 -04:00
Ethan Buchman
8544e18eaf Merge pull request #1919 from tendermint/jae/rpc_int_noquote
WIP RPC HTTP does not require quotes around int64/int/uint64/uint types
2018-07-06 13:05:13 -04:00
Ethan Buchman
379e5a15cc Uint64 2018-07-06 07:56:00 -04:00
Ethan Buchman
bd47ed989f rpc/lib/server: add test for int parsing 2018-07-06 07:55:15 -04:00
Jae Kwon
d336cfe5d3 RPC HTTP does not require quotes around int64/int/uint64/uint types 2018-07-05 23:36:49 -07:00
Zach Ramsay
e54c0f804f docs re-orgnization 2018-07-05 16:08:42 -04:00
Zach Ramsay
79d6bd8ce0 TEST 2018-07-05 13:27:54 -04:00
Zach Ramsay
14b6010240 move a file 2018-07-05 13:22:06 -04:00
Ethan Buchman
2fa9962835 changelog and version 2018-07-05 12:03:23 -04:00
Ethan Buchman
64bae01d00 Merge pull request #1913 from tendermint/zach/path-fix
HOTFIX: fix url path because cloudfront
2018-07-05 11:48:12 -04:00
Zach
e282b3d761 Merge branch 'master' into zach/path-fix 2018-07-05 10:10:11 -04:00
Zach
07747de305 add docs/DOCS_README.md for devs, closes #1885 (#1905) 2018-07-05 11:44:15 +04:00
Zach
030c782e6f Zach/1793 repo consolidation v2 (#1907) 2018-07-04 17:11:34 -04:00
Alexander Simmerl
1f215eb875 Merge pull request #1898 from tendermint/1893-err-if-zero-power-val
state: err if 0 power validator is added to the validator set
2018-07-04 23:05:22 +02:00
Ethan Buchman
82a5e9604c Merge pull request #1903 from tendermint/zach/lint-md
lint the docs markdown & fix codeblocks for website
2018-07-04 16:03:38 -04:00
Ethan Buchman
962bb3f969 Merge pull request #1904 from tendermint/zach/jb/docs-owners
update codeowners
2018-07-04 15:23:47 -04:00
Zach Ramsay
f7156afee3 repo bloat artifacts errrrywhere 2018-07-04 15:09:06 -04:00
Zach Ramsay
bc010ab5fa updates 2018-07-04 14:54:53 -04:00
Zach Ramsay
0c393b5c62 abci mostly done, still gonna want to consolidate the tests 2018-07-04 14:48:45 -04:00
Zach Ramsay
cf9d63628b move abci Dockerfile (still needs to be updated tho) 2018-07-04 14:19:33 -04:00
Zach Ramsay
f9c39740cd remove old abci scripts 2018-07-04 14:18:03 -04:00
Anton Kaliaev
59f624043c reorder statements 2018-07-04 20:50:36 +04:00
Zach Ramsay
e786d3feca add @zramsay & @jolesbi as docs owners 2018-07-04 12:31:17 -04:00
Zach Ramsay
82a43593ab add linters to docs 2018-07-04 12:01:19 -04:00
Zach Ramsay
ccaad06eb5 lint markdown 2018-07-04 12:00:57 -04:00
Alexander Simmerl
5cfd8ebaa2 Merge pull request #1899 from tendermint/1839-shutdown-wal-properly
Properly shutdown consensus WAL
2018-07-04 15:23:25 +02:00
Alexander Simmerl
99e982669e Merge pull request #1902 from tendermint/1766-wrong-field-access
fix wrong field access in LoadConsensusParams
2018-07-04 15:17:10 +02:00
Alexander Simmerl
48a1f6f9b3 state: Format panics 2018-07-04 14:59:50 +02:00
Anton Kaliaev
e565e348d5 fix wrong field access in LoadConsensusParams
Closes #1766
2018-07-04 15:34:13 +04:00
Anton Kaliaev
b242b15d40 wait until WAL closes the autogroup
Refs #1839
2018-07-04 13:59:16 +04:00
Anton Kaliaev
c1aeb08e4b return error if power is negative
Refs #1893
2018-07-04 13:21:29 +04:00
Anton Kaliaev
dda8b67f37 state: err if 0 power validator is added to the validator set
Closes #1893
2018-07-04 12:36:11 +04:00
Ethan Buchman
bff68abe04 update abci spec 2018-07-03 23:16:32 -04:00
Ethan Buchman
19662ac8a1 Merge pull request #1895 from tendermint/zach/1874-docs-examples
docs/examples: remove node* directories, update docs for testnet command
2018-07-03 23:02:41 -04:00
Ethan Buchman
fa05b03956 Merge pull request #1894 from tendermint/ebuchman-patch-1
Update CHANGELOG.md
2018-07-03 21:20:03 -04:00
Zach Ramsay
fcf8bd94c2 docs/examples: update getting started and remove old script (now in scripts/install) 2018-07-03 19:07:19 -04:00
Ethan Buchman
087d3e54d2 Update CHANGELOG.md
Emphasize that all integers are encoded as strings in the rpc
2018-07-03 18:52:26 -04:00
Zach Ramsay
0821ccb603 docs/examples: remove node* files 2018-07-03 18:47:13 -04:00
Alexander Simmerl
7a61e8cf9d Merge pull request #1862 from tendermint/zramsay-patch-1
Delete libs/common/array.go
2018-07-03 17:45:06 +02:00
Alexander Simmerl
4c373a6e78 Merge pull request #1872 from tendermint/1829-fill-in-missing-fields
overwrite pubkey and address for convenience
2018-07-03 17:44:29 +02:00
Alexander Simmerl
2f29aa9605 Merge pull request #1871 from tendermint/1774-remove-init-testnet-script
remove init_testnet script
2018-07-03 17:42:58 +02:00
Alexander Simmerl
eb77f662f2 Merge pull request #1886 from tendermint/zach/libs
cleanup repo merge artifacts
2018-07-03 17:40:08 +02:00
Alexander Simmerl
277e323d4a Merge pull request #1888 from tendermint/zach/abci-spec-location
abci spec should be in one location
2018-07-03 17:38:56 +02:00
Zach Ramsay
8e4b803161 abci spec is in docs/abci-spec.md, closes #1847 2018-07-03 10:38:40 -04:00
Zach Ramsay
5fb3955c93 cleanup repo merge artifacts, closes #1873, starts #1793 2018-07-03 10:17:08 -04:00
Anton Kaliaev
26a7d757cb overwrite pubkey and address for convenience
Closes #1829
2018-07-03 16:31:34 +04:00
Anton Kaliaev
a42c58604d remove init_testnet script
`tendermint testnet` cmd should be used instead

Closes #1774
2018-07-03 15:42:52 +04:00
Zach
489f2525bd Delete libs/common/array.go
closes https://github.com/tendermint/tmlibs/issues/133
2018-07-02 16:14:40 -04:00
Ethan Buchman
931b465a05 dev version bump 2018-07-02 14:50:57 -04:00
Ethan Buchman
dfa9a9a30a Merge pull request #1840 from tendermint/release/v0.22.0
Release/v0.22.0
2018-07-02 14:39:30 -04:00
Ethan Buchman
5923b6288f update changelog 2018-07-02 14:40:59 -04:00
Ethan Buchman
0f6f6bd3c0 Merge pull request #1606 from tendermint/bucky/hash
Bucky/hash
2018-07-02 14:30:24 -04:00
Ethan Buchman
ca3e337ef9 remove libs/merkle 2018-07-02 14:32:27 -04:00
Ethan Buchman
ec710395b7 RIPEMD160 -> SHA256 2018-07-02 14:27:43 -04:00
Ethan Buchman
d47b4ef12d update some docs 2018-07-02 14:20:27 -04:00
Ethan Buchman
72475c800b Merge pull request #1843 from tendermint/bucky/external_address
Bucky/external address
2018-07-02 13:48:09 -04:00
Ethan Buchman
c3504c111e add test 2018-07-02 13:04:34 -04:00
Ethan Buchman
737c5c065d fixes from review 2018-07-02 12:46:02 -04:00
Ethan Buchman
1c018d3fd2 p2p: external address
* new config option for external address to advertise
* if blank, defaults to best guess from listener
* if laddr ip address is also blank, default to IPv4
2018-07-02 12:44:48 -04:00
Ethan Buchman
60f233a4bc Merge pull request #1842 from tendermint/bucky/merge-tmlibs
Bucky/merge tmlibs
2018-07-02 12:31:39 -04:00
Ethan Buchman
eccdce11c5 make linter happy 2018-07-02 12:06:43 -04:00
Ethan Buchman
3f4847331f update grpc version. fix remotedb tests 2018-07-01 23:15:14 -04:00
Ethan Buchman
ff73e0aa55 fix test folder mishap 2018-07-01 22:50:31 -04:00
Ethan Buchman
965a55d2a8 remove tmlibs from dep 2018-07-01 22:39:41 -04:00
Ethan Buchman
d55243f0e6 fix import paths 2018-07-01 22:36:49 -04:00
Ethan Buchman
233b35a2a9 Revert "delete some things for the merge"
This reverts commit 2902ab1a14.
2018-07-01 22:36:13 -04:00
Ethan Buchman
ae3bf81833 mv tmlibs files to libs dir 2018-07-01 22:36:03 -04:00
Ethan Buchman
2d7ffdd72b Merge remote-tracking branch 'tmlibs/master' into bucky/merge-tmlibs 2018-07-01 22:32:33 -04:00
Ethan Buchman
2902ab1a14 delete some things for the merge 2018-07-01 22:32:06 -04:00
Ethan Buchman
9ff99114b1 update for tmlibs v0.9.0 2018-07-01 22:12:58 -04:00
Ethan Buchman
af703620d4 consensus: stop wal 2018-07-01 12:53:51 -04:00
Ethan Buchman
3a0dff7db2 fix changelog 2018-07-01 11:51:06 -04:00
Ethan Buchman
59145eca62 Merge pull request #1824 from tendermint/1762-tm-stops-producing-blocks
Fix emptyPacketMsgSize calc. plus limit max request body size and other mics. changes
2018-07-01 11:39:56 -04:00
Ethan Buchman
d6394bcbfd Merge branch 'release/v0.22.0' into 1762-tm-stops-producing-blocks 2018-07-01 11:39:43 -04:00
Anton Kaliaev
2d98899b9b set MaxTxs to 10000 (the same that was used in the config before) 2018-07-01 09:44:12 +04:00
Ethan Buchman
da4632c651 docs/spec: update address spec to sha2 for ed25519 2018-07-01 01:29:28 -04:00
Ethan Buchman
f35ebd5cf7 docs: minor fix for abci query peer filter 2018-07-01 01:23:38 -04:00
Ethan Buchman
6e5a01ccec changelog and version 2018-07-01 00:50:49 -04:00
Ethan Buchman
b2c3f6f737 Merge pull request #1836 from tendermint/1830-nil-pointer-in-pex
fix nil pointer panic by checking if peer is nil
2018-06-29 17:55:06 -04:00
Lawrence Tran
bb0313d060 Fix typo (#1837)
The base64 encoding for 'abcd' is incorrect for the python decoding examples.
2018-06-29 22:09:50 +04:00
Zach Ramsay
71da5e128a fix url path because cloudfront 2018-06-29 09:56:15 -04:00
Anton Kaliaev
9752e059e1 fix nil pointer panic by checking if peer is nil
Fixes #1830

remember that PeerSet#Get can return nil
2018-06-29 16:03:31 +04:00
Anton Kaliaev
399e2fbdac update changelog 2018-06-29 12:57:17 +04:00
Anton Kaliaev
61c5791fa3 revert back to Jae's original payload size limit
except now we calculate the max size using the maxPacketMsgSize()
function, which frees developers from having to know amino encoding
details.

plus, 10 additional bytes are added to leave the room for amino upgrades
(both making it more efficient / less efficient)
2018-06-29 12:57:17 +04:00
Anton Kaliaev
ab04201c3d fix empty packet size calculation
Fixes #1762#issuecomment-398940107
2018-06-29 12:40:32 +04:00
Anton Kaliaev
297cd4cfe8 limit HTTP request body and WS read msg size to 1MB 2018-06-29 12:40:32 +04:00
Anton Kaliaev
f760c24ff0 [config] remove MaxBlockSizeTxs and MaxBlockSizeBytes in favor of consensus params 2018-06-29 12:40:32 +04:00
Anton Kaliaev
2a7602c4ed [tendermint init] add default consensus params to genesis 2018-06-29 12:40:32 +04:00
Anton Kaliaev
9563927bbd print only tx's hash and size when logging blocks
Closes #1799
2018-06-29 12:40:32 +04:00
Anton Kaliaev
ac12432603 [rpc/client/http] set codec on rpc client 2018-06-29 12:40:32 +04:00
Anton Kaliaev
ada5ef0669 [p2p] add godoc comments to Listener (#1828)
* update changelog

* document p2p/listener

* do not expose underlying net.Listener

* add a TODO

* replace todo with a comment
2018-06-29 11:48:52 +04:00
Rigel
58acbf5ee3 contributing guide typos (#1831)
* contributing guide typos

* fix git remote cmd
2018-06-29 11:09:16 +04:00
Dev Ojha
41733b46b9 crypto: Abstract pubkey / signature size when known to constants (#1808)
* crypto: Abstract pubkey / signature size when known to constants

* Created PubKeyEd25519Size as 32
* Created PubkeySecp256k1Size as 33
* Created SignatureEd25519Size as 64

* Remove extraneous message from changelog
2018-06-29 11:08:01 +04:00
Dev Ojha
e26d6ed448 Update ISSUE_TEMPLATE to mention using pastebin (#1832)
* Update ISSUE_TEMPLATE to mention using pastebin

closes #1826

* Update ISSUE_TEMPLATE
2018-06-29 11:01:11 +04:00
kph7
e556e3336e Adding IPv6 support to peering (#1818) 2018-06-28 11:29:27 +04:00
Max Levy
69356a60b5 Broken link to docs/terraform-and-ansible corrected (#1823)
Fixed rst -> md
2018-06-28 11:28:41 +04:00
Dev Ojha
b1d6deaf0b config: rename skip_upnp to upnp (#1827)
* config: rename skip_upnp to upnp

Change default option to enable upnp.

Closes #1806

* doc updates

- fix comment and set UPNP to false in TestP2PConfig
- add UPNP to config template
- update changelog
2018-06-28 11:09:39 +04:00
Anton Kaliaev
aa20c45ae9 log total when adding new txs to the mempool 2018-06-27 18:14:45 +04:00
Ethan Buchman
70d314312c consensus: fix addProposalBlockPart
* When create_empty_blocks=false, we don't enterPropose until we
* receive a transaction, but if we then receive a complete proposal,
* we should enterPrevote. A guard in addProposalBlockPart was checking if
* step==Propose before calling enterPrevote, but we need it to be step<=Propose,
* since we may not have seen a tx.
* This was discovered by disabling mempool broadcast, sending txs to
* peers one a time, and observing their consensus logs.
2018-06-27 18:14:45 +04:00
Ethan Buchman
fa3bd05d44 mempool: log hashes, not whole tx 2018-06-27 18:14:45 +04:00
Roman Useinov
f0e5332b1f Feature/support https rpc client (#1816)
* Implement support for https in rpc client

* Update changelog

* update comment

* support wss protocol

* fixed changelog

* if -> switch

* fix lint

* protocol constants introduced
2018-06-27 15:03:47 +04:00
Max Levy
231812c875 proper link to a docs module (#1822)
Fixed rst -> md
2018-06-27 10:54:01 +04:00
Ricardo Domingos
e6abdb8b9d p2p/trust: Fix nil pointer error on TrustMetric Copy() (#1819) 2018-06-27 08:37:30 +04:00
Anton Kaliaev
8412b75b10 Merge pull request #1800 from tendermint/zach/more-docs-fixes
docs cleanup
2018-06-26 11:33:25 +04:00
Anton Kaliaev
9f656e1239 add a link to full node guide
Refs https://github.com/tendermint/tendermint/pull/1800/files#r197919542
2018-06-26 11:21:25 +04:00
Zach Ramsay
c6626f94de the last RTD version is archived 2018-06-25 10:33:18 -04:00
Zach
fd55ccdd99 Merge branch 'develop' into zach/more-docs-fixes 2018-06-25 10:27:33 -04:00
Zach Ramsay
516b3399f3 docs: update js-abci example
closes https://github.com/tendermint/js-abci/issues/21
2018-06-25 10:14:32 -04:00
Jae Kwon
e09e3a56f3 Merge pull request #225 from tendermint/develop
0.9.0 release
2018-06-24 19:41:18 -07:00
Jae Kwon
49596e0a1f Bump version to 0.9.0 2018-06-24 19:40:24 -07:00
Jeremiah Andrews
cb08d28d40 Reverse iterators (#224)
with passing tests
2018-06-24 19:37:32 -07:00
Ethan Buchman
ce0d0b312f Merge pull request #1711 from tendermint/bucky/adrs
Bucky/adrs
2018-06-23 09:22:14 -04:00
Ethan Buchman
1215081951 adr: update readme 2018-06-23 09:29:46 -04:00
Ethan Buchman
500fca8efe fixes from review 2018-06-23 09:29:46 -04:00
Anton Kaliaev
f6ff6b0e15 use consistent naming for protobuf
protobuf -> proto
protobuf version X -> protoX
2018-06-23 09:29:46 -04:00
Ethan Buchman
956e6d3435 change BeginBlock validators to LastCommitInfo 2018-06-23 09:28:44 -04:00
Ethan Buchman
3e1684d2a2 adr-010-crypto-changes 2018-06-23 09:28:44 -04:00
Ethan Buchman
a25d181074 adr-009: add references 2018-06-23 09:28:44 -04:00
Ethan Buchman
7d82bdb3e6 adr-009: no pubkeys in beginblock 2018-06-23 09:28:44 -04:00
Ethan Buchman
c48ff031cd add ADR-009 for ABCI design upgrade 2018-06-23 09:28:44 -04:00
zramsay
835af6fcb9 link fixes 2018-06-23 00:06:04 +00:00
zramsay
6c92a6f99a prepare RTD dismantling 2018-06-23 00:00:42 +00:00
Alexander Simmerl
f62d6651e3 Merge pull request #1781 from tendermint/1740-node-crashes-when-too-many-rpc-connections
limit number of open connections
2018-06-23 01:15:03 +02:00
Alexander Simmerl
0d35d722cb rpc: Break up long lines 2018-06-23 01:01:31 +02:00
Alexander Simmerl
e39e43f86f Merge pull request #1790 from tendermint/xla/merge-abci-tmlibs
Merge abci
2018-06-23 00:55:31 +02:00
Alexander Simmerl
e9e00c4db7 Merge pull request #1797 from SamuelSarle/develop
Rename sync_info.syncing to sync_info.catching_up
2018-06-23 00:49:47 +02:00
Zach Ramsay
003d8956a5 rm dead docs file 2018-06-22 18:23:45 -04:00
Zach
867550dd8b docs: update abci links (#1796) 2018-06-23 00:16:51 +02:00
Zach Ramsay
c1548c7861 docs readme is vuepress landing page 2018-06-22 18:13:25 -04:00
Zach Ramsay
8ff95bf32c remove old code 2018-06-22 18:10:50 -04:00
Samuel Sarle
8554a6dcd8 Renamed sync_info.syncing to sync_info.catching_up. 2018-06-23 00:20:49 +03:00
Anton Kaliaev
f5b8849106 bump max connections number to 900 2018-06-22 22:48:20 +04:00
Alexander Simmerl
01f6009518 abci: Add comment for doc update 2018-06-22 20:36:29 +02:00
Alexander Simmerl
3f34deab90 abci: Remove LICENSE 2018-06-22 20:29:23 +02:00
Alexander Simmerl
693a973997 abci: Remove nested .gitignore 2018-06-22 20:28:54 +02:00
Alexander Simmerl
02e5cbaa07 abci: Remove old repo docs 2018-06-22 20:23:37 +02:00
Alexander Simmerl
77573a1bad ci: Move over abci-cli tests 2018-06-22 20:09:44 +02:00
Alexander Simmerl
3ff3a8ec37 ci: Setup abci in dependency step 2018-06-22 19:29:44 +02:00
Anton Kaliaev
936a655990 limit number of open connections
Refs #1740

also, expose limit option for number concurrent streams for gRPC
(unlimited by default)
2018-06-22 19:25:11 +04:00
Alexander Simmerl
a605b66c5a Move abci imports 2018-06-22 07:28:07 +02:00
Alexander Simmerl
3e1baf68f8 crypto: Rename last traces of go-crypto (#1786)
Follow-up to #1782
2018-06-22 08:24:36 +04:00
Alexander Simmerl
4bee228ba7 Add abci repo 2018-06-22 02:36:54 +02:00
Alexander Simmerl
7e3de2027e Merge pull request #1787 from tendermint/dev/hkdfchachapoly_testvector_seal
crypto/hkdfchachapoly: Add testing seal to the test vector
2018-06-22 01:59:35 +02:00
ValarDragon
3ae878b229 crypto/hkdfchachapoly: Add testing seal to the test vector 2018-06-21 16:47:48 -07:00
Ethan Buchman
2b5229dd5e Merge pull request #1782 from Liamsi/merge-city
Merge go-crypto into tendermint
2018-06-21 15:53:02 -07:00
Ethan Buchman
9cd9f3338b Merge branch 'master' into develop 2018-06-21 12:57:09 -07:00
Ethan Buchman
46369a1ab7 Merge pull request #1779 from tendermint/release/v0.21.0
Release/v0.21.0
2018-06-21 12:44:31 -07:00
Ethan Buchman
1e3951c61c update changelog 2018-06-21 12:47:29 -07:00
Liamsi
9803f18494 review comments:
gofmt
2018-06-21 12:21:33 -07:00
Liamsi
a39b2522d5 review comments:
- re-add test
- add TODO
- err instead of panic where possible
2018-06-21 11:51:46 -07:00
Liamsi
c96b27136f remove go-crypto from go-crypto:
use tendermint/crypto :-)
2018-06-20 21:05:38 -07:00
Liamsi
80ab7bfe99 fix p2p test in circleci 2018-06-20 20:59:33 -07:00
Liamsi
f3d755f5e8 please the linter gods:
crypto/hkdfchacha20poly1305/hkdfchachapoly_test.go:36:25⚠️ should use make([]byte, 24) instead (S1019) (gosimple)
2018-06-20 20:29:12 -07:00
Liamsi
8329b86570 more changes from #1721 2018-06-20 20:25:08 -07:00
Liamsi
4fb40e5437 cherry pick @melekes changes 2018-06-20 20:04:43 -07:00
Liamsi
25397fb9f8 more changes from #1721 2018-06-20 18:30:14 -07:00
Liamsi
6677f81ffb revert change from #1721
makes TestListener never quit
2018-06-20 17:48:04 -07:00
Liamsi
5a70fa6f35 fix typos 2018-06-20 17:42:52 -07:00
Liamsi
d2c05bc5b9 Revert "delete everything" (includes everything non-go-crypto)
This reverts commit 96a3502
2018-06-20 17:35:30 -07:00
Liamsi
587505d4d2 fix crypto tests 2018-06-20 17:34:28 -07:00
Liamsi
eedd20f4d5 Revert "delete everything"
This reverts commit 96a3502126.

# Conflicts:
#	CHANGELOG.md
#	Gopkg.lock
#	Gopkg.toml
#	LICENSE
#	Makefile
#	README.md
2018-06-20 15:37:45 -07:00
Liamsi
368c236c75 mv go-crypto files to crypto dir 2018-06-20 15:30:44 -07:00
Liamsi
96a3502126 delete everything 2018-06-20 15:19:08 -07:00
Christopher Goes
edb36d38b2 Merge PR #142: Delete keys package & Ledger integration; update tests 2018-06-20 23:33:33 +02:00
Christopher Goes
c7a842a4e2 Update Gopkg.lock 2018-06-20 23:31:57 +02:00
Liamsi
7ebc7c08e7 delete keys package
- also delete ledger code and deps (thx cwgoes)

Signed-off-by: Liamsi <Liamsi@users.noreply.github.com>
2018-06-20 14:30:57 -07:00
Liamsi
a589e0eabd delete keys package
- it will be moved to cosmos-sdk
2018-06-20 14:09:24 -07:00
Ismail Khoffi
4634063698 keys package: fundraiser compatibility and HD keys (BIP 39 & BIP 32 / BIP 44) (#118)
- fundraiser compatibility for HD keys (BIP 39 & BIP 32 / BIP 44)
2018-06-20 13:30:22 -07:00
Alexander Simmerl
37385cb1d4 Merge pull request #1737 from tendermint/986-monitoring
metrics
2018-06-20 20:43:20 +02:00
Anton Kaliaev
8c1ca9d64a updates to docs/specification/configuration.md after rebase 2018-06-20 12:42:43 +04:00
Anton Kaliaev
205d8b8062 fixes after @xla review
- move prometheus metrics into internal packages
- *Option structs
- misc. format changes
2018-06-20 12:40:25 +04:00
Anton Kaliaev
e4bb3566a0 move metrics constructors to a separate package 2018-06-20 12:40:25 +04:00
Anton Kaliaev
829342a82d make StartPrometheusServer func private
we don't really need to export it
2018-06-20 12:40:25 +04:00
Anton Kaliaev
84812145cb friendly apis for constructors 2018-06-20 12:40:25 +04:00
Anton Kaliaev
cd11a54f7a add since column to list of available metrics table 2018-06-20 12:40:25 +04:00
Anton Kaliaev
d8fea3ec9d separate http server for metrics 2018-06-20 12:40:23 +04:00
Anton Kaliaev
b10b0da3fd bundle imports 2018-06-20 12:40:11 +04:00
Anton Kaliaev
bba2862498 add one useful query 2018-06-20 12:40:11 +04:00
Anton Kaliaev
e90cb4f5fa add docs 2018-06-20 12:40:11 +04:00
Anton Kaliaev
1bdff076ad add config option 2018-06-20 12:40:08 +04:00
Anton Kaliaev
c958b5319c update ADR 2018-06-20 12:38:45 +04:00
Anton Kaliaev
7efb73aa18 mempool size metric 2018-06-20 12:38:45 +04:00
Anton Kaliaev
19699d644f p2p metric, make height and totalTxs gauges 2018-06-20 12:38:45 +04:00
Anton Kaliaev
0cb50c05fc add rounds metric 2018-06-20 12:38:45 +04:00
Anton Kaliaev
e58d674f4c add validators power gauges 2018-06-20 12:38:45 +04:00
Anton Kaliaev
fad76e103b extract metrics to provider, remove height label 2018-06-20 12:38:45 +04:00
Anton Kaliaev
489d9b9184 more metrics 2018-06-20 12:38:45 +04:00
Anton Kaliaev
3cdf3b670d serve metrics under /metrics 2018-06-20 12:38:45 +04:00
Anton Kaliaev
5c869b5888 validator metrics 2018-06-20 12:38:45 +04:00
Anton Kaliaev
9e14dc21a9 add labels column 2018-06-20 12:38:45 +04:00
Anton Kaliaev
5c7093cc9f go-kit metrics plus prometheus: one metric 2018-06-20 12:38:45 +04:00
Anton Kaliaev
03079185d4 metrics ADR
Refs #986
2018-06-20 12:38:45 +04:00
Zach
63e2f43b72 updates to docs for vuepress (#1763)
* fix docs for vue, #1640

* docs: clean up re-install instructions
2018-06-20 11:51:16 +04:00
Ethan Buchman
d220a1ef13 changelog 2018-06-20 00:22:07 -07:00
Ethan Buchman
c6c468c341 update changelog 2018-06-20 00:13:23 -07:00
Ethan Buchman
1d86270e20 version 2018-06-20 00:09:55 -07:00
Ethan Buchman
43745c83db Merge branch 'release/v0.20.1' into develop 2018-06-20 00:08:51 -07:00
Ethan Buchman
c793a72ac5 Merge pull request #1769 from tendermint/1755-possible-memory-leak
Memory leak in Websocket
2018-06-19 23:57:29 -07:00
Dev Ojha
fed8807a32 Switch xchachapoly to hkdfchachapoly (#135)
* Switch from xchachapoly to hkdfchachapoly
2018-06-19 22:18:36 -07:00
Anton Kaliaev
cfff83fa3d update changelog 2018-06-19 20:20:30 +04:00
Anton Kaliaev
4fc06e9d2a [libs/pubsub] fix memory leak
Refs #1755

I started with writing a test for wsConnection (WebsocketManager) where
I:

- create a WS connection
- do a simple echo call
- close it

No leaking goroutines, nor any leaking memory were detected.

For useful shortcuts see my blog post
https://blog.cosmos.network/debugging-the-memory-leak-in-tendermint-210186711420

Then I went to the rpc tests to see if calling Subscribe results in
memory growth. It did.

I used a slightly modified version of TestHeaderEvents function:

```
func TestHeaderEvents(t *testing.T) {
	// memory heap before
	f, err := os.Create("/tmp/mem1.mprof")
	if err != nil {
		t.Fatal(err)
	}
	pprof.WriteHeapProfile(f)
	f.Close()

	for i := 0; i < 100; i++ {
		c := getHTTPClient()
		err = c.Start()
		require.Nil(t, err)

		evtTyp := types.EventNewBlockHeader
		evt, err := client.WaitForOneEvent(c, evtTyp, waitForEventTimeout)
		require.Nil(t, err)
		_, ok := evt.(types.EventDataNewBlockHeader)
		require.True(t, ok)

		c.Stop()
		c = nil
	}

	runtime.GC()

	// memory heap before
	f, err = os.Create("/tmp/mem2.mprof")
	if err != nil {
		t.Fatal(err)
	}
	pprof.WriteHeapProfile(f)
	f.Close()

	// dump all running goroutines
	time.Sleep(10 * time.Second)
	pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
}
```

```
Showing nodes accounting for 35159.16kB, 100% of 35159.16kB total
Showing top 10 nodes out of 48
      flat  flat%   sum%        cum   cum%
32022.23kB 91.08% 91.08% 32022.23kB 91.08%  github.com/tendermint/tendermint/libs/pubsub/query.(*QueryParser).Init
 1056.33kB  3.00% 94.08%  1056.33kB  3.00%  bufio.NewReaderSize
  528.17kB  1.50% 95.58%   528.17kB  1.50%  bufio.NewWriterSize
  528.17kB  1.50% 97.09%   528.17kB  1.50%  github.com/tendermint/tendermint/consensus.NewConsensusState
  512.19kB  1.46% 98.54%   512.19kB  1.46%  runtime.malg
  512.08kB  1.46%   100%   512.08kB  1.46%  syscall.ByteSliceFromString
         0     0%   100%   512.08kB  1.46%  github.com/tendermint/tendermint/consensus.(*ConsensusState).(github.com/tendermint/tendermint/consensus.defaultDecideProposal)-fm
         0     0%   100%   512.08kB  1.46%  github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote
         0     0%   100%   512.08kB  1.46%  github.com/tendermint/tendermint/consensus.(*ConsensusState).defaultDecideProposal
         0     0%   100%   512.08kB  1.46%  github.com/tendermint/tendermint/consensus.(*ConsensusState).enterNewRound
```

100 subscriptions produce 32MB.

Again, no additional goroutines are running after the end of the test
(wsConnection readRoutine and writeRoutine both finishes). **It means
that some exiting goroutine or object is holding a reference to the
*Query objects, which are leaking.**

One of them is pubsub#loop. It's using state.queries to map queries to
clients and state.clients to map clients to queries.

Before this commit, we're not thoroughly cleaning state.queries, which
was the reason for memory leakage.
2018-06-19 19:59:21 +04:00
Anton Kaliaev
aaddf5d32f set pubsub default capacity to 0
Refs #951

Jae: I don't know a good way to catch these errors in general, but
forcing pubsub's internal channel to have a capacity of 0 will reveal
bugs sooner, if the subscriber also has a 0 or small capacity ch to pull
from.
2018-06-19 17:07:21 +04:00
Anton Kaliaev
26b2e808f7 [rpc/lib/server] wrote a basic test for WebsocketManager 2018-06-19 17:06:48 +04:00
Anton Kaliaev
3d30a42943 add config to issue template 2018-06-19 11:59:14 +04:00
Anton Kaliaev
4f5492c831 add nopTxCache (Nil Object Pattern)
to better handle zero cache size
2018-06-19 11:59:07 +04:00
Anton Kaliaev
70d973016e output msg only once during start 2018-06-19 11:40:40 +04:00
Ethan Buchman
4b2348f697 mempool: fix cache_size==0. closes #1761 2018-06-18 18:21:19 -07:00
Ethan Buchman
6a324764ac fix circle 2018-06-18 17:18:35 -07:00
Ethan Buchman
3470e5d7b3 changelog and version 2018-06-18 17:15:41 -07:00
Ethan Buchman
a519825bf8 consensus: fixes #1754
* updateToState exits early if the state isn't new, which happens after
* fast syncing. This results in not sending a NewRoundStep message. The mempool
* reactor depends on PeerState, which is updated by NewRoundStep
* messages. If the peer never sends a NewRoundStep, the mempool reactor
* will think they're behind, and never forward transactions. Note this
* only happens when `create_empty_blocks = false`, because otherwise
* peers will move through the consensus state and send a NewRoundStep
* for a new step soon anyways. Simple fix is just to send the
* NewRoundStep message during updateToState even if exit early
2018-06-18 17:08:09 -07:00
Ethan Buchman
d457887dd6 Merge pull request #1759 from tendermint/bucky/readme
update README
2018-06-16 22:56:35 -07:00
Ethan Buchman
adb6a94f18 contact us at riot 2018-06-16 23:05:24 -07:00
Ethan Buchman
b8bfc041d3 update README 2018-06-16 19:00:42 -07:00
Ethan Buchman
9bad770f21 Merge pull request #1757 from tendermint/bucky/update-spec
docs/spec: some organizational cleanup
2018-06-16 13:03:00 -07:00
Ethan Buchman
d3b53e62a5 fix circle 2018-06-15 23:46:43 -07:00
Ethan Buchman
506cf6c9c7 docs/spec: DuplicateVoteEvidence 2018-06-15 23:19:42 -07:00
Ethan Buchman
b8f340afd0 docs/spec: some organizational cleanup 2018-06-15 22:56:26 -07:00
Ismail Khoffi
1a2f468695 fix circleci 2.0 config (#139) 2018-06-15 15:17:40 -07:00
Ethan Buchman
c84be3b8dd Merge pull request #1751 from tendermint/bucky/codeowner-alex
add xla as codeowner
2018-06-14 20:22:04 -07:00
Ethan Buchman
050636d5ce add xla as codeowner 2018-06-14 17:04:45 -07:00
ia
b5775b56c6 all: gofmt (#1743)
* all: gofmt

Run 'gofmt -w .' from project root.

* Update changelog to say that I ran gofmt

* Revert "Update changelog to say that I ran gofmt"

This reverts commit 956f133ff0354fd7338e7df7c823e6f98b655da6.
2018-06-15 02:03:50 +02:00
Alexander Simmerl
19af3e9733 Merge pull request #1738 from tendermint/zarko/add-blockchain-reactor-algorithm-spec
Add algorithm for Blockchain Reactor
2018-06-15 01:47:36 +02:00
Ismail Khoffi
41369d7529 circleci 2.0 (#134)
* circleci 2.0
2018-06-14 00:04:30 -07:00
Jae Kwon
fb7ec62b29 Fix comment 2018-06-13 23:45:44 -07:00
Jae Kwon
21726a6853 Add ColoredBytes() and update DebugDB 2018-06-13 23:45:44 -07:00
Jae Kwon
1b1c4cd94d Reduce Errors T/Cause/Message into single Data 2018-06-13 23:45:44 -07:00
Ethan Buchman
917bf4d428 Merge pull request #1732 from maxim-levy/patch-2
typo fix
2018-06-13 17:42:29 -07:00
Anton Kaliaev
696e8c6f9e [docs] write about addr_book_strict in production notes (#1741)
Refs #1736
2018-06-13 18:24:12 +04:00
Zarko Milosevic
ce73884857 Add spec for Blockchain Reactor algorithm 2018-06-13 14:05:17 +02:00
Alexander Simmerl
fa32dc5181 Merge pull request #1739 from tendermint/dev/bump_version
Bump abci version
2018-06-13 01:48:13 +02:00
Alexander Simmerl
da4d1c2038 Merge pull request #270 from tendermint/xla/update-develop-v0120
Xla/update develop v0120
2018-06-13 01:32:14 +02:00
ValarDragon
ec0c901bec Bump abci version 2018-06-12 16:30:24 -07:00
Dev Ojha
198dccf0dd Merge pull request #269 from tendermint/release/v0.12.0
Release/v0.12.0
2018-06-12 16:22:00 -07:00
Alexander Simmerl
1eeebabb0b Update version and changelog 2018-06-13 01:20:21 +02:00
Christopher Goes
8e273220a3 Remove error from priv.PubKey() (#131)
* Remove error from priv.PubKey()

* Update changelog
2018-06-12 13:35:22 -07:00
Dev Ojha
b84f788f36 Switch ports 466xx to 266xx (#1735)
* Switch ports 466xx to be 266xx
This is done so the default ports aren't in the linux kernel's default ephemeral port range.

* Update ABCI import

* Bump cache on circleci

* Get more verbose output for debugging

* Bump abci dependency

* Fix accidental change of a block header's hash

* pin abci release
2018-06-12 13:25:52 +04:00
Adrian Brink
ac80b93b60 unsafe_reset_all also resets addrbook.json (#1731)
* `unsafe_reset_all` also resets addrbook.json

When executing `unsafe_reset_all` it also clear all IP addresses from
addrbook.json. This is the expected behaviour of `unsafe_reset_all`.

* Fix tests

* improve logging statements

* use correct file
2018-06-12 12:55:10 +04:00
Dev Ojha
887bd8be08 Merge pull request #268 from tendermint/xla/resolve-divergence
Resolve divergence
2018-06-11 19:51:48 -07:00
Alexander Simmerl
514065a3c4 Merge branch 'master' into xla/resolve-divergence 2018-06-12 04:50:20 +02:00
Ismail Khoffi
42c6a64e04 version bump (#128)
version bump
2018-06-11 17:27:32 -07:00
Alexander Simmerl
260d69f372 Merge pull request #110 from tendermint/bucky/sig-name
SignatureKey -> Signature
2018-06-12 01:57:26 +02:00
Liamsi
e552d344e3 forgot PrivKeyLedgerSecp256k1 2018-06-11 16:51:38 -07:00
Liamsi
c4484c4a1b Merge remote-tracking branch 'remotes/origin/develop' into bucky/sig-name
# Conflicts:
#	Gopkg.lock
#	keys/keybase_test.go
#	signature_test.go
2018-06-11 16:46:08 -07:00
Liamsi
f4663e5bb7 fix tests, bump amino version, move encoding to encode_test.go,
include an example, do not err check on info ... bur for empty info
instead
2018-06-11 16:37:14 -07:00
Liamsi
45a1c8aef3 fix tests, move encoding to encode_test.go, include an example 2018-06-11 16:23:34 -07:00
Alexander Simmerl
dfc5aefd5f Merge pull request #1726 from tendermint/1717-panic-in-netaddress
return an error if we fail to parse external IP
2018-06-12 01:08:16 +02:00
Alexander Simmerl
eb4a8e0e7a Merge pull request #1719 from Slamper/develop
Escape paths in config template
2018-06-12 01:06:22 +02:00
Ethan Buchman
e694c309ba update ed25519 address scheme (#112)
make PubKeyEd25519.Address() returns the first 20 bytes of the hash of the raw 32-byte pubkey, no amino required
2018-06-11 15:43:32 -07:00
Dev Ojha
0c98d10b4f Merge pull request #222 from tendermint/dev/bech32_err_msg
Bech32: Wrap error messages
2018-06-11 10:20:51 -07:00
Max Levy
708ddb30f7 typo fix
And typo fix
2018-06-11 22:53:48 +09:00
Joon
66794a174a Move from tmlibs #213 (#115)
* move from tmlibs 213
* expose KVPair, simpleproofsfrommap returns keys
2018-06-10 20:43:40 -07:00
Christopher Goes
c21f67c5af Unify local and external keys in keybase interface (#117)
* Return errors on priv.Sign(), priv.PubKey()

* Add CreateLedger, CreateOffline

* Add switch on .Sign() for Ledger wallets

* Add offline signing switch on .Sign()

* Use MustUnmarshalBinaryBare()

* Add confirmation to delete offline/Ledger keys

* Lowercase error message

* Add human-readable .GetType() function to Info interface

* Rename CryptoAlgo => SignAlgo

* assert.Nil(t, err) => assert.NoError(t, err)
2018-06-10 01:01:41 -07:00
ValarDragon
1d66e34dc8 Bech32: Wrap error messages 2018-06-09 16:22:52 -07:00
Anton Kaliaev
cd3a240c9f return an error if we fail to parse external IP
```
I[06-08|11:51:57.234] Getting UPNP external address                module=p2p
I[06-08|11:51:58.867] Got UPNP external address                    module=p2p address=
```

Fixes #1717

```
I[06-08|11:51:56.952] Starting multiAppConn                        module=proxy impl=multiAppConn
I[06-08|11:51:56.952] Starting localClient                         module=abci-client connection=query impl=localClient
I[06-08|11:51:56.952] Starting localClient                         module=abci-client connection=mempool impl=localClient
I[06-08|11:51:56.952] Starting localClient                         module=abci-client connection=consensus impl=localClient
I[06-08|11:51:56.952] ABCI Handshake                               module=consensus appHeight=0 appHash=
I[06-08|11:51:56.952] ABCI Replay Blocks                           module=consensus appHeight=0 storeHeight=0 stateHeight=0
I[06-08|11:51:57.053] Completed ABCI Handshake - Tendermint and App are synced module=consensus appHeight=0 appHash=
I[06-08|11:51:57.053] This node is a validator                     module=consensus addr=6816B5D9BAC32A3CDF07884D9D3D2650694C371D pubKey=PubKeyEd25519{27A40CD032DD2467342D0CF27C5EC92052D966FEC714B6CF2F3BF3146AFD0D51}
I[06-08|11:51:57.234] Starting Node                                module=main impl=Node
I[06-08|11:51:57.234] Starting EventBus                            module=events impl=EventBus
I[06-08|11:51:57.234] Local listener                               module=p2p ip=:: port=46656
I[06-08|11:51:57.234] Getting UPNP external address                module=p2p
I[06-08|11:51:58.867] Got UPNP external address                    module=p2p address=
I[06-08|11:51:58.867] Starting DefaultListener                     module=p2p impl=Listener(@<nil>:46656)
I[06-08|11:51:58.867] P2P Node ID                                  module=main ID=3629b516392e494ae717ac4c6a1ea7eb0fe421c3 file=/home/tpb/.tendermint/config/node_key.json
I[06-08|11:51:58.868] Add our address to book                      module=p2p book=/home/tpb/.tendermint/config/addrbook.json addr=null
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x89fb86]

goroutine 1 [running]:
github.com/tendermint/tendermint/p2p.(*NetAddress).String(0x0, 0xc96e24, 0x17)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/p2p/netaddress.go:171 +0x26
github.com/tendermint/tendermint/p2p/pex.(*addrBook).AddOurAddress(0xc420190620, 0x0)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/p2p/pex/addrbook.go:160 +0x116
github.com/tendermint/tendermint/node.(*Node).OnStart(0xc420286d00, 0xc4201b8010, 0xd)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/node/node.go:402 +0x547
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start(0xc420286d00, 0xe51c40, 0xc42000bd40)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x3bd
github.com/tendermint/tendermint/cmd/tendermint/commands.NewRunNodeCmd.func1(0xc42022e000, 0xc4200acdc0, 0x0, 0x1, 0x0, 0x0)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/cmd/tendermint/commands/run_node.go:58 +0xfe
github.com/tendermint/tendermint/vendor/github.com/spf13/cobra.(*Command).execute(0xc42022e000, 0xc4200acda0, 0x1, 0x1, 0xc42022e000, 0xc4200acda0)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/vendor/github.com/spf13/cobra/command.go:762 +0x468
github.com/tendermint/tendermint/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1289280, 0xbbdda0, 0xc420015e01, 0xc4201bc640)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/vendor/github.com/spf13/cobra/command.go:852 +0x30a
github.com/tendermint/tendermint/vendor/github.com/spf13/cobra.(*Command).Execute(0x1289280, 0xc4201bc640, 0xc420015e98)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/vendor/github.com/spf13/cobra/command.go:800 +0x2b
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/cli.Executor.Execute(0x1289280, 0xde5798, 0x2, 0xc4200332c0)
	/home/tpb/code/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/cli/setup.go:89 +0x4e
main.main()
	/home/tpb/code/go/src/github.com/tendermint/tendermint/cmd/tendermint/main.go:45 +0x24d
```
2018-06-09 15:03:38 +04:00
Hendrik Hofstadt
e93865f7de escape paths in config template 2018-06-08 20:44:54 -07:00
Ethan Buchman
f6c960c3d3 Merge branch 'develop' of https://github.com/tendermint/go-crypto into develop 2018-06-08 17:29:20 -07:00
Ethan Buchman
854eb323dd dev version bump 2018-06-08 17:28:50 -07:00
Ethan Buchman
710efe576a Merge pull request #113 from tendermint/release/v0.7.0
Release/v0.7.0
2018-06-08 17:17:35 -07:00
Alexander Simmerl
2e0466d1c8 Merge pull request #1722 from tendermint/dev/document_peer_types
Update description of seed and persistent peer nodes
2018-06-09 02:14:48 +02:00
ValarDragon
fd9375c35b Docs: Update description of seeds and persistent peers 2018-06-09 01:25:46 +02:00
Ethan Buchman
5ebf9b816b Merge pull request #1698 from tendermint/zach/rst-2-md
docs to markdown
2018-06-07 21:46:18 -07:00
Christopher Goes
361277f9be Merge branch 'develop' into dev/ephemeral_ports 2018-06-08 04:14:45 +02:00
Zach Ramsay
724b6c39b8 style fixes/typos/etc from PR review 2018-06-07 10:01:31 -04:00
Zach Ramsay
9aef3fa610 docs: pretty fixes 2018-06-07 09:41:57 -04:00
Zach Ramsay
e82ab1c374 moar fixes 2018-06-07 09:41:57 -04:00
Zach Ramsay
ffa8b5f620 oomph 2018-06-07 09:41:57 -04:00
Zach Ramsay
df07f8b36a moar 2018-06-07 09:41:57 -04:00
Zach Ramsay
d4d91d7781 running in prod 2018-06-07 09:41:57 -04:00
Zach Ramsay
3039aa1e67 intro 2018-06-07 09:41:57 -04:00
Zach Ramsay
d4d79886b2 indexing txns 2018-06-07 09:41:57 -04:00
Zach Ramsay
b429d65f9f how to read logs 2018-06-07 09:41:57 -04:00
Zach Ramsay
20e1eadcf1 getting started 2018-06-07 09:41:57 -04:00
Zach Ramsay
2e18a4e633 determinism & ecosystem 2018-06-07 09:41:57 -04:00
Zach Ramsay
b860018975 deploy tesnets 2018-06-07 09:41:57 -04:00
Zach Ramsay
44c88805a7 app devel 2018-06-07 09:41:57 -04:00
Zach Ramsay
a9b6fcdbc4 docs: cleanup/clarify build process 2018-06-07 09:41:57 -04:00
Zach Ramsay
14a5dfd945 docs: start move back to md 2018-06-07 09:41:57 -04:00
Ethan Buchman
24fa2a62b0 dev version bump 2018-06-06 20:57:19 -07:00
Ethan Buchman
27bd1deabe Merge pull request #1703 from tendermint/release/v0.20.0
Release/v0.20.0
2018-06-06 20:47:17 -07:00
Ethan Buchman
76c82fd433 add more tests 2018-06-06 20:49:00 -07:00
Ethan Buchman
640af0205d Merge pull request #219 from tendermint/include-group-close-in-tests
[autofile] include call to group#Close in tests
2018-06-06 20:46:39 -07:00
Ethan Buchman
9481cabd50 fixes from review 2018-06-06 20:45:20 -07:00
Ethan Buchman
46b957929c Merge branch 'develop' into release/v0.20.0 2018-06-06 19:24:36 -07:00
Ethan Buchman
512e563d4b Merge pull request #1694 from tendermint/dev/bsd_install_script
docs: Add BSD install script
2018-06-06 19:14:46 -07:00
ValarDragon
a6a4fc7784 docs: Add BSD install script 2018-06-06 17:57:25 -07:00
Ethan Buchman
bfcec02423 Merge pull request #1702 from tendermint/xla/fix-racy-config
Fix race when mutating MConnConfig
2018-06-06 17:15:53 -07:00
Ethan Buchman
fcf61b8088 check addrs match pubkeys in abci Validator. version bump 2018-06-06 16:35:35 -07:00
Ethan Buchman
46fb179605 Merge pull request #1701 from tendermint/bucky/abci-fixes
Bucky/abci fixes
2018-06-06 16:12:12 -07:00
Ethan Buchman
89925501f3 p2p/filter/pubkey -> p2p/filter/id 2018-06-06 16:13:51 -07:00
Ethan Buchman
6b8613b3e7 ResponseEndBlock: ensure Address matches PubKey if provided 2018-06-06 16:12:14 -07:00
Ethan Buchman
8be27494bb update abci spec. add address spec 2018-06-06 16:11:58 -07:00
Alexander Simmerl
c661a3ec21 Fix race when mutating MConnConfig
Instead of mutating the passed in MConnConfig part of P2PConfig we just
use the default and override the values, the same as before as it was
always the default version. This is yet another good reason to not embed
information and access to config structs in our components and will go
away with the ongoing refactoring in #1325.
2018-06-07 01:09:13 +02:00
Ethan Buchman
8e45348737 update for abci v0.11.0 release. let InitChain update validators 2018-06-06 15:47:04 -07:00
Ethan Buchman
0b0d9d0029 Merge pull request #262 from tendermint/changelog-date
date in changelog
2018-06-06 14:56:15 -07:00
Ethan Buchman
aaeeb76808 date in changelog 2018-06-06 13:22:57 -07:00
Ethan Buchman
7dfc74a6b6 Merge pull request #1667 from tendermint/bucky/abci-11
Update ABCI for new PubKey type and changes to BeginBlock and InitChain
2018-06-06 13:16:09 -07:00
Ethan Buchman
ebee2fe114 Merge pull request #261 from tendermint/release/v0.11.0
Release/v0.11.0
2018-06-06 13:13:20 -07:00
Ethan Buchman
084f2e5b8c update readme 2018-06-06 13:17:11 -07:00
Ethan Buchman
2edc68c59b use all fields in abci types 2018-06-06 13:07:17 -07:00
Ethan Buchman
3f6da94d55 update Makefile 2018-06-06 12:52:11 -07:00
Ethan Buchman
72330e6609 val_set_hash -> validators_hash 2018-06-06 12:29:05 -07:00
Dev Ojha
fe4123684d Change reset messages (#1699) 2018-06-06 22:07:10 +04:00
Anton Kaliaev
f0c44d1bd0 [autofile] include call to group#Close in tests 2018-06-06 11:52:59 +04:00
Ethan Buchman
2897685c57 abci header takes ValidatorsHash 2018-06-06 00:28:12 -07:00
Ethan Buchman
8fa7c493bc add val_set_hash to header 2018-06-06 00:01:38 -07:00
Ethan Buchman
bc07d06647 update changelog, version, spec 2018-06-05 23:37:15 -07:00
Ethan Buchman
71556c62eb fixes from rebase 2018-06-05 22:14:37 -07:00
Ethan Buchman
0e02e45ac7 Merge pull request #254 from tendermint/bucky/genesi
include genesis file structure
2018-06-05 22:07:15 -07:00
Ethan Buchman
54e61468d4 fixes from review 2018-06-05 22:04:38 -07:00
Ethan Buchman
5c7ccbd4a7 use const for abci type strings 2018-06-05 22:04:38 -07:00
Ethan Buchman
e2f5a6fbe4 update abci 2018-06-05 22:04:38 -07:00
Ethan Buchman
aa8be33da1 fix fmt 2018-06-05 22:04:27 -07:00
Ethan Buchman
909f66e841 remove extra eventBus 2018-06-05 22:04:27 -07:00
Ethan Buchman
3d2c4fd309 update Evidence type - requires pubkey and valset to verify and convert to abci.Evidence 2018-06-05 22:04:26 -07:00
Ethan Buchman
e5bca1df6f update godep for abci 2018-06-05 22:00:43 -07:00
Ethan Buchman
866bcceb35 fix consensus tests 2018-06-05 22:00:25 -07:00
Ethan Buchman
e1e6878a4d fix state tests 2018-06-05 22:00:25 -07:00
Ethan Buchman
e4147b6f1a state test runs 2018-06-05 22:00:25 -07:00
Ethan Buchman
7606b7595f compiles 2018-06-05 22:00:25 -07:00
Ethan Buchman
5480fd4a67 Merge branch 'develop' into bucky/genesi 2018-06-05 22:00:11 -07:00
Ethan Buchman
485b4a0c6f revert gogo 2018-06-05 21:59:52 -07:00
Ethan Buchman
575d94dbb9 state compiles 2018-06-05 21:59:52 -07:00
Ethan Buchman
ebd2fe7a68 more types 2018-06-05 21:59:52 -07:00
Ethan Buchman
f28eae7816 update types 2018-06-05 21:59:52 -07:00
Ethan Buchman
e13c1ab735 update for new abci 2018-06-05 21:59:52 -07:00
Ethan Buchman
8bbe43aa33 update changelog 2018-06-05 21:53:09 -07:00
Ethan Buchman
a7e049a228 Merge branch 'master' into develop 2018-06-05 21:39:23 -07:00
Ethan Buchman
0e0461d9bc dev version bump 2018-06-05 18:54:30 -07:00
Ethan Buchman
057e076ca9 Merge pull request #1693 from tendermint/release/v0.19.9
Release/v0.19.9
2018-06-05 18:00:02 -07:00
Ethan Buchman
775fef31c2 remove go-wire from test/app/grpc_client 2018-06-05 17:43:39 -07:00
Ethan Buchman
9cb079dcc6 dep, version, changelog 2018-06-05 17:38:54 -07:00
Ethan Buchman
67180344b7 Merge pull request #1663 from tendermint/zach/quick-install
quick install script
2018-06-05 17:17:47 -07:00
Ethan Buchman
825fdf2c24 Merge pull request #1679 from tendermint/flush-wal-on-stop
Flush cs.wal on stop
2018-06-05 17:14:19 -07:00
Ethan Buchman
692f1d86a6 Merge pull request #218 from tendermint/release/v0.8.4
Release/v0.8.4
2018-06-05 17:11:19 -07:00
Ethan Buchman
22541b881d changelog and version 2018-06-05 17:12:33 -07:00
Anton Kaliaev
e0985bf566 flush on stop & function to close group
as opposite to OpenGroup
2018-06-05 17:11:06 -07:00
Ethan Buchman
61002ad264 Merge pull request #1628 from tendermint/bucky/selective-evidence-broadcast
evidence: dont send evidence to unsynced peers
2018-06-05 17:07:29 -07:00
Ethan Buchman
41e847ec97 linter 2018-06-05 17:02:05 -07:00
Ethan Buchman
55bae62d71 fix test 2018-06-05 16:54:58 -07:00
Ethan Buchman
d2259696af Merge pull request #1689 from tendermint/1688-tx-search-panic
validate per_page before page
2018-06-05 07:52:49 -07:00
Ethan Buchman
32719123d9 Merge pull request #1687 from tendermint/sdk-1045-memory-leak
do not drain the channel because there is no channel, duh
2018-06-05 07:51:21 -07:00
Zach
80e7807cae move spec to markdown (#260) 2018-06-05 10:27:55 -04:00
Anton Kaliaev
2ce8179c8b validate per_page before page
plus an additional check just in case
Closes #1688
2018-06-05 16:20:48 +04:00
Anton Kaliaev
b8c076ca79 do not drain the channel because there is no channel, duh
Fixes https://github.com/cosmos/cosmos-sdk/issues/1045
2018-06-05 14:57:20 +04:00
Ethan Buchman
1b2e34738a checkSendEvidenceMessage 2018-06-05 00:01:01 -07:00
Ethan Buchman
566024b64f use Hash as map key 2018-06-04 21:50:29 -07:00
Ethan Buchman
932381effa evidence: give each peer a go-routine 2018-06-04 21:20:23 -07:00
Ethan Buchman
2007c66091 fix test 2018-06-04 21:20:23 -07:00
Ethan Buchman
97c5533c35 update some comments 2018-06-04 21:20:23 -07:00
Ethan Buchman
3d33226e80 move types/services.go to state pkg. pass State to evpool.Update 2018-06-04 21:20:23 -07:00
Ethan Buchman
edb851280a state: b -> block 2018-06-04 21:20:23 -07:00
Ethan Buchman
dd62f06994 state: s -> state 2018-06-04 21:20:23 -07:00
Ethan Buchman
19d95b5410 evidence: check peerstate exists; dont send old evidence 2018-06-04 21:20:23 -07:00
Ethan Buchman
53937a8129 changelog 2018-06-04 21:20:23 -07:00
Ethan Buchman
f1c53c7358 evidence: dont send evidence to unsynced peers
* only send evidence to peers that are synced enough to validate it all
* closes #1624
2018-06-04 21:20:23 -07:00
Ethan Buchman
3445f1206e Merge pull request #1683 from tendermint/bucky/test
fix byz-test
2018-06-04 21:09:10 -07:00
Ethan Buchman
097f778c1e fix byz-test 2018-06-04 20:48:35 -07:00
Ethan Buchman
c85c21d1bc Merge pull request #1670 from tendermint/xla/extract-privval
Extract priv_validator into first class package
2018-06-04 18:57:09 -07:00
Ethan Buchman
fd4db8dfdc Merge pull request #1676 from tendermint/xla/collapse-peerconfig
Collapse PeerConfig into P2PConfig
2018-06-04 18:50:41 -07:00
Alexander Simmerl
1318bd18cd Merge pull request #1680 from Slamper/develop
Return 404 for unknown RPC endpoints
2018-06-05 02:14:16 +02:00
Alexander Simmerl
ea896865a7 Collapse PeerConfig into P2PConfig
As both configs are concerned with the p2p packaage and PeerConfig is
only used inside of the package there is no good reason to keep the
couple of fields separate, therefore it is collapsed into the more
general P2PConifg. This is a stepping stone towards a setup where the
components inside of p2p do not have any knowledge about the config.

follow-up to #1325
2018-06-05 02:07:56 +02:00
Ethan Buchman
aeb91dfc22 dev version bump 2018-06-04 15:57:57 -07:00
Ethan Buchman
5727916c5b Merge pull request #1681 from tendermint/release/v0.19.8
Release/v0.19.8
2018-06-04 15:48:22 -07:00
Ethan Buchman
876c8f14e7 changelog and version 2018-06-04 14:16:58 -07:00
Hendrik Hofstadt
67416feb3a return 404 for unknown RPC endpoints 2018-06-04 22:14:20 +02:00
Zach Ramsay
8706ae765c docs: a link to quick install script 2018-06-04 10:42:28 -04:00
Zach Ramsay
954a8941ff scripts: quickest/easiest fresh install 2018-06-04 10:42:28 -04:00
Anton Kaliaev
1f22f34edf flush wal group on stop
Refs #1659
Refs https://github.com/tendermint/tmlibs/pull/217
2018-06-04 16:47:44 +04:00
Anton Kaliaev
0562009275 bring back assert 2018-06-04 16:33:57 +04:00
idoor88
fedd07c522 removed assertion to avoid confusion (#1626) 2018-06-04 14:30:46 +04:00
Anton Kaliaev
3fa734ef5a recheck only if there are txs left in the mempool (#1645) 2018-06-04 14:28:47 +04:00
Ethan Buchman
cd6bfdc42f Merge pull request #1673 from tendermint/bucky/mempool
fix possible mempool deadlock
2018-06-03 16:14:58 -04:00
Ethan Buchman
98b0c51b5f fix possible mempool deadlock 2018-06-03 16:11:52 -04:00
Ethan Buchman
c777be256a changelog, version 2018-06-03 16:11:21 -04:00
Ethan Buchman
d66f8bf829 Merge branch 'master' into develop 2018-06-03 16:10:04 -04:00
Alexander Simmerl
bf370d36c2 Extract priv_validator into first class package
This is a maintenance change to move the private validator package out
of the types and to a top-level location. There is no good reason to
keep it under the types and it will more clearly coommunicate where
additions related to the privval belong. It leaves the interface and the
mock in types for now as it would introduce circular dependency between
privval and types, this should be resolved eventually.

* mv priv_validator to privval pkg
* use consistent `privval` as import

Follow-up to #1255
2018-06-03 13:51:58 +02:00
Ethan Buchman
1c643701f5 Merge pull request #1662 from Liamsi/develop
WIP: simplify & update documentation, fix typo
2018-06-02 18:39:36 -04:00
Alexander Simmerl
0b0290bdb2 Merge pull request #1675 from tendermint/xla/disable-slate-ci
Disable slate step in CI workflow
2018-06-02 15:56:43 +02:00
Alexander Simmerl
a4779fdf51 Disable slate step in CI workflow
It's currently breaking for unknown reasons, until fixed we going to
disable it, to not block on it for unrelated PRs.
2018-06-02 15:49:25 +02:00
Liamsi
7030d5c2a7 remove notes column
according to: https://github.com/tendermint/go-crypto/pull/110#issuecomment-394048086
2018-06-02 13:04:40 +01:00
Ethan Buchman
9af8b7a7c8 fix tests file 2018-06-01 22:03:47 -04:00
Ethan Buchman
f34d1009c4 Merge pull request #1671 from tendermint/1518-xla/remove-auth_enc-option
Remove auth_enc config option
2018-06-01 21:07:14 -04:00
Alexander Simmerl
0e3dc32b3d Merge pull request #1672 from tendermint/xla/store-ci-test-logs
Store CI test logs
2018-06-02 02:44:01 +02:00
Alexander Simmerl
d292fa4541 Store CI test logs
For post-mortem introspection it is helpful to have the full logs of
test runs available for download.
2018-06-02 02:33:31 +02:00
Alexander Simmerl
3255c076e5 Remove auth_enc config option
As we didn't hear any voices requesting this feature, we removed the
option to disable it and always have peer connection auth encrypted.

closes #1518
follow-up #1325
2018-06-01 21:07:20 +02:00
Zaki Manian
44f1bdb0d5 Bech32 (#216)
* Add support for regular bech32 to tmlibs

* Add bech32 to gopkg.toml
2018-06-01 13:56:00 +04:00
ValarDragon
72543092a0 Switch usage of port 46658 to 26658 2018-05-31 21:50:22 -07:00
Ethan Buchman
c681347ee3 move genesis fields into RequestInitChain. some nullable=false 2018-05-31 23:58:02 -04:00
Ethan Buchman
512b3121a7 include genesis file structure 2018-05-31 21:59:20 -04:00
Ethan Buchman
355fde16fe Merge pull request #255 from tendermint/bucky/gogo
Revert "Merge pull request #247 from tendermint/bucky/no-gogo"
2018-05-31 21:43:11 -04:00
Ethan Buchman
90c3a469ff Revert "Merge pull request #247 from tendermint/bucky/no-gogo"
This reverts commit ef79007433, reversing
changes made to bcfdd6dbaf.
2018-05-31 21:45:14 -04:00
Christopher Goes
2bbad9d496 Merge pull request #85 from tendermint/cwgoes/ledger-integration
Ledger integration
2018-05-31 21:45:00 +02:00
Liamsi
978277a4c1 make slightly more readable 2018-05-31 20:40:01 +01:00
Christopher Goes
80e9752250 Move TODOs to #114 2018-05-31 21:30:20 +02:00
Christopher Goes
63aac65590 Remove Ledger ed25519 support, for now 2018-05-31 21:21:50 +02:00
Liamsi
58eb76f34d simplify & update documentation, fiy typo 2018-05-31 20:13:41 +01:00
Ethan Buchman
a017f2fdd4 Merge pull request #1654 from tendermint/release/v0.19.7
Release/v0.19.7
2018-05-31 09:15:13 -04:00
Ethan Buchman
aaaa5f23e2 changelog and version 2018-05-30 23:36:36 -04:00
Ethan Buchman
178e357d7f Merge pull request #1618 from tendermint/1494-production-notes
[docs] notes about running a production system
2018-05-30 23:23:51 -04:00
Ethan Buchman
683b527534 Merge pull request #1636 from tendermint/bucky/docs
gut docs/app-arch
2018-05-30 23:17:26 -04:00
Ethan Buchman
d584e03427 fix link and typo 2018-05-30 23:23:39 -04:00
Ethan Buchman
d454b1b25f SkipDuplicate -> AllowDuplicate; fix p2p test on mac 2018-05-30 21:44:39 -04:00
Ethan Buchman
432f21452d Merge branch 'master' into develop 2018-05-30 21:43:31 -04:00
Ethan Buchman
e1ce3ffe0f changelog and version 2018-05-30 20:48:52 -04:00
Ethan Buchman
eadc7b137b Merge branch 'master' into develop 2018-05-30 18:58:39 -04:00
Ethan Buchman
9706935233 fix link in readme 2018-05-30 18:57:53 -04:00
Ethan Buchman
21b821d661 SignatureKey -> Signature 2018-05-30 18:41:08 -04:00
Ethan Buchman
434759e17b Merge pull request #94 from Liamsi/const_time
Use constant-time comparator to compare signatures
2018-05-30 18:27:05 -04:00
Ethan Buchman
20fdec6c0e fix comment 2018-05-30 18:34:11 -04:00
Ethan Buchman
aa3212180f Merge pull request #80 from alessio/keymanager
Add import/export of public keys #79
2018-05-30 18:24:53 -04:00
Ethan Buchman
f9d094dc1a Merge pull request #97 from Liamsi/prng_seed
safer PRNG seeding
2018-05-30 18:17:58 -04:00
Ethan Buchman
251041ce09 Merge pull request #105 from tendermint/bucky/merkle
Bring in merkle and tmhash from tmlibs
2018-05-30 18:08:25 -04:00
Ethan Buchman
52bd867fd9 merkle: use amino for byteslice encoding 2018-05-30 17:50:17 -04:00
Liamsi
862d3c342a commit doc.go 2018-05-30 17:44:20 -04:00
Ethan Buchman
9f04935caa merkle: remove unused funcs. unexport simplemap. improv docs 2018-05-30 17:44:02 -04:00
Christopher Goes
bb81e4aa5f Pin to an upstream revision 2018-05-30 22:16:30 +02:00
Christopher Goes
c689f38cb5 Implement PubKeyLedgerEd25519 2018-05-30 22:07:20 +02:00
Anton Kaliaev
f0ce8b3883 note about state syncing 2018-05-30 16:55:39 +04:00
Anton Kaliaev
3da5198631 fixes after @zramsay's review 2018-05-30 16:51:20 +04:00
Anton Kaliaev
252a0a392b move reactor descriptions to relevant specs 2018-05-30 16:51:19 +04:00
Anton Kaliaev
f7106bfb39 more config variables
Refs #1494
2018-05-30 16:51:19 +04:00
Anton Kaliaev
2a517ac98c hardware specs and configuration params
Refs #1494
2018-05-30 16:51:19 +04:00
Anton Kaliaev
b542dce2e1 [docs] signal handling
Refs #1494
2018-05-30 16:51:19 +04:00
Anton Kaliaev
82ded582f2 [docs] debugging/monitoring sections, restart handling
Refs #1494
2018-05-30 16:51:19 +04:00
Anton Kaliaev
e0d4fe2dba document DOS exposure and mitigation
Refs #1494
2018-05-30 16:51:19 +04:00
Anton Kaliaev
83c6f2864d document the consensus WAL
Refs #1494
2018-05-30 16:51:19 +04:00
Anton Kaliaev
33ec8cb609 document logging
Refs #1494
2018-05-30 16:51:19 +04:00
Ethan Buchman
ef79007433 Merge pull request #247 from tendermint/bucky/no-gogo
Bucky/no gogo
2018-05-30 08:41:03 -04:00
Ethan Buchman
6e3191fd6c Merge branch 'develop' into bucky/no-gogo 2018-05-30 08:34:16 -04:00
Ethan Buchman
21951dd5b3 update tmlibs dep 2018-05-30 08:42:07 -04:00
Ethan Buchman
e0acf357bb Merge pull request #214 from tendermint/bucky/no-gogo
no gogo proto
2018-05-30 08:30:54 -04:00
Ethan Buchman
43a652bcbf Merge pull request #1647 from tendermint/1643-events-query-pubsub
[docs] indexing transactions and subscribing to events
2018-05-30 08:16:08 -04:00
Ethan Buchman
094a40084d Merge pull request #1646 from tendermint/xla/duplicate-ip-check-config
Introduce option to skip duplicate ip check
2018-05-30 08:12:46 -04:00
Anton Kaliaev
eec9f142b5 [docs] indexing transactions and subscribing to events
Refs #1643
2018-05-30 13:10:04 +04:00
Alexander Simmerl
5796e879b9 Introduce option to skip duplicate ip check
In some scenarios like tests we want to disable the guard which prevents
peers connecting from the same ip.

Fixes #1632
Closes #1634
2018-05-30 10:40:22 +02:00
Christopher Goes
ee411daa17 Add ed25519, tests will fail until ed25519 verification fix 2018-05-30 03:42:57 +02:00
Christopher Goes
3186dc4cef Clarify function names 2018-05-30 03:29:42 +02:00
Christopher Goes
e534559bdc Update upstream Ledger code 2018-05-30 01:39:50 +02:00
Ethan Buchman
846ca5ce56 Merge pull request #1641 from tendermint/release/v0.19.6
Release/v0.19.6
2018-05-29 13:14:44 -04:00
Jae Kwon
fd6021876b Potential fix for blockchain pool halting issue 2018-05-29 12:32:22 -04:00
Ethan Buchman
2763c8539c changelog and version 2018-05-29 12:31:01 -04:00
Ethan Buchman
1c0bfe1158 Merge pull request #1633 from tendermint/jae/blockchain_pool
Potential fix for blockchain pool halting issue
2018-05-29 10:27:53 -04:00
Ethan Buchman
1e87ef7f75 circle: add GOCACHE=off and -v to tests 2018-05-29 09:28:29 -04:00
Zach
bcfdd6dbaf Merge pull request #249 from tendermint/zach/fix-test
fix cli test
2018-05-28 18:34:58 -04:00
Ethan Buchman
c8be091d4a gut docs/app-arch 2018-05-28 16:58:38 -04:00
Zach
ec34c8f9d2 docs: update ABCI output (#1635) 2018-05-28 22:06:02 +04:00
Anton Kaliaev
6004587347 expect all tags to be strings (#1498)
* expect all tags to be strings

Refs #1369

* port changes from https://github.com/tendermint/tmlibs/pull/204

Refs #1369
2018-05-28 14:37:11 +04:00
Jae Kwon
f55725ebfa Potential fix for blockchain pool halting issue 2018-05-26 22:08:42 -07:00
Zach Ramsay
b73157141b fix make test_cli, #244 2018-05-25 16:22:27 -04:00
Zach
7f20eb5f8e generate RPC docs using Slate (#1612)
* generate RPC docs using Slate (#691)

* update changelog

* skip if branch not develop

* slate: only build if rpc/core has changes

* fetch develop to compare against

* slate: build on master only

* [rpc/core] use original repo, not fork in README
2018-05-25 15:59:24 +04:00
Anton Kaliaev
eeabb4c06b Merge pull request #1607 from tendermint/1600-wal-bug
[wal] small fixes in SearchEndHeight & replay logic
2018-05-25 15:41:57 +04:00
Anton Kaliaev
4da81aa0b7 commented out TestPEXReactorRunning 2018-05-25 15:11:32 +04:00
Anton Kaliaev
67068a34f2 log requesting addresses 2018-05-25 15:11:32 +04:00
Anton Kaliaev
2a0e9f93ce provide arg to error
BEFORE:

```
E[05-24|11:55:37.229] Dialing failed                               pex=0 addr=022ec801d79025caab3afbbf816d92ff8450d040@127.0.0.2:6593 err="Connect to self: <nil>" attempts=0
```

AFTER:

```
E[05-24|11:55:37.229] Dialing failed                               pex=0 addr=022ec801d79025caab3afbbf816d92ff8450d040@127.0.0.2:6593 err="Connect to self: 022ec801d79025caab3afbbf816d92ff8450d040@127.0.0.2:6593" attempts=0
```
2018-05-25 15:11:32 +04:00
Anton Kaliaev
708f35e5c1 do not look for height in older files if we've seen height - 1
Refs #1600
2018-05-25 15:11:15 +04:00
Anton Kaliaev
f3f5c7f472 we must only return io.EOF to progress to the next file in auto.Group
since we never write msg partially, if we've encountered io.EOF in the
middle of the msg, we must abort
2018-05-25 15:10:51 +04:00
Anton Kaliaev
68f6226bea data is corrupted, but this requires manual intervention
i.e., can't be skipped

and we should only return DataCorruptionError if we can skip a msg safely
2018-05-25 15:10:51 +04:00
Anton Kaliaev
118b86b1ef fix nil panic error
msg is nil and if we continue executing, we'll get nil exception at
`msg.Msg.(....)`
2018-05-25 15:10:51 +04:00
Anton Kaliaev
b9afcbe3a2 fix typo 2018-05-25 15:10:51 +04:00
Anton Kaliaev
a885af0826 Merge pull request #1574 from tendermint/847-separate-internal-pubsub
[pubsub] Prioritise internal subscribers (e.g. reactor) over external (e.g. RPC)
2018-05-24 21:09:56 +04:00
vrde
707d27c11e Fix dead link in README.md (#106)
* Fix dead link in README.md
2018-05-24 16:57:37 +02:00
Ethan Buchman
6334b3a501 fix makefile 2018-05-24 00:17:46 -04:00
Ethan Buchman
01f87fd8d3 remove gogoproto 2018-05-24 00:13:43 -04:00
Ethan Buchman
d24a30858e no gogo proto 2018-05-24 00:10:35 -04:00
Ethan Buchman
cfdec76020 update everything for Params and Result types 2018-05-23 23:27:46 -04:00
Ethan Buchman
5830c338ae Application uses new ParamsXxx and ResultXxx Types 2018-05-23 22:49:46 -04:00
Ethan Buchman
07a9ddb2d5 result.go is json.go and codetype.go 2018-05-23 22:49:13 -04:00
Ethan Buchman
fac6bcd19e consolidate util.go and pubkey.go to validator.go 2018-05-23 22:46:15 -04:00
Ethan Buchman
3d4f3bbbdd varint -> uvarint for length prefix 2018-05-23 22:46:13 -04:00
Ethan Buchman
927c16281c Merge pull request #245 from tendermint/bucky/validator-types
Request/ResponseValidator, update Header
2018-05-23 22:18:45 -04:00
Ethan Buchman
3dbdc87edb protoc and update everything 2018-05-23 22:24:39 -04:00
Ethan Buchman
8bb04d7ef7 Validator and SignedValidator 2018-05-23 22:20:24 -04:00
Ethan Buchman
3a947b0117 Merge pull request #1619 from tendermint/zach/cleaner-repo
clean up links & spec docs
2018-05-23 21:09:15 -04:00
Ethan Buchman
caf5afc084 Merge pull request #1520 from tendermint/bucky/p2p-same-ip
p2p: prevent connections from same ip
2018-05-23 20:57:17 -04:00
Ethan Buchman
f0b1f6e8ac Merge pull request #98 from zmanian/xChaChaPoly1035
Implementation of xchacha20poly1035 aead
2018-05-23 18:42:17 -04:00
Zaki Manian
05a5294e52 Remove panic and check the round trip 2018-05-24 00:12:54 +02:00
Zaki Manian
384f1e399a Fixed the directory name and added a test vector 2018-05-23 23:54:26 +02:00
Zach Ramsay
2aa5285c66 fix from self-review 2018-05-23 10:08:57 -04:00
Zach Ramsay
b166831fb5 link to both consensus specs 2018-05-23 10:05:03 -04:00
Zach Ramsay
423fef1416 docs: use absolute links (#1617) 2018-05-23 10:01:32 -04:00
Zach Ramsay
b4d10b5b91 consensus: link to spec from readme (#1609) 2018-05-23 09:41:54 -04:00
Ethan Buchman
6f1bfb6280 Merge pull request #1616 from tendermint/zach/no-debora
remove debora scripts
2018-05-23 08:43:22 -04:00
Ethan Buchman
5e7177053c Merge pull request #1611 from tendermint/zach/dead-links
fix dead links & other doc updates
2018-05-23 08:42:25 -04:00
Zach Ramsay
a0201e7862 docker readme: update 2018-05-23 08:28:55 -04:00
Zach Ramsay
126ddca1a6 remove debora scripts (#1610) 2018-05-23 08:01:07 -04:00
Alexander Simmerl
186d38dd8a Use different loopback addresses for test switch 2018-05-23 02:36:48 +02:00
Alexander Simmerl
01fd102dba Incoporate review feedback 2018-05-23 01:56:03 +02:00
Alexander Simmerl
e11f3167ff Fix pex reactor test 2018-05-23 01:35:03 +02:00
Alexander Simmerl
7d98cfd3d6 Test duplicate IP guard in peer set 2018-05-23 01:24:27 +02:00
Alexander Simmerl
4848e88737 Fix persistent peer switch test 2018-05-23 00:24:40 +02:00
Zach Ramsay
60d7486de2 docs: fix dead links, closes #1608 2018-05-22 14:46:56 -04:00
Ethan Buchman
c2636c3c6b tmhash: add Sum function 2018-05-22 13:04:42 -04:00
Ethan Buchman
4663ffdf08 add tmhash 2018-05-22 12:49:44 -04:00
Ethan Buchman
134fdf7169 bring in merkle from tmlibs 2018-05-22 12:43:44 -04:00
Ethan Buchman
c3b72ea708 Merge pull request #210 from tendermint/bucky/tmhash
tmhash
2018-05-22 12:09:52 -04:00
Zaki Manian
f9b0820752 Merge branch 'develop' into xChaChaPoly1035 2018-05-22 05:47:05 -07:00
Zaki Manian
8423f6ef5a Add the libsodium test vector 2018-05-21 20:45:36 -07:00
Ethan Buchman
d468cee107 Merge branch 'master' into develop 2018-05-21 21:40:07 -04:00
Ethan Buchman
d970af8724 Merge pull request #212 from tendermint/release/v0.8.3
Release/v0.8.3
2018-05-21 21:30:52 -04:00
Ethan Buchman
06cffa6acb changelog and version 2018-05-21 21:38:02 -04:00
Ethan Buchman
d72de8ba68 fix test 2018-05-21 20:26:54 -04:00
Ethan Buchman
d82699bf43 tmhash 2018-05-21 20:15:32 -04:00
Ethan Buchman
4fb515fa08 Merge pull request #208 from tendermint/bucky/remotedb
Move remotedb under db
2018-05-21 17:36:18 -04:00
Ethan Buchman
f27c358a8a revert protobuf recompile 2018-05-21 17:37:53 -04:00
Ethan Buchman
229c18f1bd Merge branch 'master' into develop 2018-05-21 16:13:11 -04:00
Alexander Simmerl
91b6d3f18c Do not set address for self error 2018-05-21 18:47:14 +02:00
Alexander Simmerl
20e9dd0737 Return fake IP even when there is no conn 2018-05-21 17:55:40 +02:00
Alexander Simmerl
7b02b5b66b Add RemoteIP to test implementation 2018-05-21 17:41:34 +02:00
Alexander Simmerl
0cd92a4948 Fix race in test suffix 2018-05-21 17:35:49 +02:00
Ethan Buchman
747f28f85f Merge pull request #1602 from tendermint/bucky/readme
update readme
2018-05-21 09:27:15 -04:00
Anton Kaliaev
a9d0adbdef update changelog 2018-05-21 10:56:33 +04:00
Anton Kaliaev
3485edf4f5 update test docker image Go version to 1.10 2018-05-21 10:51:47 +04:00
Anton Kaliaev
c6f612bfc3 subscribe before state emits NewRoundStep
I had to alter events package for that. Hope that's fine.
Refs #847
2018-05-21 10:51:47 +04:00
Anton Kaliaev
bb9aa85d22 copy events and pubsub packages from tmlibs
Refs #847
2018-05-21 10:51:47 +04:00
Anton Kaliaev
c4fef499b6 switch to events package 2018-05-21 10:50:55 +04:00
Anton Kaliaev
b77d5344fc rename methods for clarity 2018-05-21 10:50:55 +04:00
Anton Kaliaev
21f5f3faa7 use channels to send votes, ... from consensus state to reactor
Refs #847
2018-05-21 10:50:55 +04:00
Ethan Buchman
3399ca9369 Merge pull request #101 from Liamsi/go-bindata
Get rid of go-bindata in Makefile
2018-05-20 21:52:21 -04:00
Ethan Buchman
bf6527fc59 Merge pull request #1382 from EugeneChung/develop
remove Heap.Update() call when setting Proposer field
2018-05-20 19:32:13 -04:00
Ismail Khoffi
a8910a30e6 Merge branch 'develop' into go-bindata 2018-05-20 23:34:19 +02:00
Ethan Buchman
ed8d9951c0 point to terraform-ansible docs 2018-05-20 17:05:57 -04:00
Ethan Buchman
97b39f340e update readme 2018-05-20 17:01:15 -04:00
Ethan Buchman
383c255f35 dev version bump 2018-05-20 16:54:21 -04:00
Ethan Buchman
931fb385d7 Merge pull request #1599 from tendermint/release/v0.19.5
Release/v0.19.5
2018-05-20 16:45:00 -04:00
Ethan Buchman
018e096748 Merge pull request #1601 from tendermint/bucky/wal-sync
consensus: only fsync wal after internal msgs
2018-05-20 16:36:33 -04:00
Ethan Buchman
ee4eb59355 update comments 2018-05-20 16:44:08 -04:00
Ethan Buchman
efbc2efb42 add proposer to header 2018-05-20 16:25:48 -04:00
Ethan Buchman
31576150ad add total_voting_power to evidence 2018-05-20 16:24:21 -04:00
Ethan Buchman
459ee59e46 Request/ResponseValidator, update Header 2018-05-20 16:15:58 -04:00
Ethan Buchman
f9dce53728 Merge pull request #243 from tendermint/cwgoes/timestamp-in-evidence
Add evidence type and block timestamp to abci.Evidence
2018-05-20 15:00:51 -04:00
Ethan Buchman
a1b8579591 Merge branch 'develop' into cwgoes/timestamp-in-evidence 2018-05-20 14:58:48 -04:00
Ethan Buchman
082a02e6d1 consensus: only fsync wal after internal msgs 2018-05-20 14:40:47 -04:00
Ethan Buchman
2c40966e46 fix changelog 2018-05-20 14:08:35 -04:00
Ethan Buchman
0a9dc9f875 changelog 2018-05-20 10:25:21 -04:00
Ethan Buchman
87cefb724d version 2018-05-20 10:22:42 -04:00
Ethan Buchman
6701dba876 changelog 2018-05-20 10:22:22 -04:00
Ethan Buchman
442bbe592f Merge pull request #1598 from tendermint/bucky/docs-clean
Bucky/docs clean
2018-05-20 09:46:09 -04:00
Ethan Buchman
301aa92f9c phony 2018-05-20 09:53:38 -04:00
Ethan Buchman
52f27686ef Merge pull request #1567 from tendermint/909-limit-tx-search-output
limit /tx_search output
2018-05-20 09:44:41 -04:00
Ethan Buchman
6f9867cba6 fix validate pagination params 2018-05-20 01:47:15 -04:00
Ethan Buchman
02615c8695 update readme 2018-05-20 00:41:54 -04:00
Ethan Buchman
2df137193c security.md 2018-05-20 00:33:37 -04:00
Ethan Buchman
1ef415728d docs/spec: blockchain and consensus dirs 2018-05-20 00:28:47 -04:00
Ethan Buchman
773e3917ec networks: update readmes 2018-05-19 23:35:45 -04:00
Ethan Buchman
26fdfe10fd update readme 2018-05-19 23:28:27 -04:00
Ethan Buchman
d76e2dc3ff readme.rst -> readme.md 2018-05-19 23:26:02 -04:00
Ethan Buchman
420f925a4d link bug bounty in readme 2018-05-19 23:21:42 -04:00
Ethan Buchman
d7d12c8030 update networks/local readme 2018-05-19 23:21:35 -04:00
Ethan Buchman
6c4a26f248 update readme 2018-05-19 22:44:29 -04:00
Ethan Buchman
2a26c47da5 Merge pull request #1590 from tendermint/1227-msg-bytes
nice output for msgBytes
2018-05-18 19:17:22 -04:00
Ethan Buchman
aabe96f1af Merge pull request #1594 from tendermint/zach/tests-less-bash
test cleanup
2018-05-18 19:00:44 -04:00
Ethan Buchman
bb68d7e7be Merge pull request #177 from tendermint/jenkins
tests: slow is smooth, smooth is fast
2018-05-18 18:57:06 -04:00
Christopher Goes
e196dacf80 Add 'type' field to abci.Evidence 2018-05-18 20:29:32 +02:00
Zach Ramsay
0e1f730fbb rm unused file, fix docker-compose.yml 2018-05-18 14:12:01 -04:00
Zach Ramsay
0b68ec4b8e move a file to remove a directory 2018-05-18 13:37:58 -04:00
Zach Ramsay
ca120798e4 s/dummy/kvstore/g for compatibility (#1532) 2018-05-18 13:26:26 -04:00
Zach Ramsay
595fc24c56 remove very old bash file 2018-05-18 13:22:04 -04:00
Zach Ramsay
e19cedc4b4 tests: more smoothness 2018-05-18 12:03:57 -04:00
Zach Ramsay
2adef2e8f8 less bash in tests 2018-05-18 11:51:56 -04:00
Zach Ramsay
de02ab4b3c lil fix 2018-05-18 11:51:18 -04:00
Zach Ramsay
308ce8b235 tests: less bash 2018-05-18 11:50:57 -04:00
Anton Kaliaev
4611cf44f0 Merge pull request #1591 from tendermint/zach/dawks
docs improvements
2018-05-18 18:32:43 +04:00
Alexander Simmerl
d596ed1bc2 Let peerConn handle IPs in for tests 2018-05-18 16:27:57 +02:00
Zach Ramsay
0fb33ca91d docs: update install instructions, closes #1580 2018-05-18 10:12:52 -04:00
Zach Ramsay
35428ceb53 docs: lil fixes 2018-05-18 10:01:56 -04:00
Ethan Buchman
de8d4325de Merge pull request #1585 from tendermint/345-mempool-cache
Mempool cache
2018-05-18 08:54:47 -04:00
Anton Kaliaev
5a041baa36 nice output for msgBytes
Closes #1227
2018-05-18 12:45:09 +04:00
Anton Kaliaev
202a43a5af remove TODO
no longer relevant, I guess. since ABCI only defines 0 (success) code.
2018-05-18 10:48:13 +04:00
Anton Kaliaev
2987158a65 [docs] add a note about replay protection
Refs #345, https://github.com/tendermint/tendermint/issues/458#issuecomment-297077148
2018-05-18 10:45:51 +04:00
Anton Kaliaev
c9001d5a11 bound the mempool
Refs #345
2018-05-18 10:45:51 +04:00
Anton Kaliaev
90446261f3 [docs] document transactional semantics
Refs #1494, #345
2018-05-18 10:45:51 +04:00
Anton Kaliaev
ae572b9038 remove extra call to Exists
Refs #345

https://github.com/tendermint/tendermint/issues/1539#issuecomment-387240606
2018-05-18 10:17:09 +04:00
Zach
0908e668bd document testnet command, closes #1535 (#1588) 2018-05-18 09:52:31 +04:00
Ethan Buchman
e0dbc3673c version bump 2018-05-17 22:28:53 -04:00
Ethan Buchman
545990f845 Merge pull request #1587 from tendermint/release/v0.19.4
Release/v0.19.4
2018-05-17 22:20:17 -04:00
Ethan Buchman
19ccd1842f version and changelog 2018-05-17 15:47:07 -04:00
Ethan Buchman
b4d6bf7697 add back new-spec/README to tell people it moved 2018-05-17 15:39:49 -04:00
Ethan Buchman
1854ce41fc Merge pull request #1586 from tendermint/bucky/add-part-fix
Bucky/add part fix
2018-05-17 15:21:29 -04:00
Ethan Buchman
547e8223b9 fix 2018-05-17 15:24:37 -04:00
Ethan Buchman
8e46df14e7 improve consensus logger 2018-05-17 13:59:41 -04:00
Christopher Goes
435eb273a4 Update changelog 2018-05-17 19:47:52 +02:00
Christopher Goes
4c73ceee08 Add time field to abci.Evidence 2018-05-17 19:46:00 +02:00
Anton Kaliaev
8d60a5a7bd update changelog 2018-05-17 21:25:45 +04:00
Anton Kaliaev
5115618550 add limit param to /unconfirmed_txs 2018-05-17 21:25:04 +04:00
Anton Kaliaev
a6b74b82d1 limit /tx_search output
Refs #909
2018-05-17 21:25:03 +04:00
Ethan Buchman
e5220360c5 AddPart always verifies 2018-05-17 13:17:50 -04:00
Zach
b5c4098c53 update docs/examples & terraform/ansible (#1534)
* update docs/examples

* ansible: add node IDs from docs/examples

* better monikers

* ansible: clearer paths

* upgrade version

* examples: updates

* docs: consolidate terraform & ansible

* remove deprecated info, small reorgs

* docs build fix

* docs: t&a critical commit

* s/dummy/kvstore/g

* terraform/DO region unavailable, persistent error can't be bothered to debug rn

* terraform: need vars

* networks: t&a standalone integration script for DO

* t&a more updates

* examples: add script that shows what the testnet command does

* use AMS3, since AMS2 is not available
2018-05-17 18:05:59 +04:00
Anton Kaliaev
bc8768cfea Merge pull request #1550 from tendermint/perf-improvements
Performance improvements
2018-05-17 10:50:28 +04:00
Anton Kaliaev
d832bde280 update Vagrantfile 2018-05-17 10:43:38 +04:00
Anton Kaliaev
5e3a23df6d simplify indexer service main loop 2018-05-17 10:00:59 +04:00
Anton Kaliaev
6f7333fd5f fix tests 2018-05-17 10:00:59 +04:00
Anton Kaliaev
58e3246ffc batch index txs 2018-05-17 10:00:59 +04:00
Anton Kaliaev
bbe1355957 log only hash, not tx itself 2018-05-17 10:00:59 +04:00
Anton Kaliaev
7c14fa820d do not log txs at info level
BEFORE:

```
./tm-bench -c 5 -r 1000 127.0.0.1:46657
Stats          Avg       StdDev     Max
Txs/sec        1826      843        2744
Blocks/sec     1.100     0.300      2
```

AFTER:

```
./tm-bench -T 30 -c 5 -r 1000 127.0.0.1:46657
Stats          Avg       StdDev     Max
Txs/sec        6120      1970       9776
Blocks/sec     1.000     0.000      1
```
2018-05-17 10:00:59 +04:00
Anton Kaliaev
0d93424c6a disable indexer by default 2018-05-17 10:00:59 +04:00
Anton Kaliaev
efc01cf582 stop localnet before starting
in order to avoid having to stop it manually
2018-05-17 10:00:58 +04:00
Zach
754be1887c spec: move to final location (#1576) 2018-05-17 09:58:15 +04:00
Zach
775b015173 docs: add diagram, closes #1565 (#1577) 2018-05-17 09:57:28 +04:00
Alexander Simmerl
b698a9febc Remove double locking in HasIP 2018-05-16 19:21:12 +02:00
Alexander Simmerl
c5f45275ec Use remotePeer for test switch 2018-05-16 19:21:12 +02:00
Alexander Simmerl
77f09f5b5e Move to ne.IP 2018-05-16 19:21:12 +02:00
Ethan Buchman
1fe41be929 p2p: prevent connections from same ip 2018-05-16 19:21:12 +02:00
Ethan Buchman
906331a8d1 Merge pull request #100 from Liamsi/nano_wallet
Remove outdated non-building code in _nano
2018-05-16 11:20:57 -04:00
Zach
b161f0e8c9 Merge pull request #241 from tendermint/max/fix/l_addr
A redundant "listen address" flag removed
2018-05-16 11:14:35 -04:00
Max
64c796f1d2 A redundant "listen address" flag removed 2018-05-16 11:11:26 -04:00
Ethan Buchman
4780afcc58 Merge pull request #240 from tendermint/zach/fix-circle
circle: fix config.yml
2018-05-16 10:45:12 -04:00
Zach Ramsay
a13a2529bf circle: fix config.yml 2018-05-16 10:27:44 -04:00
Zach
31c0c9555e Merge pull request #209 from tendermint/tm-847
events and pubsub were moved to tendermint core
2018-05-16 08:49:23 -04:00
Anton Kaliaev
4a77eda368 events and pubsub were moved to tendermint core
Refs https://github.com/tendermint/tendermint/issues/847
2018-05-16 12:57:08 +04:00
Ethan Buchman
68a0b3f95b version bump. add roadmap back. minor fixes 2018-05-15 22:42:29 -04:00
Ethan Buchman
b1f3c11948 Merge branch 'master' into develop 2018-05-15 22:41:03 -04:00
Jae Kwon
e1a3f16fa4 Comment tweaks 2018-05-15 08:48:59 -07:00
Ethan Buchman
aab98828fe Merge pull request #1570 from tendermint/release/v0.19.3
Release/v0.19.3
2018-05-15 08:44:16 -04:00
Liamsi
3fe985e289 fix makefile 2018-05-15 12:23:33 +01:00
Liamsi
9136140719 get rid of go-bindata dependency in Makefile; hardcode its output instead 2018-05-15 12:07:05 +01:00
Liamsi
aa2b6b546f Remove outdated non-building code in _nano 2018-05-15 11:39:48 +01:00
Ethan Buchman
ec8079089f Merge pull request #237 from tendermint/bucky/begin-end-block-tags
add tags to begin/end block
2018-05-14 18:55:41 -04:00
Ethan Buchman
9b20287463 add tags to begin/end block 2018-05-14 19:01:49 -04:00
Ethan Buchman
4b080454bb Merge pull request #236 from tendermint/bucky/absent-vals
absent_validators: repeated int -> repeated bytes
2018-05-14 18:48:04 -04:00
Ethan Buchman
f7d775337b absent_validators: repeated int -> repeated bytes 2018-05-14 18:54:48 -04:00
Ethan Buchman
6f316db5de Merge pull request #213 from tendermint/validators-type-assert-to-sortInterface
types: compile time assert to, and document sort.Interface
2018-05-14 18:37:57 -04:00
Ethan Buchman
453e8efe8a Merge pull request #234 from tendermint/adrian/genesis_bytes
Change AppStateBytes to GenesisBytes
2018-05-14 18:34:27 -04:00
Ethan Buchman
063a7d83c1 Merge branch 'develop' into adrian/genesis_bytes 2018-05-14 18:32:47 -04:00
Ethan Buchman
49849de414 Merge pull request #233 from tendermint/adrian/requestinitchain
Allow ResponseInitChain to return the initial validator set
2018-05-14 18:23:40 -04:00
Ethan Buchman
43e72bbcc0 version bump 2018-05-14 18:30:41 -04:00
Ethan Buchman
cd24e92dcb Merge pull request #235 from tendermint/develop
Develop
2018-05-14 18:22:02 -04:00
Ethan Buchman
da73fb87a4 Merge branch 'develop' into adrian/requestinitchain 2018-05-14 18:19:36 -04:00
Ethan Buchman
03f6a29a64 changelog and version 2018-05-14 17:00:57 -04:00
Ethan Buchman
4851653d8e Merge pull request #1569 from tendermint/bucky/update-valid-block-rule
Fix validBlock rule
2018-05-14 16:48:20 -04:00
Ethan Buchman
162811476a update some comments 2018-05-14 16:32:19 -04:00
Zarko Milosevic
b5ac9ede8a Add rules in gossipVotesForHeight to clarify priorities on messages to send 2018-05-14 16:18:50 -04:00
Jae Kwon
ff5dfc0c15 Add more comments for Valid* 2018-05-14 16:18:50 -04:00
Jae Kwon
d3a98675aa Refactor addVote() to be clearer 2018-05-14 16:17:21 -04:00
Jae Kwon
e3c4625e63 Suggested changes to consensus/reactor.go 2018-05-14 16:17:21 -04:00
Zarko Milosevic
01ac378c96 Update condition based on Jae input 2018-05-14 16:17:21 -04:00
Zarko Milosevic
83ca46396d Update gossipVotes routine to align with validBlock mechanism 2018-05-14 16:17:21 -04:00
Zarko Milosevic
2c125b6c78 Fix validValue rule 2018-05-14 16:17:21 -04:00
Ethan Buchman
468be0f8d6 mv remotedb, proto, grpcdb all under db/remotedb 2018-05-14 15:49:00 -04:00
Ethan Buchman
3dde0584ed Merge pull request #1529 from tendermint/greg/persistent-script-fix
Persistence test bash fix for relative folder path
2018-05-14 15:44:27 -04:00
Ethan Buchman
45caff1a20 changelog and version 2018-05-14 15:21:29 -04:00
Ethan Buchman
e132e7842b Merge pull request #223 from tendermint/adrian/circle2
Upgrade to Circle 2.0
2018-05-14 15:09:13 -04:00
Zach
52d6dfe074 Update specification.rst 2018-05-14 12:27:29 -04:00
Greg Szabo
4bca7c1009 Added tendermint/testing docker image description 2018-05-14 12:24:54 -04:00
Greg Szabo
4be3ffbe9b Persistence test bash fix for relative folder path 2018-05-14 12:24:54 -04:00
Ethan Buchman
5b9a1423ae Merge pull request #1564 from tendermint/bucky/dump-consensus
Improve consensus state RPC
2018-05-14 12:21:54 -04:00
Ethan Buchman
16932f889f changelog 2018-05-14 10:45:18 -04:00
Ethan Buchman
e9804d76cf fixes from review 2018-05-14 10:33:31 -04:00
Christopher Goes
e6d0ade0e1 Update to latest upstream, debugging information 2018-05-14 16:24:08 +02:00
Christopher Goes
337ad8e594 Update to new Ledger API in progress 2018-05-14 15:26:14 +02:00
Christopher Goes
49e03fb481 Update dependency versions 2018-05-14 15:26:14 +02:00
Christopher Goes
86b09b0cd7 Bugfix 2018-05-14 15:26:14 +02:00
Christopher Goes
391936b734 Prevent unnecessary signatures, improve error messages 2018-05-14 15:26:14 +02:00
Christopher Goes
e25a64fdf1 Fix testcases, all looks OK 2018-05-14 15:26:14 +02:00
Christopher Goes
065c3943b1 Fix no-Ledger testcase 2018-05-14 15:26:14 +02:00
Christopher Goes
1c9ff46e98 Ledger integration, WIP 2018-05-14 15:26:14 +02:00
Adrian Brink
9439306f0f Change last instance of AppStateBytes to GenesisBytes 2018-05-13 20:05:45 -04:00
Ethan Buchman
a41f0d3891 rpc: /consensus_state for simplified output 2018-05-13 19:53:54 -04:00
Adrian Brink
f80b3aee48 Change AppStateBytes to GenesisBytes
The consensus should pass the entire genesis file to the application.
That way the application has access to the chain_id, the timestap, ...
2018-05-13 19:50:15 -04:00
Ethan Buchman
658060150c rpc: add voting power totals to vote bitarrays 2018-05-13 19:22:23 -04:00
Adrian Brink
ef67705524 Allow ResponseInitChain to return the initial validator set
ResponseInitChain should be able to return an initial validator set that
is determined by some logic within the genesis.json file.
2018-05-13 19:04:03 -04:00
Ethan Buchman
d0229e8b1e Merge pull request #1554 from tendermint/jae/expose_peer_stats
Expose peer stats for dump_consensus_state
2018-05-13 16:16:35 -04:00
Zaki Manian
1c8dffaa28 Initial implementation of xchacha20poly1035 aead 2018-05-13 11:06:20 -04:00
Jae Kwon
56c9e0da7e Add back sample output in rpc/core/consensus.go; Tweak DumpConsensusState output for peers 2018-05-12 15:39:30 -07:00
Ethan Buchman
fbe253767e Merge pull request #1540 from tendermint/set-genesis-time-on-init
set GenesisTime to now during `tendermint init`
2018-05-12 10:10:06 -04:00
Jae Kwon
edbec10f9e Expose peer stats for dump_consensus_state 2018-05-10 22:43:21 -07:00
Jae Kwon
a8fcf45624 Change defaults to 100M and 10G respectively 2018-05-10 20:58:28 -07:00
Jae Kwon
2e41756b55 Add logjack command 2018-05-10 20:43:50 -07:00
Christopher Goes
67faf556ed Merge pull request #162 from tendermint/db-gRPC
DB as a service: remove database deployment with API
2018-05-10 18:46:05 +02:00
Jae Kwon
43570388a9 Update README.md 2018-05-09 13:48:49 -07:00
Jae Kwon
35cf21c6eb Update README.md 2018-05-09 13:48:21 -07:00
Liamsi
3477dd7a90 safer PRNG seeding: hash concatenation of fresh seedBytes with current seedBytes 2018-05-09 15:04:51 +01:00
Liamsi
94ce56d243 Use constant-time comparator (sublte.ConstantTimeCompare) to compare
signatures

prevents potential signature forgery

resolves #91
2018-05-09 11:48:46 +01:00
Allen
c0a1a8d3c0 add link to github (#1542) 2018-05-09 12:13:07 +04:00
Christopher Goes
20be8c75e5 Tweak testcases 2018-05-08 17:13:13 +02:00
Christopher Goes
0b6d101c77 Implement batch operations 2018-05-08 16:38:39 +02:00
Christopher Goes
45514a6013 Address PR comments 2018-05-08 15:47:06 +02:00
Anton Kaliaev
ac2d3a917e set GenesisTime to now during tendermint init 2018-05-08 12:04:20 +04:00
Christopher Goes
39e1567d0a Add iterator tests 2018-05-08 00:53:33 +02:00
Christopher Goes
55f4ccd4fc CI fix 2018-05-07 23:28:41 +02:00
Christopher Goes
2cca5a7a4c Implement TLS/SSL 2018-05-07 23:16:06 +02:00
Christopher Goes
bf16d6453c Address PR comments 2018-05-07 22:12:26 +02:00
Emmanuel T Odeke
5d12e1eb46 remotedb: a client package implementing the db.DB interface
Simplified the abstractions to remotedb, a package that
allows clients to use whatever database they can in client
code without having to switch out their code e.g
```go
client, err := remotedb.NewInsecure(":9888")
...
// Just like they'd initialize locally
in := &remotedb.Init{
  Name: "test-remote-db",
  Type: "leveldb",
  Dir: "/tmp/dbs",
}

if err := client.InitRemote(in); err != nil {
    log.Fatalf("Failed to initialize the database")
}

v1 := client.Get(k1)
client.Set(k9, dog)

for itr := client.Iterator(a1, z1); itr.Valid(); itr.Next() {
  k, v := itr.Key(), itr.Value()
  dom := itr.Domain()
  ...
}
```
2018-05-07 22:00:38 +02:00
Emmanuel T Odeke
1260b75f63 grpcdb: Better readability for docs and constructor names
* Added some docs for NewClient, BindServer, *server.Init
* Security level clarified, whether "secure" for https
or "insecure" for non-https gRPC connections.
2018-05-07 22:00:38 +02:00
Emmanuel T Odeke
11bee6194a DB as a service
Fixes https://github.com/tendermint/tendermint/issues/1162

Databases as a service!

Can now access Databases as a remote service
via gRPC for performance and easy deployment.

The caveat is that each service is stateful in regards to
the DB i.e. each unique service uses only one unique DB
but nonetheless multiple clients can access it.

A full standalone example

```go
package main

import (
  "bytes"
  "context"
  "log"

  grpcdb "github.com/tendermint/tmlibs/grpcdb"
  protodb "github.com/tendermint/tmlibs/proto"
)

func main() {
  addr := ":8998"
  go func() {
    if err := grpcdb.BindRemoteDBServer(addr); err != nil {
      log.Fatalf("BindRemoteDBServer: %v", err)
    }
  }()

  client, err := grpcdb.NewClient(addr, false)
  if err != nil {
    log.Fatalf("Failed to create grpcDB client: %v", err)
  }

  ctx := context.Background()
  // 1. Initialize the DB
  in := &protodb.Init{
    Type: "leveldb",
    Name: "grpc-uno-test",
    Dir:  ".",
  }
  if _, err := client.Init(ctx, in); err != nil {
    log.Fatalf("Init error: %v", err)
  }

  // 2. Now it can be used!
  query1 := &protodb.Entity{Key: []byte("Project"), Value:
[]byte("Tmlibs-on-gRPC")}
  if _, err := client.SetSync(ctx, query1); err != nil {
    log.Fatalf("SetSync err: %v", err)
  }

  query2 := &protodb.Entity{Key: []byte("Project")}
  read, err := client.Get(ctx, query2)
  if err != nil {
    log.Fatalf("Get err: %v", err)
  }
  if g, w := read.Value, []byte("Tmlibs-on-gRPC"); !bytes.Equal(g, w) {
    log.Fatalf("got= (%q ==> % X)\nwant=(%q ==> % X)", g, g, w, w)
  }
}
```
2018-05-07 22:00:33 +02:00
Ethan Buchman
aefb6c58b6 Merge pull request #87 from tendermint/bucky/fix-ed-gen
fix ed25519 Generate
2018-05-07 10:52:46 -04:00
Ethan Buchman
ad837a8183 fix ed25519 Generate 2018-05-05 19:17:21 -04:00
Ethan Buchman
64408a4041 Merge pull request #1528 from tendermint/release/v0.19.2
Release/v0.19.2
2018-04-30 18:28:38 -04:00
Ethan Buchman
cae31157b1 fix lint 2018-04-30 18:23:02 -04:00
Ethan Buchman
66c2b60324 version and changelog 2018-04-30 16:06:45 -04:00
Ethan Buchman
e2e2127365 Merge pull request #1519 from tendermint/bucky/p2p-cleanup
Cleanup P2P
2018-04-30 15:54:04 -04:00
Ethan Buchman
f395b82f73 node: remove commented out trustMetric 2018-04-30 15:59:05 -04:00
Ethan Buchman
47557f868a create addrbook even if pex=false. fixes #1525 2018-04-30 08:31:03 -04:00
Ethan Buchman
b6c062c451 fixes from review 2018-04-30 08:19:19 -04:00
Max Levy
12fc396101 Split CMD's param on space (#1523)
This is to avoid "ERROR: unknown flag: --proxy_app dummy" message when running "docker-compose up"
2018-04-29 17:35:10 +03:00
Ethan Buchman
c195772de1 p2p: small lint 2018-04-28 21:17:28 -04:00
Ethan Buchman
d3c4f746a7 spec: abci notes. closes #1257 2018-04-28 21:12:25 -04:00
Ethan Buchman
fae94a44a2 p2p/pex: some addrbook fixes
* fix before/after in isBad()
* allow multiple IPs per ID even if ID isOld
2018-04-28 20:09:02 -04:00
Ethan Buchman
3a30ee75b9 minor fixes 2018-04-28 17:27:51 -04:00
Ethan Buchman
3498b676a6 update spec and addrbook.go 2018-04-28 17:14:58 -04:00
Ethan Buchman
6157c700dd forgot errors file 2018-04-28 16:15:30 -04:00
Ethan Buchman
c90bf77566 rpc: add n_peers to /net_info 2018-04-28 16:09:18 -04:00
Ethan Buchman
6805ddf1b8 p2p: change some logs from Error to Debug. #1476 2018-04-28 16:00:45 -04:00
Ethan Buchman
2761861b6b p2p: MinNumOutboundPeers. Closes #1501 2018-04-28 15:52:05 -04:00
Ethan Buchman
64569b15e5 fix build and test 2018-04-28 15:39:09 -04:00
Ethan Buchman
0450e35d67 some comments 2018-04-28 15:19:33 -04:00
Ethan Buchman
268055e549 node: remove dup code from rebase 2018-04-28 15:04:37 -04:00
Ethan Buchman
aaa81092e7 p2p: some comments and a log line 2018-04-28 15:01:33 -04:00
Ethan Buchman
3ee1d7909e p2p: explicit netaddress errors 2018-04-28 14:48:51 -04:00
Ethan Buchman
32268a8135 limit maxPexMessageSize based on maxAddressSize 2018-04-28 14:41:36 -04:00
Ethan Buchman
f645187122 spec: pex update 2018-04-28 13:11:32 -04:00
Ethan Buchman
40c79235c0 p2p: dont require minor versions to match in handshake 2018-04-28 13:09:17 -04:00
Ethan Buchman
c23909eecf p2p/pex: minor cleanup and comments 2018-04-28 13:08:44 -04:00
Ethan Buchman
936d1a0e68 some notes about the p2p layer 2018-04-28 11:35:09 -04:00
Ethan Buchman
0cbbb61962 minor cleanup 2018-04-28 01:02:39 -04:00
Ethan Buchman
fa66694f2e Merge branch 'develop' into fix-persistent-first 2018-04-28 00:34:03 -04:00
Ethan Buchman
d92def4b60 version bump 2018-04-28 00:06:05 -04:00
Ethan Buchman
26f633ed48 Merge pull request #1514 from tendermint/release/v0.19.1
Release/v0.19.1
2018-04-27 23:36:15 -04:00
Ethan Buchman
79bfbebfff rpc: docs/comments 2018-04-27 23:19:40 -04:00
Ethan Buchman
f33da8817a rpc: lower_case peer_round_states, use a list, add the node_address 2018-04-27 23:00:09 -04:00
Ethan Buchman
ffe81a0206 changelog and version 2018-04-27 12:35:21 -04:00
Ethan Buchman
0e00154fcc Merge branch 'master' into develop 2018-04-27 12:23:12 -04:00
Ethan Buchman
1ab89e6cbf update changelog 2018-04-27 12:23:00 -04:00
Ethan Buchman
14cff484f1 Merge pull request #1440 from tendermint/1428-remove-wal-light
[config] remove wal_light setting
2018-04-27 12:06:51 -04:00
Ethan Buchman
25cee8827a Merge branch 'develop' into 1428-remove-wal-light 2018-04-27 12:06:08 -04:00
Jae Kwon
65ebbccb74 Add GoAmino DeepCopy() benchmark for RoundState 2018-04-27 11:55:45 -04:00
Ethan Buchman
1188dfe7ee Merge pull request #1511 from tendermint/bucky/rpc-fixes
Various RPC fixes
2018-04-27 11:45:46 -04:00
Ethan Buchman
c45ba2967a fixes from review 2018-04-27 10:29:05 -04:00
Ethan Buchman
f67c5a9e7b forgot wire.go file 2018-04-27 10:00:34 -04:00
Ethan Buchman
593a785ae2 set NodeInfo on switch before starting RPC server
should fix #1199
2018-04-26 23:49:48 -04:00
Ethan Buchman
94e823cc91 p2p: NodeInfo.Channels is HexBytes 2018-04-26 23:43:51 -04:00
Ethan Buchman
47e4d64973 add validator address to /status 2018-04-26 23:43:51 -04:00
Ethan Buchman
a2d77cbe4e add MarshalJSON methods to fix dump_consensus_state 2018-04-26 23:43:48 -04:00
Ethan Buchman
390b592dec Merge pull request #1510 from tendermint/bucky/docs-and-fixes
JSON Indent and some docs
2018-04-26 23:03:47 -04:00
Ethan Buchman
9ab1fafdf1 some amino json for #1504 2018-04-26 22:06:15 -04:00
Ethan Buchman
94c016a04e use MarshalJSONIndent for init files. closes #1506 2018-04-26 21:32:18 -04:00
Ethan Buchman
97f3ada9c2 update godep 2018-04-26 21:31:48 -04:00
Ethan Buchman
d7d4471072 Merge pull request #1507 from tendermint/bucky/docs-pre-amino
document pre-amino pubkeys/addresses
2018-04-26 20:40:53 -04:00
Ethan Buchman
d48a6f930d document pre-amino pubkeys/addresses 2018-04-26 20:46:08 -04:00
Ethan Buchman
389a6ffa16 Merge pull request #1500 from tendermint/bucky/spec-updates
Bucky/spec updates
2018-04-26 11:44:27 -04:00
Ethan Buchman
f1ead2df70 typo 2018-04-26 11:50:45 -04:00
Ethan Buchman
e5951acfb4 SHA256 -> RIPEMD160 2018-04-26 11:47:13 -04:00
Ethan Buchman
0e1414ef9d spec: add Address spec. notes about Query 2018-04-26 11:46:20 -04:00
Ethan Buchman
97be1eef87 add abci notes 2018-04-26 11:08:34 -04:00
Anton Kaliaev
0d9004a854 [cmd] Turn off strict routability when using testnet cmd (#1493)
* [cmd] Turn off strict routability when using testnet cmd

Refs https://github.com/tendermint/tendermint/pull/1454

* use "testnet" instead of "it"
2018-04-26 16:52:11 +02:00
Ethan Buchman
91c81ef9a1 spec: note on byte arrays, clean up bitarrays and more, add merkle proof, add crypto.go script 2018-04-26 10:42:58 -04:00
Ethan Buchman
e2f0778c14 spec: update encoding.md 2018-04-26 09:36:41 -04:00
Ethan Buchman
da088e3ecd Merge pull request #229 from tendermint/update-spec
specify DeliverTx/CheckTx Tags format
2018-04-25 23:39:29 -04:00
Anton Kaliaev
a6fe2a9854 specify DeliverTx/CheckTx Tags format 2018-04-25 22:52:11 +02:00
Anton Kaliaev
63f8c58009 Merge pull request #1471 from tendermint/greg/devopstools
Greg/devopstools
2018-04-25 10:37:28 +02:00
Greg Szabo
9ba208c1f5 wrapper.sh logfile check fix 2018-04-24 16:40:51 -04:00
Greg Szabo
6ce6b20993 Renamed remotenet to sentrynet to match the purpose better. 2018-04-24 14:22:19 -04:00
Anton Kaliaev
5361073439 Merge pull request #1483 from tendermint/jae/lower_case_round_state
Jae/lower case round state
2018-04-24 09:57:42 +02:00
suyuhuang
6c04465d3d Fix Prove int abci.ABCIQuery (#1485)
* fix Prove in abci query

* fix Prove in abci query

* fix doc

* fix doc
2018-04-24 09:56:25 +02:00
Greg Szabo
089ce6744c Added ansible playbook to remote networks to ship logs to logz.io 2018-04-23 22:38:49 -04:00
Max Levy
17a5c6fa1a typo fix 2018-04-23 21:03:34 +02:00
Rigel
18c3f8f3f1 writeDefaultCondigFile -> writeDefaultConfigFile (#1490) 2018-04-23 21:01:40 +02:00
Jae Kwon
cc5f287c47 Add developer branch 0.8.3 to CHANGELOG 2018-04-23 02:36:49 -07:00
Jae Kwon
9b2a8f07a3 [common] Add ASCIITrim 2018-04-23 01:32:18 -07:00
Anton Kaliaev
d94e312673 add MarshalJSON and UnmarshalJSON to BitArray (#200)
See CHANGELOG
2018-04-23 00:16:05 -07:00
Jae Kwon
8fa4211bbd Fixes TestParallelAbort nondeterministic failure #201 (#202) 2018-04-23 00:07:03 -07:00
Jae Kwon
b42d5a2211 blockID -> block_id for JSON 2018-04-21 20:24:50 -07:00
Jae Kwon
e328006bfe Jae/fixprefixdb (#199)
* Fix PrefixDB Iterator
* PrefixDB Iterator/ReverseIterator fixes
* Bump version 0.8.2
* Update CHANGELOG.md about DebugDB
* Keep invalid source to be closed
* Use prefixBatch instead of memBatch
2018-04-21 04:25:45 -07:00
Jae Kwon
b20e777f53 lower_case json field names 2018-04-20 23:20:44 -07:00
Greg Szabo
659762736c Makefile targets for remotenet fixed 2018-04-18 05:56:13 -04:00
Anton Kaliaev
ece3f678da [docs/spec] update msg type and Tendermint behavior (#1468)
Refs #1422
2018-04-17 19:38:10 +02:00
Zach
d02e4f344f Merge pull request #227 from tendermint/tm-1422-commit-hash
[docs/Commit] all application instances must return the same hash
2018-04-17 13:34:50 -04:00
Greg Szabo
5b5acbb343 Ansible README update and small fixes 2018-04-17 12:28:05 -04:00
Ethan Buchman
a2930cd723 Merge pull request #1474 from tendermint/release/v0.19.0
Release/v0.19.0
2018-04-17 10:59:36 +02:00
Ethan Buchman
45a05b4726 Merge pull request #1461 from tendermint/update-changelog
update changelog
2018-04-17 09:56:53 +02:00
Greg Szabo
8bdfe15de9 Dockerfile, localnode, sentry node scripts changes
- Updated Dockerfile and created build-docker target
- Changed localnode docker image to set permissions to more permissive (docker has different user than host system)
- Added sentry node terraform and ansible script
2018-04-16 11:34:01 -04:00
Anton Kaliaev
44a8a23932 [docs/Commit] all application instances must return the same hash
Refs https://github.com/tendermint/tendermint/issues/1422
2018-04-16 13:40:19 +02:00
Greg Szabo
b3904b8da8 ShellChecked wrapper.sh 2018-04-13 21:34:05 -04:00
Greg Szabo
f2dae2a2d8 Moved to networks folder, introduced cloud server scripts using terraform and ansible (sentry nodes) 2018-04-13 21:03:25 -04:00
Anton Kaliaev
1706ce6f7f update changelog for 0.19.0 release 2018-04-13 10:50:34 +02:00
Jae Kwon
d0beaba7e8 Bump version to 0.19.0 2018-04-13 01:32:47 -07:00
Anton Kaliaev
c28784de5e Merge pull request #1453 from tendermint/fix-localnet
Fix permissions and folder structure for localnet
2018-04-12 17:50:08 +02:00
Anton Kaliaev
d06390638d [localnet] use routable IPs 2018-04-12 16:02:31 +02:00
Anton Kaliaev
3a0edc561d log error from AddrBook#AddAddress in DialPeersAsync
Refs #1434
2018-04-12 15:51:17 +02:00
Anton Kaliaev
f8ed578325 [localnet] execute cmd from root
not secure, but we don't care because it's local tooling
2018-04-12 15:51:32 +02:00
Anton Kaliaev
5babaf9a88 [localnet] fix folder permissions errors 2018-04-12 15:51:17 +02:00
Greg Szabo
c0610b2c32 Greg/localnet (#1450)
* Added new Makefile targets for local testnet running using docker

* Added localnode docker image description, some documentation and refactored to use the tendermint testnet command

* Fixes for the new tendermint testnet command

* More fixes on tendermint testnet and docker-compose

* Changed logging

* Added missing targets to phony
2018-04-12 13:15:16 +02:00
Anton Kaliaev
1db2224241 do not use mask in testnet cmd (#1451)
fix node ids
2018-04-11 20:53:33 +02:00
Anton Kaliaev
0323b03daf improve testnet cmd (#1449)
* improve testnet cmd

* allow non-validators
* configurable prefix
* populating of persistent peers

* relax permissions

* cleanup output dir every time

* do not remove dir

* remove panic comments
2018-04-11 19:40:53 +02:00
Anton Kaliaev
379f9f875b update docs for latest develop (#1448)
* update docs for latest develop

* latest_app_hash, not app_hash
2018-04-11 17:36:14 +02:00
Thomas Corbière
ab00bf7c8b standardize PRNG access (#1411)
* replace math/rand with tmlibs equivalent.

* update tmlibs dependency
2018-04-11 11:38:30 +02:00
Bric3d
64879c1e6a 1417 status response format (#1424)
* Reformated the ResultStatus

* fix misuse of ResultStatus.

* updated changelog

* Fixed tests

* fixed rpc helper tests

* fixed rpc_tests

* fixed mock/status_test

* fixed typo

* fixed ommitempty on validatorstatus and the changelog

* fixed extra line in changelog

* Updated usage of the /status json response in tests after breaking changes

* Updated remaining tests with changes after searching the codebase for usage

* Reformated the ResultStatus

* fix misuse of ResultStatus.

* updated changelog

* Fixed tests

* fixed rpc helper tests

* fixed rpc_tests

* fixed mock/status_test

* fixed typo

* fixed ommitempty on validatorstatus and the changelog

* Updated usage of the /status json response in tests after breaking changes

* Updated remaining tests with changes after searching the codebase for usage

* rebased against develop
2018-04-11 10:38:34 +02:00
Vladislav Dmitriyev
7c22e47629 Replaced NodeInfo's pubkey to ID (#1443)
* Replaced NodeInfo PubKey to NodeID

* Fixed tests and replaced NodeID with ID

* Removed unnecessary method ID()

* Fixed codec_test.go

* Fixed codec_test.go

* Removed unnecessary bracket

* Fixed all tests

* Fixed peer_set_test.go

* Fixed peer_test.go

* Fixed common_test.go

* Fixed common_test.go

* Renamed node_id to id

* Removed peer.ID() from RPC net.go

* Replaced NodeInfo pubKey to ID

* Fixed codec_test.go

* Fixed peer_set_test.go

* Fix pex_reactor_test.go

* Refactored code for privateKey initiali

* Fixed peer_set_test.go

* Fixed test.proto and removed orphan string in codec_test.go

* Fixed pointer to a string

* generate node_key when running tendermint init

* [docs] prefix IPs with node IDs

Refs #1429

* gen_node_key cmd

* [docs/specification/secure-p2p] add a note about config

* fix data race

Closes #1442

```
WARNING: DATA RACE
Write at 0x00c4209de7c8 by goroutine 23:
  github.com/tendermint/tendermint/types.(*Block).fillHeader()
      /home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:88 +0x157
  github.com/tendermint/tendermint/types.(*Block).Hash()
      /home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:104 +0x121
  github.com/tendermint/tendermint/types.(*Block).HashesTo()
      /home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:135 +0x4f
  github.com/tendermint/tendermint/consensus.(*ConsensusState).enterPrecommit()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1037 +0x182d
  github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1425 +0x1a6c
  github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1318 +0x77
  github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:581 +0x7a9
  github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:539 +0x6c3

Previous read at 0x00c4209de7c8 by goroutine 47:
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*HexBytes).MarshalJSON()
      <autogenerated>:1 +0x52
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.invokeMarshalJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:433 +0x88
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:82 +0x8d2
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).MarshalJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/amino.go:296 +0x182
  github.com/tendermint/tendermint/rpc/lib/types.NewRPCSuccessResponse()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/types/types.go:100 +0x12c
  github.com/tendermint/tendermint/rpc/lib/server.makeJSONRPCHandler.func1()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/handlers.go:152 +0xab7
  net/http.HandlerFunc.ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:1918 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:2254 +0xa2
  github.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:138 +0x4fa
  net/http.HandlerFunc.ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:1918 +0x51
  net/http.serverHandler.ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:2619 +0xbc
  net/http.(*conn).serve()
      /usr/lib/go-1.9/src/net/http/server.go:1801 +0x83b

Goroutine 23 (running) created at:
  github.com/tendermint/tendermint/consensus.(*ConsensusState).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:250 +0x35b
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/reactor.go:69 +0x1b4
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).Start()
      <autogenerated>:1 +0x43
  github.com/tendermint/tendermint/p2p.(*Switch).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/p2p/switch.go:177 +0x124
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/node.(*Node).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/node/node.go:416 +0xa1b
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/rpc/test.StartTendermint()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/test/helpers.go:100 +0x5b
  github.com/tendermint/tendermint/rpc/client_test.TestMain()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/client/main_test.go:17 +0x4c
  main.main()
      github.com/tendermint/tendermint/rpc/client/_test/_testmain.go:76 +0x1cd

Goroutine 47 (running) created at:
  net/http.(*Server).Serve()
      /usr/lib/go-1.9/src/net/http/server.go:2720 +0x37c
  net/http.Serve()
      /usr/lib/go-1.9/src/net/http/server.go:2323 +0xe2
  github.com/tendermint/tendermint/rpc/lib/server.StartHTTPServer.func1()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:35 +0xb3
```

* removed excessive comment

Refs https://github.com/tendermint/tendermint/pull/1446#discussion_r180353446

* use the tag interface for pubsub. (#1438)

* use the tag interface for pubsub.

* update tmlibs.

* Fix unresolved conflict.

* improve `show_node_id` (#1433)

* fix show_node_id

* make LoadNodeKey public

* make LoadNodeKey public

* remove if

* remove if
2018-04-11 10:11:11 +02:00
Anton Kaliaev
e88f74bb9b remove wal_light setting
Closes #1428
2018-04-11 10:08:03 +02:00
suyuhuang
384b3ea065 improve show_node_id (#1433)
* fix show_node_id

* make LoadNodeKey public

* make LoadNodeKey public

* remove if

* remove if
2018-04-10 16:03:51 +02:00
Thomas Corbière
6a48bd0c88 use the tag interface for pubsub. (#1438)
* use the tag interface for pubsub.

* update tmlibs.

* Fix unresolved conflict.
2018-04-10 16:03:03 +02:00
Ethan Buchman
d93e177a69 Merge pull request #1446 from tendermint/1442-data-race-fix-attempt
fix data race
2018-04-10 16:49:36 +03:00
Anton Kaliaev
cef053386b Merge pull request #1439 from tendermint/1429-add-docs-for-node-ids
docs: update docs to include IDs or set auth_enc to false
2018-04-10 11:46:48 +02:00
Anton Kaliaev
cca1dd8e3e removed excessive comment
Refs https://github.com/tendermint/tendermint/pull/1446#discussion_r180353446
2018-04-10 11:36:31 +02:00
Anton Kaliaev
26c38e770e fix data race
Closes #1442

```
WARNING: DATA RACE
Write at 0x00c4209de7c8 by goroutine 23:
  github.com/tendermint/tendermint/types.(*Block).fillHeader()
      /home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:88 +0x157
  github.com/tendermint/tendermint/types.(*Block).Hash()
      /home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:104 +0x121
  github.com/tendermint/tendermint/types.(*Block).HashesTo()
      /home/vagrant/go/src/github.com/tendermint/tendermint/types/block.go:135 +0x4f
  github.com/tendermint/tendermint/consensus.(*ConsensusState).enterPrecommit()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1037 +0x182d
  github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1425 +0x1a6c
  github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:1318 +0x77
  github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:581 +0x7a9
  github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:539 +0x6c3

Previous read at 0x00c4209de7c8 by goroutine 47:
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*HexBytes).MarshalJSON()
      <autogenerated>:1 +0x52
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.invokeMarshalJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:433 +0x88
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:82 +0x8d2
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSONStruct()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:348 +0x539
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec)._encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:119 +0x83f
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).encodeReflectJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/json-encode.go:50 +0x10e
  github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino.(*Codec).MarshalJSON()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-amino/amino.go:296 +0x182
  github.com/tendermint/tendermint/rpc/lib/types.NewRPCSuccessResponse()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/types/types.go:100 +0x12c
  github.com/tendermint/tendermint/rpc/lib/server.makeJSONRPCHandler.func1()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/handlers.go:152 +0xab7
  net/http.HandlerFunc.ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:1918 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:2254 +0xa2
  github.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:138 +0x4fa
  net/http.HandlerFunc.ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:1918 +0x51
  net/http.serverHandler.ServeHTTP()
      /usr/lib/go-1.9/src/net/http/server.go:2619 +0xbc
  net/http.(*conn).serve()
      /usr/lib/go-1.9/src/net/http/server.go:1801 +0x83b

Goroutine 23 (running) created at:
  github.com/tendermint/tendermint/consensus.(*ConsensusState).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/state.go:250 +0x35b
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/consensus/reactor.go:69 +0x1b4
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).Start()
      <autogenerated>:1 +0x43
  github.com/tendermint/tendermint/p2p.(*Switch).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/p2p/switch.go:177 +0x124
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/node.(*Node).OnStart()
      /home/vagrant/go/src/github.com/tendermint/tendermint/node/node.go:416 +0xa1b
  github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.(*BaseService).Start()
      /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/service.go:130 +0x5fc
  github.com/tendermint/tendermint/rpc/test.StartTendermint()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/test/helpers.go:100 +0x5b
  github.com/tendermint/tendermint/rpc/client_test.TestMain()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/client/main_test.go:17 +0x4c
  main.main()
      github.com/tendermint/tendermint/rpc/client/_test/_testmain.go:76 +0x1cd

Goroutine 47 (running) created at:
  net/http.(*Server).Serve()
      /usr/lib/go-1.9/src/net/http/server.go:2720 +0x37c
  net/http.Serve()
      /usr/lib/go-1.9/src/net/http/server.go:2323 +0xe2
  github.com/tendermint/tendermint/rpc/lib/server.StartHTTPServer.func1()
      /home/vagrant/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:35 +0xb3
```
2018-04-10 11:15:16 +02:00
Anton Kaliaev
609452958c [docs/specification/secure-p2p] add a note about config 2018-04-09 17:02:48 +02:00
Anton Kaliaev
c954fca376 gen_node_key cmd 2018-04-09 17:02:47 +02:00
Anton Kaliaev
9be16d56ba [docs] prefix IPs with node IDs
Refs #1429
2018-04-09 17:02:47 +02:00
Anton Kaliaev
2b732bc11a generate node_key when running tendermint init 2018-04-09 17:02:47 +02:00
Ethan Buchman
dcd00b0e68 update deps and changelog 2018-04-09 16:36:42 +03:00
Ethan Buchman
78a8905690 update deps and version bump 2018-04-09 16:27:58 +03:00
Ethan Buchman
ff3f35c5f4 Merge pull request #1347 from tendermint/jae/aminoify
Convert Tendermint to use GoAmino
2018-04-09 16:24:38 +03:00
Ethan Buchman
915416979b update for latest amino. bump version 2018-04-09 16:21:58 +03:00
Ethan Buchman
357648b8d6 Merge branch 'master' into develop 2018-04-09 16:03:08 +03:00
Ethan Buchman
50ad19541d Merge pull request #198 from tendermint/release/v0.8.1
Release/v0.8.1
2018-04-09 15:47:27 +03:00
Ethan Buchman
0f92a01737 changelog dates 2018-04-09 15:51:54 +03:00
Thomas Corbière
75345c2046 Use an interface for tags. (#195)
* Use an interface for tags.

* rename TagSet to TagMap.

* add documentation to TagMap.
2018-04-09 14:36:40 +02:00
Ethan Buchman
93c4312cdd Merge pull request #1432 from tendermint/bucky/aminoify
Bucky/aminoify
2018-04-09 15:20:36 +03:00
Ethan Buchman
1a1e4e767b check max msg size in DecodeMessage 2018-04-09 15:18:47 +03:00
Ethan Buchman
bb1b249e8a types: lock block on MakePartSet 2018-04-09 15:04:59 +03:00
Sunny Aggarwal
a807b5db57 added PrefixEndBytes (#186)
* added PrefixToBytes

* added test

* added comment
2018-04-09 12:51:24 +02:00
Anton Kaliaev
40a73fa75c Merge pull request #196 from tendermint/joon/simple-proofs-from-map
add SimpleProofsFromMap
2018-04-09 12:40:22 +02:00
Ethan Buchman
c778d7f5d1 fix addresses 2018-04-07 23:13:41 +03:00
Ethan Buchman
bb9b12d67a add scripts/wire2amino.go 2018-04-07 22:04:28 +03:00
Ethan Buchman
767521ac52 update test/p2p/data for amino 2018-04-07 22:03:48 +03:00
Ethan Buchman
df9bf60b05 forgot Gopkg.lock 2018-04-07 20:59:13 +03:00
Ethan Buchman
466c3ab1c7 forgot node/wire.go 2018-04-07 19:53:29 +03:00
Ethan Buchman
c68d406195 fix tests 2018-04-07 19:47:19 +03:00
Ethan Buchman
02c0835e9b fixes post merge 2018-04-07 16:25:10 +03:00
Ethan Buchman
c170800fbd Merge branch 'develop' into jae/aminoify 2018-04-07 16:16:53 +03:00
Jae Kwon
7afe74a963 Update go-crypto to 0.6.1 and change config/toml.go privval address 2018-04-07 02:01:45 -07:00
Javed Khan
5d8767e656 p2p: don't use dial funcn in peerconfig 2018-04-07 12:51:51 +05:30
Javed Khan
54adb790f2 p2p: switch - reconnect only if persistent 2018-04-07 11:46:48 +05:30
Jae Kwon
02531ca5a3 Fix race testing (cont;) Bump version to 0.19.0 2018-04-06 17:06:46 -07:00
Jae Kwon
d24e4cb821 Fix race testing 2018-04-06 17:02:29 -07:00
Jae Kwon
fb64314d1c Review from Anton 2018-04-06 13:46:40 -07:00
Ethan Buchman
4930b61a38 Merge pull request #1431 from tendermint/release/v0.18.0
Release/v0.18.0
2018-04-06 23:19:09 +03:00
Ethan Buchman
9cc2cf362f changelog and version 2018-04-06 23:03:27 +03:00
Ethan Buchman
ed93fb34ab Merge pull request #1350 from tendermint/1275-p2p-loopbacks
p2p: loopbacks should be detected and ignored instead of dialling self infinitely
2018-04-06 18:59:05 +03:00
Anton Kaliaev
3d32474da8 make linter happy 2018-04-06 13:26:05 +02:00
Anton Kaliaev
3233c318ea only log errors, dial correct addresses
"this means if there are lookup errors or typos in the persistent_peers,
tendermint will fail to start ? didn't some one ask for us not to do
this previously ?"
2018-04-06 12:35:48 +02:00
Jae Kwon
32e1d195a0 Fix cmd and lite 2018-04-05 22:05:30 -07:00
Jae Kwon
3ca5292dc9 Fix rpc tests 2018-04-05 21:19:14 -07:00
Jae Kwon
c541d58d2f WIP: fix rpc/core 2018-04-05 16:07:29 -07:00
Jae Kwon
3037b5b7ca Fix rpc/lib/... 2018-04-05 15:45:11 -07:00
mossid
50c521e706 expose KVPair 2018-04-05 21:56:29 +02:00
mossid
2861f795f5 add SimpleProofsFromMap 2018-04-05 21:30:15 +02:00
Ethan Buchman
c9a263c589 Merge pull request #1389 from tendermint/1380-trim-whitespaces
trim whitespace from elements of lists (like `persistent_peers`)
2018-04-05 18:22:46 +03:00
Jae Kwon
e4492afbad Merge 2018-04-05 08:17:10 -07:00
Ethan Buchman
799beebd36 fix consensus tests 2018-04-05 17:54:26 +03:00
Jae Kwon
45ec5fd170 WIP consensus 2018-04-05 07:05:45 -07:00
Anton Kaliaev
6e39ec6e26 do not even try to dial ourselves
also, remove address from the book (plus mark it as our address)
and return an error if we fail to parse peers list
2018-04-05 15:45:52 +02:00
Anton Kaliaev
d38a6cc7ea trim whitespace from elements of lists (like persistent_peers)
Refs #1380
2018-04-05 16:42:26 +03:00
Anton Kaliaev
7f6ee7a46b add a comment for NewSwitch 2018-04-05 15:27:47 +02:00
Anton Kaliaev
34b77fcad4 log error when we fail to add new address 2018-04-05 15:27:47 +02:00
Anton Kaliaev
3b3f45d49b use addrbook#AddOurAddress to store our address 2018-04-05 15:27:47 +02:00
Anton Kaliaev
3284a13fee add test
Refs #1275
2018-04-05 15:27:47 +02:00
Anton Kaliaev
fc9ffee2e3 remove unused tracking because it leads to memory leaks in tests
see https://blog.cosmos.network/debugging-the-memory-leak-in-tendermint-210186711420
2018-04-05 15:27:47 +02:00
Anton Kaliaev
3a672cb2a9 update changelog [ci skip] 2018-04-05 15:27:46 +02:00
Anton Kaliaev
4b8e342309 fix panic: lookup testing on 10.0.2.3:53: no such host 2018-04-05 15:27:46 +02:00
Anton Kaliaev
5a2fa71b03 use combination of IP and port, not just IP 2018-04-05 15:27:46 +02:00
Anton Kaliaev
9a57ef9cbf do not dial ourselves (ok, maybe just once)
Refs #1275
2018-04-05 15:27:46 +02:00
Ethan Buchman
59ca9bf480 update to tmlibs v0.8.1 2018-04-05 16:16:36 +03:00
Ethan Buchman
7cce07bc99 Merge pull request #1352 from tendermint/1228-require-id
p2p: require all addresses come with an ID no matter what
2018-04-05 15:55:41 +03:00
Ethan Buchman
0ae66f75ce Merge pull request #1420 from tendermint/1414-data-race
protect Record* peerStateStats functions by mutex
2018-04-05 15:53:15 +03:00
Jae Kwon
5d1c758730 Fix evidence 2018-04-05 05:43:23 -07:00
Jae Kwon
1b9323f105 Fix blockchain tests 2018-04-05 05:17:43 -07:00
Jae Kwon
2e24b64fc1 Add IsEmpty; Publish 0.8.1 2018-04-05 03:14:53 -07:00
Anton Kaliaev
cee7b5cb54 GetSelectionWithBias
Refs #1130
2018-04-05 12:00:16 +02:00
Anton Kaliaev
1585152341 https://github.com/tendermint/tendermint/pull/1128#discussion_r162799294
Refs #1130
2018-04-05 12:00:16 +02:00
Anton Kaliaev
8e699c2bfd defaultSeedDisconnectWaitPeriod should be at least as long as we expect
it to take for a peer to become MarkGood

Refs #1130
2018-04-05 12:00:16 +02:00
Anton Kaliaev
904a3115a6 require addresses to have an ID by default
Refs #1228
2018-04-05 11:55:29 +02:00
Anton Kaliaev
a506cf47ad protect Record* peerStateStats functions by mutex
Fixes #1414

DATA RACE:
```
Read at 0x00c4214ee940 by goroutine 146:
  github.com/tendermint/tendermint/consensus.(*peerStateStats).String()
      <autogenerated>:1 +0x57
  fmt.(*pp).handleMethods()
      /usr/local/go/src/fmt/print.go:596 +0x3f4
  fmt.(*pp).printArg()
      /usr/local/go/src/fmt/print.go:679 +0x11f
  fmt.(*pp).doPrintf()
      /usr/local/go/src/fmt/print.go:996 +0x319
  fmt.Sprintf()
      /usr/local/go/src/fmt/print.go:196 +0x73
  github.com/tendermint/tendermint/consensus.(*PeerState).StringIndented()
      github.com/tendermint/tendermint/consensus/_test/_obj_test/reactor.go:1426 +0x573
  github.com/tendermint/tendermint/consensus.(*PeerState).String()
      github.com/tendermint/tendermint/consensus/_test/_obj_test/reactor.go:1419 +0x66
  github.com/go-logfmt/logfmt.safeString()
      /home/ubuntu/go/src/github.com/go-logfmt/logfmt/encode.go:299 +0x9d
  github.com/go-logfmt/logfmt.writeValue()
      /home/ubuntu/go/src/github.com/go-logfmt/logfmt/encode.go:217 +0x5a0
  github.com/go-logfmt/logfmt.(*Encoder).EncodeKeyval()
      /home/ubuntu/go/src/github.com/go-logfmt/logfmt/encode.go:61 +0x1dd
  github.com/tendermint/tmlibs/log.tmfmtLogger.Log()
      /home/ubuntu/go/src/github.com/tendermint/tmlibs/log/tmfmt_logger.go:107 +0x1001
  github.com/tendermint/tmlibs/log.(*tmfmtLogger).Log()
      <autogenerated>:1 +0x93
  github.com/go-kit/kit/log.(*context).Log()
      /home/ubuntu/go/src/github.com/go-kit/kit/log/log.go:124 +0x248
  github.com/tendermint/tmlibs/log.(*tmLogger).Debug()
      /home/ubuntu/go/src/github.com/tendermint/tmlibs/log/tm_logger.go:64 +0x1d0
  github.com/tendermint/tendermint/consensus.(*PeerState).PickSendVote()
      github.com/tendermint/tendermint/consensus/_test/_obj_test/reactor.go:1059 +0x242
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).gossipVotesForHeight()
      github.com/tendermint/tendermint/consensus/_test/_obj_test/reactor.go:789 +0x6ef
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).gossipVotesRoutine()
      github.com/tendermint/tendermint/consensus/_test/_obj_test/reactor.go:723 +0x1039

Previous write at 0x00c4214ee940 by goroutine 21:
  github.com/tendermint/tendermint/consensus.(*PeerState).RecordVote()
      github.com/tendermint/tendermint/consensus/_test/_obj_test/reactor.go:1242 +0x15a
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).Receive()
      github.com/tendermint/tendermint/consensus/_test/_obj_test/reactor.go:309 +0x32e6
  github.com/tendermint/tendermint/p2p.createMConnection.func1()
      /home/ubuntu/go/src/github.com/tendermint/tendermint/p2p/peer.go:365 +0xea
  github.com/tendermint/tendermint/p2p/conn.(*MConnection).recvRoutine()
      /home/ubuntu/go/src/github.com/tendermint/tendermint/p2p/conn/connection.go:531 +0x779
```
2018-04-05 11:42:45 +02:00
Anton Kaliaev
7689c15413 Merge pull request #1378 from tendermint/bucky/disable-test-libs
comment out test_libs because of gcc dep in tmlibs
2018-04-05 11:06:30 +02:00
Zaki Manian
f907113c19 Net_info should print the ID of peers (#1312) 2018-04-05 11:02:23 +02:00
Anton Kaliaev
140f962201 Merge pull request #1406 from tendermint/docker
Update dockerfile and readme
2018-04-05 10:57:19 +02:00
Ethan Buchman
c23d907f12 Merge pull request #1391 from tendermint/581-include-validator-power
Include validator power in /status
2018-04-05 11:18:45 +03:00
Alessio Treglia
105847b7dd Fix comments 2018-04-05 08:13:13 +01:00
Alessio Treglia
9c02c8ce93 Add import/export of public keys #79 2018-04-04 23:29:00 +01:00
Jae Kwon
fb7bde9c24 Add cause in Error.Error() 2018-04-04 13:43:19 -07:00
Jae Kwon
390de81bbc Release version 0.8.0 2018-04-04 12:30:13 -07:00
Anton Kaliaev
ed782e7508 include validator's voting power in /status
Refs #581
2018-04-04 11:34:59 +02:00
Anton Kaliaev
0732526465 use more relaxing < and >= ops instead of !=
an example of Search from godocs:

```
package main

import (
	"fmt"
	"sort"
)

func main() {
	a := []int{1, 3, 6, 10, 15, 21, 28, 36, 45, 55}
	x := 6

	i := sort.Search(len(a), func(i int) bool { return a[i] >= x })
	if i < len(a) && a[i] == x {
		fmt.Printf("found %d at index %d in %v\n", x, i, a)
	} else {
		fmt.Printf("%d not found in %v\n", x, a)
	}
}
```
2018-04-04 10:42:35 +02:00
Anton Kaliaev
39a4963782 document funcs in validator_set.go 2018-04-04 10:42:35 +02:00
Anton Kaliaev
37ce6b195a ValidatorSet#GetByAddress: return -1 if no validator was found 2018-04-04 10:42:34 +02:00
Ethan Buchman
7aa6d36258 Merge pull request #1412 from tendermint/bucky/exit-conR-subscribe-routine
consensus: check for closed subscription channels and exit routine
2018-04-03 23:53:48 +03:00
Ethan Buchman
5c3d3f0875 Merge pull request #194 from Tilkal/random-missing-methods
Random missing methods
2018-04-03 23:52:16 +03:00
Ethan Buchman
991017fc41 Merge pull request #1336 from tendermint/zarko/1308-add-light-client-spec
Add light client spec
2018-04-03 23:02:32 +03:00
Ethan Buchman
5f548c7679 consensus: close pubsub channels. fixes #1372 2018-04-03 22:57:32 +03:00
Ethan Buchman
d14aacf03e Merge pull request #1300 from tendermint/lite-proxy-hardening-and-tests
lite/proxy: Validation* tests and hardening for nil dereferences
2018-04-03 22:43:38 +03:00
Ethan Buchman
39ff4d22e9 minor cleanup 2018-04-03 22:34:18 +03:00
Thomas Corbière
74486f7f93 Add Int63n() and RandInt63n(). 2018-04-03 16:24:38 +02:00
Thomas Corbière
d66d43d2ea Add Int31n() and RandInt31n(). 2018-04-03 16:23:36 +02:00
Jae Kwon
196f8410ba WIP commit; Fix types/results_test 2018-04-03 07:03:08 -07:00
Jae Kwon
f457435199 HexBytes formatting; Make computeHashFromAunts more defensive 2018-04-03 07:02:19 -07:00
Anton Kaliaev
8462493cbf [rpc] fix subscribing using an abci.ResponseDeliverTx tag
Refs #1369
2018-04-03 15:53:13 +02:00
Anton Kaliaev
47b8bd1728 wrote a test for EventBus#PublishEventTx
Refs #1369
2018-04-03 15:53:13 +02:00
Jae Kwon
89cdde7f1e Fix state tests 2018-04-03 06:50:53 -07:00
Ethan Buchman
3cd4dcf13b changelog 2018-04-03 16:23:41 +03:00
Ethan Buchman
b5e6f8a446 Merge pull request #191 from Tilkal/random-float64
Add Float64() and RandFloat64().
2018-04-03 16:15:06 +03:00
Ethan Buchman
f664b020cd Merge pull request #189 from mohanson/patch-2
bug fix: WriteFileAtomic
2018-04-03 16:13:56 +03:00
Ethan Buchman
657fd671ea Merge pull request #1409 from tendermint/zach/docs/tm-monitor
docs: build updates
2018-04-03 15:24:55 +03:00
Thomas Corbière
3375dac049 add Float64() and RandFloat64(). 2018-04-03 14:09:50 +02:00
Zach Ramsay
315c475b79 docs: build updates
ref: https://github.com/tendermint/tools/pull/79
2018-04-03 04:48:40 -07:00
Mohanson
b221ca0efa refine comments 2018-04-03 19:04:09 +08:00
Thomas Corbière
ee67e34519 Fix lint errors (#190)
* use increment and decrement operators.

* remove unnecessary else branches.

* fix receiver names.

* remove omittable code.

* fix dot imports.
2018-04-03 12:23:28 +02:00
Mohanson
29a8cb8d87 add comments. 2018-04-03 16:51:30 +08:00
Mohanson
2fbd9f15fa bug fix: WriteFileAtomic
Must close file before rename it.
2018-04-03 15:26:47 +08:00
Javed Khan
5ef639fcbe p2p: persistent - redial if first dial fails
Fixes #1401
2018-04-03 09:27:06 +05:30
Ethan Buchman
a557bb4d0b Merge pull request #185 from tendermint/bucky/merge-master
Bucky/merge master
2018-04-02 22:26:22 +03:00
Anton Kaliaev
b800b4ec1d update docker readme 2018-04-02 16:57:25 +02:00
Anton Kaliaev
208ac32fa2 update Dockerfile to point to 0.17.1 release 2018-04-02 16:56:07 +02:00
Anton Kaliaev
641476d40f update docker to use alpine 3.7 2018-04-02 16:55:43 +02:00
Anton Kaliaev
491c8ab4c1 [rpc/lib] log cert and key files in StartHTTPAndTLSServer 2018-04-02 15:21:05 +02:00
Anton Kaliaev
5ef8a6e887 deprecate not fully formed addresses 2018-04-02 15:21:05 +02:00
Anton Kaliaev
d694d47d22 [rpc/lib] rename vars according to Go conventions 2018-04-02 15:21:05 +02:00
Zaki Manian
ecdc1b9bb0 Add a method for creating an https server (#1403) 2018-04-02 11:36:09 +02:00
Anton Kaliaev
9c757108ca [test] remove test_libs
Reasons:
1) all deps we're using should be passing tests (including external)
2) deps can require complicated setup for testing
3) the person responsible for releasing Tendermint should be cautious
when updating a dep
2018-04-02 11:29:03 +02:00
Anton Kaliaev
5243e54641 [codecov] ignore docs, scripts and DOCKER dirs 2018-04-02 11:23:56 +02:00
Ethan Buchman
70e7454c21 comment out test_libs because of gcc dep in tmlibs 2018-04-02 11:23:56 +02:00
Jae Kwon
382e99d06e Add IsTypedNil 2018-04-02 01:47:42 -07:00
Thomas Corbière
2644a529f0 Fix lint errors (#1390)
* use increment and decrement operators.

* remove unnecessary else branches.

* fix package comment with leading space.

* fix receiver names.

* fix error strings.

* remove omittable code.

* remove redundant return statement.

* Revert changes (code is generated.)

* use cfg as receiver name for all config-related types.

* use lsi as the receiver name for the LastSignedInfo type.
2018-04-02 10:21:17 +02:00
Greg Szabo
eaee98ee1f CGO_ENABLED=0 added for static linking (#1396) 2018-04-01 19:54:48 +02:00
Ethan Buchman
41302c206a Merge branch 'master' into develop
* Update changelog
2018-03-31 19:36:05 +03:00
Jae Kwon
35a1d747b0 Fix mempool 2018-03-31 11:51:32 +02:00
Jae Kwon
34974e3932 Make types use Amino; Refactor PrivValidator* to FilePV/SocketPV 2018-03-31 00:18:43 +02:00
Anton Kaliaev
898216d419 add SplitAndTrim func (#183)
Refs https://github.com/tendermint/tendermint/issues/1380
2018-03-29 12:04:01 +02:00
Alex Hernandez
575a46d9d4 fix typo on block header (#1387) 2018-03-29 11:28:29 +02:00
Ethan Buchman
bcadbd1b10 Merge pull request #1376 from tendermint/1368-unsubscribe-does-not-work
[rpc] unsubscribe does not work
2018-03-28 15:13:40 -04:00
Tomoya Ishizaki
ead9daf1ba Fix code style (#1362)
* cfg: Uniform style for method args and var names
2018-03-28 13:40:47 -04:00
Anton Kaliaev
22949e6dfd new tmlibs Parallel implementation 2018-03-28 19:13:08 +02:00
Anton Kaliaev
49986b05bc update tmlibs
Refs #1376
2018-03-28 19:12:52 +02:00
Anton Kaliaev
0f2811441f [pubsub] fix unsubscribing (#181)
* [pubsub] fix unsubscribing

by giving it the same exact query, which was used to subscribe

Refs https://github.com/tendermint/tendermint/issues/1368

* use original query to unsubscribe

Refs #1368

* modify the unit test the issue is fixed
2018-03-28 16:04:46 +02:00
Vladislav Dmitriyev
2fa7af4614 [lite] fixed listen address (#1384) 2018-03-28 15:59:09 +02:00
Anton Kaliaev
2d857c4b1b add hash field to ResultTx (/tx and /tx_search endpoints) (#1374)
Refs #1367
2018-03-28 15:44:58 +02:00
Christopher Goes
6e26392209 Return config parse errors (#182) 2018-03-28 15:35:52 +02:00
Anton Kaliaev
2b63f57b4c fix tx_indexer's matchRange
before we're using IteratePrefix, which is wrong because we want full
range, not just "account.number=1".
2018-03-28 15:02:54 +02:00
Anton Kaliaev
4085c72496 sort /tx_search results by height by default
Refs #1366
2018-03-28 15:02:54 +02:00
Adrian Brink
eea93b8904 Upgrade to Circle 2.0 2018-03-28 12:37:42 +02:00
Eugene Chung
34f5d439ee remove Heap.Update() call when setting Proposer field
In for loop of IncrementAccum(), Heap.Update() call is unnecessary when i == times - 1.
2018-03-28 12:58:53 +09:00
Ethan Buchman
6f9956990c Merge pull request #1377 from tendermint/release/0.17.1
Release/0.17.1
2018-03-27 11:24:48 -04:00
Ethan Buchman
9bf5862def types: fix genesis.AppStateJSON 2018-03-27 11:20:09 -04:00
Ethan Buchman
e1d98bb7f6 forgot bug fix in changelog 2018-03-27 10:06:30 -04:00
Ethan Buchman
e5cd006bce Merge pull request #1373 from tendermint/release/0.17.0
Release/0.17.0
2018-03-27 09:57:10 -04:00
Anton Kaliaev
58242e1b63 bump version one more time 2018-03-27 09:07:29 +02:00
Anton Kaliaev
4e86835163 update changelog for 0.17.0 release 2018-03-27 09:06:32 +02:00
Anton Kaliaev
ab4ac04c88 bump up the version 2018-03-26 22:07:07 +02:00
Anton Kaliaev
2c1887a635 update changelog 2018-03-26 22:06:58 +02:00
Anton Kaliaev
1c82281b77 make app_options -> app_state backwards compatible 2018-03-26 21:51:07 +02:00
Tomoya Ishizaki
43ac92b615 Changed to make line break easier to read (#1363) 2018-03-26 16:27:20 +02:00
Jae Kwon
7fb3f704b3 Update README with examples; Add signature test 2018-03-26 10:59:10 +02:00
Jae Kwon
5d5f580f49 Update changelog for v0.6.1 2018-03-26 10:44:04 +02:00
Jae Kwon
0d4436dea7 Use MarshalBinaryBare; Fix encode_test; Bump version 2018-03-26 10:41:04 +02:00
Jae Kwon
901b456151 P2P now works with Amino 2018-03-26 06:40:02 +02:00
Emmanuel T Odeke
8813684040 lite/proxy: consolidate some common test headers into a variable
Addressing some feedback from @ebuchman in regards to
consolidating some common test headers into a variable.

I've added that for simple cases, trying to meet in the middle
instead of creating helpers that obscure readibility and easy
comparison of test cases.
2018-03-25 00:27:42 -06:00
Emmanuel T Odeke
58f36bb321 Review feedback from @melekes
* Fix typo on naming s/deabBeef/deadBeef/g
* Use `assert.*(t,` instead of `assert.New(t);...;assert.*(`
2018-03-24 23:54:01 -06:00
Emmanuel T Odeke
4c2f56626a lite/proxy: Validation* tests and hardening for nil dereferences
Updates https://github.com/tendermint/tendermint/issues/1017

Ensure that the Validate* functions in proxy are tests
and cover the case of sneakish bugs that have been encountered
a few times from nil dereferences. The lite package should
theoretically never panic with a nil dereference. It is meant
to contain the certifiers hence it should never panic with such.

Requires the following bugs to be fixed first;
* https://github.com/tendermint/tendermint/issues/1298
* https://github.com/tendermint/tendermint/issues/1299
2018-03-24 23:54:01 -06:00
Jae Kwon
a04f2ae5c6 tmlibs 0.8.0-dev; canonical concrete names 2018-03-25 07:15:24 +02:00
Jae Kwon
e9cf47606c Merge panics into errors in Parallel 2018-03-25 00:04:47 +01:00
Jae Kwon
c62aed95f2 Lock to 0.8.0-dev tmlibs 2018-03-24 23:51:08 +01:00
Jae Kwon
87c0473730 New Error (#180)
* New Error can capture Stacktrace
* Intelligent ErrorWrap
* Review fixes
2018-03-24 22:19:44 +01:00
Ethan Buchman
e3337d764a Merge pull request #1354 from tendermint/bucky/dep
update dep
2018-03-24 12:14:56 -04:00
Ethan Buchman
aeb6d14c1c version bump 2018-03-23 09:13:59 -04:00
Anton Kaliaev
214817ed17 do not add peer to switch if it fails to start 2018-03-23 13:31:48 +01:00
Anton Kaliaev
116a4ec705 temporary fix
I assume there is a deeper issue with how UnmarshalBinary works in
go-amino (i.e., when loading array of some objects, the empty array
becomes []object{nil}). Note when Marshaling, the object is nil.
2018-03-23 12:47:02 +01:00
Ethan Buchman
bbaad22982 update dep 2018-03-23 10:27:00 +01:00
Anton Kaliaev
a7250af303 Exponential backoff follow up (#1349)
* document new functionality [ci skip]

Refs #1304

* add fixme [ci skip]

Refs #1304

* ensure that we dial peer after backoff duration

Refs #1304
2018-03-23 09:48:27 +01:00
Ethan Buchman
46686763ba Merge pull request #219 from tendermint/release/v0.10.2
Release/v0.10.2
2018-03-23 00:16:46 -04:00
Ethan Buchman
454db6c12b version and changelog 2018-03-23 00:21:27 -04:00
Ethan Buchman
8fc21cdcd9 remove omitempty 2018-03-22 23:59:25 -04:00
Ethan Buchman
5310e85bbb run make protoc 2018-03-22 23:46:23 -04:00
Ethan Buchman
f3f9f792a5 Merge pull request #218 from tendermint/release/v0.10.1
Release/v0.10.1
2018-03-22 23:18:30 -04:00
Ethan Buchman
968db546ee changelog update 2018-03-22 23:13:55 -04:00
Ethan Buchman
4600f19d9f add nullable=false and omitempty to fee 2018-03-22 22:53:09 -04:00
Ethan Buchman
e0c174b02b remove nullable=false from fee 2018-03-22 22:50:26 -04:00
Ethan Buchman
f9d9d92ea3 fix dep for minor version bumps 2018-03-22 20:01:07 -04:00
Ethan Buchman
c11bcd7890 update dep for tmlibs 2018-03-22 19:44:43 -04:00
Ethan Buchman
24da7009c3 Merge pull request #178 from tendermint/release/v0.7.1
Release/v0.7.1
2018-03-22 19:38:39 -04:00
Ethan Buchman
db3d1cb7fa changelog and version 2018-03-22 19:36:57 -04:00
Alexander Simmerl
d46b9afb79 Simplify WriteFileAtomic
We can make the implementation more robust by adjusting our assumptions
and leverage explicit file modes for syncing. Additionally we going to
assume that we want to clean up and can't really recover if thos
operations (file close and removal) fail.

* utilise file mode for majority of concerns
* improve test coverage by covering more assumptions
* signature parity with ioutil.WriteFile
* always clean up

Replaces #160
2018-03-22 19:36:24 -04:00
Emmanuel T Odeke
97bdad8262 common: NewBitArray never crashes on negatives (#170)
Fixes #169
Fixes https://github.com/tendermint/tendermint/issues/1322

The previous code was very trusting assuming that
rational actors will use this code. However, Byzantine
actors don't care and in the case of the linked issue
negative lengths can be sent to this code unfettered
having been received from a peer.

This code is essentially just a sign change from
`==`
to
`<=`

and we've gutted out that attack by being more defensive.
2018-03-22 19:36:24 -04:00
Ethan Buchman
3135fca73b changelog, dep, version 2018-03-22 19:19:16 -04:00
Ethan Buchman
215831d035 update spec and explain more 2018-03-22 19:12:08 -04:00
Ethan Buchman
5306147a2d types: revert CheckTx/DeliverTx changes. make them the same 2018-03-22 19:11:34 -04:00
Ethan Buchman
c0549ec943 Merge pull request #175 from tendermint/bucky/changelog
update version, changelog
2018-03-22 19:09:06 -04:00
Ethan Buchman
dc1042eb5f finish changelog 2018-03-22 13:55:55 -04:00
Zach
6545a21369 docs/examples: update quick start guide (#1351) 2018-03-22 08:58:02 +01:00
Zarko Milosevic
416f03c05b Add light client spec 2018-03-21 10:00:18 +01:00
Ethan Buchman
b6400af7ac update version, changelog 2018-03-21 05:15:30 +01:00
Ethan Buchman
a86b1d8f75 Merge pull request #171 from tendermint/feature/xla-writefileatomic
Simplify WriteFileAtomic
2018-03-21 05:04:14 +01:00
Jae Kwon
ced74251e9 maxPacketMsg -> packetMsgMax... 2018-03-21 02:47:38 +01:00
Jae Kwon
6c345f9fa2 First stab: p2p/conn 2018-03-21 02:27:10 +01:00
Ethan Buchman
8c0c8e8e01 Merge pull request #1301 from tendermint/types-data+header+non-nil-panics
types: Hash invoked for nil Data and Header should not panic
2018-03-20 23:38:55 +01:00
Jae Kwon
4e5c655944 Parallel reaps automatically before returning 2018-03-20 23:08:51 +01:00
Jae Kwon
4caf943f49 Parallel returns a TaskResultSet 2018-03-20 21:43:58 +01:00
Jae Kwon
db48010e81 Add return parameter to Parallel 2018-03-20 19:58:05 +01:00
Jae Kwon
bf24f2dcc5 Implement better Parallel (#174)
* Implement better Parallel
2018-03-20 19:24:18 +01:00
Alexander Simmerl
79315efd1f Merge pull request #1341 from EugeneChung/develop
Remove unnecessary bytes.Compare() call
2018-03-20 16:27:06 +01:00
Eugene Chung
a61130aebb Remove unnecessary bytes.Compare() call 2018-03-20 23:43:18 +09:00
Alexander Simmerl
5a51a0ba06 Merge pull request #1337 from tendermint/1296-follow-up
Follow up for /health endpoint
2018-03-20 10:36:47 +01:00
Ethan Buchman
0d0b56739d Merge pull request #1335 from tendermint/zarko/1146-improve-bft-time-spec
Improve BFT time spec
2018-03-20 01:00:34 +01:00
Ethan Buchman
eb1816c9ff Merge pull request #1338 from tendermint/1266/xla-fix-flaky-testswitchreconnectstopersistentpeer
p2p: Keep reference to connections in test peer
2018-03-20 00:14:38 +01:00
Alexander Simmerl
50ae892d5e p2p: Keep reference to connections in test peer
We observed non-deterministic test failures in one of our switch tests,
which would happen if the GC would run between iterations of the accept
loop. As we don't hold any reference to the connection the setup
finalizer might get triggered and therefore the file handle closed. For
the curious check the references on finalizers and the variable scoping
in the spec:

https://groups.google.com/forum/#!topic/golang-nuts/xWkhGJ5PY6c
https://groups.google.com/forum/#!topic/golang-nuts/d8aF4rAob7U/discussion
https://golang.org/ref/spec#Declarations_and_scope

Fixes #1266
2018-03-19 20:35:12 +01:00
Zarko Milosevic
5a79b3d74a Improve the spec to make explicit median computation based on voting power 2018-03-19 19:10:02 +01:00
Anton Kaliaev
460599ef75 fix comment 2018-03-19 20:01:43 +03:00
Anton Kaliaev
830bb72d6f add Health method to clients
Refs #1296
2018-03-19 20:01:43 +03:00
Anton Kaliaev
b11c26cc1c update CHANGELOG 2018-03-19 19:53:28 +03:00
Constantine
152290db7e Add \health rpc endpoint (#1306)
* Init `\health` rpc endpoint

* remove additional info from `\health` rpc endpoint

* Cleanup imports

* Added time threshold for health check

* Update rpc doc

* Remove unnecessary checks for blocktime creation lag

* Clean up of unnecessary config usage
2018-03-19 19:39:37 +03:00
Ethan Buchman
20b198681b Merge pull request #1328 from tendermint/bucky/add-vote-readability
addVote readability
2018-03-19 12:24:28 +01:00
Ethan Buchman
2bf106a1b3 Merge pull request #1333 from tendermint/1244-follow-up
consensus: fix tracking for MarkGood
2018-03-19 12:19:16 +01:00
Anton Kaliaev
2c445059f2 mark peer as good every blocksToContributeToBecomeGoodPeer blocks
if enough peers are marked good eventually some will become unmarked, so
good to have a force that will continue to cycle them back into good
territory!

Refs #1317
2018-03-19 14:10:25 +03:00
Anton Kaliaev
d8b08cd943 return back panic in peer#onReceive
Refs #1317
2018-03-19 13:19:05 +03:00
Anton Kaliaev
ab59f64f57 test we record votes and block parts
Refs #1317
2018-03-19 13:17:11 +03:00
Anton Kaliaev
42e3457884 fix tracking of votes and blockparts to not allow old information
also remove mutex
Refs #1317
2018-03-19 13:17:06 +03:00
Anton Kaliaev
31f3dd42e7 mark peer as good only once
or should we do it every N blocks?
Refs #1317
2018-03-19 13:17:00 +03:00
Anton Kaliaev
5fab8e404d replace magic number with blocksToContributeToBecomeGoodPeer const
Refs #1317
2018-03-19 13:16:56 +03:00
Anton Kaliaev
701df09971 do not use keywords
Refs #1317
2018-03-19 13:16:02 +03:00
Alexander Simmerl
bb65f097fd Simplify WriteFileAtomic
We can make the implementation more robust by adjusting our assumptions
and leverage explicit file modes for syncing. Additionally we going to
assume that we want to clean up and can't really recover if thos
operations (file close and removal) fail.

* utilise file mode for majority of concerns
* improve test coverage by covering more assumptions
* signature parity with ioutil.WriteFile
* always clean up

Replaces #160
2018-03-19 09:38:28 +01:00
Ethan Buchman
d350da3135 config: fix private_peer_ids 2018-03-18 23:55:44 +01:00
Jae Kwon
f010462639 Make concrete registered name be tendermint/* 2018-03-18 23:45:46 +01:00
Ethan Buchman
ab7dea4f20 consensus: return from errors sooner in addVote 2018-03-18 23:09:04 +01:00
Ethan Buchman
b297efb532 consensus: return from go-routine in test 2018-03-18 23:05:04 +01:00
Ethan Buchman
eaabdb5cac Merge pull request #1282 from tendermint/1126-private-peers
private peers
2018-03-18 22:53:57 +01:00
racin
066aee3045 Documentation: The character for 1/3 fraction could not be rendered in PDF on readthedocs. (#1326) 2018-03-18 22:44:38 +03:00
Emmanuel T Odeke
4b0058dd64 common: remove {Left, Right}PadString (#168)
Fixes #134

Those functions are unused in the whole Tendermint Github
organization plus they were unnecessariy verbose and could
have been concisely replaced with

```go
func RightPadString(s string, totalLength uint) string {
       return fmt.Sprintf("% *s", totalLength, s)
}

func LeftPadString(s string, totalLength uint) string {
       return fmt.Sprintf("% -*s", totalLength, s)
}
```

delete them anyways
2018-03-18 15:19:23 +04:00
Emmanuel T Odeke
b1c9b82531 common: NewBitArray never crashes on negatives (#170)
Fixes #169
Fixes https://github.com/tendermint/tendermint/issues/1322

The previous code was very trusting assuming that
rational actors will use this code. However, Byzantine
actors don't care and in the case of the linked issue
negative lengths can be sent to this code unfettered
having been received from a peer.

This code is essentially just a sign change from
`==`
to
`<=`

and we've gutted out that attack by being more defensive.
2018-03-18 15:17:11 +04:00
Jae Kwon
b0e0dc5de3 Implement DebugDB (#166) 2018-03-18 01:52:28 +01:00
Jae Kwon
3412587036 Fix race condition in random.go 2018-03-18 01:50:15 +01:00
Jae Kwon
4e02184676 Remove pkg/errors; Update Gopkg.toml, but not GRPC because it breaks. 2018-03-18 01:40:26 +01:00
Jae Kwon
9b9a9e7f8c Add Error Type for switching 2018-03-17 16:32:49 +01:00
Jae Kwon
99437a96fb Add efficient implementation of fmt and use for errors. 2018-03-17 15:23:22 +01:00
Jae Kwon
bb875303c2 Add NewErrorWithCause() 2018-03-17 14:44:12 +01:00
Jae Kwon
de36bfe31c Add TMLibs/Error from Cosmos-SDK/Error 2018-03-17 13:56:39 +01:00
Jae Kwon
90cd89eab0 Unexpose r.rand (#167) 2018-03-17 05:18:22 -07:00
Jae Kwon
6d61ca3bb5 New -> NewRand 2018-03-17 12:34:23 +01:00
Jae Kwon
536c27de8e common/random.go supports seeding and *Rand (#121)
* common/random.go supports seeding and *Rand
* Ensure determinism
2018-03-17 04:28:53 -07:00
Ethan Buchman
ff1ec0260e Merge pull request #1318 from tendermint/bucky/testnet-cmd-fix
testnet cmd: ensure config dir exists. closes #1290
2018-03-17 00:05:30 +01:00
Jae Kwon
a3800da0a1 Update Gopkg.lock to use go-amino 2018-03-16 07:01:02 -07:00
Jae Kwon
7dee27c851 Merge pull request #76 from tendermint/update-go-amino
wire -> amino
2018-03-16 06:48:32 -07:00
Emmanuel T Odeke
7cb3188fbc testnet cmd: ensure config dir exists. closes #1290 2018-03-16 14:26:43 +01:00
Alexander Simmerl
9b9022f8df privVal: Improve SocketClient network code (#1315)
Follow-up to feedback from #1286, this change simplifies the connection
handling in the SocketClient and makes the communication via TCP more
robust. It introduces the tcpTimeoutListener to encapsulate accept and
i/o timeout handling as well as connection keep-alive, this type could
likely be upgraded to handle more fine-grained tuning of the tcp stack
(linger, nodelay, etc.) according to the properties we desire. The same
methods should be applied to the RemoteSigner which will be overhauled
when the priv_val_server is fleshed out.

* require private key
* simplify connect logic
* break out conn upgrades to tcpTimeoutListener
* extend test coverage and simplify component setup
2018-03-16 16:32:17 +04:00
Ethan Buchman
68e049d3af Merge pull request #1244 from tendermint/1147-using-mark-good-and-stop-peer-for-error
Using MarkGood and StopPeerForError
2018-03-15 18:58:29 +01:00
Jae Kwon
d289c9286e Implement NewPrefixDB (#164)
* encodeByteSlice uses uvarint for length instead of varint
* Implemented NewPrefixDB
* Fix flowrate test (#165)
* Complete implementation and fix tests
* Add tests for MemBatch Write[Sync]
2018-03-15 09:43:23 -07:00
Anton Kaliaev
86ddf17db0 add a todo
Refs #1281
2018-03-15 11:58:20 +04:00
Anton Kaliaev
a655500047 fix copy-pasted comment [ci skip] 2018-03-15 11:58:20 +04:00
Anton Kaliaev
714f885dac mark peer as good if it contributed enough votes or block parts
Refs #1147
2018-03-15 11:58:20 +04:00
Anton Kaliaev
b0d8f552c5 return err if peer has sent a vote that does not match our round 2018-03-15 11:58:20 +04:00
Anton Kaliaev
63cb69cb96 comment out ErrAddingVote because it breaks byzantine_test 2018-03-15 11:58:20 +04:00
Anton Kaliaev
266974cb59 stop peer if it sends invalid vote 2018-03-15 11:58:20 +04:00
Anton Kaliaev
bcf54b0aa3 PanicSanity is deprecated 2018-03-15 11:58:20 +04:00
Anton Kaliaev
d86855ad7a stop peer if it sends us msg with unknown channel 2018-03-15 11:58:20 +04:00
Anton Kaliaev
d0c67bbe16 stop peer if evidence is not valid 2018-03-15 11:58:20 +04:00
Anton Kaliaev
4242352852 stop peer on decoding error 2018-03-15 11:58:19 +04:00
Anton Kaliaev
f299689573 return back defaultChannelCapacity 2018-03-15 11:58:19 +04:00
Anton Kaliaev
baf457e6d4 return error if peer sent us a block we didn't expect with a height too far ahead/behind 2018-03-15 11:58:19 +04:00
Anton Kaliaev
0c7e871ef0 [blockchain] replace timeoutsCh with more abstract errorsCh 2018-03-15 11:58:19 +04:00
Anton Kaliaev
87ce804b4a cmn.PanicSanity is deprecated 2018-03-15 11:58:19 +04:00
Anton Kaliaev
2a258a2c3f revert removing private peers from persistent 2018-03-15 11:55:30 +04:00
Anton Kaliaev
a40518c7da revert adding dial_peers's private flag 2018-03-15 11:55:30 +04:00
Anton Kaliaev
31deaa4a79 fix broken merge 2018-03-15 11:55:30 +04:00
Anton Kaliaev
736ea055a8 add a test for pex reactor 2018-03-15 11:55:30 +04:00
Anton Kaliaev
a39aec0bae rename private_peers to private_peer_ids to distinguish from peers 2018-03-15 11:55:30 +04:00
Anton Kaliaev
8bef3eb1f4 private peers
Refs #1126
2018-03-15 11:55:29 +04:00
Ethan Buchman
244d88dfda Merge pull request #1314 from tendermint/add-go-amino-as-source-to-wire
Add go amino as source to wire
2018-03-15 01:10:38 +01:00
Ethan Buchman
791f95bac3 Merge pull request #215 from tendermint/bucky/fees-gas
comment some fields in ResponseCheck/DeliverTx. closes #214
2018-03-14 18:47:26 +01:00
Anton Kaliaev
76e1dd41e4 fix Makefile's .PHONY 2018-03-14 21:42:35 +04:00
Anton Kaliaev
e39187a063 add go-amino as source for go-wire 2018-03-14 21:42:17 +04:00
Ethan Buchman
f7afa3d91f comment some fields in ResponseCheck/DeliverTx. closes #214 2018-03-13 13:40:41 +01:00
Emmanuel T Odeke
121f0d3fcf types: compile time assert to, and document sort.Interface
Fixes #212

Declare the purpose of the Less, Len, Swap methods
so that readers can see why they are defined.

Raised by an auditor in their report, as it looked like a security
concern but actually sort.Interface requires those methods implemented.
2018-03-12 14:46:06 -07:00
Ethan Buchman
cd2ba4aa7f Merge pull request #1286 from tendermint/feature/xla-priv-val-invert-dial
Invert privVal socket communication
2018-03-12 16:49:32 +01:00
Anton Kaliaev
73407e7cff add CODEOWNERS file 2018-03-12 12:37:19 +04:00
Anton Kaliaev
47b8a8864b remove any mention of glide 2018-03-12 12:34:43 +04:00
Anton Kaliaev
f499ce8713 update go-amino 2018-03-12 12:29:25 +04:00
Emmanuel T Odeke
0de19420f6 cmd/tendermint/commands/lite: add tcp scheme to address URLs (#1297)
Noticed while investigating
https://github.com/tendermint/tendermint/issues/970

As reported by @zramsay, we'd get the warning
from tendermint/rpc/lib because we were passing in
scheme-less addresses, so by default use "tcp".

Also by default, "node" (nodeAddr) has been set to:
  "tcp://localhost:46657"
instead of the bare:
  "localhost:46657"

This change is just to clean up such warnings as
they spuriously would spook users for a package "lite"
that claims to be secure.
2018-03-12 10:03:11 +04:00
Jae Kwon
b1cc688a61 encodeByteSlice uses uvarint for length instead of varint (#161) 2018-03-12 09:46:31 +04:00
Ethan Buchman
f3000d0c84 Merge pull request #1292 from tendermint/1125-exp-backoff-for-ensure-peers
exponential backoff for addrs in the address book
2018-03-11 19:57:49 +01:00
Anton Kaliaev
fc5b0471d9 use time.Since 2018-03-11 14:13:34 +04:00
Anton Kaliaev
264bce4ddd skip dialing based on last time dialed 2018-03-11 14:00:49 +04:00
Anton Kaliaev
0f41570c80 fixes from bucky's review 2018-03-11 13:22:37 +04:00
Emmanuel T Odeke
8723c91db9 types: Hash invoked for nil Data and Header should not panic
Fixes https://github.com/tendermint/tendermint/issues/1298
Fixes https://github.com/tendermint/tendermint/issues/1299

Found while writing tests in https://github.com/tendermint/tendermint/pull/1300
2018-03-10 21:44:08 -08:00
Anton Kaliaev
f85c8896d9 test pex_reactor's dialPeer 2018-03-09 16:23:52 +04:00
Anton Kaliaev
f0d4f56327 refactor pex_reactor tests 2018-03-09 16:02:24 +04:00
Anton Kaliaev
3d5c05e4e6 Merge pull request #1293 from tendermint/update-template
add 2 more points to ISSUE_TEMPLATE
2018-03-09 15:15:34 +04:00
Anton Kaliaev
018da09f14 do not run complete test suite on make
bad dev experience
2018-03-08 18:55:14 +04:00
Anton Kaliaev
60a64af28d add 2 more points to ISSUE_TEMPLATE
Refs #1291
2018-03-08 18:53:11 +04:00
Zach
13a2013229 Testing refactor for Jenkins (#1098)
* de-mystify tests & run them in parallel (#1031)

* test optimization for jenkins (#1093)

* makefile cleanup

* tests: split fast and slow go tests, closes #1055

* pr comments

* restore circle conditions

* fix need_abci

* ...

* docker run: no :Z for circle?

* Remove cmd breaking comment
2018-03-08 18:52:38 +04:00
Anton Kaliaev
1941b5c769 fixes from @xla's review 2018-03-08 16:31:44 +04:00
Anton Kaliaev
21e2c41c6b exponential backoff for addrs in the address book
Refs #1125
2018-03-08 14:04:26 +04:00
Alexander Simmerl
589781721a Invert privVal socket communication
Follow-up to #1255 aligning with the expectation that the external
signing process connects to the node. The SocketClient will block on
start until one connection has been established, support for multiple
signers connected simultaneously is a planned future extension.

* SocketClient accepts connection
* PrivValSocketServer renamed to RemoteSigner
* extend tests
2018-03-07 12:37:05 +01:00
Ethan Buchman
2ce57a65ff Merge pull request #1284 from tendermint/feature/xla-follow-priv-val
Follow-ups to PrivValidator
2018-03-06 23:37:10 +01:00
Alexander Simmerl
2aa77025c3 Fix typo 2018-03-06 19:56:31 +01:00
Alexander Simmerl
8e1856a90a Use builtin panic 2018-03-06 19:56:31 +01:00
Alexander Simmerl
ca619c80b6 Stop privVal socket client on node shutdown 2018-03-06 19:56:30 +01:00
Alexander Simmerl
25ff699425 Improve method docs 2018-03-06 19:55:26 +01:00
Alexander Simmerl
879b4c0a2c Use common method to determine file existence 2018-03-06 19:55:26 +01:00
Ethan Buchman
45d07a3d0b Merge pull request #1283 from tendermint/feature/xla-run-integration-release
Speed up CircleCI builds
2018-03-06 19:38:08 +01:00
Admir Sabanovic
788354d81e fix typo (#1285) 2018-03-06 20:44:13 +04:00
Alexander Simmerl
b7ce89e568 Speed up CircleCI builds
To achieve faster feedback cycles for our feature PRs this change
reduces the average buildtime from 35 to ~6min by utilising their new
2.0 offering based on docker and nomad. We make use of parallel build
steps wherever possible so that the duration is determined by the
slowest test suite (p2p).

This is an intermediate step until we move our CI/CD completely
on-premise for more control and added security.
2018-03-06 17:36:44 +01:00
Anton Kaliaev
8d81a259c7 Merge pull request #1280 from tendermint/zach/explain-determinism
docs: add 'On Determinism'
2018-03-06 13:44:00 +04:00
Simon Vadée
066fe82a92 pubsub implements service.OnReset (#156) 2018-03-06 11:29:18 +04:00
Zach Ramsay
3019761204 docs: add document 'On Determinism'
closes https://github.com/tendermint/abci/issues/56
2018-03-06 15:19:59 +08:00
Anton Kaliaev
6120a4c5e4 Merge pull request #1256 from tendermint/feature/more-priv-val
PrivValidatorAddr -> PrivValidatorListenAddr. Update ADR008
2018-03-05 21:48:16 +04:00
Alexander Simmerl
533ed2a876 adr: Amend decisions for PrivValidator 2018-03-05 17:38:05 +01:00
Ethan Buchman
d4e4055d57 PrivValidatorAddr -> PrivValidatorListenAddr. Update ADR008 2018-03-05 17:11:43 +01:00
Alexander Simmerl
ee51ad8e29 Make RPC handler protocol agnostic (#1276) 2018-03-05 19:59:04 +04:00
Zach
bdd50c5f37 fix docs links & stuff (#1273)
* fix links in docs/spec etc, closes #1261

* spec: remove ref to non-existant repo

* codecov you weirdo
2018-03-05 16:30:36 +04:00
Anton Kaliaev
3d88612690 Merge pull request #1274 from tendermint/codecov
Codecov
2018-03-05 15:54:33 +04:00
Anton Kaliaev
630d54c95a return back threshold and ignore sections 2018-03-05 15:16:24 +04:00
Zach
d5361de300 Merge pull request #209 from zmanian/transitive_deps
Move the tmlibs dependency to develop
2018-03-05 12:12:56 +08:00
Zaki Manian
a38ad4e21b Move the tmlibs dependency to develop 2018-03-04 20:00:42 -08:00
Zach
a29163d85b Merge pull request #208 from tendermint/zramsay-patch-1
update spec formatting for docs
2018-03-05 10:48:26 +08:00
Zach
a183219659 update spec formatting for docs
this file is pulled in by tendermint's doc building
2018-03-05 10:46:51 +08:00
Ethan Buchman
7579abd710 bring back dummy for backwards compatibility ... 2018-03-03 20:40:43 -05:00
Ethan Buchman
69e960da42 Merge pull request #71 from zmanian/dep
Switch to dep from glide for dependency resolution
2018-03-02 11:54:26 -05:00
Ethan Buchman
5e07356264 use previously working new go-wire. not bleeding edge 2018-03-02 11:43:58 -05:00
Ethan Buchman
e05ba9511a Merge branch 'master' into develop 2018-03-02 11:42:06 -05:00
Ethan Buchman
3cedd8cf07 Merge pull request #1265 from tendermint/bucky/new-wire-api
Bucky/new wire api
2018-03-02 10:56:24 -05:00
Ethan Buchman
929f326dd2 update dep 2018-03-02 10:59:10 -05:00
Ethan Buchman
c3e19f3ea2 Merge pull request #73 from tendermint/develop-pre-wire
Develop pre wire
2018-03-02 10:40:13 -05:00
Ethan Buchman
3a92931657 changelog, version, glide 2018-03-02 10:40:36 -05:00
Ethan Buchman
ff8c648c23 types: uncomment some tests 2018-03-02 09:26:37 -05:00
Ethan Buchman
8bceb5ce36 Merge pull request #1233 from tendermint/feature/xla-dial-seed-without-timeout
p2p: if we have no peers we should dial seeds right away
2018-03-02 09:07:01 -05:00
Alexander Simmerl
8f2703e8b2 Dial seeds directly without potential peers
In order to improve the operator experience we want the node to dial
seeds immediately if there are no peers to connect to. Until now the
routine responsible for ensuring peers are connected to would wait
a random amount of time up to 30s (if not configured otherwise).
2018-03-02 12:55:01 +01:00
Ethan Buchman
c394eef7b8 types: TestValidatorSetVerifyCommit 2018-03-02 04:21:23 -05:00
Ethan Buchman
f9921ae362 types/validator_set_test: move funcs around 2018-03-02 03:52:44 -05:00
Ethan Frey
fff0c6cd8e Add app_state from genesis file in InitChain message 2018-03-02 03:46:04 -05:00
Ethan Buchman
6c6d01b51c Keybase refactor
Same as 788cc0a792 but without the new go-wire
2018-03-02 03:08:48 -05:00
Ethan Buchman
59872bf335 update dep for new go-wire API 2018-03-02 02:28:53 -05:00
Ethan Buchman
656854186c state: fix txResult issue with UnmarshalBinary into ptr 2018-03-02 02:28:17 -05:00
Ethan Buchman
6596bff8ec types: bring back json.Marshal/Unmarshal for genesis/priv_val 2018-03-02 02:09:28 -05:00
Ethan Buchman
eaafd9d61c state: builds 2018-03-02 01:51:27 -05:00
Ethan Buchman
5378bfc5c7 types.SignBytes -> o.SignBytes 2018-03-02 01:50:17 -05:00
Ethan Buchman
abeeeeb611 types: fix validator_set_test issue with UnmarshalBinary into ptr 2018-03-02 01:49:59 -05:00
Ethan Buchman
ca3655a409 types: p2pID -> P2PID 2018-03-02 01:42:56 -05:00
Ethan Buchman
6cf5100645 types: working on tests... 2018-03-02 01:34:23 -05:00
Ethan Buchman
51628aea08 types: revert to old wire. builds 2018-03-02 01:33:38 -05:00
Ethan Buchman
3395f5fb0e types: builds 2018-03-02 01:28:38 -05:00
Ethan Buchman
d2cd079541 types: tests build 2018-03-02 01:28:21 -05:00
Ethan Buchman
fc35e3b8c5 wire: no codec yet 2018-03-02 01:27:52 -05:00
Ethan Buchman
085b4f5f2e add wire pkg with global codec 2018-03-02 01:26:38 -05:00
Ethan Buchman
fd58645dd2 types: remove dep on p2p 2018-03-02 01:26:03 -05:00
Ethan Buchman
200787ede2 types: update for new go-wire. WriteSignBytes -> SignBytes 2018-03-02 01:25:54 -05:00
Ethan Buchman
9e0e00bef4 Merge branch 'master' into develop 2018-03-01 23:55:14 -05:00
Ethan Buchman
9cdba04fe9 Merge pull request #1142 from tendermint/add_valid_value_mechanism
Add support for ValidBlock mechanism for the simplest case
2018-03-01 23:33:46 -05:00
Ethan Buchman
c015e7a23d Merge pull request #206 from tendermint/bucky/fix-spec-and-changelog-for-v0.10.0
update CHANGELOG, README, spec for v0.10. Fixes #205
2018-03-01 19:50:05 -05:00
Ethan Buchman
fb808a00d5 update CHANGELOG, README, spec for v0.10. Fixes #205 2018-03-01 19:52:01 -05:00
Anton Kaliaev
e92c87630d Merge pull request #1258 from tendermint/return-dummy-app
return back dummy & persistent_dummy as options for proxy_app
2018-03-01 15:14:07 +04:00
Zarko Milosevic
d4e93a6de3 Separate ValidBlock rule from unlocking rule 2018-03-01 11:42:22 +01:00
Zarko Milosevic
4670857c15 Add support for ValidBlock mechanism for the simplest case 2018-03-01 11:42:22 +01:00
Anton Kaliaev
e8d8aedd1f update changelog 2018-03-01 12:00:09 +04:00
Anton Kaliaev
87372da730 return back dummy & persistent_dummy as options for proxy_app 2018-03-01 11:54:08 +04:00
Zach
031be404cf Merge pull request #203 from tendermint/fix-dockerfile-develop
fix Dockerfile.develop
2018-03-01 14:43:43 +08:00
Anton Kaliaev
3b40b62d04 Merge pull request #1198 from tendermint/feature/genesisrawjson
SDK: AppOptions -> AppState
2018-03-01 00:55:13 +04:00
Anton Kaliaev
c41cbf2a07 add missing golang.org/x/net/netutil package 2018-02-28 23:44:18 +04:00
Anton Kaliaev
1a3faa8db1 add app_state field to docs 2018-02-28 23:44:10 +04:00
Anton Kaliaev
4ce79baac7 rename app_options to app_state in genesis_test 2018-02-28 23:44:10 +04:00
Anton Kaliaev
056b70b4ce update changelog 2018-02-28 23:44:10 +04:00
rigelrozanski
4806b3b9bf AppOptions -> AppStateJSON 2018-02-28 23:44:10 +04:00
Ethan Buchman
2a8f0000b2 Merge pull request #1250 from tendermint/ditch-glide
Ditch glide
2018-02-28 09:52:12 -05:00
Ethan Buchman
dd2d846c02 Merge pull request #1203 from tendermint/feature/priv_val
types/priv_validator package
2018-02-28 09:27:03 -05:00
Anton Kaliaev
2ae87eee4e style fixes from @xla 2018-02-28 12:24:26 +04:00
use-n-delete
4be23027ed adding recipe for minimalistic deps analysis (#1218) 2018-02-28 11:23:31 +04:00
Anton Kaliaev
c19bbb2403 switch back to parsing .lock file 2018-02-28 11:15:40 +04:00
Ethan Buchman
edb871f514 Merge pull request #1237 from tendermint/feature/priv_val_socket_client
privVal: Integrate socket client
2018-02-28 00:57:51 -05:00
Ethan Buchman
9c5937df96 Merge pull request #1247 from tendermint/feature/xla-integrate-codecov
Integrate CodeCov as change acceptance stage
2018-02-28 00:38:37 -05:00
Ethan Buchman
be6082df8e Merge pull request #1043 from tendermint/lite-binary-vs-linear-search+optimize-insertions
lite: memStoreProvider GetHeightBinarySearch method + fix ValKeys.signHeaders
2018-02-28 00:33:59 -05:00
Anton Kaliaev
66354de219 cd into tendermint before calling dep status 2018-02-27 18:47:53 +04:00
Alexander Simmerl
458a40f74e Integrate CodeCov as change acceptance stage
As a rough measure to keep quality up we want to integrate our code
coverage tooling to the point where it is required for changes to be
merged.

Example taken from https://github.com/cosmos/voyager/blob/develop/codecov.yaml
2018-02-27 15:39:28 +01:00
Anton Kaliaev
0821384ac6 update abci version 2018-02-27 18:34:32 +04:00
Anton Kaliaev
e01650f21d fix Dockerfile.develop 2018-02-27 18:02:40 +04:00
Anton Kaliaev
8dd06cf197 ditch glide 2018-02-27 18:02:40 +04:00
Anton Kaliaev
93732b4c1e remove old network tests
Refs #1249
2018-02-27 18:02:25 +04:00
Zach
2cc63069c6 rename dummy to kvstore (#1223)
* remove accidental binary

* docs: s/Dummy&dummy/KVStore&kvstore/g

* glide update to abci

* update abci import paths

* dummy begone, hello kvstore

* RequestInitChain needs genesisBytes

* glide update
2018-02-27 18:01:10 +04:00
Anton Kaliaev
345a5a5a34 remove glide 2018-02-27 17:54:25 +04:00
Anton Kaliaev
c57ab8724e fix Dockerfile.develop 2018-02-27 17:54:25 +04:00
Zaki Manian
3d5f0a8b94 Switch dependency management to dep from glide (#202) 2018-02-27 17:24:09 +04:00
Zaki Manian
192fb2aabc Fix string formatting error for go1.10 (#201) 2018-02-27 16:03:21 +04:00
Zaki Manian
26f2ab65f8 Switch to dep from glide (#155) 2018-02-27 16:01:49 +04:00
Zaki Manian
6270ecef8c Switch to dep from glide for dependency management (#1243)
* Switch to dep from glide for dependency management

* Update CI dockerfile to use dep instead of glide

* Wrong file extension

* Run 'dep ensure' after copying code

* Install glide to handle abci dependencies in testing

* Use `dep ensure -vendor-only` to setup vendor directory before installing source code on ci
2018-02-27 15:59:50 +04:00
Ethan Buchman
9293ae76bf p2p: introduce peerConn to simplify peer creation (#1226)
* expose AuthEnc in the P2P config

if AuthEnc is true, dialed peers must have a node ID in the address and
it must match the persistent pubkey from the secret handshake.

Refs #1157

* fixes after my own review

* fix docs

* fix build failure

```
p2p/pex/pex_reactor_test.go:288:88: cannot use seed.NodeInfo().NetAddress() (type *p2p.NetAddress) as type string in array or slice literal
```

* p2p: introduce peerConn to simplify peer creation

* Introduce `peerConn` containing the known fields of `peer`
* `peer` only created in `sw.addPeer` once handshake is complete and NodeInfo is checked
* Eliminates some mutable variables and makes the code flow better
* Simplifies the `newXxxPeer` funcs
* Use ID instead of PubKey where possible.
        * SetPubKeyFilter -> SetIDFilter
        * nodeInfo.Validate takes ID
        * remove peer.PubKey()

* persistent node ids

* fixes from review

* test: use ip_plus_id.sh more

* fix invalid memory panic during fast_sync test

```
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: panic: runtime error: invalid memory address or nil pointer dereference
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x98dd3e]
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]:
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: goroutine 3432 [running]:
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.newOutboundPeerConn(0xc423fd1380, 0xc420933e00, 0x1, 0x1239a60, 0
xc420128c40, 0x2, 0x42caf6, 0xc42001f300, 0xc422831d98, 0xc4227951c0, ...)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/peer.go:123 +0x31e
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.(*Switch).addOutboundPeerWithConfig(0xc4200ad040, 0xc423fd1380, 0
xc420933e00, 0xc423f48801, 0x28, 0x2)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:455 +0x12b
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.(*Switch).DialPeerWithAddress(0xc4200ad040, 0xc423fd1380, 0x1, 0x
0, 0x0)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:371 +0xdc
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: github.com/tendermint/tendermint/p2p.(*Switch).reconnectToPeer(0xc4200ad040, 0x123e000, 0xc42007bb00)
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:290 +0x25f
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: created by github.com/tendermint/tendermint/p2p.(*Switch).StopPeerForError
2018-02-21T06:30:05Z box887.localdomain docker/local_testnet_4[14907]: #011/go/src/github.com/tendermint/tendermint/p2p/switch.go:256 +0x1b7
```
2018-02-27 15:54:40 +04:00
Zaki Manian
3570c2eb9e Fix test in makefile 2018-02-25 09:41:32 -08:00
Zaki Manian
b6d029050b Switch to dep from glide for dependency resolution 2018-02-25 08:48:53 -08:00
Alexander Simmerl
74d3f7e1fd Integrate private validator socket client
Following ADDR 008 the node will connect to an external
process to handle signing requests. Operation of the external process is
left to the user.

* introduce alias for PrivValidator interface on socket client
* integrate socket client in node
* structure tests
* remove unnecessary flag
2018-02-23 13:58:22 +01:00
Ethan Buchman
2fd023a239 remove accidental binary 2018-02-21 00:04:53 -05:00
Ethan Buchman
6d47f4afe2 Merge pull request #197 from tendermint/sed-dummy-kvstore
rename dummy to kvstore
2018-02-21 00:03:44 -05:00
Ethan Buchman
c8a2bdf78b Merge pull request #1225 from tendermint/release-v0.16.0
Release v0.16.0
2018-02-20 23:23:48 -05:00
Zach Ramsay
3cd604562c RequestInitChain needs genesisBytes 2018-02-21 03:43:47 +00:00
Zach Ramsay
7c6c0dba53 glide update 2018-02-21 03:32:02 +00:00
Ethan Buchman
68592f4d8e Merge pull request #198 from tendermint/develop
v0.10.0
2018-02-20 22:10:11 -05:00
Ethan Buchman
9b6088cc26 glide and changelog 2018-02-20 22:06:27 -05:00
Ethan Buchman
1b9b5652a1 changelog date 2018-02-20 22:00:20 -05:00
Ethan Buchman
3e79f9e198 Merge pull request #154 from tendermint/develop
v0.7.0 (aka "sdk2")
2018-02-20 21:55:52 -05:00
Ethan Buchman
fe7e26eecf changelog and version bump 2018-02-19 17:44:49 -05:00
Ethan Buchman
ec2f3f49ef changelog date and version 2018-02-19 17:35:46 -05:00
Ethan Buchman
8bba7c64bc update version and changelog [ci skip] 2018-02-19 17:33:48 -05:00
Ethan Buchman
c6163bdab2 version bump and changelog 2018-02-19 17:05:36 -05:00
Ethan Buchman
ffd2483e67 Merge pull request #1204 from tendermint/feature/priv_val_sockets
Feature/priv val sockets
2018-02-19 16:06:07 -05:00
zramsay
831e10f15d finish the job, dummy 2018-02-19 20:43:36 +00:00
zramsay
594db86069 rename dummy*.go files to kvstore*.go 2018-02-19 20:40:33 +00:00
zramsay
a3362ccf35 s/Dummy/KVStore/g 2018-02-19 20:38:22 +00:00
Ethan Buchman
0467de890a Merge pull request #1202 from tendermint/restore-mempool-memory-leak-tests
restore mempool memory leak tests
2018-02-19 15:36:19 -05:00
Anton Kaliaev
0ae0155cba restore mempool memory leak tests 2018-02-19 15:34:33 -05:00
Ethan Buchman
f4feb7703b fix appHash log. closes #1207 2018-02-19 15:32:09 -05:00
Alexander Simmerl
a14aab67de Integrate PrivValidator socket server 2018-02-19 19:20:01 +01:00
Ethan Buchman
c960c52756 Merge pull request #193 from tendermint/feature/init-chain-app-state
types: RequestInitChain.AppStateBytes
2018-02-17 12:51:05 -05:00
Ethan Buchman
a6be687088 types: RequestInitChain.AppStateBytes 2018-02-16 19:49:33 -05:00
Ethan Buchman
b1e29d22f6 Merge pull request #192 from tendermint/feature/fix_glide_yaml
Pin tmlibs to develop
2018-02-16 19:37:09 -05:00
Adrian Brink
7a6a079afe Pin tmlibs to develop 2018-02-15 12:28:05 +01:00
Ethan Buchman
a0f652dc2e Merge pull request #151 from tendermint/fix/nit
minor nit
2018-02-14 11:57:38 -05:00
Alexander Simmerl
106d804357 Correct config description 2018-02-14 02:51:05 +01:00
Alexander Simmerl
a1020307a0 Clean up flags 2018-02-14 02:41:16 +01:00
Alexander Simmerl
6c70b4ce05 Apply connection deadline consistently 2018-02-14 02:25:17 +01:00
Alexander Simmerl
2a292efb56 Return error for all PrivValidator methoods
As calls to the private validator can involve side-effects like network
communication it is desirable for all methods returning an error to not
break the control flow of the caller.

* adjust PrivValidator interface
2018-02-13 19:34:50 +01:00
Alexander Simmerl
82b1a34a36 Separate connect logic
* break out connect functionality out of OnStart
* introduce max retries
2018-02-13 19:08:21 +01:00
Ethan Buchman
0e68638af3 update glide abci/tmlibs to develop 2018-02-12 19:13:36 -05:00
Ethan Buchman
737c30c19d minor nit 2018-02-12 19:12:24 -05:00
Ethan Buchman
d3e276bf80 Merge pull request #1209 from tendermint/1205-fixes-for-p2p-memory-leak-and-pong
Fixes for p2p memory leak and pong
2018-02-12 19:04:31 -05:00
Ethan Buchman
bf70f5e273 Merge pull request #191 from tendermint/tm-1205-quit-method-added
Quit method was added to Service/BaseService
2018-02-12 19:04:04 -05:00
Ethan Buchman
c858b3ba78 Merge pull request #150 from tendermint/tm-1205-add-quit-method-to-service
add Quit method to Service interface
2018-02-12 18:39:26 -05:00
Anton Kaliaev
fc585bcdec do not block when writing to pongTimeoutCh
Refs #1205
2018-02-12 17:04:07 +04:00
Anton Kaliaev
2a24ae90c1 fixes from Jae's review
1. remove pointer
2. add Quit() method to Service interface
2018-02-12 14:32:09 +04:00
Anton Kaliaev
5913ae8960 Quit method was added to Service/BaseService
Refs https://github.com/tendermint/tendermint/issues/1205
2018-02-12 12:22:32 +04:00
Anton Kaliaev
a57340ffb5 add Quit method to Service interface
remove deprecated QuitService
2018-02-12 11:40:42 +04:00
Ethan Buchman
8da2a6a147 types/priv_validator: fixes for latest p2p and cmn 2018-02-09 17:24:30 -05:00
Alexander Simmerl
7d71e702d8 Integrate privVal client with node secret 2018-02-09 16:54:43 -05:00
Alexander Simmerl
38d18ca11a Harden tests 2018-02-09 16:53:17 -05:00
Alexander Simmerl
32d9563a15 Format and consolidate 2018-02-09 16:53:17 -05:00
Alexander Simmerl
18f7e52562 Use secret connection 2018-02-09 16:53:17 -05:00
Alexander Simmerl
fec541373d Correct server protocol 2018-02-09 16:53:17 -05:00
Alexander Simmerl
ff600e9aa0 wip: check error of wire read 2018-02-09 16:53:17 -05:00
Alexander Simmerl
a49357b19e wip: Avoid underscore in var name 2018-02-09 16:53:17 -05:00
Alexander Simmerl
4b997c29ee wip: fix nil pointer deference 2018-02-09 16:53:17 -05:00
Alexander Simmerl
d321839669 wip: fix code block in ADR 2018-02-09 16:53:17 -05:00
Alexander Simmerl
c27fda09dd wip: Comment types
* add comments to all public types
* fix comments to adhere to comment standards
2018-02-09 16:53:15 -05:00
Ethan Buchman
23eb84db35 wip: priv val via sockets 2018-02-09 16:52:58 -05:00
Ethan Buchman
bef91ea7fe adr-008-priv-validator 2018-02-09 16:52:05 -05:00
Ethan Buchman
459633fb4c types/priv_validator 2018-02-09 16:38:23 -05:00
Ethan Buchman
f1c8489270 Merge pull request #1201 from tendermint/1022-do-not-enforce-1/3-val-changes
do not enforce 1/3 validator power change
2018-02-09 16:15:38 -05:00
Ethan Buchman
2d10c8f15b Merge pull request #1095 from tendermint/804-p2p-issues
[p2p] Pong Timeout
2018-02-09 14:38:24 -05:00
Anton Kaliaev
106cdb74e5 do not enforce 1/3 validator power change
leave it to the app

Refs #1022
2018-02-09 23:30:04 +04:00
Anton Kaliaev
22b038810a do not block in recvRoutine 2018-02-09 23:03:26 +04:00
Anton Kaliaev
45750e1b29 fix race by sending signal instead of stopping pongTimer 2018-02-09 21:32:29 +04:00
Anton Kaliaev
26419fba28 refactor code plus add one more test
* extract stopPongTimer method
* TestMConnectionMultiplePings
2018-02-09 21:32:29 +04:00
Anton Kaliaev
ac0123d249 drain pongTimeoutCh and pongTimer's channel to prevent leaks 2018-02-09 21:32:29 +04:00
Anton Kaliaev
f4ff66de30 rewrite pong timer to use time.AfterFunc 2018-02-09 21:32:29 +04:00
Anton Kaliaev
747b73cb95 fix merge conflicts 2018-02-09 21:32:29 +04:00
Anton Kaliaev
161e100a24 close return channel when we're done
Benchmark results:

```
BenchmarkSwitchBroadcast-2         30000             71275 ns/op
--- BENCH: BenchmarkSwitchBroadcast-2
        switch_test.go:339: success: 1, failure: 0
        switch_test.go:339: success: 100, failure: 0
        switch_test.go:339: success: 10000, failure: 0
        switch_test.go:339: success: 30000, failure: 0
```
2018-02-09 21:32:29 +04:00
Anton Kaliaev
3ae738f453 increase timeouts 2018-02-09 21:32:29 +04:00
Anton Kaliaev
d14d4a2527 remove TryBroadcast 2018-02-09 21:32:29 +04:00
Anton Kaliaev
860da464df remove weird concurrency testing 2018-02-09 21:32:28 +04:00
Anton Kaliaev
4e2000abfe control order by sending msgs from one goroutine 2018-02-09 21:32:28 +04:00
Anton Kaliaev
5834a59816 read ping 2018-02-09 21:32:28 +04:00
Anton Kaliaev
b28b76ddf7 rename pingTimeout to pingInterval, pongTimer is now time.Timer 2018-02-09 21:32:28 +04:00
zbo14
91e4f4b786 ping/pong timeout in config 2018-02-09 21:32:28 +04:00
zbo14
9b554fb2c4 switch test modification 2018-02-09 21:32:28 +04:00
zbo14
f97ead4f5f prep for merge 2018-02-09 21:32:28 +04:00
zbo14
5af22d6ee6 remove SwitchEventNewPeer, SwitchEventDonePeer 2018-02-09 21:32:28 +04:00
zbo14
1d16df6a92 add test, TrySend in broadcast 2018-02-09 21:32:27 +04:00
Ethan Buchman
e7bc946760 Merge pull request #1200 from tendermint/update-deps
Update tmlibs & protobuf deps
2018-02-09 11:00:43 -05:00
Ethan Buchman
cf1e1f5899 Merge pull request #1194 from tendermint/1177-semantics-of-currate-low-msg
improve "curRate too low" message
2018-02-09 11:00:09 -05:00
Anton Kaliaev
2f8372d629 update protobuf 2018-02-09 13:58:36 +04:00
Anton Kaliaev
d84e4effce update tmlibs 2018-02-09 13:47:51 +04:00
Anton Kaliaev
52ce4c20f8 Fix RepeatTimer memory leak (#137)
fix RepeatTimer memory leak (Refs #137)

* test case

* drain channels on reset

Leaking memory:
```
leaktest.go:144: leaktest: leaked goroutine: goroutine 116 [chan send]:
        github.com/tendermint/tmlibs/common.(*RepeatTimer).fireRoutine(0xc42006a410, 0xc4203403c0, 0xc42031b2c0)
                /go/src/github.com/tendermint/tmlibs/common/repeat_timer.go:160 +0x6e
        created by github.com/tendermint/tmlibs/common.(*RepeatTimer).reset
                /go/src/github.com/tendermint/tmlibs/common/repeat_timer.go:196 +0xe9
```

The alternative solution could be draining channels on the client side.

* add one more select instead of draining

thanks to Jae
2018-02-09 13:31:32 +04:00
Anton Kaliaev
0c1b91b762 revert back curRate != 0 2018-02-09 13:02:44 +04:00
Anton Kaliaev
c8990d06d9 remove curRate != 0 2018-02-09 12:01:13 +04:00
Anton Kaliaev
b0a55882b2 lower the minRecvRate
See https://github.com/tendermint/tendermint/issues/1177#issuecomment-363720118
2018-02-09 12:01:12 +04:00
Anton Kaliaev
d1fa44e816 improve "curRate too low" message
Refs #1177

Note on labels:
KB - 1024
kB - 1000
https://ux.stackexchange.com/questions/13815/files-size-units-kib-vs-kb-vs-kb
2018-02-09 12:01:12 +04:00
Ethan Buchman
199ea40980 Merge pull request #1196 from tendermint/1149-TestReactorValidatorSetChanges-fails-non-deterministically
WIP: TestReactorValidatorSetChanges fails non deterministically
2018-02-09 01:51:17 -05:00
Ethan Buchman
66fc476e1e Merge pull request #1173 from tendermint/memory-leak-in-reconnect-to-peer-2
fix memory leak in mempool reactor
2018-02-09 01:50:34 -05:00
Ethan Buchman
82ab92da9a Merge pull request #139 from tendermint/expose-channel-on-clist
add waitCh as an alternative to waitGroup
2018-02-09 01:18:39 -05:00
Ethan Buchman
6b347200d9 Merge pull request #1197 from tendermint/1155-seed-mode-flag
add seed_mode flag (`--p2p.seed_mode`)
2018-02-08 17:48:39 -05:00
Ethan Buchman
8a908a7cf9 Merge pull request #1193 from tendermint/return-back-cmd-logging
With must be called on log.filter, otherwise "main" entries get filtered
2018-02-08 16:30:29 -05:00
Ethan Buchman
0bcc11c9bc Merge pull request #1191 from tendermint/event-buffer-slice-clearing-on-flush
types: TxEventBuffer.Flush now uses capacity preserving slice clearing idiom
2018-02-08 16:28:47 -05:00
Ethan Buchman
35bb398b1f Merge pull request #147 from tendermint/reduce-bitArray-fragility
common/BitArray: reduce fragility with methods
2018-02-08 15:31:30 -05:00
Ethan Buchman
0247a21a93 Merge pull request #1086 from tendermint/966-deterministic-tooling-for-releases
Distribution improvements (freeze glide version + get rid of gox)
2018-02-08 15:26:11 -05:00
Anton Kaliaev
cf1f483526 add seed_mode flag (--p2p.seed_mode) 2018-02-08 17:20:55 +04:00
Anton Kaliaev
3f9aa8d8fa document that msgBytes in p2p/connection change 2018-02-08 13:25:26 +04:00
Anton Kaliaev
d6d1f8512d do not reset pingTimer
don't bother with this "only ping when we havent heard from them". lets
just always ping every peer from the sendRoutine every 10s no matter
what. if they dont pong within pongTimeout, disconnect :)
2018-02-08 13:08:11 +04:00
Anton Kaliaev
2b2c233977 write docs for Reactor interface 2018-02-08 13:07:40 +04:00
Ethan Buchman
7640e6a29f add some p2p TODOs 2018-02-08 12:46:04 +04:00
Anton Kaliaev
b0ca8a0872 With must be called on log.filter, otherwise "main" entries get filtered
Also, we should allow "main" module to log INFO messages like

```
I[02-07|07:57:25.074] Found private validator                      module=main path=/home/vagrant/.tendermint/config/priv_validator.json
I[02-07|07:57:25.076] Found genesis file                           module=main path=/home/vagrant/.tendermint/config/genesis.json
```

Refs https://github.com/cosmos/gaia/issues/118

**BEFORE**:
```
$ tendermint init

```

**AFTER**:
```
$ tendermint init
I[02-07|07:57:25.074] Found private validator                      module=main path=/home/vagrant/.tendermint/config/priv_validator.json
I[02-07|07:57:25.076] Found genesis file                           module=main path=/home/vagrant/.tendermint/config/genesis.json
```
2018-02-07 12:08:13 +04:00
Ethan Buchman
9e767771fc Merge pull request #1188 from ltfschoen/patch-1
Update getting-started.rst with Python 3 example
2018-02-06 12:53:47 -05:00
Emmanuel Odeke
763dc21393 common/BitArray: reduce fragility with methods
Fixes https://github.com/tendermint/tmlibs/issues/145
Fixes https://github.com/tendermint/tmlibs/issues/146

The code in here has been fragile when it comes to nil
but these edge cases were never tested, although they've
showed up in the wild and were only noticed because
the reporter actually read the logs otherwise
we'd have never known.

This changes covers some of these cases and adds some tests.
2018-02-06 01:12:24 -08:00
Anton Kaliaev
6c8d7a8c19 deterministic tooling for releases
get rid of gox

build target builds inside docker, dev-build - locally

Revert "build target builds inside docker, dev-build - locally"

This reverts commit 8ba89d5e8c5668e3839ff49952a9166d1158f6e8.

add build tags to make build/build_race/install

use tendermint's fork of glide instead of tar.gz

remove TMHOME unused var + set length for git hash

get rid of GOTOOLS_CHECK

fixes after review

zip

needed for distribution
2018-02-06 12:46:13 +04:00
Emmanuel Odeke
15ef57c6d0 types: TxEventBuffer.Flush now uses capacity preserving slice clearing idiom
Fixes https://github.com/tendermint/tendermint/issues/1189

For every TxEventBuffer.Flush() invoking, we were invoking
a:
  b.events = make([]EventDataTx, 0, b.capacity)
whose intention is to innocently clear the events slice but
maintain the underlying capacity.

However, unfortunately this is memory and garbage collection intensive
which is linear in the number of events added. If an attack had access
to our code somehow, invoking .Flush() in tight loops would be a sure
way to cause huge GC pressure, and say if they added about 1e9
events maliciously, every Flush() would take at least 3.2seconds
which is enough to now control our application.

The new using of the capacity preserving slice clearing idiom
takes a constant time regardless of the number of elements with zero
allocations so we are killing many birds with one stone i.e
  b.events = b.events[:0]

For benchmarking results, please see
https://gist.github.com/odeke-em/532c14ab67d71c9c0b95518a7a526058
for a reference on how things can get out of hand easily.
2018-02-05 23:34:15 -08:00
Luke Schoen
f37c502fd8 Update getting-started.rst with Python 3 example 2018-02-06 16:00:51 +11:00
Anton Kaliaev
945b0e6eca cleanup glide.yaml 2018-02-05 22:53:44 +04:00
Anton Kaliaev
84a0a1987c comment out tests for now
https://github.com/tendermint/tendermint/pull/1173#issuecomment-363173047
2018-02-05 22:26:14 +04:00
Anton Kaliaev
11b68f1934 rewrite broadcastTxRoutine to use channels
https://play.golang.org/p/gN21yO9IRs3

```
func waitWithCancel(f func() *clist.CElement, ctx context.Context) *clist.CElement {
	el := make(chan *clist.CElement, 1)
	select {
	case el <- f():
```
will just run f() blockingly, so this doesn't change much in terms of behavior.
2018-02-05 16:36:26 +04:00
Anton Kaliaev
202d9a2c0c fix memory leak in mempool reactor
Leaking goroutine:
```
114 @ 0x42f2bc 0x42f3ae 0x440794 0x4403b9 0x468002 0x9fe32d 0x9ff78f 0xa025ed 0x45e571
```

Explanation:
it blocks on an empty clist forever. so unless theres txs coming in,
this go routine will just sit there, holding onto the peer too.
if we're constantly reconnecting to some peer, old instances are not
garbage collected, leading to memory leak.

Fixes https://github.com/cosmos/gaia/issues/108
Previous attempt https://github.com/tendermint/tendermint/pull/1156
2018-02-05 13:52:18 +04:00
Anton Kaliaev
19e818fdf7 Merge pull request #142 from tendermint/ishex-fragility
common: IsHex should be able to handle 0X prefixed strings
2018-02-05 13:14:53 +04:00
Anton Kaliaev
91b41ddd59 add waitCh as an alternative to waitGroup
new methods:
 - [CList] WaitChan()
 - [CElement] NextWaitChan()
 - [CElement] PrevWaitChan()

Refs https://github.com/tendermint/tendermint/pull/1173
2018-02-05 11:36:36 +04:00
Ethan Buchman
bf84e82577 Merge pull request #1184 from tendermint/sdk2-tmlibs-abci
Updates for tmlibs and abci (sdk2)
2018-02-03 10:45:54 -05:00
Ethan Buchman
abca9a2d61 woops - bring back glide.lock file 2018-02-03 03:59:16 -05:00
Ethan Buchman
d34286c421 minor fixes - tests pass 2018-02-03 03:54:49 -05:00
Anton Kaliaev
bb2bdbc0e1 add missing element (tag.Value) to keyForTag
encoded as %s. not sure this will work with raw bytes
2018-02-03 03:52:25 -05:00
Ethan Buchman
e7747f7d66 it compiles 2018-02-03 03:52:17 -05:00
Ethan Buchman
7a5060dc52 replace data.Bytes with cmn.HexBytes 2018-02-03 03:47:01 -05:00
Ethan Buchman
426379dc47 remove use of wire/nowriter 2018-02-03 03:39:14 -05:00
Ethan Buchman
cd0fd06b0d update for sdk2 libs. need to fix kv test
NOTE we only updating for tmlibs and abci
2018-02-03 03:35:02 -05:00
Ethan Buchman
4e3488c677 update types 2018-02-03 03:23:10 -05:00
Ethan Buchman
061ad355bb update glide 2018-02-03 03:22:56 -05:00
Ethan Buchman
2679b7554b lite: comment out iavl code - TODO #1183 2018-02-03 03:02:49 -05:00
Ethan Buchman
5a4f56056e Merge pull request #189 from tendermint/no-wire-crypto
remove go-wire and go-crypto deps
2018-02-03 02:55:22 -05:00
Ethan Buchman
1148027baf remove go-wire and go-crypto deps 2018-02-03 02:39:34 -05:00
Ethan Buchman
21dd648732 Merge pull request #187 from tendermint/no-iavl
Remove IAVL dependency
2018-02-03 02:26:26 -05:00
Ethan Buchman
baea45177d example/dummy: remove iavl dep - just use raw db 2018-02-03 02:02:40 -05:00
Ethan Buchman
deaaf014d8 Merge pull request #141 from tendermint/no-wire
merkle: remove go-wire dep by copying EncodeByteSlice
2018-02-03 01:57:27 -05:00
Emmanuel Odeke
951333ecb0 common: IsHex should be able to handle 0X prefixed strings
IsHex should also successfully decode strings prefixed with
0X instead of only 0x strings.

Also add tests generally for IsHex.
2018-02-02 23:41:24 -07:00
Ethan Buchman
d6d97889f2 merkle: remove go-wire dep by copying EncodeByteSlice 2018-02-03 01:29:39 -05:00
Ethan Buchman
c617737e03 Merge pull request #184 from tendermint/sdk2
update for go-wire sdk2
2018-02-03 00:22:50 -05:00
Ethan Buchman
4450a20bde types: check bufio.Reader 2018-02-03 00:24:48 -05:00
Ethan Buchman
d2845d923b add more versions to glide 2018-02-03 00:14:15 -05:00
Ethan Buchman
700792bc10 update glide 2018-02-03 00:08:39 -05:00
Ethan Buchman
11d383f1c7 update for go-wire sdk2 2018-02-02 23:56:19 -05:00
Ethan Buchman
4fc3055dbd update glide again 2018-02-02 23:50:24 -05:00
Ethan Buchman
1d7fc78ea1 update glide 2018-02-02 23:49:14 -05:00
Ethan Buchman
5a94049dbc update glide again 2018-02-02 23:42:22 -05:00
Ethan Buchman
9e897ab8b0 update glide 2018-02-02 23:34:07 -05:00
Ethan Buchman
690d6c6070 cli: WriteDemoConfig -> WriteConfigVals 2018-02-02 23:05:28 -05:00
Ethan Buchman
4542cc5a71 Merge pull request #64 from tendermint/sdk2
Merge sdk2 into develop
2018-02-02 22:48:01 -05:00
Ethan Buchman
027c37281d Merge pull request #123 from tendermint/sdk2
Merge sdk2 into develop
2018-02-02 22:32:33 -05:00
Ethan Buchman
1b5176003a DbBackend -> DBBackend 2018-02-02 22:31:17 -05:00
Adrian Brink
45b71f7d11 Bump tmlibs commit. Needs to be changed to develop as soon as tmlibs PR is merged 2018-02-02 18:51:41 +01:00
Adrian Brink
cbc63518e5 Export DbBackendType in order to fix IAVL tests 2018-02-02 18:50:24 +01:00
Adrian Brink
0391e499fb Clean up glide.yaml 2018-02-02 18:31:25 +01:00
Adrian Brink
2e76546223 Clean up glide.yaml 2018-02-02 18:09:48 +01:00
Adrian Brink
6b2409f714 Update go-wire to develop 2018-02-02 14:12:29 +01:00
Anton Kaliaev
95b53c80e1 Merge pull request #140 from tendermint/sdk2-hashers-and-simple-map
Sdk2 hashers and simple map
2018-02-02 14:15:56 +04:00
Anton Kaliaev
9ccfe161ad lowercase memDB type key 2018-02-02 14:08:05 +04:00
Jae Kwon
f6dbe9ba05 Refactor string -> dbBackendType 2018-02-02 14:08:05 +04:00
Jae Kwon
b95cac5f4f Remove unnecessary Byteser interface 2018-02-02 14:08:05 +04:00
Jae Kwon
c75298e359 Update SimpleMap to hash both keys and values for benefit; Hashable is Hasher; Don't assume go-wire 2018-02-02 14:08:05 +04:00
Jae Kwon
580c3db8f9 Hashable -> Hasher; SimpleMap upgrade; No "SimpleHashFromBinary" (#128)
* Update SimpleMap to hash both keys and values for benefit; Hashable is Hasher; Don't assume go-wire
2018-02-02 12:51:30 +04:00
Jae Kwon
7ef6d4b813 Glide update 2018-02-02 12:51:30 +04:00
Jae Kwon
ff230682d1 Fix logical time (#122)
Should fix a nondeterministic bug so...
2018-02-02 12:51:30 +04:00
Ethan Buchman
cfbb9338bd use go-wire sdk2 2018-02-02 12:51:30 +04:00
Jae Kwon
6637c202bf Revert "Update to use tmlibs sdk2"
This reverts commit ae58af0be534a5c344896461b97a6490d428deb4.
Breaks the tests.
2018-02-02 12:51:30 +04:00
Jae Kwon
4e2a275a67 Update to use tmlibs sdk2 2018-02-02 12:51:30 +04:00
Jae Kwon
bcd8d403dc Remove encoding from common cli 2018-02-02 12:51:29 +04:00
Ethan Buchman
62c9cad484 Merge pull request #1180 from tendermint/1146-add-BFT-time-spec
Add BFT time spec
2018-02-01 16:38:05 -05:00
Zarko Milosevic
4cbdbbaac9 Add BFT time spec 2018-02-01 15:22:08 +01:00
Emmanuel Odeke
9ed296ae71 GetByHeight switches between linear & binary search on >=50 items
* GetByHeight will now switch to using binary search once
we have  >=50 items.
* Feedback from @ebuchman to catch a missed spot where
we forgot about lazy sorting that the original code
assumed would always have sorted commits by height.
Added a lazy sorting routine here too.
A test as well to ensure that we always get the properly
sorted and last value.
2018-01-31 20:53:03 -07:00
Zach Ramsay
e8d0960cef nolint 2018-01-31 20:52:12 -07:00
Emmanuel Odeke
2023115ff8 lite: TestCacheGetsBestHeight with GetByHeight and GetByHeightBinarySearch
Addressing PR review requests from @melekes and @ebuchman to
add a test that checks that the heights returned from both are
the same thus providing a perceptible equivalence of the code
linear range search vs binary range search code.
2018-01-31 20:52:12 -07:00
Adrian Brink
7790ae9e6f Fix spelling mistake 2018-01-31 20:52:12 -07:00
Emmanuel Odeke
206da7a1b8 lite: < len(v) in for loop check, as per @melekes' recommendation
Also lazily load the commits to only be run once when
the benchmarks are activated, lest it slows down all the tests
2018-01-31 20:52:11 -07:00
Emmanuel Odeke
14eaba9ec3 lite: memStoreProvider GetHeightBinarySearch method + fix ValKeys.signHeaders
Updates #1021

* Implement a GetHeightBinarySearch method that looks for
the height using the binary search algorithm guaranteeing
worst case iteration time of O(log2(n))
whereas
worst case iteration time of O(n) for the current linear search

So if n we had 500 commits stored by height and sorted, to
trigger the worst case scenario for each, pass in
the most negative height you can find e.g. -1
Linear search: 500 iterations
Binary search: 9 iterations

with n=1000, qHeight = -1
Linear search: 1000 iterations
Binary search: 10 iterations

with n=1e6, qHeight = -1
Linear search: 1e6 iterations
Binary search: 20 iterations

Of course there are realistic expectations e.g. a max of
commits that may be saved so linear search might be useful
for very small size set because it has less preparing overhead
and only ~2 types of comparisons, but nonetheless binary search
shines as soon as we start to hit say 50 commits to search from
as you can see below:

```shell
$ go test -v -run=^$ -bench=MemStore
goos: darwin
goarch: amd64
pkg: github.com/tendermint/tendermint/lite
BenchmarkMemStoreProviderGetByHeightLinearSearch5-4     300000        6491 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch50-4      200000       12064 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch100-4      50000       32987 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch500-4       5000      395521 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch1000-4	       500     2940724 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch5-4     300000        6281 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch50-4      200000       10117 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch100-4     100000       18447 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch500-4      20000       89029 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch1000-4	      5000      265719 ns/op      1600 B/op       15 allocs/op
PASS
ok    github.com/tendermint/tendermint/lite 86.614s
$ go test -v -run=^$ -bench=MemStore
goos: darwin
goarch: amd64
pkg: github.com/tendermint/tendermint/lite
BenchmarkMemStoreProviderGetByHeightLinearSearch5-4     300000        6779 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch50-4      100000       12980 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch100-4      30000       43598 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch500-4       5000      377462 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightLinearSearch1000-4	       500     3278122 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch5-4     300000        7084 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch50-4      200000        9852 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch100-4     100000       19020 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch500-4      20000       99463 ns/op      1600 B/op       15 allocs/op
BenchmarkMemStoreProviderGetByHeightBinarySearch1000-4	      5000      259293 ns/op      1600 B/op       15 allocs/op
PASS
ok    github.com/tendermint/tendermint/lite 86.204s
```

which gives
```shell
$ benchstat old.txt new.txt
name                               old time/op    new time/op    delta
MemStoreProviderGetByHeight5-4       6.63µs ± 2%    6.68µs ± 6%   ~             (p=1.000 n=2+2)
MemStoreProviderGetByHeight50-4      12.5µs ± 4%    10.0µs ± 1%   ~             (p=0.333 n=2+2)
MemStoreProviderGetByHeight100-4     38.3µs ±14%    18.7µs ± 2%   ~             (p=0.333 n=2+2)
MemStoreProviderGetByHeight500-4      386µs ± 2%      94µs ± 6%   ~             (p=0.333 n=2+2)
MemStoreProviderGetByHeight1000-4    3.11ms ± 5%    0.26ms ± 1%   ~             (p=0.333 n=2+2)
```

If need be we can make a hybrid algorithm that switches between the
linear and binary search depending on the number of items.
This is reminiscent of Python's TimSort algorithm.
2018-01-31 20:52:11 -07:00
Ethan Buchman
2919bc3f7f Merge pull request #1178 from tendermint/nice-err-msg
improve error message
2018-01-31 21:32:58 -05:00
Zach Ramsay
1c01671ec6 improve vague error msg, closes #1158 2018-01-31 17:44:19 +00:00
Ethan Buchman
13f009bf68 Merge pull request #136 from tendermint/fix-bitArray-nil-update
common: fix BitArray.Update to avoid nil dereference
2018-01-29 17:17:18 -05:00
Emmanuel Odeke
85be26c675 common: BitArray: feedback from @adrianbrink to simplify tests 2018-01-28 22:02:51 -07:00
Emmanuel Odeke
84afef20f5 common: fix BitArray.Update to avoid nil dereference
Update previously only checked that the receiver was
non-nil but didn't check that the input parameter to update
"o" was non-nil causing a nil dereference in cases such as
fe632ea32a/consensus/reactor.go (L306)

Fixes https://github.com/tendermint/tendermint/issues/1169
2018-01-28 10:39:42 -07:00
Ethan Buchman
fe632ea32a spec: minor fixes 2018-01-26 17:26:33 -05:00
Zach Ramsay
5b368252ac spec: more fixes 2018-01-26 17:26:33 -05:00
Zach Ramsay
8cca953590 spec: remove notes, see #1152 2018-01-26 17:26:33 -05:00
Zach Ramsay
4b4a2029c4 spec: typos & other fixes 2018-01-26 17:26:33 -05:00
Ethan Buchman
6aa85357b6 Merge pull request #1160 from shapeshed/patch-1
Fix documentation typos
2018-01-26 17:17:43 -05:00
Ethan Buchman
eae62ec09b Merge branch 'develop' into patch-1 2018-01-26 17:17:28 -05:00
Ethan Buchman
18d96266bc Merge pull request #1140 from tendermint/feature/vagrant
Fix Vagrantfile
2018-01-26 17:12:06 -05:00
George Ornbo
4529fd6787 Fix documentation typos 2018-01-26 14:44:48 +00:00
Ethan Buchman
4a99a2a07d update contributing.md 2018-01-26 01:18:33 -05:00
Adrian Brink
4b63b3aa0b Switch to correct directory in Vagrant 2018-01-26 01:16:07 -05:00
Adrian Brink
fc860c3a07 Final Vagrantfile 2018-01-26 01:16:07 -05:00
Adrian Brink
2f147ec000 Remove upgrade step 2018-01-26 01:16:07 -05:00
Adrian Brink
0a7a190cd1 Fix vagrantfile
If you get an error, please run `vagrant box update`.
2018-01-26 01:16:07 -05:00
Ethan Buchman
3366dfe32a Merge pull request #1151 from tendermint/fix/p2p-stop-conn
p2p/conn: fix blocking on pong during quit and break out of loops
2018-01-25 02:45:06 -05:00
Ethan Buchman
baff4bd8cc p2p/conn: better handling for some stop conditions 2018-01-25 02:11:16 -05:00
Ethan Buchman
fb109db33d update changelog 2018-01-25 02:10:01 -05:00
Ethan Buchman
2f5971532e Merge pull request #1154 from tendermint/fix/consensus-tests
consensus: fix SetLogger in tests
2018-01-25 02:07:20 -05:00
Ethan Buchman
ab13806276 consensus: print go routines in failed test 2018-01-25 01:22:53 -05:00
Ethan Buchman
3ae26bd6e6 consensus: fix SetLogger in tests 2018-01-24 23:34:57 -05:00
Zach
fa8c374aff Merge branch 'master' into develop 2018-01-25 00:10:39 +00:00
Ethan Buchman
27ef3489a0 Merge pull request #1049 from tendermint/p2p-channels
p2p: add Channels to NodeInfo and don't send for unknown channels
2018-01-24 15:29:38 -05:00
Ethan Buchman
b6eb275b22 p2p: fix break in double loop 2018-01-24 14:27:37 -05:00
Ethan Buchman
57cc8ab977 Merge pull request #1143 from tendermint/1091-race-condition
call FlushSync before calling CommitSync
2018-01-24 14:22:43 -05:00
Ethan Buchman
99034904f8 p2p: fix tests for required channels 2018-01-23 23:45:51 -05:00
Ethan Buchman
a0ffcbcee4 Merge pull request #1137 from tendermint/docs-consolidate
WIP: docs consolidation
2018-01-23 23:45:20 -05:00
Ethan Buchman
260affd037 docs consolidation 2018-01-23 23:46:28 -05:00
Ethan Buchman
d7b1b8d3d5 Merge pull request #1129 from tendermint/addrbook
p2p: bust up into sub dirs
2018-01-23 23:10:50 -05:00
Ethan Buchman
50129ad8ac p2p: add Channels to NodeInfo and don't send for unknown channels 2018-01-23 22:43:56 -05:00
Ethan Buchman
5c9cb5e6a2 Merge pull request #1133 from tendermint/fix/stop-peer-for-error
StopPeerForError in blockchain and consensus
2018-01-23 22:26:52 -05:00
Ethan Buchman
4051391039 blockchain: test wip for hard to test functionality [ci skip] 2018-01-23 22:27:33 -05:00
Ethan Buchman
8f3bd3f209 p2p: addrBook.Save() on DialPeersAsync 2018-01-23 22:25:39 -05:00
Ethan Buchman
85816877c6 config: fix addrbook path to go in config 2018-01-23 22:21:17 -05:00
Ethan Buchman
87087b8acd consensus: minor cosmetic 2018-01-23 21:41:13 -05:00
Ethan Buchman
775bb85efb p2p/pex: wait to connect to all peers in reactor test 2018-01-23 21:30:53 -05:00
Ethan Buchman
21ce5856b3 p2p: notes about ListenAddr 2018-01-23 21:26:19 -05:00
Ethan Buchman
f5226e0008 Merge pull request #1144 from tendermint/create-logs-tarball
mercy for developers with slow Internet
2018-01-23 12:47:45 -05:00
Anton Kaliaev
a745fe2eed mercy for developers with slow Internet 2018-01-23 20:37:38 +04:00
Anton Kaliaev
5f3048bd09 call FlushSync before calling CommitSync
if we call it after, we might receive a "fresh" transaction from
  `broadcast_tx_sync` before old transactions (which were not
  committed).

Refs #1091

```
Commit is called with a lock on the mempool, meaning no calls to CheckTx
can start. However, since CheckTx is called async in the mempool
connection, some CheckTx might have already "sailed", when the lock is
released in the mempool and Commit proceeds.

Then, that spurious CheckTx has not yet "begun" in the ABCI app (stuck
in transport?). Instead, ABCI app manages to start to process the
Commit. Next, the spurious, "sailed" CheckTx happens in the wrong place.
```
2018-01-23 16:56:14 +04:00
Ethan Buchman
6a5818e107 Merge pull request #1138 from tendermint/small-fix
Small fix in example
2018-01-22 17:27:35 -05:00
Zarko Milosevic
dfdfd6c98e Small fix in example 2018-01-22 13:10:54 +01:00
Jae Kwon
12142af1cb Remove reliance on global wire.Marshal 2018-01-21 19:03:23 -08:00
Ethan Buchman
3090b05eb4 p2p: use conn.Close when peer is nil 2018-01-21 16:26:59 -05:00
Ethan Buchman
ee674f919f StopPeerForError in blockchain and consensus 2018-01-21 13:32:04 -05:00
Ethan Buchman
813bb6af96 Merge pull request #1092 from tendermint/add-consensus-reactor-doc
Add consensus reactor doc
2018-01-21 12:40:28 -05:00
Ethan Buchman
aecbff725f Merge pull request #1082 from tendermint/document-proposer-selection
Document proposer selection procedure
2018-01-21 12:39:43 -05:00
Ethan Buchman
6679fef2be Merge pull request #1056 from tendermint/feature/mempool-spec
WIP: Mempool specification
2018-01-21 12:39:10 -05:00
Ethan Buchman
c070ed056a Merge pull request #1051 from tendermint/feature/blockchain_reactor_docs
docs: Blockchain Reactor Documentation
2018-01-21 12:38:32 -05:00
Ethan Buchman
2c6ed302b7 minor changes [ci skip] 2018-01-21 12:36:46 -05:00
Adrian Brink
0eb85161aa More specification 2018-01-21 12:35:09 -05:00
Adrian Brink
940145b368 Bullet points for reactor and poolRoutine 2018-01-21 12:32:45 -05:00
Adrian Brink
a30315276b Formatting and documentation 2018-01-21 12:32:23 -05:00
Adrian Brink
6366eb9d99 Cleanup build and structure 2018-01-21 12:31:14 -05:00
Ethan Buchman
44e967184a p2p: tmconn->conn and types->p2p 2018-01-21 00:34:41 -05:00
Ethan Buchman
2ec425ae4b Merge pull request #1128 from tendermint/862-seed-crawler-mode
seed crawler mode
2018-01-20 23:35:26 -05:00
Ethan Buchman
0d7d16005a fixes 2018-01-20 21:44:30 -05:00
Ethan Buchman
5b5cbaa66a p2p: use sub dirs 2018-01-20 21:35:37 -05:00
Ethan Buchman
03550c7076 wip addrbook 2018-01-20 21:33:43 -05:00
Ethan Buchman
930fde056a p2p: add back lost func 2018-01-20 21:28:00 -05:00
Ethan Buchman
8d758560d8 p2p/trustmetric: non-deterministic test 2018-01-20 21:24:22 -05:00
Ethan Buchman
7b87cdaed8 p2p: seed disconnects after sending addrs 2018-01-20 21:24:22 -05:00
Ethan Buchman
c2f97e6454 p2p: seed mode fixes from rebase and review 2018-01-20 21:24:22 -05:00
Ethan Buchman
88eb3e7af0 some minor renames 2018-01-20 21:24:20 -05:00
caffix
949211a137 added a test for PEX reactor seed mode 2018-01-20 21:23:48 -05:00
Ethan Buchman
39d8da3536 docs: update getting started [ci skip] 2018-01-20 21:21:50 -05:00
Ethan Buchman
ae27e85bf7 add warnings about new spec 2018-01-20 21:20:15 -05:00
Ethan Buchman
f2d19162d2 fixes from caffix review 2018-01-20 21:20:09 -05:00
Zarko Milosevic
d36e118bf6 Add Consensus reactor spec 2018-01-19 19:57:08 +01:00
Ethan Buchman
02c1aef48b Merge pull request #1121 from tendermint/consensus-tests
Consensus tests
2018-01-19 12:50:32 -05:00
Ethan Buchman
6f3d9b4be3 fix race 2018-01-19 01:36:52 -05:00
Ethan Buchman
f06cc6630b mempool: cfg.CacheSize and expose InitWAL 2018-01-19 01:03:03 -05:00
Ethan Buchman
8171628ee5 make tests run faster 2018-01-19 00:59:09 -05:00
Ethan Buchman
1cb76625d3 consensus: rename test funcs 2018-01-19 00:59:09 -05:00
Ethan Buchman
ebeadfc57e dont run metalinter 2018-01-19 00:58:54 -05:00
Ethan Buchman
cca597a9c0 fix and test config file 2018-01-19 00:08:19 -05:00
Ethan Buchman
940db715f4 Merge pull request #1104 from tendermint/p2p-consolidate
WIP: P2P consolidate
2018-01-18 19:00:35 -05:00
Ethan Buchman
ec2b038493 Merge pull request #1103 from tendermint/1100-document-event-subscriptions
document event subscriptions
2018-01-18 19:00:01 -05:00
Ethan Buchman
ba0cb4f10e Merge pull request #1115 from tendermint/docs-tx-format
document tx formats
2018-01-18 18:57:23 -05:00
Ethan Buchman
e764a180d8 docs: fix tx formats [ci skip] 2018-01-18 18:58:33 -05:00
Ethan Buchman
bc19e7843c Merge branch 'develop' into p2p-consolidate 2018-01-18 18:30:37 -05:00
Ethan Buchman
f57f97c4bd fix bash tests 2018-01-18 17:40:12 -05:00
Ethan Buchman
b32474bb1a Merge pull request #1116 from tendermint/feature/prs
Create PULL_REQUEST_TEMPLATE.md
2018-01-18 13:52:18 -05:00
Adrian Brink
0a20e8f268 Create PULL_REQUEST_TEMPLATE.md 2018-01-18 13:53:18 -05:00
Zach Ramsay
9d4d939b89 docs: tx formats: closes #1083, #536 2018-01-18 15:37:56 +00:00
Ethan Buchman
c1e6e73bb1 Merge pull request #1108 from tendermint/zramsay-patch-1
Update p2p README
2018-01-15 10:31:31 -05:00
Ethan Buchman
32741be212 update glide for go-wire and tmlibs 2018-01-14 17:40:16 -05:00
Jae Kwon
442dab45a5 Merge pull request #63 from tendermint/sdk2-newwire
Use new go-wire; PubKey etc are interfaces; Keybase refactor
2018-01-14 13:32:38 -08:00
Ethan Buchman
620c957a44 fix test 2018-01-14 13:24:43 -05:00
Ethan Buchman
64ce7eef16 Merge pull request #1107 from tendermint/p2p-pex-abuse
better abuse handling in pex
2018-01-14 13:03:02 -05:00
Ethan Buchman
fc7915ab4c fixes from review 2018-01-14 13:03:57 -05:00
Zach Ramsay
26aaa283a9 p2p: remove deprecated Dockerfile 2018-01-14 13:51:28 +00:00
Zach
a29c67563c Update p2p README, closes #1102 2018-01-14 13:50:34 +00:00
Jae Kwon
788cc0a792 Use new go-wire; PubKey etc are interfaces; Keybase refactor 2018-01-14 01:09:30 -08:00
Ethan Buchman
17f7a9b510 improve seed dialing logic 2018-01-14 03:56:15 -05:00
Ethan Buchman
3df5fd21cd better abuse handling in pex 2018-01-14 03:22:01 -05:00
Ethan Buchman
99076f1942 Merge pull request #1105 from tendermint/p2p-switch
cleanup switch
2018-01-14 01:20:13 -05:00
Ethan Buchman
3368eeb03e fix tests 2018-01-14 01:19:07 -05:00
Ethan Buchman
68237911ba NetAddress.Same checks ID or DialString 2018-01-14 01:15:37 -05:00
Ethan Buchman
f9e4f6eb6b reorder peer.go methods 2018-01-14 01:15:37 -05:00
Ethan Buchman
8b74a8d6ac NodeInfo not a pointer 2018-01-14 01:15:33 -05:00
Ethan Buchman
08f84cd712 a little more moving around 2018-01-13 23:56:57 -05:00
Ethan Buchman
452d10f368 cleanup switch 2018-01-13 17:37:52 -05:00
Ethan Buchman
8b3fb743cf Merge pull request #1048 from tendermint/p2p-id
P2P ID
2018-01-13 17:35:21 -05:00
Ethan Buchman
7667e11973 remove RemoteAddr from NodeInfo 2018-01-13 17:36:03 -05:00
Ethan Buchman
53a5498fc5 more fixes from review 2018-01-13 17:34:12 -05:00
Ethan Buchman
e4d52401cf some fixes from review 2018-01-13 16:06:51 -05:00
Ethan Buchman
9670519a21 remove PoW from ID 2018-01-13 15:50:59 -05:00
Ethan Buchman
b1485b181a Merge branch 'p2p-consolidate' into p2p-id 2018-01-13 15:20:23 -05:00
Ethan Buchman
47a6928890 Merge pull request #1030 from tendermint/864-distinguish-between-seeds-and-manual-peers
Distinguish between seeds and manual peers
2018-01-13 15:12:47 -05:00
Ethan Buchman
c1e167e330 note in trust metric test 2018-01-13 15:11:13 -05:00
Ethan Buchman
e2b3b5b58c dial_persistent_peers -> dial_peers with persistent option 2018-01-13 14:50:58 -05:00
Ethan Buchman
e6b70baae0 Merge branch 'develop' into 864-distinguish-between-seeds-and-manual-peers 2018-01-13 14:34:32 -05:00
Anton Kaliaev
b40aa91b41 document event subscriptions
Refs #1100
2018-01-12 12:53:34 -06:00
Ethan Buchman
a13b17ec6c Merge pull request #792 from tendermint/config
Config Improvements
2018-01-10 14:41:30 -05:00
Ethan Buchman
b32a507a1b Merge pull request #1088 from tendermint/1087-update-docker
Update docker image
2018-01-10 14:23:06 -05:00
Ethan Buchman
d6e01e8cee Merge pull request #1089 from tendermint/1075-document-underflow-overflow
document the maximum supported voting power due to overflow [ci skip]
2018-01-10 14:20:31 -05:00
Anton Kaliaev
c79ba3c349 document the maximum supported voting power due to overflow [ci skip]
Refs #1075
2018-01-10 14:21:26 -05:00
Anton Kaliaev
12ca972761 Merge branch 'develop' into 1087-update-docker 2018-01-10 11:08:14 -06:00
Zach Ramsay
657ad214cb p2p tests: put priv_val in right place 2018-01-10 16:30:00 +00:00
Zach
39acf1c5e8 Merge branch 'develop' into config 2018-01-10 14:21:24 +00:00
Anton Kaliaev
075ae1e301 minimal test for dialing seeds in pex reactor 2018-01-09 18:29:29 -06:00
Anton Kaliaev
705d51aa42 move dialSeedsIfAddrBookIsEmptyOrPEXFailedToConnect into PEX reactor 2018-01-09 17:54:29 -06:00
Anton Kaliaev
ef0493ddf3 rewrite Peers section of Using Tendermint guide [ci skip] 2018-01-09 17:54:28 -06:00
Anton Kaliaev
1b455883d2 readd /dial_seeds 2018-01-09 17:54:28 -06:00
Anton Kaliaev
e4897b7bdd rename manual peers to persistent peers 2018-01-09 16:18:05 -06:00
Anton Kaliaev
37f86f9518 update changelog [ci skip] 2018-01-09 16:04:07 -06:00
Anton Kaliaev
28fc15028a distinguish between seeds and manual peers in the config/flags
- we only use seeds if we can’t connect to peers in the addrbook.
- we always connect to nodes given in config/flags

Refs #864
2018-01-09 16:03:24 -06:00
Anton Kaliaev
179d6062e4 try to connect through addrbook before requesting peers from seeds
we only use seeds if we can’t connect to peers in the addrbook.

Refs #864
2018-01-09 16:03:24 -06:00
Zach
c521f385a6 add quick start guide (#1069) 2018-01-09 20:35:47 +00:00
Anton Kaliaev
b8214fce66 Merge branch 'develop' into 1087-update-docker 2018-01-09 12:21:23 -06:00
Ethan Buchman
03a14d8342 docs/p2p: updates from review (#1076) 2018-01-09 11:44:49 -06:00
Anton Kaliaev
48638eaa20 update docker readme 2018-01-09 11:05:15 -06:00
Anton Kaliaev
170777300e update docker
Closes #1087
2018-01-09 11:04:37 -06:00
Adrian Brink
32311acd01 Vulnerability in light client proxy (#1081)
* Vulnerability in light client proxy

When calling GetCertifiedCommit the light client proxy would call
Certify and even on error return the Commit as if it had been correctly
certified.

Now it returns the error correctly and returns an empty Commit on error.

* Improve names for clarity

The lite package now contains StaticCertifier, DynamicCertifier and
InqueringCertifier. This also changes the method receivers from one
letter to two letter names, which will make future refactoring easier
and follows the coding standards.

* Fix test failures

* Rename files

* remove dead code
2018-01-09 10:36:11 -06:00
Ethan Buchman
b9cbaf8f10 priv-val: fix timestamp for signing things that only differ by timestamp 2018-01-08 16:36:16 -05:00
Ethan Buchman
8d86b6c2d2 Merge pull request #1084 from tendermint/fix-make-dist-script
fix broken `make dist` target
2018-01-08 16:20:36 -05:00
Anton Kaliaev
555f560ecd fix broken make dist target 2018-01-08 13:13:47 -06:00
Zarko Milosevic
dba4815616 Define requirements of the proposer selection procedure 2018-01-08 14:10:01 +01:00
Ethan Buchman
cf42611187 Merge pull request #997 from tendermint/919-careful-with-validator-voting
check for overflow and underflow while choosing proposer
2018-01-07 16:48:39 -05:00
Ethan Buchman
90c691df2b Merge pull request #1063 from tendermint/feature/Issue1020
NewInquiring returns error instead of swallowing it
2018-01-07 16:30:33 -05:00
Adrian Brink
13fa23c568 Add error checking 2018-01-06 22:24:58 +01:00
Ethan Buchman
67a47e6a0b Address is a type alias 2018-01-06 16:05:50 -05:00
Jae Kwon
124c58d48f Merge pull request #1071 from tendermint/revert-1053-feature/buildprocess
Revert "Changes to achieve a standardized build process and deterministic builds"
2018-01-05 22:42:19 -08:00
Jae Kwon
a034600024 Revert "Changes to achieve a standardized build process and deterministic builds" 2018-01-05 22:35:57 -08:00
Ethan Buchman
ffbe912ff3 Merge pull request #171 from tendermint/sdk2
WIP: Sdk2
2018-01-06 01:29:55 -05:00
Zach
e0e600df05 Merge branch 'develop' into config 2018-01-06 05:30:38 +00:00
Ethan Buchman
2bd556205d disable fragile bash test 2018-01-05 22:57:45 -05:00
Ethan Buchman
a55adfaa4f tests: use shasum to avoid rarer dependency 2018-01-05 22:33:18 -05:00
Ethan Buchman
92f5ae5a84 fix vagrant [ci skip] 2018-01-05 22:26:10 -05:00
Ethan Buchman
e1e3ea4e7f fix a get_tools 2018-01-05 22:22:55 -05:00
Ethan Buchman
a488c0f027 update changelog and glide and a fix 2018-01-05 22:19:37 -05:00
Ethan Buchman
629e2fc2a0 update readme 2018-01-05 21:52:52 -05:00
Ethan Buchman
c38ac88d69 Merge branch 'develop' into sdk2 2018-01-05 21:45:48 -05:00
Ethan Buchman
d57ddec302 Merge pull request #1053 from tendermint/feature/buildprocess
Changes to achieve a standardized build process and deterministic builds
2018-01-05 21:13:42 -05:00
Greg Szabo
bb3dc10f24 Makefile improvements for deterministic builds based on Bucky's feedback 2018-01-05 14:22:13 -05:00
Greg Szabo
2cc50938a4 Merge branch 'develop' into feature/buildprocess 2018-01-05 13:01:40 -05:00
Adrian Brink
ba475d3128 Fix formatting 2018-01-05 13:25:58 +01:00
Adrian Brink
ed81fb54ec NewInquiring returns error instead of swallowing it 2018-01-05 13:24:16 +01:00
Ethan Buchman
8481da2405 Merge pull request #1046 from tendermint/abci-spec-docs
docs: add abci spec
2018-01-04 13:57:40 -05:00
Ethan Buchman
ecb7303e35 Merge branch 'develop' into abci-spec-docs 2018-01-04 13:57:08 -05:00
Ethan Frey
9cb45eb7df Add skeleton for functionality and concurrency 2018-01-04 19:08:03 +01:00
Ethan Buchman
6855e62f0a Merge pull request #1052 from tendermint/feature/p2p_docs
docs: P2P Documentation
2018-01-04 12:32:28 -05:00
Ethan Buchman
82aed60acb Merge pull request #173 from tendermint/cobra-helpers
fill in empty command helpers
2018-01-04 12:19:55 -05:00
Ethan Buchman
19e065b6f5 Merge pull request #174 from tendermint/examples-in-readme
update readme with example code
2018-01-04 12:19:18 -05:00
Ethan Buchman
f205a937cf Merge pull request #172 from tendermint/spec-docs
convert spec to .rst for consumption by tendermint RTD
2018-01-04 12:16:00 -05:00
Ethan Frey
17b61db40a Document p2p and rpc messages 2018-01-04 18:12:48 +01:00
Ethan Frey
7b52499463 Start writing mempool specification
Include overview and configuration options.
2018-01-04 17:11:35 +01:00
Zach
f6172e84a9 Merge pull request #176 from tendermint/shasum
use sha256sum because more secure
2018-01-04 15:53:56 +00:00
Zach Ramsay
f47b8f8a2d use sha256sum because more secure 2018-01-04 15:41:25 +00:00
Ethan Buchman
3ebe3250ff Merge pull request #58 from tendermint/sdk2
SDK2
2018-01-03 20:32:07 -05:00
Greg Szabo
f67f99c227 Extended install document with docker option. Added extra checks to developer's build target. 2018-01-03 17:24:11 -05:00
Greg Szabo
0430ebf95c Makefile changes for cross-building and standardized builds using gox 2018-01-03 14:58:23 -05:00
Adrian Brink
f602de437e Move P2P docs into docs folder 2018-01-03 10:49:47 +01:00
Zach Ramsay
a573b20888 docs: add counter/dummy code snippets
closes https://github.com/tendermint/abci/issues/134
2018-01-03 01:23:38 +00:00
Zach Ramsay
a77213e6c5 update readme, closes #134 2018-01-03 00:48:00 +00:00
Ethan Buchman
156416fe27 fix wordlist paths 2018-01-02 16:39:43 -05:00
Ethan Buchman
793d7717dc no metalinter for now 2018-01-02 16:34:25 -05:00
Ethan Buchman
1afc034006 Merge pull request #119 from tendermint/sdk2
Sdk2
2018-01-02 11:37:17 -05:00
Ethan Buchman
2bb538b150 cmn: fix HexBytes.MarshalJSON 2018-01-02 11:05:53 -05:00
Ethan Buchman
1460540acd metalinter is for another time 2018-01-02 11:05:39 -05:00
Ethan Buchman
8bb383c264 Merge pull request #59 from tendermint/sdk2-cleanup
Sdk2 cleanup
2018-01-02 10:54:40 -05:00
Ethan Buchman
1838db2880 circle 2018-01-02 10:53:56 -05:00
Ethan Buchman
7fe3d5dac2 metalinter 2018-01-02 10:48:36 -05:00
Ethan Buchman
a991e2fe9c Merge branch 'develop' into sdk2 2018-01-02 10:29:04 -05:00
Ethan Buchman
488ae529ad p2p: authenticate peer ID 2018-01-01 23:23:11 -05:00
Ethan Buchman
6e823c6e87 p2p: support addr format ID@IP:PORT 2018-01-01 23:08:20 -05:00
Ethan Buchman
7d35500e6b p2p: add ID to NetAddress and use for AddrBook 2018-01-01 22:39:08 -05:00
Ethan Buchman
a17105fd46 p2p: peer.Key -> peer.ID 2018-01-01 22:39:05 -05:00
Ethan Buchman
b289d2baf4 persistent node key and ID 2018-01-01 21:21:42 -05:00
Ethan Buchman
f2e0abf1dc p2p: reorder some checks in addPeer; add comments to NodeInfo 2018-01-01 21:21:39 -05:00
Ethan Buchman
528154f1a2 p2p: PrivKey need not be Ed25519 2018-01-01 19:44:01 -05:00
Ethan Buchman
bc71840f06 more p2p docs 2018-01-01 16:30:36 -05:00
Zach Ramsay
47d5fd0f1b prettify the command helpers 2018-01-01 16:21:36 +00:00
Zach Ramsay
cd15b677ec docs: add abci spec 2018-01-01 15:35:28 +00:00
Zach Ramsay
12fd445e6f spec: convert to rst 2018-01-01 14:48:29 +00:00
Zach Ramsay
e9ff0eefbb move spec from readme to own file 2018-01-01 14:45:57 +00:00
Ethan Buchman
1acb12edf5 p2p docs 2017-12-31 17:11:09 -05:00
Ethan Buchman
008de93bbe Merge pull request #1039 from tendermint/add_consensus_spec
Spec of consensus/gossip protocol
2017-12-31 14:59:32 -05:00
Zach
4e834baa9a docs: update ecosystem.rst (#1037)
* docs: update ecosystem.rst

* typo [ci skip]
2017-12-31 13:54:50 +00:00
Ethan Buchman
b31d37b480 update circle.yml 2017-12-30 18:25:42 -05:00
Ethan Buchman
d058d0098f keys/bcrypt 2017-12-30 17:30:18 -05:00
Ethan Buchman
8c61bb27b7 fix nano test 2017-12-30 17:30:18 -05:00
Ethan Buchman
bd30cb4de9 keys/keybase.go: comments and fixes 2017-12-30 17:30:18 -05:00
Ethan Buchman
f3f49c2362 keys/words 2017-12-30 17:30:18 -05:00
Ethan Buchman
1f8e66fdb3 nano: update comments 2017-12-30 17:29:51 -05:00
Ethan Buchman
7c77f6b2da move hd into keys/hd 2017-12-30 17:29:51 -05:00
Ethan Buchman
87f2005fa8 hd: comments and some cleanup 2017-12-30 17:29:51 -05:00
Zarko Milosevic
96e0e4ab5a Describe messages sent as part of consensus/gossip protocol 2017-12-30 21:18:12 +01:00
Ethan Buchman
f2bfa83b42 Merge pull request #116 from tendermint/remove-logger-package
remove deprecated logger package
2017-12-29 20:50:03 -05:00
Ethan Buchman
381fe19335 changelog date [ci skip] 2017-12-29 17:51:19 -05:00
Ethan Buchman
ff99ca7cdf bump wal test timeout 2017-12-29 17:51:13 -05:00
Ethan Buchman
60f95cd9ea changelog and version 2017-12-29 11:28:44 -05:00
Ethan Buchman
28bbeac763 state: send byzantine validators in BeginBlock 2017-12-29 11:26:55 -05:00
Zach Ramsay
a84bc2f5b2 logger is deprecated, removed; closes #115 2017-12-29 16:25:15 +00:00
Ethan Buchman
9f72e25b23 readme 2017-12-29 16:25:15 +00:00
Ethan Buchman
e97e0bacd1 update glide 2017-12-29 11:11:13 -05:00
Ethan Buchman
91b4b534ad Merge pull request #118 from tendermint/develop
v0.6.0
2017-12-29 11:05:12 -05:00
Ethan Buchman
abfdfe67e8 test/p2p: add some timeouts 2017-12-29 11:02:47 -05:00
Ethan Buchman
35e6f11ad4 changelog and version 2017-12-29 11:01:37 -05:00
Ethan Buchman
b54da51c0c Merge pull request #111 from tendermint/timers_jae
WIP RepeatTimer fix
2017-12-29 10:52:25 -05:00
Ethan Buchman
92c17f3f25 give test more time 2017-12-29 10:49:49 -05:00
Ethan Buchman
71f13cc071 drop metalinter 2017-12-29 10:42:02 -05:00
Ethan Buchman
5d5ea6869b Merge pull request #170 from tendermint/develop
v0.9.0
2017-12-29 10:36:33 -05:00
Ethan Buchman
70da70d852 abandon the metalinter because honestly who has the time 2017-12-29 10:30:59 -05:00
Jae Kwon
a171d90611 Fix possibly incorrect usage of conversion 2017-12-29 10:28:00 -05:00
Ethan Buchman
558f8e7769 fix recursion 2017-12-29 10:28:00 -05:00
Ethan Buchman
76433d9040 little things 2017-12-29 10:28:00 -05:00
Jae Kwon
6b5d08f7da RepeatTimer fix 2017-12-29 10:27:54 -05:00
Ethan Buchman
992371b4cf Merge pull request #1035 from tendermint/readme-min-requirements
README: document the minimum Go version
2017-12-29 10:24:57 -05:00
Ethan Buchman
07eeddc5e1 Merge pull request #1015 from tendermint/state_funcs
state: move methods to funcs
2017-12-29 10:24:22 -05:00
Emmanuel Odeke
3b70c89e07 README: document the minimum Go version
Solidify in writing, the minimum Go version that
we support, as Go1.9.
2017-12-28 23:26:45 -07:00
Ethan Buchman
444db4c242 metalinter 2017-12-28 23:15:54 -05:00
Ethan Buchman
cb845ebff5 fix EvidencePool and VerifyEvidence 2017-12-28 23:15:54 -05:00
Ethan Buchman
6112578d07 ValidateBlock is a method on blockExec 2017-12-28 23:15:54 -05:00
Ethan Buchman
ae68fcb78a move fireEvents to ApplyBlock 2017-12-28 23:15:54 -05:00
Ethan Buchman
8d8d63c94c changelog 2017-12-28 23:15:54 -05:00
Ethan Buchman
1d6f00859d fixes from review 2017-12-28 23:15:54 -05:00
Ethan Buchman
397251b0f4 fix evidence 2017-12-28 23:15:54 -05:00
Ethan Buchman
537b0dfa1a use NopEventBus 2017-12-28 23:15:54 -05:00
Ethan Buchman
0acca7fe69 final updates for state 2017-12-28 23:15:54 -05:00
Ethan Buchman
bac60f2067 blockchain: update for new state 2017-12-28 23:15:54 -05:00
Ethan Buchman
f82b7e2a13 state: re-order funcs. fix tests 2017-12-28 23:15:54 -05:00
Ethan Buchman
9e6d088757 state: BlockExecutor 2017-12-28 23:15:54 -05:00
Ethan Buchman
c915719f85 *State->State; SetBlockAndValidators->NextState 2017-12-28 23:15:54 -05:00
Ethan Buchman
f55135578c state: move methods to funcs 2017-12-28 23:15:54 -05:00
Ethan Buchman
6372c415a5 Merge pull request #113 from tendermint/hotfix/clist
Fix #112 by using RWMutex per element
2017-12-28 22:23:02 -05:00
Jae Kwon
b31397aff5 Fix GoLevelDB Iterator which needs to copy a temp []byte 2017-12-28 18:30:56 -08:00
Ethan Buchman
38eb32d7bf version and changelog 2017-12-28 17:28:07 -05:00
Ethan Buchman
139eca0177 Merge pull request #1027 from tendermint/1026-error-signing-vote-wal-gen
change directory for each call, not only for each test
2017-12-28 16:08:52 -05:00
Ethan Buchman
a8e625e99d config: unexpose chainID 2017-12-28 20:49:02 +00:00
Zach Ramsay
a92a32b862 config: lil fixes 2017-12-28 20:49:02 +00:00
Zach Ramsay
9da5cd0180 rebase fix 2017-12-28 20:49:02 +00:00
Anton Kaliaev
a6f2e502e7 move genesis.json file into config dir 2017-12-28 20:49:02 +00:00
Anton Kaliaev
69d8c2e554 fixes after my own review 2017-12-28 20:49:02 +00:00
Zach Ramsay
70ba608850 config: write all default options to config file
config: test the default file

docs: spiff up config

config: minor fixes & comments

config: simplify test

config; use a seperate config directory, #556

config: update docs & parameterize file paths

config: PR comments

config: use the default object

fix a rebase error
2017-12-28 20:49:02 +00:00
Anton Kaliaev
75182f7205 change directory for each call, not only for each test
Fixes #1026
2017-12-28 11:17:15 -06:00
Ethan Buchman
41caa4415c Merge pull request #1024 from tendermint/1023-tendermint-version
remove quotes from `tendermint version`
2017-12-28 10:14:39 -05:00
Anton Kaliaev
c611cc7268 remove quotes from tendermint version
before:
0.14.0-'88f5f21d'

after:
0.14.0-88f5f21d

Fixes #1023
2017-12-28 09:02:25 -06:00
Jae Kwon
e47ce81422 Comment fixes from Emmanuel 2017-12-28 03:05:55 -08:00
Jae Kwon
f48baf86fb Add Address type which is HexBytes 2017-12-27 14:37:37 -08:00
Jae Kwon
93c05aa8c0 Add back on HexBytes 2017-12-27 13:52:32 -08:00
Ethan Buchman
d14ec7d7d2 Merge pull request #1011 from tendermint/1006-panic-on-light-client-startup
protect memStoreProvider#byHash map by mutex
2017-12-27 15:30:59 -05:00
Anton Kaliaev
4ca19e33c2 add mutex to memStoreProvider
Fixes #1006

```
goroutine 230 [runnable]:
github.com/cosmos/gaia/vendor/golang.org/x/crypto/ripemd160.(*digest).Sum(0xc420ac2af0, 0x0, 0x0, 0x0, 0xc420c01360, 0xc420c01378, 0x20)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/golang.org/x/crypto/ripemd160/ripemd160.go:119 +0x2c9
github.com/cosmos/gaia/vendor/github.com/tendermint/tmlibs/merkle.KVPair.Hash(0x49447e8, 0x7, 0x47ff760, 0xc420048d50, 0xc420aba9a0, 0x14, 0x20)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tmlibs/merkle/simple_tree.go:122 +0x200
github.com/cosmos/gaia/vendor/github.com/tendermint/tmlibs/merkle.(*KVPair).Hash(0xc4200f7ae0, 0xc420aba9a0, 0x14, 0x20)
	<autogenerated>:1 +0x57
github.com/cosmos/gaia/vendor/github.com/tendermint/tmlibs/merkle.SimpleHashFromHashables(0xc420111900, 0x9, 0x10, 0x10, 0xc420ad06c0, 0xc420087500)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tmlibs/merkle/simple_tree.go:87 +0xaa
github.com/cosmos/gaia/vendor/github.com/tendermint/tmlibs/merkle.SimpleHashFromMap(0xc420b987e0, 0xc420b987e0, 0x4941892, 0x3)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tmlibs/merkle/simple_tree.go:96 +0x4d
github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/types.(*Header).Hash(0xc420a541a0, 0x4034f, 0xc420a28530, 0xa)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/types/block.go:177 +0x54a
github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite.Commit.ValidateBasic(0xc420a541a0, 0xc420a1e300, 0xc420a28530, 0xa, 0xb, 0x27)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite/commit.go:83 +0x1c9
github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite/files.(*provider).StoreCommit(0xc4202f2780, 0xc420a541a0, 0xc420a1e300, 0xc420a24870, 0x0, 0x0)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite/files/provider.go:71 +0x5e
github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite.cacheProvider.StoreCommit(0xc4202f27a0, 0x2, 0x2, 0xc420a541a0, 0xc420a1e300, 0xc420a24870, 0xc420a541a0, 0xc420a1e300)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite/provider.go:39 +0x8f
github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite.(*cacheProvider).StoreCommit(0xc4202f27c0, 0xc420a541a0, 0xc420a1e300, 0xc420a24870, 0x2, 0xc420a541a0)
	<autogenerated>:1 +0x70
github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite.NewInquiring(0xc420990610, 0xa, 0xc420a541a0, 0xc420a1e300, 0xc420a24870, 0x4f3eb80, 0xc4202f27c0, 0x4f3e5c0, 0xc4202f2840, 0xa)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/lite/inquirer.go:29 +0x5c
github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client.GetCertifier(0xc420990610, 0xa, 0x4f3eb80, 0xc4202f27c0, 0x4f3e5c0, 0xc4202f2840, 0xc4200f68a0, 0xc420b21888, 0x470eece)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/common.go:47 +0x141
github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands.GetCertifier(0x4f46aa0, 0xc4200f68a0, 0xc420b218e0)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands/common.go:82 +0x83
github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands/query.GetWithProof(0xc420a260c0, 0x22, 0x30, 0x0, 0x4947dd6, 0xc42016a000, 0xc420b219a0, 0x4389d85, 0x0, 0x0, ...)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands/query/get.go:73 +0x52
github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands/query.Get(0xc420a260c0, 0x22, 0x30, 0x0, 0x1, 0x0, 0xc420b21a08, 0x43c9c91, 0xc4200a20f0, 0x4947dd6, ...)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands/query/get.go:64 +0x178
github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands/query.GetParsed(0xc420a260c0, 0x22, 0x30, 0x47d1440, 0xc420b984e0, 0x0, 0x1, 0x30, 0x1d, 0x40)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/client/commands/query/get.go:31 +0x5f
github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/modules/coin/rest.doQueryAccount(0x4f3d300, 0xc4201ee0e0, 0xc420111500)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/cosmos/cosmos-sdk/modules/coin/rest/handlers.go:66 +0x3a5
net/http.HandlerFunc.ServeHTTP(0x4a9d808, 0x4f3d300, 0xc4201ee0e0, 0xc420111500)
	/usr/local/go/src/net/http/server.go:1918 +0x44
github.com/cosmos/gaia/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201aab40, 0x4f3d300, 0xc4201ee0e0, 0xc420111500)
	/Users/mappum/go/src/github.com/cosmos/gaia/vendor/github.com/gorilla/mux/mux.go:150 +0xed
net/http.serverHandler.ServeHTTP(0xc4209992b0, 0x4f3d300, 0xc4201ee0e0, 0xc420111300)
	/usr/local/go/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc4200b5540, 0x4f3df80, 0xc420086900)
	/usr/local/go/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2720 +0x288
```
2017-12-27 15:29:17 -05:00
Ethan Buchman
1a0db878bf Merge pull request #1009 from tendermint/spec
Spec
2017-12-27 15:23:13 -05:00
Ethan Buchman
53eb9aca2b Merge pull request #592 from tendermint/evidence
track evidence, include in block
2017-12-27 15:22:24 -05:00
Ethan Buchman
caccabd4e5 spec: fixes from review 2017-12-27 15:14:49 -05:00
Ethan Buchman
d0e0ac5fac types: better error messages for votes 2017-12-27 14:46:24 -05:00
Ethan Buchman
7d81a3f4a5 address some comments from review 2017-12-27 01:27:03 -05:00
Ethan Buchman
4041adbf92 Merge pull request #54 from tendermint/cRandHex-doc-fix
CRandHex: fix up doc to mention length of digits
2017-12-26 23:48:05 -05:00
Ethan Buchman
f95b7529eb Merge pull request #999 from tendermint/feature/result-hash-header
Add results hash to header
2017-12-26 20:49:20 -05:00
Ethan Buchman
6a4fd46479 fixes from rebase 2017-12-26 20:42:34 -05:00
Ethan Buchman
b01b1e4758 remove unused var 2017-12-26 20:27:40 -05:00
Ethan Buchman
014b0b9944 evidence: reactor test 2017-12-26 20:27:40 -05:00
Ethan Buchman
5904f6df8b minor fixes from review 2017-12-26 20:27:40 -05:00
Ethan Buchman
0f293bfc2b remove some TODOs 2017-12-26 20:27:40 -05:00
Ethan Buchman
cfbedec719 evidence: reactor test 2017-12-26 20:27:40 -05:00
Ethan Buchman
666ae244b3 evidence: pool test 2017-12-26 20:27:40 -05:00
Ethan Buchman
c13e93d63e evidence: store tests and fixes 2017-12-26 20:27:40 -05:00
Ethan Buchman
c2585b5525 evidence_pool.go -> pool.go. remove old test files 2017-12-26 20:27:40 -05:00
Ethan Buchman
1d021c2790 update consensus/test_data/many_blocks.cswal 2017-12-26 20:27:40 -05:00
Ethan Buchman
cc418e5dab state.VerifyEvidence enforces EvidenceParams.MaxAge 2017-12-26 20:27:32 -05:00
Ethan Buchman
c7acdfadf2 evidence: more funcs in store.go 2017-12-26 20:27:32 -05:00
Ethan Buchman
869d873d5c state.ApplyBlock takes evpool and calls MarkEvidenceAsCommitted 2017-12-26 20:27:32 -05:00
Ethan Buchman
3271634e7a types: evidence cleanup 2017-12-26 20:26:21 -05:00
Ethan Buchman
4854c231e1 evidence store comments and cleanup 2017-12-26 20:26:21 -05:00
Ethan Buchman
7a18fa887d evidence linked with consensus/node. compiles 2017-12-26 20:26:21 -05:00
Ethan Buchman
6c4a0f9363 cleanup evidence pkg. state.VerifyEvidence 2017-12-26 20:26:21 -05:00
Ethan Buchman
f7731d38f6 some comments and cleanup 2017-12-26 20:25:14 -05:00
Ethan Buchman
df3f4de7c3 check evidence is from validator; some cleanup 2017-12-26 20:25:14 -05:00
Ethan Buchman
10c43c9edc introduce evidence store 2017-12-26 20:25:14 -05:00
Ethan Buchman
fe4b53a463 EvidencePool 2017-12-26 20:24:54 -05:00
Ethan Buchman
5b1f987ed1 mempool: remove Peer interface. use p2p.Peer 2017-12-26 20:24:12 -05:00
Ethan Buchman
48d778c4b3 types/params: introduce EvidenceParams 2017-12-26 20:24:12 -05:00
Ethan Buchman
7d086e9524 check if we already have evidence 2017-12-26 20:21:17 -05:00
Ethan Buchman
6e9433c7a8 post rebase fix 2017-12-26 20:21:17 -05:00
Ethan Buchman
39299e5cc1 consensus: note about duplicate evidence 2017-12-26 20:21:17 -05:00
Ethan Buchman
eeab0efa56 types: tx.go comments 2017-12-26 20:21:17 -05:00
Ethan Buchman
77e45756f2 types: Evidences for merkle hashing; Evidence.String() 2017-12-26 20:21:17 -05:00
Ethan Buchman
9cdcffbe4b types: comments; compiles; evidence test 2017-12-26 20:21:17 -05:00
Ethan Buchman
50850cf8a2 verify sigs on both votes; note about indices 2017-12-26 20:21:17 -05:00
Ethan Buchman
35587658cd verify evidence in block 2017-12-26 20:21:17 -05:00
Ethan Buchman
4661c98c17 add pubkey to conflicting vote evidence 2017-12-26 20:21:17 -05:00
Ethan Buchman
7928659f70 track evidence, include in block 2017-12-26 20:21:17 -05:00
Ethan Buchman
f80f6445a6 fix test 2017-12-26 20:15:09 -05:00
Ethan Buchman
336c2f4fe1 rpc: fix getHeight 2017-12-26 20:08:25 -05:00
Ethan Buchman
bfcb40bf6b validate block.ValidatorsHash 2017-12-26 20:00:45 -05:00
Ethan Buchman
051c2701ab remove LastConsensusParams 2017-12-26 19:56:39 -05:00
Ethan Buchman
028ee58580 call it LastResultsHash 2017-12-26 19:53:26 -05:00
Ethan Buchman
801e3dfacf rpc: getHeight helper function 2017-12-26 19:37:42 -05:00
Ethan Buchman
4171bd3bae fixes 2017-12-26 19:24:45 -05:00
Ethan Buchman
73fb1c3a17 consolidate saveResults/SaveABCIResponses 2017-12-26 19:24:45 -05:00
Ethan Frey
d65234ed51 Add /block_results?height=H as rpc endpoint
Expose it in rpc client
Move ABCIResults into tendermint/types from tendermint/state
2017-12-26 19:24:25 -05:00
Ethan Frey
58c5df729b Add ResultHash to header 2017-12-26 19:24:25 -05:00
Ethan Frey
632cc918b4 Save/Load Results for every height
Add some tests.
Behaves like saving validator set, except it always saves at each height
instead of a reference to last changed.
2017-12-26 19:24:25 -05:00
Ethan Frey
f870a49f42 Add ABCIResults with Hash and Proof to State
State maintains LastResultsHash
Verify that we can produce unique hashes for each result,
and provide valid proofs from the root hash.
2017-12-26 19:24:25 -05:00
Ethan Buchman
d844799b3b Merge branch '950-enforce-less-13-val-changes-per-block' into develop 2017-12-26 19:22:21 -05:00
Ethan Buchman
3ea1145486 bring back test 2017-12-26 19:22:15 -05:00
Jae Kwon
8f87efd7f8 ABCI message updates (code/log/info)
* Add info to Response[CheckTx/DeliverTx/Query]
* Remove code and log from Response[SetOption/Commit]
2017-12-26 15:46:06 -08:00
Ethan Buchman
d4716fc03c state 2017-12-26 18:43:03 -05:00
Ethan Buchman
16227594ef notes about block 1 2017-12-26 16:33:42 -05:00
Ethan Buchman
65cdb07f0c merkle 2017-12-26 15:48:17 -05:00
Ethan Buchman
eb73e82279 encoding.md 2017-12-26 15:30:56 -05:00
Ethan Buchman
d6fbfddddd spec.md -> blockchain.md. some fixes 2017-12-26 15:30:27 -05:00
Anton Kaliaev
1339a44402 add safe*Clip funcs 2017-12-26 14:13:12 -06:00
Anton Kaliaev
b8215d8ac8 more test cases 2017-12-26 13:30:00 -06:00
Ethan Buchman
289d92c97d consensus: remove log stmt. closes #987 2017-12-26 10:41:31 -05:00
Ethan Buchman
6c39c77fc5 Merge pull request #996 from ricardohsd/types-add-tests-to-vote
Add more tests to types/vote.go
2017-12-26 10:32:07 -05:00
Jae Kwon
66580408f8 GasWanted and GasUsed for Check & Deliver 2017-12-26 05:29:33 -08:00
Jae Kwon
e1ff53fd0b Use []byte instead of Bytes, use tmlibs/common.KVPair 2017-12-26 04:52:02 -08:00
Jae Kwon
b25df389db Remove Bytes, just use []byte; Use protobuf for KVPair/KI64Pair 2017-12-26 04:40:35 -08:00
Jae Kwon
a861d68a31 Update glide.yaml and fix tests 2017-12-26 00:45:31 -08:00
Jae Kwon
bf644b0984 Do not shadow assert 2017-12-26 00:36:58 -08:00
Jae Kwon
9472476a8b Update Makefile 2017-12-26 00:28:07 -08:00
Jae Kwon
6ec8c1602f Update Makefile 2017-12-25 22:41:40 -08:00
Jae Kwon
0f8ebd024d Update clist.go
Add more justification of synchrony primitives in documentation.
2017-12-25 22:28:15 -08:00
Jae Kwon
2fd8f35b74 Fix #112 by using RWMutex per element 2017-12-25 21:12:14 -08:00
Jae Kwon
797bcdd9e0 Remove common/http 2017-12-25 17:46:21 -08:00
Anton Kaliaev
69c3a7640b add safeAdd & safeSub plus quickcheck tests 2017-12-25 18:39:14 -06:00
Anton Kaliaev
e8b0458f16 check for overflow and underflow while choosing proposer
Refs #919
2017-12-25 18:39:14 -06:00
Anton Kaliaev
6b89639f90 update docs 2 [ci skip] 2017-12-25 17:58:15 -06:00
Anton Kaliaev
9b25f7325a update docs [ci skip] 2017-12-25 17:53:54 -06:00
Anton Kaliaev
0093f9877a change voting power change, not number of vals 2017-12-25 17:49:36 -06:00
Zach
96c816f428 Merge pull request #160 from KrzysiekJ/test-cmd-short-circuit
Short-circuit assertions in test command
2017-12-25 20:21:24 +00:00
Jae Kwon
f2a8e95248 Add KI64Pair(s) 2017-12-25 11:40:05 -08:00
Anton Kaliaev
cf0b5d3715 enforce <1/3 validator updates
Refs #950
2017-12-25 12:10:53 -06:00
Ethan Buchman
616f7e74db Merge pull request #1001 from tendermint/makefile
Cleaned up makefile
2017-12-25 12:09:10 -05:00
Ethan Buchman
14c812a39c tmlibs timer fix 2017-12-25 11:11:55 -05:00
Ethan Buchman
1e52751344 update tests for makefile 2017-12-25 10:24:41 -05:00
Jae Kwon
ff65421324 Proposal: New Makefile standard template (#168)
* Cleaned up makefile.
* Improve 'make all' order
* Add devdoc
* Update circle.yml
2017-12-25 00:14:13 -08:00
Jae Kwon
f390385baf Fee is a KNPair (#167)
KVPair is {[]byte,[]byte}
2017-12-24 18:39:16 -08:00
Jae Kwon
d7ac6e516a Cleaned up makefile 2017-12-23 02:23:05 -08:00
Emmanuel Odeke
62115b55ef CRandHex: fix up doc to mention length of digits
The previous doc seemed misleading and was out of date i.e.
RandHex(24)
not
CRandHex.

Anyways provide a doc of what the function does in relation to
the length of digits of the hex value returned i.e.
  floor(numDigits / 2) * 2
so the even lowest number
  e.g:
  * len(CRandHex(5)) = 4
  * len(CRandHex(4)) = 4
2017-12-22 23:16:34 -07:00
Jae Kwon
aaaacba1cd Use gogoproto's nullable=false (#166)
* Use gogoproto's nullable=false where appropriate.
2017-12-22 19:41:19 -08:00
Ethan Buchman
c2436c46e6 Merge pull request #972 from tendermint/feature/enhance-endblock
Update EndBlock parameters
2017-12-22 01:30:58 -05:00
Ethan Buchman
e3585a6eb0 wip: tendermint specification 2017-12-21 22:36:37 -05:00
Ethan Buchman
43cc4fb645 Merge pull request #53 from tendermint/constant-time-equals
Constant time equals
2017-12-21 20:03:53 -05:00
Ethan Buchman
eaf4b8c795 fix Equals 2017-12-21 19:51:57 -05:00
Ethan Buchman
38608b1b0f comment and tmlibs fix 2017-12-21 18:32:40 -05:00
Ethan Buchman
2b634dab32 Merge pull request #994 from tendermint/clean/block-validation
Clean/block validation
2017-12-21 17:53:11 -05:00
Ethan Buchman
91acc51cd1 fix test 2017-12-21 17:52:06 -05:00
Ethan Buchman
dc54ba67e4 state: TestValidateBlock 2017-12-21 17:51:03 -05:00
Ethan Buchman
35521b553a save historical consensus params 2017-12-21 17:46:25 -05:00
Ethan Buchman
70a744558c types: params.Update() 2017-12-21 17:00:52 -05:00
Ethan Buchman
4b789ff7e9 another cmn fix 2017-12-21 16:49:47 -05:00
Ethan Buchman
306657a118 no patience for metalinter right now 2017-12-21 16:49:47 -05:00
Ethan Buchman
be765e4cb9 update glide for cmn fixes 2017-12-21 16:49:47 -05:00
Ethan Buchman
b5857da877 forgot file 2017-12-21 16:49:47 -05:00
Ethan Buchman
3ad055ef3a fix randPort 2017-12-21 16:49:47 -05:00
Ethan Buchman
3d00c477fc separate block vs state based validation 2017-12-21 16:49:47 -05:00
Ethan Buchman
c2912d612a update glide 2017-12-21 16:49:47 -05:00
Ethan Buchman
218acc2224 Merge pull request #107 from tendermint/fix/cmn
Fix/cmn
2017-12-21 16:30:45 -05:00
Ethan Buchman
a3c7525249 Merge pull request #993 from tendermint/984-priv-validator-signing
priv validator returns last sign bytes if h/r/s matches
2017-12-21 16:30:22 -05:00
Ethan Buchman
f81025631e update comment [ci skip] 2017-12-21 16:28:05 -05:00
Ethan Buchman
9c03c58de2 priv validator checks if only difference is timestamp; else error 2017-12-21 15:37:27 -05:00
Ethan Buchman
e2d7f1aa41 cmn: fix race 2017-12-21 14:21:15 -05:00
Anton Kaliaev
0ffd60b8cf ValidatorSetUpdates -> ValidatorUpdates 2017-12-21 11:52:26 -06:00
Ricardo Domingos
d5baa6601c types: Add test for IsVoteTypeValid 2017-12-21 18:13:31 +01:00
Ricardo Domingos
19eeef0aad types: Rename exampleVote to examplePrecommit on vote_test
exampleVote doesn't express the type of the vote.
2017-12-21 18:13:31 +01:00
Ethan Buchman
b0b740210c cmn: fix repeate timer test with manual ticker 2017-12-21 11:15:17 -05:00
Ethan Buchman
a25ed5ba1b cmn: fix race condition in prng 2017-12-21 10:02:25 -05:00
Jae Kwon
e4b9f1abe7 Id -> ID using gogo 2017-12-20 17:33:59 -08:00
Ricardo Domingos
e76392e330 types: Update String() test to assert Prevote type 2017-12-20 23:21:30 +01:00
Ethan Buchman
98a38737c4 Merge pull request #156 from tendermint/use-single-connection-in-console
cmd/abci-cli: use a single connection per session
2017-12-20 16:11:25 -05:00
Ethan Buchman
9c145a9e19 Merge branch 'develop' into use-single-connection-in-console 2017-12-20 15:55:36 -05:00
Ethan Buchman
2927caa0eb fix flag parsing in console mode 2017-12-20 15:54:14 -05:00
Anton Kaliaev
a1cc9ac642 priv validator returns last sign bytes if h/r/s matches
since now we have time in the msgs and we might crash between writing
the priv val and writing to wal.

Refs #984
2017-12-20 14:41:43 -06:00
Ethan Buchman
c03928766d Merge pull request #163 from tendermint/feature/enhance-endblock
Update the ResponseEndBlock values
2017-12-20 15:16:09 -05:00
Ethan Buchman
fa15e4f554 update changelog [ci skip] 2017-12-20 15:16:15 -05:00
Anton Kaliaev
0d69ace961 fix circleci config 2017-12-20 13:40:26 -06:00
Jae Kwon
e46a99a32f Fix Makefile 2017-12-20 11:02:22 -08:00
Emmanuel T Odeke
67c3af3bf8 cmd/tendermint: fix initialization file creation checks (#991)
* cmd/tendermint: fix initialization file creation checks

Fixes #989.

The original initialization sequence started to inexplicably
fail
```shell
tendermint unsafe_reset_all
tendermint init
tendermint node --proxy_app=dummy
```

used to fail with
```shell
ERROR: Failed to create node: Couldn't read GenesisDoc file: open
/Users/emmanuelodeke/.tendermint/genesis.json: no such file or directory
```

because the initialization sequence always assumed that the
genesisDoc would only be set if the privValidator was generated.

However, `tendermint unsafe_reset_all` only created the
`priv_validator.json` file which would mean that then running
`tendermint init` would never create the `genesis.json` file
which if following the recommended sequence would then fail
since the `genesis.json` was absent.

* cmd/tendermint: Load PrivValidatorFS if existent, lest generate it

Feedback from @melekes

* change logging messages for init cmd

Refs #989
2017-12-20 12:50:27 -06:00
Adrian Brink
57c49cc825 Include unsaved circle.yml file 2017-12-20 10:40:35 +01:00
Adrian Brink
c268c4e767 Update Circle and Makefile to run tests/linting on CI 2017-12-20 10:33:24 +01:00
Jae Kwon
57a83fe73e Merge branch 'develop' into feature/enhance-endblock 2017-12-20 00:11:57 -08:00
Jae Kwon
3798f9fa8e Reorder README 2017-12-20 00:07:58 -08:00
Jae Kwon
c14d3982ac ValidatorSetUpdates -> ValidatorUpdates 2017-12-20 00:02:41 -08:00
Jae Kwon
b70ae4919b Update glide file 2017-12-19 20:47:22 -08:00
Jae Kwon
ca56a274bd Nil bytes are OK for Get/Set etc
And s/Release/Close/g
2017-12-19 20:36:37 -08:00
Anton Kaliaev
c8ddf156a7 Merge pull request #104 from tendermint/revert-94-feature/timer-refactor
Revert "Refactor throttle timer"
2017-12-19 16:32:21 -06:00
Anton Kaliaev
e17e8e425f Revert "Refactor throttle timer" 2017-12-19 16:23:20 -06:00
Anton Kaliaev
be2b0fa31e Merge pull request #103 from tendermint/revert-95-feature/repeat-timer
Revert "Refactor repeat timer"
2017-12-19 16:22:48 -06:00
Anton Kaliaev
70e30f74e6 Revert "Refactor repeat timer" 2017-12-19 16:16:16 -06:00
Anton Kaliaev
9a5b943e77 update changelog [ci skip] 2017-12-19 13:17:29 -06:00
Anton Kaliaev
843e1ed400 Updates -> ValidatoSetUpdates 2017-12-19 13:03:39 -06:00
Anton Kaliaev
4ddf212286 Merge pull request #100 from tendermint/internal-randSource
common: no more relying on math/rand.DefaultSource
2017-12-19 12:54:54 -06:00
Emmanuel T Odeke
811dc071aa protoc: "//nolint: gas" directive after pb generation (#164)
* protoc: "//nolint: gas" directive after pb generation

Fixes #138

Since we can't add package directives through the protoc
compiler, yet we need to "//nolint: gas" the Go generated
protobuf file, added a script whose purpose is to
go find the "package (\w+)$" declaration after go fmt
was run by protoc.

The competing solutions were more complex and can be
examined by visiting
https://github.com/tendermint/abci/issues/138#issuecomment-352226217

* simplify script

* rewrite script to work on Mac
2017-12-19 12:29:59 -06:00
Anton Kaliaev
66296fe11a updates -> validator_set_updates
ConsensusParamChanges -> ConsensusParamUpdates
2017-12-19 12:13:45 -06:00
Ethan Buchman
4bca6bf6f5 fix test 2017-12-19 12:30:34 -05:00
Ethan Frey
960b25408f Store LastConsensusHash in State as well
Update all BlockValidation that it matches the last state
2017-12-19 12:28:08 -05:00
Ethan Frey
45bc106de7 Updated lite tests to set ConsensusHash in header 2017-12-19 12:28:08 -05:00
Ethan Frey
d151e36ea8 Add ConsensusHash to header 2017-12-19 12:28:08 -05:00
Ethan Frey
56cada6a0c Validate ConsensusParams returned from abci app 2017-12-19 12:28:08 -05:00
Ethan Frey
a0b2d77bef Add hash to ConsensusParams 2017-12-19 12:28:08 -05:00
Ethan Frey
030fd00232 Added tests for applying consensus param changes 2017-12-19 12:28:08 -05:00
Ethan Frey
d21f39160f Apply ConsensusParamChanges to state/State 2017-12-19 12:28:08 -05:00
Ethan Frey
4265a94bfe Update EndBlock parameters
* Update abci dependencies
* Modify references from Diffs to Changes
* Fixes issues #924
2017-12-19 12:28:08 -05:00
Ethan Buchman
652d1e3de8 Merge pull request #979 from tendermint/934-node-fails-to-parse-seeds
strip protocol if defined
2017-12-19 12:26:32 -05:00
Ethan Buchman
b33cff4cb7 Merge pull request #981 from tendermint/977-wal-generator
enable logging for wal_generator and set timeout to 1 min
2017-12-19 12:25:58 -05:00
Ethan Buchman
e0fe84a856 Merge branch 'develop' into 977-wal-generator 2017-12-19 11:11:26 -05:00
Ethan Buchman
783ffdb7fd Merge pull request #983 from tendermint/circle-testing
Circle testing
2017-12-19 11:09:22 -05:00
Ethan Buchman
cb3ac6987e remove some debugs 2017-12-19 10:11:37 -05:00
Anton Kaliaev
5a83e58428 stop eventBus 2017-12-17 20:16:02 -06:00
Jae Kwon
4ce8448d7f Nil keys are OK, deprecate BeginningKey/EndingKey (#101)
* Nil keys are OK, deprecate BeginningKey/EndingKey
2017-12-17 13:11:28 -08:00
Jae Kwon
aab2d70dd3 Sdk2 kvpair (#102)
* Canonical KVPair in common
* Simplify common/Bytes to just hex encode
2017-12-17 13:04:15 -08:00
Anton Kaliaev
843b10ed26 Merge pull request #157 from tendermint/linter-fix-v2
enable linter & make deterministic
2017-12-16 23:02:05 -06:00
Anton Kaliaev
dd7728c4c5 Merge pull request #161 from tendermint/fix-some-vet-issues
all: fix vet issues with build tags, formatting
2017-12-16 22:40:51 -06:00
Anton Kaliaev
3f02ab0ead unidirectional channel 2017-12-16 22:20:07 -06:00
Anton Kaliaev
99c58fc561 enable logging for wal_generator and set timeout to 1 min
Refs #977
2017-12-16 21:59:10 -06:00
Ethan Buchman
a86df17ceb crank city 2017-12-16 19:55:04 -05:00
Ethan Buchman
5d04ccbe51 excessive logging. update tmlibs for timer fix 2017-12-16 19:16:08 -05:00
Emmanuel Odeke
e3d244091d cleanup requested from review by @melekes 2017-12-16 15:49:38 -07:00
Ethan Buchman
61dc357bb3 test/p2p/kill_all: longer timeout 2017-12-16 13:36:52 -05:00
Ethan Buchman
d7cb2f850d more logs in p2p 2017-12-16 13:36:52 -05:00
Ethan Buchman
bfe0a4a8ac more logging 2017-12-16 13:36:52 -05:00
Ethan Buchman
0ec7909ec3 more logging in p2p and consensus 2017-12-16 13:36:52 -05:00
Ethan Buchman
b5b912e2c4 Merge remote-tracking branch 'origin/977-wal-generator' into develop 2017-12-16 13:36:32 -05:00
Emmanuel Odeke
8638961f02 common: Rand* warnings about cryptographic unsafety
Lesson articulated by @jaekwon on why we need 80 bits
of entropy at least before we can think of cryptographic
safety. math/rand's seed is a max of 64 bits so can never
be cryptographically secure.

Also added some benchmarks for RandBytes
2017-12-15 22:41:36 -07:00
Ethan Buchman
e3bffd8fbd readme 2017-12-16 00:04:06 -05:00
Ethan Buchman
9504a593e9 Merge pull request #980 from tendermint/fix-test-in-develop
add missing Timestamp to Votes
2017-12-15 22:11:47 -05:00
Anton Kaliaev
f8f28c8942 enable logging for wal_generator and set timeout to 1 min
Refs #977
2017-12-15 16:15:09 -06:00
Ethan Buchman
9226659413 Merge pull request #98 from tendermint/sdk2-iterator
Sdk2 iterator
2017-12-15 15:58:48 -05:00
Ethan Buchman
66b0e8fa2d fix c level db iterator 2017-12-15 15:58:23 -05:00
Ethan Buchman
225eace316 dont run metalinter on circle ... 2017-12-15 15:14:48 -05:00
Anton Kaliaev
8fc7d63cf8 add missing Timestamp to Votes
Fixes:

```
panic: Panicked on a Sanity Check: can't encode times below 1970 [recovered]
        panic: Panicked on a Sanity Check: can't encode times below 1970

goroutine 2042 [running]:
testing.tRunner.func1(0xc420e8c0f0)
        /usr/local/go/src/testing/testing.go:711 +0x5d9
panic(0xcd9e20, 0xc420c8c270)
        /usr/local/go/src/runtime/panic.go:491 +0x2a2
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.PanicSanity(0xcd9e20, 0xf8ddd0)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/errors.go:26 +0x120
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire.WriteTime(0x0, 0x0, 0x0, 0x1306440, 0xc4201607e0, 0xc420e31658, 0xc420e31680)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire/time.go:19 +0x11e
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire.writeReflectBinary(0xdc9e40, 0xc4201fcf30, 0x199, 0x1317b80, 0xdc9e40, 0xc98451, 0x9, 0x0, 0xdc9e40, 0xc420ead9c0, ...)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire/reflect.go:525 +0x22f0
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire.writeReflectBinary(0xd25400, 0xc42000e2e8, 0x196, 0x1317b80, 0xd92d60, 0xc9a195, 0xa, 0x0, 0xcc8ce0, 0xc420164920, ...)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire/reflect.go:530 +0x21e7
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire.writeReflectBinary(0xcc8ce0, 0xc4209f95b8, 0x197, 0x1317b80, 0xcc8ce0, 0xc9a195, 0xa, 0x0, 0xcc8ce0, 0xc420164920, ...)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire/reflect.go:518 +0x2509
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire.writeReflectBinary(0xd873e0, 0xc4209f9580, 0x16, 0x1317b80, 0xd79400, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire/reflect.go:530 +0x21e7
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire.WriteBinary(0xd873e0, 0xc4209f9580, 0x1306440, 0xc4201607e0, 0xc420e31658, 0xc420e31680)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire/wire.go:80 +0x15f
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire.BinaryBytes(0xd873e0, 0xc4209f9580, 0x3, 0x8, 0xc420160798)
        /go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-wire/util.go:15 +0xb8
github.com/tendermint/tendermint/blockchain.(*BlockStore).SaveBlock(0xc4201342a0, 0xc420eac180, 0xc420130640, 0xc4209f9580)
        github.com/tendermint/tendermint/blockchain/_test/_obj_test/store.go:192 +0x439
github.com/tendermint/tendermint/blockchain.TestBlockStoreSaveLoadBlock(0xc420e8c0f0)
        /go/src/github.com/tendermint/tendermint/blockchain/store_test.go:128 +0x609
testing.tRunner(0xc420e8c0f0, 0xf20830)
        /usr/local/go/src/testing/testing.go:746 +0x16d
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:789 +0x569
exit status 2
FAIL
```
2017-12-15 13:59:25 -06:00
Anton Kaliaev
c513649df4 strip protocol if defined
Fixes #934
2017-12-15 13:36:08 -06:00
Anton Kaliaev
a6911825b0 PanicCrisis is deprecated 2017-12-15 13:35:49 -06:00
Ethan Buchman
eddabab5e4 Merge pull request #965 from tendermint/573-handle-corrupt-wal-file
Handle corrupt WAL file
2017-12-15 14:33:16 -05:00
Ethan Buchman
3eee69de2d Merge pull request #954 from tendermint/668-send-absent-validators
Send absent validators
2017-12-15 13:55:52 -05:00
Ethan Buchman
068d83bce8 Merge pull request #677 from tendermint/blockchain-test-store
blockchain: add tests for BlockStore
2017-12-15 13:33:55 -05:00
Anton Kaliaev
7f649ccf23 fixes from Frey's review 2017-12-15 12:21:15 -06:00
Anton Kaliaev
808b830942 add a unit test
Refs #668
2017-12-15 12:13:02 -06:00
Anton Kaliaev
d669816a1b send absent validators in BeginBlock
Refs #668
2017-12-15 12:13:02 -06:00
Anton Kaliaev
e40689b9cc PanicCrisis is deprecated 2017-12-15 11:59:45 -06:00
Anton Kaliaev
709cf18aef add gofuzz test for consensus wal 2017-12-15 11:56:24 -06:00
Anton Kaliaev
e57cad6c3f correct maxMsgSizeBytes 2017-12-15 11:42:53 -06:00
Anton Kaliaev
4f94caa1b9 explain what to do in case of truncation [ci skip] 2017-12-15 11:11:21 -06:00
Ethan Buchman
78a682e4b6 blockchain: test fixes 2017-12-15 12:07:48 -05:00
Emmanuel Odeke
a7b20d4e46 db: Simplify exists check, fix IsKeyInDomain signature, Iterator Close
+ *FSDB.HasKey now uses common.FileExists to test for file existence
+ IsKeyInDomain takes key as a []byte slice instead of as a string
to avoid extraneous []byte<-->string conversions for start and end
+ Iterator.Close() instead of Iterator.Release()
+ withDB helper to encapsulate DB creation, deferred cleanups
so that for loops can use opened DBs and discard them ASAP

Addressing accepted changes from review with @jaekwon
2017-12-15 02:58:51 -07:00
Emmanuel Odeke
cdc7988823 common: use genius simplification of tests from @ebuchman
Massive test simplication for more reliable tests from @ebuchman
2017-12-15 02:14:08 -07:00
Ethan Buchman
b5f465b4ec common: use names prng and mrand 2017-12-15 00:23:25 -05:00
Ethan Buchman
21d030dbfb Merge pull request #975 from tendermint/974-fix-test-in-develop
add missing Timestamp to Vote
2017-12-14 09:22:11 -05:00
Ethan Frey
eb6d412a82 Add tests to protobuf objects for pr coverage 2017-12-14 09:35:33 +01:00
Ethan Frey
9c5e1a824d Updated naming of EndBlock parameters
* Changes -> Updates for validators
* ConsensusParams.XXXParams -> ConsensusParams.XXX
* As per feedback from Jae on PR
2017-12-14 09:27:20 +01:00
Emmanuel Odeke
29471d75cb common: no more relying on math/rand.DefaultSource
Fixes https://github.com/tendermint/tmlibs/issues/99
Updates https://github.com/tendermint/tendermint/issues/973

Removed usages of math/rand.DefaultSource in favour of our
own source that's seeded with a completely random source
and is safe for use in concurrent in multiple goroutines.
Also extend some functionality that the stdlib exposes such as
* RandPerm
* RandIntn
* RandInt31
* RandInt63

Also added an integration test whose purpose is to be run as
a consistency check to ensure that our results never repeat
hence that our internal PRNG is uniquely seeded each time.
This integration test can be triggered by setting environment variable:
`TENDERMINT_INTEGRATION_TESTS=true`
for example
```shell
TENDERMINT_INTEGRATION_TESTS=true go test
```
2017-12-14 00:18:30 -07:00
Anton Kaliaev
72da553ed9 add missing Timestamp to Vote
Fixes #974
2017-12-13 22:24:06 -06:00
Ethan Buchman
a2f7898b6d db: fix c and go iterators 2017-12-13 22:28:37 -05:00
Ethan Buchman
d4aeca8ce3 fixes from @melekes 2017-12-13 20:11:11 -05:00
Anton Kaliaev
b78606d94f Merge pull request #967 from tendermint/feature/total-tx
Add TotalTx to block header
2017-12-13 17:09:48 -06:00
Ethan Frey
a6f719a402 Add tests for block validation 2017-12-13 19:54:16 +01:00
Anton Kaliaev
e0fbd148ef Merge pull request #958 from tendermint/pex-on-by-default
activate PEX reactor by default
2017-12-13 12:52:17 -06:00
Anton Kaliaev
2f91289880 update changelog [ci skip] 2017-12-13 12:26:12 -06:00
Ethan Buchman
462b755a60 activate PEX reactor by default 2017-12-13 12:25:48 -06:00
Anton Kaliaev
0a2ecaa393 Merge pull request #953 from tendermint/feature/time-fields
Add Timestamp to Proposal/Vote
2017-12-13 12:18:55 -06:00
Ethan Frey
895e14d6bd Update Diffs to Changes, fix README 2017-12-13 17:57:43 +01:00
Ethan Frey
25f6f6518c Update the ResponseEndBlock values
* Rename diffs -> changes
* Add consensus_param_changes

For context, see:
https://github.com/tendermint/tendermint/issues/924
https://github.com/tendermint/tendermint/issues/952
2017-12-13 17:50:24 +01:00
Ethan Frey
dedf03bb81 Add TotalTx to block header, issue #952
Update state to keep track of this info.
Change function args as needed.
Make NumTx also an int64 for consistency.
2017-12-13 12:20:53 +01:00
Ethan Buchman
318982c0ba checkKeyCondition -> IsKeyInDomain 2017-12-13 01:34:00 -05:00
Anton Kaliaev
a80b66268f Merge pull request #97 from tendermint/rm-root-flag
remove deprecated --root flag
2017-12-12 23:29:36 -06:00
Anton Kaliaev
541780c6df uncomment tests 2017-12-12 23:23:49 -06:00
Anton Kaliaev
c532e8cabc add \n to Printf lines 2017-12-12 22:44:55 -06:00
Jae Kwon
5636a02d03 Remove GetError() from Iterator 2017-12-12 19:19:26 -08:00
Ethan Buchman
edf07760d6 db: fsdb iterator 2017-12-12 21:08:38 -05:00
Ethan Buchman
bcacaf164b db: cleveldb iterator 2017-12-12 20:58:35 -05:00
Ethan Buchman
3e5dbef6a2 db: goleveldb iterator 2017-12-12 20:38:03 -05:00
Ethan Buchman
39e40ff5ce db: memdb iterator 2017-12-12 20:06:50 -05:00
Ethan Buchman
bb115d4d61 cleanupDBDir 2017-12-12 19:28:52 -05:00
Emmanuel Odeke
bbc3b807c6 all: fix vet issues with build tags, formatting
* Build tags need to come before the package name
and have at least a blank line, between them and
the package, please see
  https://golang.org/pkg/go/build/#hdr-Build_Constraints
* fmt.Println doesn't take formatting verbs
* Fix a missing formatting argument to fmt.Printf
2017-12-12 17:23:16 -07:00
Ethan Buchman
ba8c5045b5 db: fixes to fsdb and clevledb 2017-12-12 19:22:08 -05:00
Ethan Buchman
c547caf04f db: some test cleanup 2017-12-12 19:08:22 -05:00
Emmanuel Odeke
5ea42475ce cmd/abci-cli: implement batch
Can now run batch which can be tested by:
```shell
echo -e "echo foo\necho blue" | abci-cli batch
```

giving
```shell
I[12-12|07:55:55.513] Starting socketClient
module=abci-client impl=socketClient
-> code: OK
-> data: foo
-> data.hex: 0x666F6F

-> code: OK
-> data: blue
-> data.hex: 0x626C7565

```
2017-12-12 16:57:51 -07:00
Zach Ramsay
cabc516726 batch: progress 2017-12-12 16:57:51 -07:00
Emmanuel Odeke
ecc13d5a8e cmd/abci-cli: use a single connection per session
Use the single client connection at startup time
for sending over commands instead of shelling out
for every command.
This code fixes the regression from
https://github.com/tendermint/abci/pull/117
which instead used "os/exec".Command with:
    "abci-cli <the_command> [args...]"

The purpose of this code is to restore us
back to the state after cobra replace urlfave/cli.
There is still a bit of work to implement Batch
itself, but that should be simpler as a focused
command.

Fixes #133
2017-12-12 16:57:51 -07:00
Ethan Buchman
5b7f90dfb2 db: test panic on nil key 2017-12-12 18:42:47 -05:00
Ethan Buchman
781f6c5d22 db: some comments in types.go 2017-12-12 18:04:05 -05:00
Jae Kwon
7f650cea86 Remove Prev from Iterator 2017-12-12 14:45:31 -08:00
Jae Kwon
0d03cd9e31 Make it compile 2017-12-12 14:00:03 -08:00
Ethan Buchman
64f056b57d Merge branch '916-remove-sleeps-from-tests' into develop 2017-12-12 16:43:36 -05:00
Ethan Buchman
90df9fa1bf p2p/trust: remove extra channels 2017-12-12 16:43:19 -05:00
Jae Kwon
50a30aafc1 New canonical Iterator 2017-12-12 12:44:47 -08:00
caffix
eae6e6381e trust metric is now a service and the test ticker has been added 2017-12-12 15:33:42 -05:00
Krzysztof Jurewicz
6633889632 Short-circuit assertions in test command 2017-12-12 21:06:56 +01:00
Anton Kaliaev
04a18e0a97 briefly describe the recover process [ci skip] 2017-12-12 13:03:09 -06:00
Anton Kaliaev
06aece31cf lower the max message size 2017-12-12 13:02:40 -06:00
Ethan Buchman
e0296d6c3c consensus: fix makeBlockchainFromWAL 2017-12-12 12:14:15 -05:00
Zach Ramsay
f39b575503 remove deprecated --root flag 2017-12-12 16:55:41 +00:00
Ethan Buchman
310beae63c types: check ResponseCheckTx too 2017-12-12 10:14:50 -05:00
Ethan Frey
5ffb5f01cc Add more tests for Proposal/Vote serialization
String() and Proposal valid after serializing.
To be safe, but mainly to increase test coverage for the PR
2017-12-12 12:59:51 +01:00
Ethan Frey
8576ad58bd Cleanup canonical json 2017-12-12 12:59:51 +01:00
Ethan Frey
c4860f6c29 Force CanonicalTime to UTC
fixes issue with vote serialization breaking the signatures
2017-12-12 12:59:51 +01:00
Ethan Frey
850310b034 Add test to isolate precommit failure
types/vote_test.go now checks signature on a serialized and
then deserialized vote. Turns out go-wire time encoding doesn't
respect timezones, and the signatures don't check out.
2017-12-12 12:59:51 +01:00
Ethan Frey
a29c781295 Add default timestamp to all instances of *types.Vote 2017-12-12 12:59:51 +01:00
Ethan Frey
599673690c Add timestamp to vote canonical encoding 2017-12-12 12:59:51 +01:00
Ethan Frey
7deda53b7c Add Timestamp to Proposal for issue #929
Store it as time.Timestamp locally, encode it as RFC3339 with milliseconds
before signing the canonical form.
2017-12-12 12:59:51 +01:00
Emmanuel Odeke
7167d4e4c7 types: compile type assertions to avoid sneaky runtime surprises
Ensure that the types in result.go implement both
json.Marshaler and json.Unmarshaler
and thus avoid any accidental deletions of their respective
methods which would then cause surprises at runtime.
2017-12-12 01:15:39 -07:00
Ethan Buchman
5ecae52bf1 Merge branch 'master' into develop 2017-12-12 02:31:47 -05:00
Ethan Buchman
ac2d0edb2f Merge pull request #964 from tendermint/fix-gometa-makefile
fix gometalinter.v2 automatically
2017-12-12 02:26:18 -05:00
Petabyte Storage
ae632654d2 add tools check with short circuit 2017-12-11 23:00:18 -08:00
Ethan Buchman
88f5f21dbb Merge pull request #960 from tendermint/release-v0.14.0
Release v0.14.0
2017-12-12 01:28:35 -05:00
Petabyte Storage
49e5510953 remove tools from all 2017-12-11 21:44:53 -08:00
Anton Kaliaev
a6644f7477 remove gopath prefixes
it's safe because I added GOPATH to PATH earlier today
2017-12-11 23:05:22 -06:00
Anton Kaliaev
10265d8667 add tools to make all because it's required for test target 2017-12-11 23:02:42 -06:00
Petabyte Storage
8be708fe5b fix spelling and makefile gometalinter.v2 2017-12-11 20:48:15 -08:00
Ethan Buchman
5facfafbd5 Merge branch 'develop' into release-v0.14.0 2017-12-11 23:09:04 -05:00
Ethan Buchman
11761d1769 initial port of cosmos-sdk basecli proxy 2017-12-11 22:23:13 -05:00
Ethan Buchman
2c14488b93 Merge pull request #963 from tendermint/remove-get-deps-from-makefile
Remove get_deps, update_deps and list_deps from Makefile
2017-12-11 21:56:05 -05:00
Ethan Buchman
c127bce73b Merge pull request #962 from tendermint/wait-a-little-longet-on-ci
wait 5 sec for a block on CircleCI
2017-12-11 21:54:57 -05:00
Anton Kaliaev
af79a2a59e fix error msg 2017-12-11 19:50:05 -06:00
Anton Kaliaev
ee66476d62 set max msg size
otherwise, it is easy to get OutOfMemory panic (somebody can even expoit
this)
2017-12-11 19:48:57 -06:00
Anton Kaliaev
40f9261d48 handle data corruption errors
Refs #573
2017-12-11 19:48:20 -06:00
Anton Kaliaev
69205594cc add gopath to path on CircleCI 2017-12-11 16:59:08 -06:00
Anton Kaliaev
d943f66abc remove get_deps, update_deps and list_deps
Rationale: they only lead to broken builds and should not be used by
anyone.
2017-12-11 16:55:40 -06:00
Anton Kaliaev
b2385b46cf wait 5 sec for a block on CircleCI
Fixes:
```
--- FAIL: TestHandshakeReplaySome (12.40s)
        replay_test.go:332: waited too long for tendermint to produce 6 blocks
```
2017-12-11 16:22:27 -06:00
Ethan Buchman
2af32d6665 changelog and version bump 2017-12-11 15:05:56 -05:00
Ethan Buchman
5c58db3bb4 changelog [ci skip] 2017-12-11 14:49:34 -05:00
Ethan Buchman
24a9491203 Merge pull request #955 from tendermint/939-p2p-exponential-backoff-on-reconnect
p2p: exponential backoff on reconnect. closes #939
2017-12-11 14:25:39 -05:00
Ethan Buchman
5511bd8e85 p2p: exponential backoff on reconnect. closes #939 2017-12-11 13:41:09 -05:00
Ethan Buchman
f1ca2b3a3a Merge pull request #698 from tendermint/feat-appveyor
WIP: Run tests on AppVeyor
2017-12-10 20:06:34 -05:00
Ethan Buchman
10fcefe346 appveyor: use make 2017-12-10 20:07:44 -05:00
Ethan Buchman
0bfc11f1ba blockchain: note about store tests needing simplification ... 2017-12-10 20:03:58 -05:00
Emmanuel Odeke
96998a5498 blockchain: Block creator helper for compressing tests as per @ebuchman 2017-12-10 19:58:22 -05:00
Emmanuel Odeke
2da5299924 blockchain: less fragile and involved tests for blockstore
With feedback from @ebuchman, to make the tests nicer
and less fragile.
2017-12-10 19:58:22 -05:00
Emmanuel Odeke
83b40b25d6 blockchain: deduplicate store header value tests 2017-12-10 19:57:06 -05:00
Emmanuel Odeke
05f30b3e28 blockchain: updated store docs/comments from review 2017-12-10 19:57:06 -05:00
Ethan Buchman
116a61beb1 blockchain: update store comments 2017-12-10 19:57:06 -05:00
Emmanuel Odeke
8c86bb8024 blockchain: add tests and more docs for BlockStore
Add tests to test store, to the fullest reasonable extent for
paths that can taken by input arguments altering internal behavior,
as well as by mutating content in the DB.
2017-12-10 19:54:34 -05:00
Ethan Buchman
41bb2c2663 Merge pull request #931 from tendermint/785-wal-improvements
[consensus] remove WAL separator
2017-12-10 19:46:02 -05:00
Ethan Buchman
e7b9cd8ee8 Merge branch 'develop' into 785-wal-improvements 2017-12-10 19:45:52 -05:00
Ethan Buchman
3019b9f320 Merge pull request #948 from tendermint/945-transparent-websocket
bring back transparent websocket (Refs #945)
2017-12-10 19:05:32 -05:00
Ethan Buchman
d836ee056d Merge pull request #96 from tendermint/tm-945
add String method to Query interface
2017-12-10 19:05:00 -05:00
Ethan Buchman
60872d7d7c Merge pull request #949 from tendermint/docs/trust-metric-usage
Docs/trust metric usage
2017-12-10 19:01:16 -05:00
Ethan Buchman
a37c1143ca adr: update 007 trust metric usage 2017-12-10 19:00:44 -05:00
Zach Ramsay
d6e821ea4f linter: enable in CI & make deterministic 2017-12-10 22:34:38 +00:00
Jae Kwon
a0b692c86d Add PushBytes to Heap 2017-12-10 14:23:27 -08:00
caffix
4e08ee1833 made clarifications based on odeke-em's PR comments 2017-12-10 15:39:43 -05:00
caffix
7563870d11 added the trust metric usage guide 2017-12-10 15:39:43 -05:00
Jae Kwon
03dfb724c7 Change heap.Push to mean int priority 2017-12-10 10:18:35 -08:00
Zach
12c5a57415 determinisitic linter (#902)
* linter: address gosimple lints

* linter: make deterministic & a rebase fix

* lint/rpc: fix a gosimple lint

* run linter in CI

* fix rebase mistake

* fix makefile

* ugh

* revert Makefile

* add metalinter to CI

* try this

* linter: last little fix

* need glide

* better

* okayy circle, have it your way

* lints: gosimple

* pr comments
2017-12-10 17:44:22 +00:00
Anton Kaliaev
101680d603 update changelog [ci skip] 2017-12-10 11:35:22 -06:00
Anton Kaliaev
d819d5d324 update changelog [ci skip] 2017-12-10 11:34:08 -06:00
Anton Kaliaev
90cdffa067 fixes after my own review (Refs #945) 2017-12-10 11:29:36 -06:00
Ethan Buchman
080640a171 Merge pull request #936 from tendermint/update-dockerfile-to-0.12.1
Update dockerfile to 0.12.1
2017-12-10 12:15:09 -05:00
Anton Kaliaev
950a64f756 bring back transparent websocket (Refs #945) 2017-12-10 01:18:10 -06:00
Anton Kaliaev
e4ef2835f0 return error if client already subscribed 2017-12-09 23:35:14 -06:00
Anton Kaliaev
cb4ba522ef add String method to Query interface
Required for https://github.com/tendermint/tendermint/issues/945
2017-12-09 23:05:13 -06:00
Anton Kaliaev
b50cef742d Merge pull request #943 from tendermint/feature/update-vagrantfile
Update Vagrantfile to xenial (16.04 LTS)
2017-12-09 17:03:44 -06:00
Anton Kaliaev
4f50935aa2 Merge pull request #946 from ricardohsd/fix-typo
consensus: Fix typo on ticker.go documentation
2017-12-09 17:03:12 -06:00
caffix
44f62e5e27 built the WaitForStop functionality into the Stop method 2017-12-09 13:25:28 -05:00
Jae Kwon
988e190ef7 Deprecated Panic* 2017-12-09 09:26:03 -08:00
Ricardo Domingos
59e89e7664 consensus: Fix typo on ticker.go documentation 2017-12-09 13:14:53 +01:00
caffix
5d464364a8 fixed the racy test and removed all the calls to Sleep 2017-12-08 15:51:18 -05:00
Ethan Frey
2112299586 Cleanup apt-get ala PR comments 2017-12-08 19:20:53 +01:00
Ethan Frey
c771964a40 Add vagrant_test to Makefile for integration tests 2017-12-08 18:36:58 +01:00
Anton Kaliaev
a199ec2813 update docker readme 2017-12-08 11:35:35 -06:00
Anton Kaliaev
a28b3fff49 update Dockerfile to 0.13.0 2017-12-08 11:34:34 -06:00
Anton Kaliaev
b49bce2bc3 Merge pull request #95 from tendermint/feature/repeat-timer
Refactor repeat timer
2017-12-08 11:31:27 -06:00
Anton Kaliaev
ff2fd63bf7 rename trySend to send 2017-12-08 11:17:07 -06:00
Ethan Frey
5bcd95f01f Use apt-get/ppa instead of tarballs for golang/docker
Minor cleanup and comments
2017-12-08 18:10:39 +01:00
Ethan Frey
c84494b36b Update Vagrantfile to xenial (16.04 LTS)
Note default username changed from vagrant to ubuntu in the base image.
2017-12-08 18:10:39 +01:00
Anton Kaliaev
7e3a5b7ce8 Merge pull request #942 from tendermint/bugfix/install-stdlib
From CGO_ENABLED=0 from make install
2017-12-08 11:03:05 -06:00
Ethan Buchman
fbfd11de2c add @melekes as codeowner 2017-12-08 11:48:05 -05:00
Ethan Frey
9657d183f8 Remove CGO_ENABLED=0 from make install
It was writing to stdlib packages net, x/crypto, etc. and failing when it didn't have write access to them (which it often shouldn't)

Fixes issue #941

Explained in golang issue: golang/go#18981 (fixed in develop/1.10)
2017-12-08 17:03:09 +01:00
Ethan Frey
ec4adf21e0 Cleanup from PR comments 2017-12-08 10:15:26 +01:00
Ethan Buchman
b98098b1f0 Merge pull request #932 from tendermint/920-default-moniker-to-host-name
default moniker to the host name
2017-12-07 18:34:38 -05:00
Ethan Buchman
1ae14e5a3d Merge pull request #933 from tendermint/880-node-fails-if-one-of-the-seeds-cannot-be-resolved
tolerate unresolvable seeds
2017-12-07 18:27:58 -05:00
Anton Kaliaev
7a92a3b729 update docker readme 2017-12-07 13:49:29 -06:00
Anton Kaliaev
457c688346 update Dockerfile to point to 0.12.1 2017-12-07 13:48:31 -06:00
Anton Kaliaev
c609b18698 tolerate unresolvable seeds (Refs #880) 2017-12-07 13:17:09 -06:00
Anton Kaliaev
5ff0bb2100 default moniker to the host name (Refs #920) 2017-12-07 12:49:29 -06:00
Anton Kaliaev
90944bb1a2 be specific about what type we're encoding
to be consistent with Decode, which returns TimedWALMessage
2017-12-07 11:45:50 -06:00
Anton Kaliaev
07571741c5 [consensus] remove WAL separator (Refs #785)
We don't really need a separator unless we have complex structures
(rows, cells like RDBMS have https://www.sqlite.org/fileformat.html).
2017-12-07 11:36:46 -06:00
Ethan Frey
cc7a87e27c Use Ticker in Repeat again to avoid drift 2017-12-07 11:22:54 +01:00
Ethan Frey
8797197cdf No more blocking on multiple Stop() 2017-12-07 10:38:50 +01:00
Ethan Frey
887d766c86 Refactored RepeatTimer, tests hang 2017-12-07 10:15:38 +01:00
Ethan Buchman
14ccc8bc4c Merge pull request #930 from tendermint/468-make-consensus-data-deterministic
make consensus/test_data deterministic
2017-12-06 22:28:03 -05:00
Anton Kaliaev
daa6c39dcb Merge pull request #94 from tendermint/feature/timer-refactor
Refactor throttle timer
2017-12-06 18:58:23 -06:00
Anton Kaliaev
3779310c72 return back output internal channel (way go does with Timer) 2017-12-06 18:48:39 -06:00
Anton Kaliaev
5cb936fa00 fixes after my own review 2017-12-06 18:28:14 -06:00
Anton Kaliaev
c6f025f40e generate WAL on the fly (Refs #468) 2017-12-06 16:01:08 -06:00
Ethan Frey
8b518fadb2 Don't close throttle channel, explain why 2017-12-06 22:28:18 +01:00
Ethan Frey
e430d3f844 One more attempt with a read-only channel 2017-12-06 21:51:23 +01:00
Ethan Frey
1ac4c5dd6d Made throttle output non-blocking 2017-12-06 21:20:30 +01:00
Ethan Frey
0a8721113a First pass of PR updates 2017-12-06 21:08:55 +01:00
Ethan Frey
4ec7883891 Cleanup 2017-12-06 11:21:01 +01:00
Ethan Frey
dcb4395604 Refactor throttle timer 2017-12-06 11:17:50 +01:00
Ethan Buchman
fca2b508c1 Merge pull request #155 from tendermint/develop
v0.8.0 take II
2017-12-06 03:26:47 -05:00
Ethan Buchman
47216538fd types: add UnmarshalJSON funcs for Response types 2017-12-06 03:19:28 -05:00
Ethan Frey
3d9113c16e Add a bit more padding to tests so they pass on osx with -race 2017-12-06 09:18:04 +01:00
Ethan Buchman
12dca48768 Merge pull request #154 from tendermint/develop
Release 0.8.0
2017-12-06 02:39:56 -05:00
Ethan Buchman
293cf5e634 minor fix [ci skip] 2017-12-06 02:41:14 -05:00
Ethan Buchman
f860c33515 changelog and version 2017-12-06 02:33:35 -05:00
Ethan Buchman
bfcc0217f1 Merge pull request #93 from tendermint/release/0.5.0
Release/0.5.0
2017-12-06 02:08:29 -05:00
Ethan Buchman
e6be03db31 update license and changelog 2017-12-06 02:05:57 -05:00
Ethan Buchman
e1ee4d6bf5 types: add MarshalJSON funcs for Response types with a Code 2017-12-06 01:56:39 -05:00
Anton Kaliaev
b166d627f3 bump up version to 0.5.0 2017-12-05 18:04:28 -06:00
Anton Kaliaev
303b6df812 update changelog 2017-12-05 18:04:07 -06:00
Anton Kaliaev
283462dfe4 Merge pull request #86 from tendermint/fix-lint
fix warnings
2017-12-05 17:53:38 -06:00
Anton Kaliaev
c325ce2182 use NoErrorf and Errorf functions 2017-12-05 17:49:42 -06:00
Ethan Buchman
4b9cae8998 Merge pull request #151 from tendermint/set-option-code
ResponseSetOption includes a response Code. Closes #64"
2017-12-05 18:48:02 -05:00
Ethan Buchman
1b2c383205 ResponseSetOption includes a response Code. Closes #64" 2017-12-05 18:41:52 -05:00
Ethan Buchman
fff8e963f8 update readme 2017-12-05 17:45:26 -05:00
Ethan Buchman
cfa14074df Merge branch 'server-test' into develop 2017-12-05 17:39:30 -05:00
Ethan Buchman
f6e22e4296 update readme for notes about grpc 2017-12-05 17:22:06 -05:00
Anton Kaliaev
27ab1f6bd9 Merge pull request #90 from tendermint/feature/throttle-timer
test timers
2017-12-05 14:17:41 -06:00
Krzysztof Jurewicz
8357326db0 Fix test command 2017-12-05 18:28:15 +01:00
Ethan Frey
26abd65e34 Add tests for repeat timer 2017-12-05 15:01:07 +01:00
Ethan Frey
53cdb6cf82 Demo throttle timer is broken 2017-12-05 14:49:16 +01:00
Petabyte Storage
4769719a4b fix Errorf 2017-12-04 08:54:19 -08:00
Anton Kaliaev
d625020c90 Merge pull request #89 from tendermint/license
add license file (Fixes #87) [ci skip]
2017-12-04 10:39:56 -06:00
Anton Kaliaev
3af6044fdf add license file (Fixes #87) [ci skip] 2017-12-04 10:38:55 -06:00
Adrian Brink
e99e6ea0c7 Extend abci-cli to allow integration tests
This commit adds the basic test command 'abci-cli test' that will
allow developers of server for their own language to continuously test
their implementation.
2017-12-04 11:33:39 +01:00
Jae Kwon
17dc8a7449 SetDeleter/Batch separation 2017-12-03 21:44:48 -08:00
Ethan Buchman
48413b4839 Merge pull request #149 from tendermint/gogo-int
Gogo int
2017-12-02 11:52:50 -05:00
Ethan Buchman
2b804bb5a1 remove custom type int https://github.com/gogo/protobuf/issues/359 2017-12-02 11:47:02 -05:00
Ethan Buchman
9afd3da3b2 changelog 2017-12-02 01:56:21 -05:00
Ethan Buchman
82d56571b5 types: int32 with gogo int 2017-12-02 01:48:46 -05:00
Ethan Buchman
3890a2058f types: IsOK() 2017-12-02 01:48:37 -05:00
Ethan Buchman
8831249e95 Merge pull request #147 from tendermint/int64
Int64
2017-12-01 16:12:20 -05:00
Ethan Buchman
026ff5e89f Merge pull request #148 from tendermint/begin_block
Begin block
2017-12-01 16:11:49 -05:00
Petabyte Storage
ebc543ebe3 fix warnings 2017-12-01 09:51:37 -08:00
Ethan Buchman
fc90b2de1c fix dummy test 2017-12-01 11:33:07 -05:00
Ethan Buchman
b20273439d types: RequestBeginBlock includes absent and byzantine validators 2017-12-01 03:00:11 -05:00
Ethan Buchman
9272756c49 types: add note about ReadMessage having no cap 2017-12-01 03:00:11 -05:00
Ethan Buchman
3d3d1288d1 types: consolidate some file 2017-12-01 03:00:11 -05:00
Ethan Buchman
b39e768a1a disable metalinter on CI 2017-12-01 02:50:17 -05:00
Ethan Buchman
b7a75ce8c3 update readme 2017-12-01 01:16:00 -05:00
Ethan Buchman
0ad7dea71f uint64 -> int64 2017-12-01 00:41:07 -05:00
Ethan Buchman
b59fe60e65 abci-cli: prefix flag variables with flag 2017-12-01 00:35:14 -05:00
Ethan Buchman
d9d5e35ca5 Merge pull request #145 from tendermint/types-makeover
Types makeover
2017-11-30 20:19:21 -05:00
Ethan Buchman
5d2838ebab fix from review 2017-11-30 20:17:06 -05:00
Ethan Buchman
ed393f9934 abci-cli: print OK if code is 0 2017-11-30 17:51:40 -05:00
Ethan Buchman
e3f6666ecc update changelog; add rudis script for safe keeping 2017-11-30 17:48:05 -05:00
Ethan Buchman
f00a19eaad fix tutorial output to remove code msg 2017-11-30 17:36:16 -05:00
Ethan Buchman
10031f57d5 fix grpc version; add log_level and some logging 2017-11-30 17:20:36 -05:00
Ethan Buchman
550d6a6081 shame: forgot to add new code pkg 2017-11-30 15:37:31 -05:00
Ethan Buchman
81e4effbdb types: use data.Bytes directly in type.proto via gogo/protobuf. wow 2017-11-30 15:31:12 -05:00
Ethan Buchman
24fbe291ab update glide; update services for new signature 2017-11-30 15:21:00 -05:00
Ethan Buchman
308cb8e454 use gogo/protobuf 2017-11-30 14:47:09 -05:00
Ethan Buchman
42a8e3240c remove CodeType 2017-11-30 14:29:12 -05:00
Anton Kaliaev
22b491bb19 Merge pull request #144 from tendermint/feature/tags-helper-methods
add 2 helper methods for building KVPair(s)
2017-11-30 11:37:03 -06:00
Anton Kaliaev
20befcf6d6 add 2 helper methods for building KVPair(s) 2017-11-30 11:17:35 -06:00
Ethan Buchman
b89fd815a5 Merge pull request #141 from tendermint/feature/add-tags-to-dummy-app
include tags into dummy application DeliverTx response
2017-11-30 03:02:11 +00:00
Ethan Buchman
32a6545604 changelog [ci skip] 2017-11-30 03:02:48 +00:00
Ethan Buchman
3b994b4e8a dummy: include app.key tag 2017-11-30 02:45:40 +00:00
Anton Kaliaev
72c3ea3872 include tags into dummy application DeliverTx response
Refs https://github.com/tendermint/tendermint/pull/835
2017-11-29 20:19:58 -06:00
Anton Kaliaev
21fb781989 Merge pull request #84 from tendermint/85-indexing
query#Conditions for indexing
2017-11-29 12:49:38 -06:00
Anton Kaliaev
c9694b1ba1 fix warnings 2017-11-29 12:44:16 -06:00
Anton Kaliaev
3822727981 add Conditions function
Refs https://github.com/tendermint/tendermint/pull/835
2017-11-29 12:44:16 -06:00
Anton Kaliaev
850fd24ee9 Merge pull request #85 from tendermint/85-indexing-2
IntInSlice and StringInSlice functions
2017-11-29 12:37:33 -06:00
Anton Kaliaev
33abe87c5b IntInSlice and StringInSlice functions
Refs https://github.com/tendermint/tendermint/pull/835
2017-11-29 12:18:03 -06:00
Ethan Frey
468c4188c1 Merge pull request #51 from tendermint/keystore
Keybase
2017-11-29 15:25:59 +01:00
Ethan Buchman
1e12754b3a Merge pull request #75 from tendermint/45-change-common-start-signature
change common start signature
2017-11-29 06:05:50 +00:00
Ethan Buchman
4d991acae0 common: comments for Service 2017-11-29 05:16:15 +00:00
Ethan Buchman
ddd141c1c5 Merge branch 'develop' into 45-change-common-start-signature 2017-11-29 05:08:12 +00:00
Ethan Buchman
57fea1335a Makefile and linter 2017-11-29 05:08:05 +00:00
Ethan Buchman
5c29adc081 Merge pull request #139 from tendermint/sunset-tmlibs-process
tests: sunset tmlibs/process.Process
2017-11-28 08:04:27 +00:00
Ethan Buchman
67a81c13e2 run linter on make test 2017-11-28 07:55:07 +00:00
Ethan Buchman
bb141794c8 client: use vars for retry intervals 2017-11-28 07:47:51 +00:00
Ethan Buchman
9ed5787b6a tests: fix ensureABCIIsUp 2017-11-28 07:38:01 +00:00
Emmanuel Odeke
6231652e87 tests: sunset tmlibs/process.Process
Updates https://github.com/tendermint/tmlibs/issues/81

No longer using tmlibs/process.Process as we deemed
it racy and would incur a maintenance cost yet not
used anywhere else but in these tests and not in actual
code.
2017-11-27 22:50:31 -07:00
Anton Kaliaev
c2fcc093b2 remove bool from Service#Reset 2017-11-27 23:42:36 -06:00
Anton Kaliaev
f75339264f Merge pull request #83 from tendermint/gut-process
remove package process
2017-11-27 22:37:35 -06:00
Emmanuel Odeke
e07ad01f62 remove package process
Fixes https://github.com/tendermint/tmlibs/issues/81

That package is untested and racy, and not used except in
a test, but even that's now gutted with
  https://github.com/tendermint/abci/pull/139
so the general consensus is that we sunset this package.
2017-11-27 21:24:46 -07:00
Anton Kaliaev
eb31c04f47 Merge tag 'v0.4.1' into develop
Tagged 0.4.1 release
2017-11-27 21:38:24 -06:00
Anton Kaliaev
b854baa1fc Merge branch 'release/0.4.1' 2017-11-27 21:38:12 -06:00
Anton Kaliaev
3244f73f32 update version 2017-11-27 21:37:39 -06:00
Anton Kaliaev
4e705a3157 update changelog 2017-11-27 21:37:15 -06:00
Ethan Buchman
460c045fcc Merge pull request #130 from tendermint/feature/tags-in-deliver-tx
Tags in DeliverTx response
2017-11-27 22:41:57 +00:00
Anton Kaliaev
a0bf6dc1a1 move comment 2017-11-27 16:28:34 -06:00
Ethan Buchman
0981c174cc update README for CheckTx Gas and Fee 2017-11-27 22:28:41 +00:00
Ethan Buchman
ab51bdef99 types.pb.go isnt linted. use nolint :( 2017-11-27 20:53:03 +00:00
Ethan Buchman
26d967af7e linter 2017-11-27 20:42:30 +00:00
Ethan Buchman
5a46675185 minor things 2017-11-27 20:27:18 +00:00
Ethan Buchman
e9094fbee3 update changelog 2017-11-27 20:19:04 +00:00
Ethan Buchman
e08885e3cd minor fix 2017-11-27 20:16:35 +00:00
Ethan Buchman
7dc5b746ac types: add gas and fee fields to CheckTx 2017-11-27 20:10:11 +00:00
Ethan Buchman
fb612e5a7b fixup tests 2017-11-27 19:52:06 +00:00
Ethan Buchman
d3bac7a6fe clist: reduce numTimes in test 2017-11-27 19:49:30 +00:00
Ethan Buchman
c7f54fb56c everything takes Request, returns Response; expect DeliverTx/CheckTx/Commit 2017-11-27 19:04:21 +00:00
Anton Kaliaev
67d2a5f66d set Code to OK in ResponseQuery in BaseApplication
See https://github.com/tendermint/abci/pull/130#discussion_r152713220
2017-11-24 16:45:36 -06:00
Anton Kaliaev
9b30fab4fc preserve behaviour of BaseApplication 2017-11-22 19:38:28 -06:00
Anton Kaliaev
03fafeec2f fix formatting of panicf function 2017-11-22 19:38:04 -06:00
Anton Kaliaev
0176a834d1 refactor code 2017-11-22 19:37:51 -06:00
Anton Kaliaev
cbf347e2aa add comment for Client interface [ci skip] 2017-11-22 19:07:36 -06:00
Anton Kaliaev
2cfad8523a test HumanCode 2017-11-22 18:24:53 -06:00
Anton Kaliaev
1726e82865 add IsErr and Error method for ResultQuery 2017-11-22 18:19:41 -06:00
Anton Kaliaev
afb7feeea2 update CHANGELOG 2017-11-22 17:51:36 -06:00
Anton Kaliaev
91efacfabc remove types.Result 2017-11-22 17:44:39 -06:00
Anton Kaliaev
f01f2bbf3a DeliverTxSync/CheckTxSync/CommitSync now return error as well 2017-11-22 17:34:00 -06:00
Anton Kaliaev
01252e8cc8 mark Result as deprecated 2017-11-22 16:18:06 -06:00
Anton Kaliaev
5fd83b3eee implement error interface for ResponseDeliverTx/CheckTx/Commit 2017-11-22 16:17:34 -06:00
Anton Kaliaev
7868a3358f gather test coverage 2017-11-21 19:07:39 -06:00
Anton Kaliaev
52ec4efe27 retire test_integrations in favor of just make test 2017-11-21 18:11:23 -06:00
Anton Kaliaev
5be9c50b47 fix megacheck warning 2017-11-21 17:53:48 -06:00
Anton Kaliaev
f6a79dd7c5 add interface assertions for all clients 2017-11-21 17:50:06 -06:00
Anton Kaliaev
e6fdc98aeb update changelog 2017-11-21 17:44:22 -06:00
Anton Kaliaev
fbe7234639 remove Result from the client package
plus make Client interface more consistent. All *Sync functions now
return an error as a second return param. Deliver/Check/Commit use Code
to indicate errors and have IsErr() func defined on ResponseXYZ structs.
2017-11-21 17:44:13 -06:00
Anton Kaliaev
8e6269ce93 update README 2017-11-21 15:24:29 -06:00
Anton Kaliaev
3a3d508e5c CheckTx and DeliverTx return ResponseCheckTx and ResponseDeliverTx respectively
Commit now returns ResponseCommit
2017-11-20 20:36:42 -06:00
Anton Kaliaev
92801dbd72 [dockerfile] install psmisc for tests 2017-11-20 18:30:10 -06:00
Anton Kaliaev
fc7db13fa8 remove tags from CheckTx
add value_type field to KVPair
2017-11-20 18:21:59 -06:00
Anton Kaliaev
02399071ff add ldconfig cmd to Dockerfile 2017-11-20 18:17:56 -06:00
Anton Kaliaev
29c1cd03ea [make install_protoc] fix folder name 2017-11-20 17:09:18 -06:00
Anton Kaliaev
3cbf44058d no need for protoc in make all since we have types.pb.go generated 2017-11-20 16:56:57 -06:00
Anton Kaliaev
8b71e47002 add linter for proto files (Fixes #128) 2017-11-20 16:56:57 -06:00
Anton Kaliaev
76bd68f881 add docker commands to Makefile 2017-11-20 16:56:57 -06:00
Anton Kaliaev
33b51378f2 reformat types.proto 2017-11-20 16:56:57 -06:00
Anton Kaliaev
bb0d7e9526 add tags field to DeliverTx and CheckTx 2017-11-20 16:56:57 -06:00
Anton Kaliaev
f07c300c14 add proto section to .editorconfig 2017-11-20 16:56:57 -06:00
Anton Kaliaev
87072d3810 add Dockerfile for development 2017-11-20 16:56:56 -06:00
Anton Kaliaev
480e4e4444 install protoc 2017-11-20 16:56:56 -06:00
Martin Dyring-Andersen
5c4397ab30 Run tests on AppVeyor 2017-11-20 13:23:28 +01:00
Ethan Buchman
135a1a7cd7 db: sort keys for memdb iterator 2017-11-20 03:06:18 +00:00
Ethan Frey
086e1f6508 Make vetshadow and zach happy 2017-11-15 13:57:17 +01:00
Anton Kaliaev
bee7c5c7aa Merge tag 'v0.7.1' into develop
Tagged 0.7.1 release
2017-11-14 13:10:35 -06:00
Anton Kaliaev
76ef8a0697 Merge branch 'release/0.7.1' 2017-11-14 13:10:17 -06:00
Anton Kaliaev
bac924e399 update version 2017-11-14 13:09:27 -06:00
Anton Kaliaev
f808dd5596 update CHANGELOG 2017-11-14 13:09:19 -06:00
Anton Kaliaev
a5f624174d Merge pull request #135 from tendermint/server/minor-refactor
server: minor refactor
2017-11-14 13:02:05 -06:00
Anton Kaliaev
bf34c378e9 Merge pull request #136 from tendermint/update-go-version-and-deps
Update go version and deps
2017-11-14 12:58:35 -06:00
Anton Kaliaev
1d49453ffb fix integration tests (Fixes #131) 2017-11-14 12:53:40 -06:00
Anton Kaliaev
f2bf7d1b2d update go version to 1.9.2 2017-11-14 12:26:01 -06:00
Anton Kaliaev
a52b98c70e update deps 2017-11-14 12:25:52 -06:00
Ethan Buchman
3bd8782ab2 server: minor refactor 2017-11-14 17:10:22 +00:00
Ethan Buchman
3972635c23 Merge pull request #129 from paulrd/patch-1
Wrong 'error' variable is being read in socket_server.go
2017-11-14 16:54:49 +00:00
Ethan Frey
2649c056cd Minor cleanup 2017-11-13 14:54:14 +01:00
Ethan Frey
9d78be41b5 Update tmlibs to sdk-develop, fix broken test 2017-11-13 14:41:00 +01:00
Ethan Frey
2d4544d6ce Tests compile 2017-11-13 14:36:43 +01:00
Ethan Frey
4173d1031e go build compiles 2017-11-13 14:36:43 +01:00
Ethan Frey
9ef978c5ec Fix errors except for es missing 2017-11-13 14:36:43 +01:00
Ethan Frey
946c9c573e Handle generating keys 2017-11-13 14:36:43 +01:00
Ethan Frey
ac841a6124 Fixed imports 2017-11-13 14:36:43 +01:00
Jae Kwon
a2583e2783 Draft of suggested changes 2017-11-13 14:36:43 +01:00
Anton Kaliaev
7dbf69df7d Merge pull request #132 from tendermint/use-makefile-commands-in-readme
use Makefile commands in readme [ci skip]
2017-11-12 22:31:55 -05:00
Anton Kaliaev
64c756de47 use Makefile commands in readme [ci skip] 2017-11-12 22:30:41 -05:00
Jae Kwon
56e51bc113 CacheWrap() -> CacheDB() CacheDB 2017-11-11 17:37:30 -05:00
Anton Kaliaev
2442a0a698 Merge pull request #78 from tendermint/editorconfig
add .editorconfig
2017-11-11 11:32:59 -05:00
Anton Kaliaev
4ea6340f1a add .editorconfig 2017-11-11 11:25:30 -05:00
Jae Kwon
8481c49c82 CacheDB (#67)
* Add CacheDB & SimpleMap
* Generic memBatch; Fix cLevelDB tests
* CacheWrap() for CacheDB and MemDB
* Change Iterator to match LeviGo Iterator
* Fixes from review
* cacheWrapWriteMutex and some race fixes
* Use tmlibs/common
* NewCWWMutex is exposed.  DB can be CacheWrap'd
* Remove GetOK, not needed
* Fsdb (#72)
* Add FSDB
* Review fixes from Anton
* Review changes
* Fixes from review
2017-11-09 17:42:32 -05:00
Anton Kaliaev
0f96d5d1f6 Merge pull request #126 from tendermint/124-version-command
version command
2017-11-09 17:08:02 -05:00
Paul
43c64163d8 Update socket_server.go
This is likely related to #125
2017-11-09 13:16:35 -04:00
Anton Kaliaev
10e1233f14 fix megacheck issues 2017-11-08 17:29:15 -05:00
Anton Kaliaev
430c49ea14 update deps 2017-11-08 17:20:20 -05:00
Anton Kaliaev
5efe88cd10 simplify Makefile install and build commands 2017-11-08 17:20:20 -05:00
Anton Kaliaev
ecb1f02f77 add version cmd (Refs #124) 2017-11-08 17:20:10 -05:00
Anton Kaliaev
176c2ceed6 Merge pull request #77 from tendermint/18-unsupported-value-type
encode complex types as "%+v"
2017-11-07 21:29:54 -05:00
Anton Kaliaev
798848320f Merge pull request #76 from tendermint/29-log-logger-errors
log logger's errors
2017-11-07 21:29:35 -05:00
Anton Kaliaev
69447564b8 encode complex types as "%+v" (Refs #18) 2017-11-06 15:44:21 -05:00
Anton Kaliaev
4b989151ed log logger's errors (Refs #29) 2017-11-06 14:18:42 -05:00
Ethan Buchman
b4f04f196c Merge pull request #49 from tendermint/pubKey-invalid-data-returns-empty-pubKey
PubKeyFromBytes: return zero value PubKey on error
2017-11-06 13:05:06 -06:00
Anton Kaliaev
e6164d4052 change service#Stop to be similar to Start 2017-11-06 12:47:23 -05:00
Anton Kaliaev
4123d54bf6 change service#Start to return just error (Refs #45)
```
@melekes
yeah, bool is superfluous
@ethanfrey
If I remember correctly when I was writing test code, if I call Start() on a Service that is already running, it returns (false, nil). Only if I try to legitimately start it, but it fails in startup do I get an error.
The distinction is quite important to make it safe for reentrant calls. The other approach would be to have a special error type like ErrAlreadyStarted, then check for that in your code explicitly. Kind of like if I make a db call in gorm, and get an error, I check if it is a RecordNotFound error, or whether there was a real error with the db query.
@melekes
Ah, I see. Thanks. I must say I like ErrAlreadyStarted approach more (not just in Golang)
```
2017-11-06 12:18:04 -05:00
Anton Kaliaev
ac0cf0b2e2 Merge pull request #74 from tendermint/73-undefined-syscall-kill
use os.Process#Kill (Fixes #73)
2017-11-04 09:07:03 -05:00
Anton Kaliaev
49d75e223e use os.Process#Kill (Fixes #73) 2017-11-04 08:14:47 -05:00
Anton Kaliaev
b658294a13 use assert.Contains in cmap_test 2017-11-04 00:10:59 -05:00
Wolf
88481fc363 Make iterating over keys possible (#63)
* Make iterating over keys possible

* add test for cmap
- test Keys() and Values() respectively

* one cmap per test-case
2017-11-04 00:06:20 -05:00
Anton Kaliaev
0f555f8d2c Merge pull request #71 from tendermint/69-read-impl-and-tests
[autofile] test GroupReader more extensively (Refs #69)
2017-11-04 00:02:02 -05:00
Anton Kaliaev
d8dd497069 fix metalinter errors 2017-10-30 13:01:18 -05:00
Anton Kaliaev
668698584d [autofile] test GroupReader more extensively (Refs #69) 2017-10-30 12:48:51 -05:00
Emmanuel Odeke
b0cf4b4757 PubKeyFromBytes: return zero value PubKey on error
Fixes https://github.com/tendermint/go-crypto/issues/48.

This previously skewed up my fuzzing tests so ensure
that on error we return the zero value PubKey.
2017-10-28 14:11:22 -07:00
Ethan Buchman
dd20358a26 Merge pull request #47 from tendermint/release-v0.4.1
Release v0.4.1
2017-10-27 22:28:35 -04:00
Ethan Buchman
d2b1a7096e changelog 2017-10-27 22:17:34 -04:00
Ethan Buchman
377d3c7e11 fix from revert 2017-10-27 22:04:22 -04:00
Ethan Buchman
6405618220 Revert "Upgrade keys to use bcrypt with salts (#38)"
This reverts commit 8e7f0e7701.
2017-10-27 22:02:44 -04:00
Ethan Buchman
87badb090f Revert "Parameterize and lower bcrypt cost"
This reverts commit dfc4cdd2d7.
2017-10-27 21:58:02 -04:00
Ethan Buchman
d1f00be7a0 Merge pull request #46 from tendermint/develop
Develop
2017-10-27 12:57:37 -04:00
Ethan Buchman
8630b724b2 version and changelog 2017-10-27 12:57:26 -04:00
Ethan Frey
ad31f6a953 osx + hid = <3 2017-10-27 18:46:21 +02:00
Ethan Buchman
dc33aad9b4 Merge pull request #122 from tendermint/develop
Develop
2017-10-27 12:25:50 -04:00
Ethan Buchman
c9612f094b glide 2017-10-27 12:13:16 -04:00
Ethan Buchman
d973cb5df9 changelog and version 2017-10-27 12:12:34 -04:00
Ethan Buchman
d9525c0fb6 Merge pull request #70 from tendermint/develop
Develop
2017-10-27 12:05:43 -04:00
Ethan Buchman
944d36ab00 changelog 2017-10-27 12:04:31 -04:00
Ethan Buchman
b14c996698 update changelog 2017-10-27 11:52:10 -04:00
Ethan Buchman
092eb701c7 cmn: Kill 2017-10-27 11:01:40 -04:00
Ethan Buchman
66de53292e Merge pull request #117 from tendermint/cobra-not-urfave
use spf13/cobra instead of urfave/cli
2017-10-27 02:47:21 -04:00
Ethan Buchman
42145a82bd version and changelog 2017-10-26 20:57:33 -04:00
Ethan Buchman
57346134a5 keys: transactions.go -> types.go 2017-10-26 16:43:32 -04:00
Ethan Frey
db5603e374 Merge pull request #45 from tendermint/bugfix/nano-hid
Bugfix: ledger nano/hid compiles on osx/golang1.9
2017-10-26 06:52:52 -07:00
Zach Ramsay
f013ee5cf9 cli: use cobra's new ExactArgs() feature 2017-10-26 08:51:43 -04:00
Zach Ramsay
461191d2f7 cli: clean up error handling 2017-10-26 08:37:42 -04:00
Zach
b5bdb6ec54 Merge pull request #119 from tendermint/93-fix-console-output
fix console output
2017-10-26 07:58:16 -04:00
Ethan Frey
5d8890530a Update glide deps, nano/hid for osx/golang1.9 2017-10-26 12:00:42 +02:00
Ethan Frey
c496dea2e5 Merge pull request #42 from tendermint/feature/bcrypt-usability
Bcrypt usability
2017-10-26 11:59:32 +02:00
Ethan Buchman
a0e38dc583 dummy: verify pubkey is go-crypto encoded in DeliverTx. closes #51 2017-10-25 23:34:37 -04:00
Ethan Buchman
4884747eb7 tests: add simple client/server test with no addr prefix 2017-10-25 23:23:23 -04:00
Ethan Buchman
b6a4ca6b3c remove testutil 2017-10-25 23:15:57 -04:00
Ethan Buchman
6c41ec65bc server: use cmn.ProtocolAndAddress 2017-10-25 23:04:20 -04:00
Emmanuel Odeke
3df2ca128d make PrivateKey + Signature comparisons use constant time comparisons
Fixes https://github.com/tendermint/go-crypto/issues/43

Avoid susceptibility to timing/side channel attacks by ensuring
that private key and signature comparisons use
`subtle.ConstantTimeCompare`
instead of
`bytes.Equal`
2017-10-25 19:56:13 -07:00
Ethan Buchman
b30e3ba26d Merge pull request #65 from tendermint/573-wal-issues-2
[autofile] Support for the new WAL format
2017-10-25 22:00:36 -04:00
Anton Kaliaev
0a652499ea Merge pull request #68 from tendermint/bugfix/gopath-executes-go
make GoPath a function
2017-10-25 11:12:13 +04:00
Anton Kaliaev
bcf15e527d make GoPath a function
otherwise it could try to execute go binary and panic if no go binary
found. See https://github.com/tendermint/tendermint/issues/782
2017-10-25 11:01:52 +04:00
Ethan Buchman
93bd2081dd Merge pull request #66 from tendermint/codecov
add codecov
2017-10-24 23:05:32 -04:00
Anton Kaliaev
f99c73502c add codecov 2017-10-24 23:36:10 +04:00
Anton Kaliaev
103fee6192 add tests for autofile group Write, reader#Read 2017-10-24 23:20:17 +04:00
Anton Kaliaev
81591e288e fix metalinter warnings 2017-10-24 23:19:53 +04:00
Ethan Frey
dfc4cdd2d7 Parameterize and lower bcrypt cost 2017-10-24 12:19:45 +02:00
Ethan Frey
0a5b1d979a Merge pull request #37 from tendermint/nano
Nano Support
2017-10-24 12:18:45 +02:00
Anton Kaliaev
d4c6a68e58 Merge pull request #64 from silasdavis/event-cache
Fix zeroed buffer getting flushed to the empty event
2017-10-24 14:16:18 +04:00
Ethan Frey
0219ba2a63 Fix bug introduced by metalinting... 2017-10-24 12:14:20 +02:00
Ethan Frey
69a7b389b8 Removed keys/server as it is now in cosmos-sdk 2017-10-24 11:59:44 +02:00
Ethan Frey
6f6bbf718e Fix metalinter complaints 2017-10-24 11:56:37 +02:00
Ethan Frey
2d04544088 Addressed Buckys PR review comments 2017-10-24 11:38:06 +02:00
Ethan Frey
4a2c63f5e1 Update ledger names to specify ed25519 2017-10-24 11:38:06 +02:00
Ethan Frey
9601e48ab4 Improve error message 2017-10-24 11:38:06 +02:00
Ethan Frey
61d1bdb5ed Test error handling, load without ledger 2017-10-24 11:38:06 +02:00
Ethan Frey
9afceb7ee8 ledger pubkey serializes properly, better load checks 2017-10-24 11:38:06 +02:00
Ethan Frey
2490952515 nano validates key on load 2017-10-24 11:38:06 +02:00
Ethan Frey
bce88a20df Enable privkey validity checking on load 2017-10-24 11:38:06 +02:00
Ethan Frey
1b8d52bb82 Rename NameLedger to NameLedgerEd25519 2017-10-24 11:38:06 +02:00
Ethan Frey
ae078ee915 Generate/recover can return error, not panic on ledger 2017-10-24 11:38:06 +02:00
Ethan Frey
085d72d212 Cleanup nano calls, cannot run parallel test on one hardware device 2017-10-24 11:38:06 +02:00
Ethan Frey
91fccb8b14 Add test for cryptostore working with ledger 2017-10-24 11:38:06 +02:00
Ethan Frey
88475230c4 Re-enabled crypostore example usage 2017-10-24 11:38:06 +02:00
Ethan Frey
34b9309f24 Re-enable signing tests with cryptostore 2017-10-24 11:38:06 +02:00
Ethan Frey
8c98c4fdf4 Add nano ledger to key manager 2017-10-24 11:38:06 +02:00
Ethan Frey
0383feab49 Add and test serialization of ledger privkey 2017-10-24 11:38:06 +02:00
Ethan Frey
3edeb0cd45 Ledger caches pubkey, works with newer firmware 2017-10-24 11:38:06 +02:00
Ethan Frey
081f21af11 Add glide version for ledger drivers 2017-10-24 11:38:06 +02:00
Ethan Frey
008dba3af8 Test ledger calls 2017-10-24 11:38:06 +02:00
Ethan Frey
623bd803c2 write code to actually call ledger app 2017-10-24 11:38:06 +02:00
Ethan Frey
265e261c63 Add more test cases from running the ledger 2017-10-24 11:38:06 +02:00
Ethan Frey
7c5a10a7d4 Add tests for pub/priv key validation 2017-10-24 11:38:06 +02:00
Ethan Frey
06d74b24dd Wrote PrivKey/PubKey for ledger 2017-10-24 11:38:06 +02:00
Ethan Frey
74878ee313 Update code to work with current nano implementation 2017-10-24 11:38:06 +02:00
Ethan Frey
8220d59178 Work on using returned bytes as crypto keys 2017-10-24 11:38:06 +02:00
Ethan Frey
0781c12ede Message encoding for nano 2017-10-24 11:38:06 +02:00
Zach Ramsay
4479e95709 console: fix tests 2017-10-23 19:54:38 -04:00
Zach Ramsay
36de70be10 console: fix output, closes #93 2017-10-23 19:35:02 -04:00
Ethan Buchman
a6e6b58c6b Merge pull request #41 from tendermint/metalinter
add metalinter to Makefile & apply some fixes
2017-10-23 19:32:07 -04:00
Zach Ramsay
3330cb4856 cleanup 2017-10-23 17:27:59 -04:00
Zach Ramsay
631844895f fixes 2017-10-23 17:18:46 -04:00
Zach Ramsay
f9e14ad61b disable PersistenPreRun for counter/dummy 2017-10-23 17:18:46 -04:00
Zach Ramsay
df5d9ac1bb consolidate counter/dummy into the binary, #95 2017-10-23 17:18:46 -04:00
Zach Ramsay
56f7d9627f update deps 2017-10-23 17:18:46 -04:00
Zach Ramsay
f67e43625b Makefile: fix linter 2017-10-23 17:17:57 -04:00
Zach Ramsay
9883013adf use cobra, closes #101 2017-10-23 17:17:05 -04:00
Silas Davis
0eff425bc7 fix zeroed buffer getting flushed to the empty event 2017-10-23 18:52:31 +01:00
Zach Ramsay
47d3fa4741 linting: a few fixes 2017-10-23 08:30:18 -04:00
Ethan Frey
bb9bb4aa46 Merge pull request #116 from tendermint/feature/merkleeyes-to-iavl
merkleeyes to iavl
2017-10-23 14:26:12 +02:00
Ethan Frey
446e50ca9e Moved RandVal into test helper functions, as needed in other repos for testing 2017-10-23 14:20:15 +02:00
Ethan Frey
e7ebf62092 Remove empty check after iavl fixup 2017-10-23 14:08:36 +02:00
Anton Kaliaev
21b2c26fb1 GroupReader#Read: return io.EOF if file is empty 2017-10-23 13:02:14 +04:00
Anton Kaliaev
c75ddd0fa3 return err if empty slice given 2017-10-23 13:02:02 +04:00
Ethan Buchman
a4443ddb0c update persistent dummy for versioned iavl 2017-10-23 00:06:50 -04:00
Ethan Buchman
8e031b367f Merge branch 'develop' into metalinter 2017-10-22 19:53:39 -04:00
Anton Kaliaev
35e81018e9 add MinIndex method to Group 2017-10-20 13:09:51 +04:00
Anton Kaliaev
aace56018a add Read method to GroupReader 2017-10-20 12:38:45 +04:00
Ethan Frey
5162ed1b2b Remove gotype from metalinter so it passes (need newer go on circleci) 2017-10-19 15:21:03 +02:00
Ethan Frey
7aa00e9ddd Fix metalinter errors 2017-10-19 14:48:07 +02:00
Ethan Frey
46e1f1ae65 Cleaup based on Antons PR comments 2017-10-19 14:43:34 +02:00
Ethan Frey
d236e0eef9 Fix trailing whitespace in tutorial test 2017-10-19 14:38:30 +02:00
Ethan Frey
bae4e4acce Fix up commits, debug cli tests 2017-10-19 14:38:29 +02:00
Ethan Frey
9aff9f94dd dummy app now uses iavl 2017-10-19 14:38:29 +02:00
Ethan Buchman
5231003bfc Merge pull request #115 from tendermint/socket_client_StopOnErrorDeadlock-fix
socketClient: fix and test for StopForError deadlock
2017-10-18 20:54:42 -04:00
Emmanuel Odeke
46d94f8325 socketClient: fix and test for StopForError deadlock
Fixes https://github.com/tendermint/abci/issues/114.

Fix and test for StopForError deadlock due to accidental
Mutex misuse. The test should return instantenously if
StopForError works without erraneous contention, lest it regressed.
2017-10-17 22:08:22 -06:00
Anton Kaliaev
45095e83e7 add Write method to autofile/Group 2017-10-17 16:48:44 +04:00
Anton Kaliaev
498fb1134a write docs for autofile/group 2017-10-17 16:48:34 +04:00
Anton Kaliaev
8e5266a9ef Merge pull request #62 from tendermint/tests-fix
fix goLevelDBIterator
2017-10-17 16:06:41 +04:00
Anton Kaliaev
1f15ade60d Merge pull request #61 from tendermint/60-cmn-gopath-needs-a-default
call go env GOPATH if env var is not found (Refs #60)
2017-10-17 12:26:20 +04:00
Anton Kaliaev
0b22b27bbb avoid infinite recursion by proxying to iterator
```
WARNING: staticcheck, gosimple and unused are all set, using megacheck instead
db/go_level_db.go:126:15⚠️ infinite recursive call (SA5007) (megacheck)
db/go_level_db.go:135:17⚠️ infinite recursive call (SA5007) (megacheck)
db/mem_db.go:106:2⚠️ redundant return statement (S1023) (megacheck)
```

https://circleci.com/gh/tendermint/tmlibs/220

Also remove unnecessary return statement
2017-10-17 11:01:46 +04:00
Anton Kaliaev
cd2ad19db4 Merge pull request #57 from tendermint/feature/improve-db-interface
WIP: Improve db interface
2017-10-13 18:31:05 +04:00
Alexis Sellier
6b1e3bcee3 Add comments about copying 2017-10-13 13:03:43 +02:00
Adrian Brink
8e7f0e7701 Upgrade keys to use bcrypt with salts (#38)
This commit adds salts to the library using bcrypt.
2017-10-12 14:26:59 +02:00
Anton Kaliaev
7166252a52 add codeowners file [ci skip] 2017-10-11 12:48:05 +04:00
Anton Kaliaev
35e38e8932 call go env GOPATH if env var is not found (Refs #60) 2017-10-11 12:42:54 +04:00
Zach Ramsay
32dec98c1c example: fix func suffix 2017-10-10 17:33:51 -04:00
Ethan Buchman
1775be1cd9 remove some assertXxx funcs 2017-10-05 22:19:48 -04:00
Zach Ramsay
796024f42f linting: little more fixes 2017-10-04 18:27:35 -04:00
Zach Ramsay
87cb57c3e5 linting: fixup some stuffs 2017-10-04 18:16:48 -04:00
Zach Ramsay
7921fb0c05 linter: last fixes & add to circle 2017-10-04 17:53:56 -04:00
Zach Ramsay
fe66a683bc linter: add metalinter to Makefile & apply some fixes 2017-10-04 17:53:56 -04:00
Ethan Buchman
7dd6b3d3f8 Merge pull request #53 from tendermint/metalinter
add metalinter to CI and address some lint warnings
2017-10-04 00:21:24 -04:00
Ethan Buchman
c8805fd7de metalinter fixes from review 2017-10-04 00:13:58 -04:00
Zach Ramsay
cf49ba876f linter: couple fixes 2017-10-03 17:23:14 -04:00
Anton Kaliaev
15cd7fb1e3 fix comment [ci skip] 2017-10-04 00:06:46 +04:00
Ethan Buchman
096dcb90e6 Merge pull request #59 from tendermint/develop
Develop
2017-10-02 23:29:35 -04:00
Ethan Buchman
e9c83b3005 version and changelog 2017-10-02 23:26:45 -04:00
Ethan Buchman
a55ec427bd Merge pull request #56 from tendermint/memdb-fix-close
db: fix MemDB.Close
2017-10-02 22:38:19 -04:00
Ethan Buchman
0948343a6f autofile: ensure file is open in Sync 2017-10-02 14:17:16 -04:00
Alexis Sellier
e9e6ec3a2c Implement Key/Value on Iterator for GoLevelDB
This is needed because leveldb reuses the keys on each iteration.
In our wrapper, we copy the key/value so that it is safe to store.
2017-09-28 17:43:47 +02:00
Alexis Sellier
219d4e8427 Add IteratorPrefix method to Iterator 2017-09-28 17:35:01 +02:00
Alexis Sellier
296d223545 Add Release & Error methods to Iterator
We need this to properly support LevelDB backend, which needs
to be released if we don't want to leak memory.
2017-09-28 17:26:24 +02:00
Emmanuel Odeke
8be8127351 db: fix MemDB.Close
Fixes https://github.com/tendermint/tmlibs/issues/55

MemDB previously mistakenly set the actual DB pointer to nil
although that side effect is not visible to the outside world
since p is an identifier within the scope of just that function
call. However, @melekes and I had a discussion in which we
came to the conclusion that Close for an in-memory DB should
instead be a noop and not cause any data loss. See the
discussion on https://github.com/tendermint/tmlibs/pull/56.
2017-09-26 15:29:51 -06:00
Emmanuel Odeke
0418d32276 Merge branch 'doc-file-started' into develop 2017-09-22 20:46:10 -06:00
Ethan Buchman
9997e3a3b4 Merge pull request #54 from tendermint/develop
common: WriteFileAtomic use tempfile in current dir
2017-09-22 13:23:12 -04:00
Ethan Buchman
35838b6af8 changeloge, version 2017-09-22 13:22:02 -04:00
Ethan Buchman
3d98504c4c common: WriteFileAtomic use tempfile in current dir 2017-09-22 13:20:13 -04:00
Zach Ramsay
2681f32bdd circle: add metalinter to test 2017-09-22 12:35:52 -04:00
Zach Ramsay
3c57c24921 linting: next round of fixes 2017-09-22 12:14:27 -04:00
Zach Ramsay
d6e03d2368 linting: add to Makefile & do some fixes 2017-09-22 11:42:29 -04:00
Ethan Buchman
191c4b6d17 Merge pull request #111 from tendermint/develop
Develop
2017-09-22 11:16:23 -04:00
Ethan Buchman
88cb73d95a changelog 2017-09-22 11:16:09 -04:00
Ethan Buchman
667c2543ea use request struct for Info 2017-09-22 11:10:55 -04:00
Ethan Buchman
3d1fd4cefa Merge pull request #110 from tendermint/update-readme
readme: re-organize & update docs links
2017-09-22 10:45:59 -04:00
Ethan Buchman
39b206f2c1 version bump, changelog, glide 2017-09-22 10:38:45 -04:00
Ethan Buchman
311e8c1bf0 Merge pull request #30 from tendermint/develop
Develop
2017-09-22 10:29:28 -04:00
Ethan Buchman
e6ea9499ff glide and changelog 2017-09-22 10:22:55 -04:00
Zach Ramsay
47d6f71e5a Makefile: remove redundant lint 2017-09-22 10:11:22 -04:00
Zach Ramsay
96d2a2c92f readme: re-organize & update docs links 2017-09-22 10:10:56 -04:00
Ethan Buchman
94d1b8d364 Merge pull request #109 from tendermint/metalinter
Metalinter
2017-09-22 09:52:15 -04:00
Zach Ramsay
fe426de5d4 lint: couple more fixes 2017-09-22 09:45:50 -04:00
Ethan Buchman
2130c329eb Merge pull request #46 from tendermint/develop
v0.3.0
2017-09-22 09:41:12 -04:00
Ethan Buchman
bffe6744ec changelog 2017-09-22 09:38:58 -04:00
Ethan Buchman
c3108f14c8 Merge pull request #52 from tendermint/573-wal-issues
call fsync after flush
2017-09-22 09:35:52 -04:00
Ethan Buchman
a3ac825490 small fix 2017-09-22 09:14:45 -04:00
Zach Ramsay
0e7d974410 install 2017-09-22 09:14:42 -04:00
Zach Ramsay
65eb7e8974 linted, somewhat 2017-09-22 09:14:25 -04:00
Zach Ramsay
36e96c5bf1 linting: catch some errors 2017-09-22 09:14:25 -04:00
Zach Ramsay
6a378d30f3 linting: cover the basics 2017-09-22 09:14:25 -04:00
Zach Ramsay
bd9f1d0d4c metalinter: add linter to Makefile like tendermint 2017-09-22 09:14:25 -04:00
Ethan Buchman
34e70090e6 Merge pull request #108 from tendermint/app-interface-upgrade
use request structs for InitChain and BeginBlock
2017-09-22 00:18:52 -04:00
Ethan Buchman
318345f996 fix tests 2017-09-22 00:10:13 -04:00
Anton Kaliaev
d71d1394ec call fsync after flush (Refs #573)
short: flushing the bufio buffer is not enough to ensure data
consistency.

long:
Saving an entry to the WAL calls writeLine to append data to the
autofile group backing the WAL, then calls group.Flush() to flush that
data to persistent storage. group.Flush() in turn proxies to
headBuf.flush(), flushing the active bufio.BufferedWriter. However,
BufferedWriter wraps a Writer, not another BufferedWriter, and the way
it flushes is by calling io.Writer.Write() to clear the BufferedWriter's
buffer. The io.Writer we're wrapping here is AutoFile, whose Write
method calls os.File.Write(), performing an unbuffered write to the
operating system, where, I assume, it sits in the OS buffers awaiting
sync. This means that Wal.Save does not, in fact, ensure the saved
operation is synced to disk before returning.
2017-09-21 16:11:28 -07:00
Anton Kaliaev
246082368a add changelog entry [ci skip] 2017-09-20 02:49:51 -04:00
Anton Kaliaev
65a07b80a3 change logger interface to not return errors (Refs #50)
See https://github.com/go-kit/kit/issues/164 for discussion of why
kitlog returns an error.

```
Package log is designed to be used for more than simple application info/warning/error logging; it's suitable for log-structured data in an e.g. Lambda architecture, where each invocation is important. I agree with you that if we were doing only application logging the error would be more noise than signal. But the scope of the package is larger than that.
```

Since we are doing only application logging and we're not checking
errors, it is safe to get rid them.
2017-09-20 02:49:51 -04:00
Ethan Buchman
9a2438e0dc common: Fingerprint comment 2017-09-20 02:49:51 -04:00
Ethan Buchman
f279171a28 use request structs for InitChain and BeginBlock 2017-09-18 15:51:48 -04:00
Ethan Buchman
4e955434aa Merge pull request #48 from tendermint/log_tweak
Log tweak
2017-09-16 00:40:44 -04:00
Emmanuel Odeke
f6a2509764 doc.go file started
Fixes #35
Updates https://github.com/tendermint/coding/issues/27

Started a doc.go file to provide an overview/high level
dive into the functionality of this repo.

Also added an example_test.go file in which we can
put end-to-end code examples/actual usage patterns
that can be copied and pasted and will always have to
compile when tests are run to ensure that we don't regress.
2017-09-15 17:35:33 -06:00
Ethan Frey
50e7c07817 Use longer checksum again 2017-09-13 14:03:28 +02:00
Ethan Buchman
c8b6d29161 version bump and changelog 2017-09-12 19:31:00 -04:00
Ethan Buchman
09447fc059 Merge pull request #34 from tendermint/feature/remove-cli
Removed all cli as it goes into cosmos-sdk
2017-09-12 14:48:29 -04:00
Jae Kwon
3a36776d4a Reorder file for grokability 2017-09-10 18:45:20 -07:00
Ethan Frey
21f6b346a3 Removed all cli as it goes into cosmos-sdk 2017-09-08 20:26:56 +02:00
Ethan Frey
ad42794b2e Merge pull request #33 from tendermint/feature/support-fundraiser-seeds
Import unencrypted private key
2017-09-08 20:23:44 +02:00
Ethan Frey
e283f580b7 Test importing raw private key 2017-09-08 20:14:51 +02:00
Ethan Frey
54260853d5 encoder accepts empty string as unencoded bytes 2017-09-08 20:14:51 +02:00
Peng Zhong
a072429659 Fix blog post link for ABCI
We moved our blog to Medium.
2017-09-07 13:32:56 +08:00
Ethan Buchman
1bc8de4caa remove String() from Signature. closes #29 2017-09-06 02:32:37 -04:00
Ethan Buchman
f1094f760b types: remove redundant version file 2017-09-06 02:22:59 -04:00
Ethan Buchman
e86930c431 Merge pull request #106 from tendermint/develop
Develop
2017-09-06 02:22:01 -04:00
Ethan Buchman
bfec1ff1cd bump version to 0.3.0 2017-08-25 16:58:59 -04:00
Ethan Buchman
bdfd978b68 update changelog 2017-08-25 16:58:37 -04:00
Ethan Buchman
8f1dea89f5 db: fix memdb iterator 2017-08-25 16:35:37 -04:00
Ethan Buchman
fe08fc00c8 Merge pull request #34 from orijtech/develop
common/IsDirEmpty: do not mask non-existance errors
2017-08-25 16:01:30 -04:00
Ethan Buchman
271145ee72 Merge pull request #32 from tendermint/bugfix/write-file-atomic
Fix rename /root/.tendermint_test/consensus_replay_test/priv_validator.json.new /root/.tendermint_test/consensus_replay_test/priv_validator.json: no such file or directory
2017-08-25 15:58:09 -04:00
Zach
01181721ad readme: update install instruction (#100) 2017-08-24 17:02:14 +02:00
Anton Kaliaev
956966e658 add missing validator package to glide.yaml 2017-08-11 16:36:26 -04:00
Ethan Buchman
20c7a8f035 Merge pull request #31 from tendermint/bugfix/escape-syntax-for-base-16-hashes
[pubsub/query] quote values using single quotes
2017-08-11 12:33:48 -04:00
Anton Kaliaev
fa990f0803 add test case for hex 2017-08-10 19:46:59 -04:00
Emmanuel Odeke
b4a51871b9 common/IsDirEmpty: do not mask non-existance errors
Currently IsDirEmpty returns true, err if it encounters
any error after trying to os.Open the directory.
I noticed this while studying the code and recalled a bug
from an earlier project in which doing the exact same thing
on code without permissions would trip out and falsely report
that the directory was empty.
Given demo.go in https://play.golang.org/p/vhTPU2RiCJ

* Demo:
```shell
$ mkdir -p sample-demo/1 && touch sample-demo/2
$ echo "1st round" && go run demo.go sample-demo
$ sudo chown root sample-demo && sudo chmod 0700 sample-demo
$ echo "2nd round" && go run demo.go sample-demo
```

That then prints out
```shell
1st round
original:: empty: false err: <nil>
updated::  empty: false err: <nil>
2nd round
original:: empty: true err: open data/: permission denied
updated::  empty: false err: open data/: permission denied
```

where in "2nd round", the original code falsely reports that
the directory is empty but that's a permission error.

I could write a code test for it, but that test requires me to change
users and switch to root as a Go user so no point in complicating our
tests, but otherwise it is a 1-to-1 translation between shell and Go.
2017-08-04 02:22:17 -06:00
Ethan Frey
75372988e7 Merge pull request #33 from orijtech/http-utils
http: http-utils added after extraction
2017-08-02 19:47:10 +02:00
Emmanuel Odeke
d67a621715 http: http-utils added after extraction
Found common http utils that were being multiply duplicated across
many libraries and since am moving things in basecoin/unstable to
add for more functionality, it's better to put them in one
place.

Utilities and tests added:
- [X] FparseJSON
- [X] FparseAndValidateJSON
- [X] ParseRequestJSON
- [X] ParseAndValidateRequestJSON
- [X] WriteCode
- [X] WriteError
- [X] WriteSuccess
- [X] ErrorResponse

During review from @ethanfrey, made updates:
* Removed tt.want since it was a distraction/artifact that made
the reviewer think the tests weren't testing for both failed
and passed results.
* Added ErrorWithCode as WithCode is a common options pattern
in Go that could cause confusion:
  ErrorWithCode(error, int) ErrorResponse
* Using json.NewDecoder(io.Reader) error instead of
ioutil.ReadAll(io.Reader) to slurp all the bytes.
* Added more test scenarios to achieve 100% coverage of http.go
2017-08-02 11:38:52 -06:00
Ethan Frey
03d2b2446e Merge pull request #28 from odeke-em/godoc-for-references
README: add godoc instead of tedious MD regeneration
2017-07-28 15:09:54 -04:00
Emmanuel Odeke
ce80f234c7 README: add godoc instead of tedious MD regeneration
Add a godoc reference to delegate indexing and references
to that service, thus keeping our library and usages upto date,
instead of relying on generated markdown that goes stale
especially for changing API signatures, and becomes tedious
where someone has to remember to always regenerate the README
markdown and then commit it.

Fixes #24
2017-07-28 13:01:31 -06:00
Ethan Frey
f2c881573c Merge pull request #26 from odeke-em/improve-reverse-bytes+tests
hd: optimize ReverseBytes + add tests
2017-07-28 14:28:16 -04:00
Emmanuel Odeke
ae9c5b1ca0 hd: optimize ReverseBytes + add tests
* Optimized ReverseBytes to:
a) Minimally allocate --> 60.0% reduction in the number of allocations
b) Only walk halfway the length of the string thus performing
byte swaps from left to right. Improves the performance as well.
Complexity is O(n/2) instead of O(n) which is still O(n) but
benchmarks show the new time is in deed 1/2 of the original time.

* Added unit tests and some common cases to ensure correctness.

* Benchmark shoot out results:
```shell
name            old time/op    new time/op    delta
ReverseBytes-4     554ns ± 4%     242ns ± 3%  -56.20%  (p=0.000 n=10+10)

name            old alloc/op   new alloc/op   delta
ReverseBytes-4      208B ± 0%      114B ± 0%  -45.19%  (p=0.000 n=10+10)

name            old allocs/op  new allocs/op  delta
ReverseBytes-4      10.0 ± 0%       4.0 ± 0%  -60.00%  (p=0.000 n=10+10)
```
2017-07-28 12:21:41 -06:00
Anton Kaliaev
d1ca2c6f83 [common] add a test for WriteFileAtomic 2017-07-28 11:40:21 -04:00
Anton Kaliaev
b25aa3b472 [common] do not create {filePath}.bak in WriteFileAtomic
We use WriteFileAtomic in two places:

```
p2p/addrbook.go
338:    err = cmn.WriteFileAtomic(filePath, jsonBytes, 0644)

types/priv_validator.go
162:    err = WriteFileAtomic(privVal.filePath, jsonBytes, 0600)
```

and we don't need .bak in any of the above. We save priv_validator every
10ms and addrbook every 2 min.
2017-07-28 11:40:21 -04:00
Anton Kaliaev
8a51210efc [common] use temp intead of {filePath}.new
The problem with {filePath}.new is that it is not safe for concurrent
use! Calling this function with the same params results in the following
error:

```
panic: Panicked on a Crisis: rename /root/.tendermint_test/consensus_replay_test/priv_validator.json.new /root/.tendermint_test/consensus_replay_test/priv_validator.json: no such file or directory

goroutine 47860 [running]:
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.PanicCrisis(0xcba800, 0xc42152d640)
	/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/errors.go:33 +0x10f
github.com/tendermint/tendermint/types.(*PrivValidator).save(0xc42235f2c0)
	/go/src/github.com/tendermint/tendermint/types/priv_validator.go:165 +0x159
github.com/tendermint/tendermint/types.(*PrivValidator).signBytesHRS(0xc42235f2c0, 0x6, 0x0, 0xc424e88f03, 0xc429908580, 0xca, 0x155, 0x80, 0xc424e88f00, 0x7f4ecafc88d0, ...)
	/go/src/github.com/tendermint/tendermint/types/priv_validator.go:249 +0x2bb
github.com/tendermint/tendermint/types.(*PrivValidator).SignVote(0xc42235f2c0, 0xc4228c7460, 0xf, 0xc424e88f00, 0x0, 0x0)
	/go/src/github.com/tendermint/tendermint/types/priv_validator.go:186 +0x1a2
github.com/tendermint/tendermint/consensus.(*ConsensusState).signVote(0xc424efd520, 0xc400000002, 0xc422d5e3c0, 0x14, 0x20, 0x1, 0xc4247b6560, 0x14, 0x20, 0x0, ...)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1556 +0x35e
github.com/tendermint/tendermint/consensus.(*ConsensusState).signAddVote(0xc424efd520, 0x2, 0xc422d5e3c0, 0x14, 0x20, 0x1, 0xc4247b6560, 0x14, 0x20, 0xc42001b300)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1568 +0x200
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterPrecommit(0xc424efd520, 0x6, 0x0)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1082 +0x13a4
github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote(0xc424efd520, 0xc424e88780, 0x0, 0x0, 0x39, 0x1dc, 0x28c)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1477 +0x1be5
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote(0xc424efd520, 0xc424e88780, 0x0, 0x0, 0xd7fb00, 0xc42152ce00)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1382 +0x93
github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg(0xc424efd520, 0xcb58e0, 0xc42547feb8, 0x0, 0x0, 0x6, 0x0, 0x4, 0xed10ca07e, 0x3077bfea, ...)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:660 +0x9fc
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine(0xc424efd520, 0x0)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:615 +0x5f5
created by github.com/tendermint/tendermint/consensus.(*ConsensusState).OnStart
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:332 +0x4a7
exit status 2
FAIL	github.com/tendermint/tendermint/consensus	76.644s
make: *** [test_integrations] Error 1
```

See https://github.com/tendermint/tendermint/pull/568
2017-07-28 11:39:59 -04:00
Ethan Frey
bf355d1b58 Merge pull request #23 from tendermint/feature/short-recover-text
Shorter recovery seed
2017-07-27 16:11:03 -04:00
Ethan Frey
050b965708 Code cleanup ala Emmanuel 2017-07-27 15:59:59 -04:00
Ethan Frey
10222adaf1 Remove deprecated code. Now in basecoin/weave 2017-07-26 16:12:25 -04:00
Ethan Frey
c20e83565c Recovery also works with secp256 keys 2017-07-22 05:53:46 -04:00
Ethan Frey
4ff889a236 Use 16 random bytes for seed and key, crc16 by default 2017-07-22 05:44:09 -04:00
Ethan Frey
65da3cf340 Add crc16 support 2017-07-22 05:25:59 -04:00
Anton Kaliaev
a6a06f820f [pubsub/query] quote values using single quotes
This fixes the problem with base-16 encoded values which may start with
digits: 015AB.... In such cases, the parser recognizes them as numbers
but fails to parse because of the follow-up characters (AB).

```
failed to parse tm.events.type=Tx AND hash=136E18F7E4C348B780CF873A0BF43922E5BAFA63:
parse error near digit (line 1 symbol 31 - line 1 symbol 32):
  "6"
```

So, from now on we should quote any values. This seems to be the way
Postgresql has chosen.
2017-07-21 13:20:32 +03:00
Ethan Buchman
2f6f3e6aa7 Merge pull request #28 from tendermint/feature/376-events.v2
New pubsub package plus the query subpackage
2017-07-20 15:03:02 -04:00
Anton Kaliaev
77f6febb03 rename TestClientResubscribes to TestClientSubscribesTwice
test UnsubscribeAll properly
test BufferCapacity getter
2017-07-20 11:46:22 +03:00
Ethan Buchman
3c6c1b7d33 common: ProtocolAndAddress 2017-07-19 15:02:04 -04:00
Anton Kaliaev
992c54253f fixes from gometalinter review 2017-07-18 11:53:41 +03:00
Anton Kaliaev
17d6091ef4 updates as per Bucky's comments 2017-07-15 13:33:47 +03:00
Anton Kaliaev
e664f9c688 use context to provide timeouts! 2017-07-14 14:49:25 +03:00
Anton Kaliaev
0006bfc359 return ErrorOverflow on Subscribe if server is overflowed
> why we need it?

most of our subscribers will be RPC WS subscribers, so if there are too
many, nothing wrong with rejecting to subscribe.

however, consensus reactor must be the first to subscribe, since its
work depends on the pubsub package.
2017-07-14 13:02:32 +03:00
Anton Kaliaev
13207a5927 remove overflow options 2017-07-14 12:32:01 +03:00
Anton Kaliaev
4aa024d843 add more info to error messages 2017-07-12 23:10:36 +03:00
Anton Kaliaev
e4f3f9d9bf remove comment about LRU cache (see comments below)
I've tried https://github.com/hashicorp/golang-lru/tree/master/simplelru today and here are
the results:

with LRU cache:

```
Benchmark10Clients-2                               50000             29021 ns/op         3976 B/op         105 allocs/op
Benchmark100Clients-2                               3000            363432 ns/op        36382 B/op        1005 allocs/op
Benchmark1000Clients-2                               500           2473752 ns/op       360500 B/op       10009 allocs/op
Benchmark10ClientsUsingTheSameQuery-2             300000              4059 ns/op          773 B/op          15 allocs/op
Benchmark100ClientsUsingTheSameQuery-2            500000              4360 ns/op          773 B/op          15 allocs/op
Benchmark1000ClientsUsingTheSameQuery-2           300000              4204 ns/op          773 B/op          15 allocs/op
```

without LRU cache:

```
Benchmark10Clients-2                      200000              5267 ns/op             616 B/op       25 allocs/op
Benchmark100Clients-2                      30000             42134 ns/op            2776 B/op      205 allocs/op
Benchmark1000Clients-2                      3000            552648 ns/op           24376 B/op     2005 allocs/op
Benchmark10ClientsOneQuery-2             1000000              2127 ns/op             462 B/op        9 allocs/op
Benchmark100ClientsOneQuery-2             500000              2353 ns/op             462 B/op        9 allocs/op
Benchmark1000ClientsOneQuery-2            500000              2339 ns/op             462 B/op        9 allocs/op
```

> How were you using the lru cache exactly?

I was adding a KV pair each time there is a match plus checking if
`lru.Contains(key)` before running the actual check (`q.Matches(tags)`).

```
key = fmt.Sprintf("%s/%v", query + tags)
```
2017-07-12 22:52:13 +03:00
Anton Kaliaev
8062ade787 remove all clients (including closing all channels) on shutdown 2017-07-12 13:10:36 +03:00
Anton Kaliaev
a99b8a6210 new events package
query parser

use parser compiler to generate query parser

I used https://github.com/pointlander/peg which has a nice API and seems
to be the most popular Golang compiler parser using PEG on Github.

More about PEG:

- https://en.wikipedia.org/wiki/Parsing_expression_grammar
- https://github.com/PhilippeSigaud/Pegged/wiki/PEG-Basics
- https://github.com/PhilippeSigaud/Pegged/wiki/Grammar-Examples

rename

implement query match function

match function

uncomment test lines

add more test cases for query#Matches

fix int case

rename events to pubsub

add comment about cache

assertReceive helper to not block on receive in tests

fix bug with multiple conditions

uncomment benchmark

first results:

```
Benchmark10Clients-2                1000           1305493 ns/op         3957519 B/op     355 allocs/op
Benchmark100Clients-2                100          12278304 ns/op        39571751 B/op    3505 allocs/op
Benchmark1000Clients-2                10         124120909 ns/op        395714004 B/op   35005 allocs/op
```

124ms to publish message to 1000 clients. A lot.

use AST from query.peg.go

separate pubsub and query packages by using Query interface in pubsub

wrote docs and refactor code

updates from Frey's review

refactor type assertion to use type switch

cleanup during shutdown

subscriber should create output channel, not the server

overflow strategies, server buffer capacity

context as the first argument for Publish

log error

introduce Option type

update NewServer comment

move helpers into pubsub_test

increase assertReceive timeout

add query.MustParse

add more false tests for parser

add more false tests for query.Matches

parse numbers as int64 / float64

try our best to convert from other types

add number to panic output

add more comments

save commit

introduce client argument as first argument to Subscribe

> Why we do not specify buffer size on the output channel in Subscribe?

The choice of buffer size of N here depends on knowing the number of
messages server will receive and the number of messages downstream
subscribers will consume. This is fragile: if we publish an additional
message, or if one of the downstream subscribers reads any fewer
messages, we will again have blocked goroutines.

save commit

remove reference counting

fix test

test client resubscribe

test UnsubscribeAll

client options

[pubsub/query] fuzzy testing

do not print msg as it creates data race!
2017-07-12 09:48:01 +03:00
Ethan Buchman
efb56aaea7 Merge pull request #25 from tendermint/stderr
CLI Execute Error prints to stderr
2017-06-23 22:22:07 -04:00
Ethan Buchman
a28e35fd98 Merge branch 'develop' into stderr 2017-06-23 22:21:36 -04:00
Ethan Buchman
bf55624f75 Merge pull request #24 from tendermint/dateparse
common date parsing
2017-06-23 22:20:32 -04:00
Ethan Buchman
7fbe6adf24 Merge branch 'develop' into dateparse 2017-06-23 22:16:37 -04:00
Ethan Frey
95b7c9e09c Merge branch 'develop' 2017-06-23 09:11:30 +02:00
Ethan Frey
d31cfbaeaa Fixed up help text for "keys recover" 2017-06-23 09:10:59 +02:00
Ethan Frey
19bd8dc3a6 Merge branch 'develop' 2017-06-21 19:36:11 +02:00
Ethan Frey
ad70b22226 Update to 0.2.1 2017-06-21 19:35:57 +02:00
Ethan Frey
8bdb5ceda4 Merge pull request #19 from tendermint/feature/cli-improvements
cli improvements
2017-06-21 19:00:25 +02:00
Ethan Frey
d665c9ef10 Code cleanup from review comments 2017-06-21 18:57:32 +02:00
rigel rozanski
cc364b14e2 changelog and PR changes 2017-06-20 17:18:55 -04:00
rigel rozanski
f3eaf9b870 quickfix 2017-06-20 16:52:22 -04:00
rigel rozanski
34bcb30f1c changelog 2017-06-20 16:40:32 -04:00
Ethan Frey
a944bdebfc Make sure prompt looks good in interactive mode 2017-06-20 20:46:00 +02:00
Ethan Frey
1ab9ab9494 Add delete and recover commands, and test them 2017-06-20 20:34:13 +02:00
Ethan Frey
e9537b2da6 Freshen up existing cmd files 2017-06-20 19:50:39 +02:00
Ethan Frey
7d08ea4c09 Fixed all tests and binaries to compile 2017-06-20 18:50:53 +02:00
Ethan Frey
53e19e3dfa Add codec to keys.Manager, recovery test passes 2017-06-20 18:35:16 +02:00
Ethan Frey
7108dedc21 Fix broken key manager tests 2017-06-20 18:19:13 +02:00
Ethan Frey
15609e1219 Updated Manager interface to return seed on create, fix server tests 2017-06-20 18:15:49 +02:00
Ethan Frey
56200e167a Use go-bindata to embed wordlist in a binary 2017-06-20 18:03:17 +02:00
Ethan Frey
878c8b3a87 Removed obsolete file 2017-06-20 17:51:25 +02:00
Ethan Frey
1e15c8f75b Extend wordcodec benchmarks 2017-06-20 17:13:10 +02:00
Ethan Frey
daab270ff7 First obvious speedup 2017-06-20 17:02:58 +02:00
Ethan Frey
1e978ba838 Import multiple language wordbanks, test them 2017-06-20 16:53:07 +02:00
Ethan Frey
2c0d52f4b5 Add typo detector test, fix panics 2017-06-20 16:52:04 +02:00
Ethan Frey
65c880e753 Test validation of word banks upon load 2017-06-20 16:32:33 +02:00
Ethan Frey
ad029d1293 Integrate ecc into word-byte codec 2017-06-20 16:10:15 +02:00
Ethan Frey
0b0e994cd1 Add crc64, constructors 2017-06-20 16:02:47 +02:00
Ethan Frey
ce6b08761e Improve crc32 2017-06-20 15:56:12 +02:00
Ethan Frey
55a25f0f62 Add first pass of ecc checksuming 2017-06-20 15:49:17 +02:00
Ethan Frey
e20cdfcbae Cleanup wordcodec 2017-06-20 15:20:40 +02:00
Ethan Frey
2278f566bf Add beginning of wordcodec for bytes 2017-06-20 14:57:49 +02:00
Ethan Frey
ea4f45828d Update circle ci for new cli tests 2017-06-19 17:52:45 +02:00
Ethan Frey
0c32d2722f #17 - better support passwords in tests, more cli tests 2017-06-19 17:49:16 +02:00
Ethan Frey
0edd1297a9 Got basic key test working 2017-06-19 17:07:12 +02:00
rigel rozanski
0a3a08a3bc stderr PR revisions 2017-06-17 18:35:05 -04:00
Ethan Buchman
7ce4da1eee Merge pull request #26 from tendermint/develop
v0.2.2
2017-06-16 11:42:58 -04:00
Ethan Buchman
bd9d0d1637 changelog and version 2017-06-16 11:40:14 -04:00
Ethan Frey
3400cee845 Handle --two-words as TMTWO_WORDS env var 2017-06-15 20:16:22 +02:00
Ethan Frey
59a77e7bef Remove Printf 2017-06-14 17:01:15 +02:00
Ethan Frey
0ecb38c6da Return exit code on error, disable in tests 2017-06-14 16:51:33 +02:00
Ethan Buchman
c5644aad31 Merge pull request #21 from tendermint/feature/tracing-logger
[log] tracing logger
2017-06-07 13:26:27 -04:00
Anton Kaliaev
c332a21fb2 Merge pull request #20 from tendermint/bugfix/16-flowrate
[flowrate] refactor clock functions (Refs #16)
2017-06-07 13:14:47 +03:00
rigel rozanski
94c0172618 doc update 2017-06-07 05:05:11 -04:00
rigel rozanski
33d0dd0bfc add stderr to tests 2017-06-06 18:36:28 -04:00
rigel rozanski
c76dca0456 cli stderr output for Execute 2017-06-06 16:13:44 -04:00
rigel rozanski
f913ed8134 date simplify 2017-06-06 16:08:57 -04:00
rigel rozanski
304be4ec2f date parse functionality 2017-06-06 04:00:36 -04:00
Ethan Buchman
462243e31a Merge pull request #23 from tendermint/hexfuncs
IsHex and StripHex
2017-06-05 17:32:49 -04:00
rigel rozanski
925f2b3350 golint corrections 2017-06-05 16:22:01 -04:00
rigel rozanski
295f6c2cc6 IsHex and StripHex 2017-06-05 15:50:11 -04:00
Ethan Buchman
7f5f48b6b9 dist: dont mkdir in container 2017-06-02 12:44:00 -04:00
Anton Kaliaev
a24a0ff003 Merge tag 'v0.2.1' into develop
v0.2.1
2017-06-02 11:57:04 +03:00
Anton Kaliaev
6b619742ac Merge branch 'release/0.2.1' 2017-06-02 11:56:17 +03:00
Anton Kaliaev
4ef77c008c update changelog 2017-06-02 11:55:43 +03:00
Anton Kaliaev
8c0959604c Merge pull request #19 from tendermint/feature/log-level-parsing-from-tendermint
copy log level parsing from tendemint
2017-06-02 10:42:23 +03:00
Ethan Buchman
b86da57571 scripts for building 2017-06-01 23:32:55 -04:00
Ethan Buchman
ea8c171bc0 Release v0.5.0 2017-06-01 23:04:32 -04:00
Anton Kaliaev
5f20b3323e don't do DeepEqual, compare ranges for durations and rates (Refs #16) 2017-05-25 13:06:42 +02:00
Anton Kaliaev
b36203bb02 [cli] add a test case to TestParseLogLevel where there is no module key 2017-05-23 23:31:29 +02:00
Anton Kaliaev
ddaa4d9b4c [log] tracing logger 2017-05-23 23:06:20 +02:00
Ethan Frey
de02488778 Enhance the tests to make it clearer how these levels work together 2017-05-23 23:04:33 +02:00
Anton Kaliaev
b5c57967b7 [flowrate] improve error formatting (Refs #16) 2017-05-23 15:24:00 +02:00
Anton Kaliaev
6b10432463 [flowrate] refactor clock functions (Refs #16)
this commit does not fix the original bug
2017-05-23 15:20:27 +02:00
Anton Kaliaev
5032b224bc copy log level parsing from tendemint
API change due to me not wanting `flags` package to depend on
tendermint's config package.

Refs https://github.com/tendermint/tendermint/issues/504
2017-05-23 00:43:12 +02:00
Ethan Buchman
864d1f80b3 Merge pull request #90 from tendermint/develop
v0.5.0
2017-05-18 11:39:39 +02:00
Ethan Buchman
609c0dbc3e CHANGELOG update release date 2017-05-18 11:39:12 +02:00
Ethan Buchman
7dff40942a Merge pull request #15 from tendermint/develop
v0.2.0
2017-05-18 11:37:23 +02:00
Ethan Buchman
c61497b56e CHANGELOG: update release date 2017-05-18 11:35:32 +02:00
Ethan Buchman
306795ae1d Merge pull request #15 from tendermint/develop
v0.2.0
2017-05-18 11:28:34 +02:00
Ethan Buchman
2733f5a738 CHANGELOG: update release date 2017-05-18 11:27:26 +02:00
Ethan Frey
8af1c70a8b Renamed --debug to --trace, used for light-client and basecoin 2017-05-17 12:03:26 +02:00
Ethan Buchman
67f558cff0 Merge pull request #17 from tendermint/feature/log-levels-per-key-in-filter
Allow custom levels for the keyvals in filter
2017-05-16 23:29:02 +02:00
Ethan Frey
438b16f1f8 Merge pull request #16 from tendermint/data-codegen
Use codegen to create wrappers for interfaces
2017-05-16 17:10:26 +02:00
Ethan Frey
db5cb8d92c Change codegen name holder->wrapper 2017-05-16 17:02:48 +02:00
Ethan Frey
bee63ce4ff Cleaned up build process, moved codegen to separate package in go-wire 2017-05-16 17:01:30 +02:00
Ethan Frey
79c580492e add make codegen for gen 2017-05-16 17:01:15 +02:00
Ethan Frey
746a2e286d Codegen wrappers for privkey and signature as well 2017-05-16 17:01:15 +02:00
Ethan Frey
ee200d998f Fix unwrap for proper json format 2017-05-16 17:01:15 +02:00
Ethan Frey
f16f711992 First code from codegen... wrong names 2017-05-16 17:01:03 +02:00
Ethan Frey
c38a6f55b3 Prepare for codegen 2017-05-16 17:01:03 +02:00
Anton Kaliaev
d0cae7b6ed [log] change helper func 2017-05-16 12:49:23 +02:00
Anton Kaliaev
761b1553aa [log] allow filtering with fields 2017-05-16 12:48:01 +02:00
Ethan Buchman
5dabeffb35 fixes from review 2017-05-15 12:59:44 -04:00
Ethan Buchman
d82c7edf3a update changelog and bump version 2017-05-15 12:52:33 -04:00
Ethan Buchman
d07b2352ad NewXXXServer doesnt run Start or return error 2017-05-15 12:51:24 -04:00
Ethan Buchman
21fff49f2c Merge branch 'feature/adrian-extendABCIcli' into develop 2017-05-15 12:30:02 -04:00
Ethan Buchman
894f3fca73 cmd: query params are flags 2017-05-15 12:28:37 -04:00
Ethan Buchman
eda4f2dddc NewXXXClient doesnt run Start or return error 2017-05-15 11:29:34 -04:00
Ethan Buchman
fadfcfdcb0 Merge pull request #82 from tendermint/feature/adrian-#79
Update grpc_server.go - 2
2017-05-15 15:52:24 +02:00
Ethan Buchman
20159f6081 Merge pull request #87 from tendermint/ResultsLike
Abci result error type comparison
2017-05-15 15:51:29 +02:00
rigel rozanski
05dc4d12dd result.IsSameCode 2017-05-15 09:50:49 -04:00
Ethan Buchman
a42b10e0fe update glide 2017-05-15 09:41:07 -04:00
Ethan Buchman
d901fba662 add changelog and version 2017-05-15 09:40:20 -04:00
Ethan Buchman
812d9f9b84 add changelog 2017-05-15 09:09:42 -04:00
Ethan Buchman
da68014a50 Merge pull request #10 from tendermint/bugfix/rotating-fails-on-windows
Close file before renaming it
2017-05-15 14:47:57 +02:00
Anton Kaliaev
74a7f8c92b [autofile] close file before renaming it
this might fix our windows bug https://github.com/tendermint/tendermint/issues/444

0980f8e197
2017-05-15 10:47:16 +02:00
Ethan Buchman
4fdeaa70af Merge pull request #14 from tendermint/feature/allow-for-custom-color-functions
[log] allow for custom color funcs
2017-05-14 23:24:03 +02:00
Anton Kaliaev
a5fcc94a3b [log] allow for custom color funcs 2017-05-14 12:03:45 +02:00
Adrian Brink
b55e695d3d Remove debug statement 2017-05-13 21:08:34 +02:00
Adrian Brink
4674bf96b0 Extend the query command 2017-05-13 18:37:00 +02:00
Anton Kaliaev
8f5a175ff4 Merge pull request #13 from tendermint/feature/filter-returns-error
[log] NewFilterByLevel returns an error
2017-05-13 16:01:02 +02:00
Anton Kaliaev
dd3e433d32 [log] NewFilterByLevel returns an error 2017-05-13 15:54:11 +02:00
Adrian Brink
b662bc7d34 Merge pull request #81 from tendermint/feature/adrian-#68
Comment out MessageType - 2
2017-05-13 10:02:07 +02:00
Adrian Brink
ea2d83e513 Clean up comments 2017-05-13 10:01:16 +02:00
Anton Kaliaev
9e1852c08d Merge pull request #12 from tendermint/feature/helper-log-func
[log] add NewFilterByLevel helper func
2017-05-12 23:12:36 +02:00
Anton Kaliaev
3007668274 [log] add NewFilterByLevel helper func 2017-05-12 22:59:31 +02:00
Ethan Buchman
dd592a21b9 Merge pull request #11 from tendermint/bugfix/multiple-module-keys
Squash module keyvals if multiple keyvals were provided
2017-05-12 22:08:36 +02:00
Anton Kaliaev
f202d02d0d [log] add separator 2017-05-12 17:39:00 +02:00
Adrian Brink
e43bcf3f26 Move package comment 2017-05-09 12:40:49 +02:00
Jacob Gadikian
840e658ec0 Update grpc_server.go 2017-05-09 12:40:49 +02:00
Adrian Brink
577ec5452f Fix indentation 2017-05-09 12:33:38 +02:00
Adrian Brink
322b4e54de Remove unused enum MessageTypes 2017-05-09 12:23:37 +02:00
Krzysztof Jurewicz
a3d4e5797d Comment out MessageType
As it is an unused enum, leaving it uncommented causes dead Protocol
Buffers code to be generated.
2017-05-09 12:23:37 +02:00
Anton Kaliaev
b2a116863c squash module key if multiple keyvals were provided
last keyvalue wins
2017-05-08 17:30:21 +04:00
Anton Kaliaev
25a5bc2697 Merge pull request #9 from tendermint/bugfix/filter-with-func
[log] proper impl of With for filter
2017-05-08 14:42:21 +04:00
Anton Kaliaev
bc6baf6774 [log] proper impl of With for filter 2017-05-06 11:21:07 +04:00
Ethan Buchman
d3e3eca3fe update glide 2017-05-05 14:57:33 -04:00
Ethan Buchman
bd2b87dd3d Merge pull request #78 from tendermint/feature/new-logging
New logging
2017-05-05 14:52:49 -04:00
Ethan Buchman
d72136da0d Merge pull request #7 from tendermint/log
Log
2017-05-05 14:02:38 -04:00
Anton Kaliaev
240215f2aa return back all in Makefile 2017-05-05 21:52:01 +04:00
Anton Kaliaev
f4be75cb1e remove warn mentions 2017-05-05 21:48:03 +04:00
Anton Kaliaev
2bf6ebf379 filter 2017-05-05 21:48:03 +04:00
Anton Kaliaev
ea01d003d1 changes per @ethanfrey comments 2017-05-05 21:48:03 +04:00
Anton Kaliaev
b2bd039923 correct impl of WithLevel 2017-05-05 21:48:03 +04:00
Anton Kaliaev
6ff7b4395d update glide.yaml and glide.lock files 2017-05-05 21:48:02 +04:00
Ethan Frey
3420b389e9 Add testify version for consistency 2017-05-05 19:45:02 +02:00
Anton Kaliaev
520561e94a add testing logger 2017-05-05 21:43:07 +04:00
Ethan Buchman
66c9401c07 log: Tm -> TM 2017-05-05 21:43:07 +04:00
Anton Kaliaev
ed76afd409 Logger interface and tmLogger impl based on go-kit 2017-05-05 21:43:07 +04:00
Ethan Frey
e71bbb2509 Update to make full use of new tmlibs/cli helpers 2017-05-05 19:25:44 +02:00
Ethan Buchman
706b9fbd67 Merge pull request #8 from tendermint/cli
Cli
2017-05-05 11:45:54 -04:00
Ethan Frey
2f02ed18e9 One more helper function for cli tests... 2017-05-05 14:58:53 +02:00
Ethan Frey
d0132b0fff Moved helper functions into non-test code for reuse elsewhere 2017-05-05 14:46:04 +02:00
Anton Kaliaev
50a9967c79 change tmlibs package version to "log" 2017-05-05 16:32:23 +04:00
Ethan Buchman
3585a542a0 cli: viper.Set(HomeFlag, rootDir) 2017-05-05 00:48:35 -04:00
Ethan Frey
ee45dbdc8b Test how unmarshall plays with flags/env/config/default struct 2017-05-04 19:44:53 -04:00
Ethan Frey
8efeeb5f38 Add --debug flag to return full stack trace on error 2017-05-04 19:44:53 -04:00
Ethan Frey
ef3b9610a1 Fixed up the --home flag, ebuchman check this out 2017-05-04 19:44:53 -04:00
Ethan Frey
d05b8131a3 Updated glide with cobra/viper, fixed Makefile typo 2017-05-04 19:44:48 -04:00
Ethan Frey
5637a78854 Test setting config file as root 2017-05-04 19:43:33 -04:00
Ethan Frey
62427adbec First basic test case on setup functionality 2017-05-04 19:43:33 -04:00
Ethan Frey
435fd0ece7 Add clarifying comments as requested by Rigel 2017-05-04 19:43:33 -04:00
Ethan Buchman
7becd35126 cli: more descriptive naming 2017-05-04 19:43:33 -04:00
Ethan Buchman
a95a60cb0b cli: support --root and --home 2017-05-04 19:43:33 -04:00
Anton Kaliaev
317e91748f remove all .sock files! 2017-05-04 23:24:58 +04:00
Anton Kaliaev
1dc3629b1a update log interface 2017-05-04 23:17:16 +04:00
Anton Kaliaev
d2a4b16b28 introduce testing logger 2017-05-04 16:50:00 +04:00
Anton Kaliaev
6baaad9975 update glide 2017-05-04 16:50:00 +04:00
Anton Kaliaev
ce124c4aeb modify test scripts to use relative paths 2017-05-04 16:50:00 +04:00
Anton Kaliaev
9a6d190282 remove stdlog 2017-05-04 16:49:59 +04:00
Anton Kaliaev
986bdd00a5 new logging 2017-05-04 16:49:59 +04:00
Ethan Frey
524ba917a3 Use new PrepareMainCmd from tmlibs/cli 2017-05-02 17:18:08 +02:00
Ethan Frey
d4ab9679d7 Fix up error in copyEnv 2017-05-02 17:16:22 +02:00
Ethan Frey
b92bd8f6a8 Separate out PrepareBaseCmd, try to set env vars 2017-05-02 17:04:46 +02:00
Ethan Buchman
f7c872981f Merge pull request #2 from tendermint/make_and_circle
Makefile and circle.yml
2017-05-01 11:33:24 -04:00
Ethan Buchman
af637abf12 Makefile and circle.yml 2017-05-01 11:30:24 -04:00
Ethan Buchman
8d8e35ae53 types: methods convert pb types to use data.Bytes 2017-04-27 19:53:22 -04:00
Ethan Buchman
8339dc3b1a types: Result and Validator use data.Bytes 2017-04-27 19:21:26 -04:00
Ethan Frey
197a2b270f Consolidate keys.Manager interface 2017-04-27 20:59:48 +02:00
Ethan Buchman
c709d3cc85 update merkleeyes 2017-04-21 18:39:18 -04:00
Ethan Buchman
be61e273ce update glide 2017-04-21 18:32:46 -04:00
Ethan Buchman
078e617d1c go-merkle -> merkleeyes/iavl and tmlibs/merkle 2017-04-21 18:28:49 -04:00
Ethan Buchman
dd303dc119 go-data -> go-wire/data 2017-04-21 18:25:30 -04:00
Ethan Buchman
28d042fdae use tmlibs 2017-04-21 18:25:13 -04:00
Ethan Buchman
03012a0532 update glide 2017-04-21 18:24:18 -04:00
Ethan Buchman
df250b6941 docs: go-events -> tmlibs/events 2017-04-21 16:25:23 -04:00
Ethan Buchman
9b95da8fa4 go-data -> go-wire/data 2017-04-21 16:10:06 -04:00
Ethan Buchman
1ea866fd69 glide 2017-04-21 16:05:03 -04:00
Ethan Buchman
56d36c8f25 merkle: go-common -> tmlibs 2017-04-21 16:04:58 -04:00
Ethan Buchman
fd296811df simple merkle tree 2017-04-21 15:33:25 -04:00
Ethan Buchman
6c49312aa2 Merge pull request #11 from tendermint/unstable
Unstable
2017-04-21 14:43:55 -04:00
Ethan Buchman
e3f9b8731b circle.yml 2017-04-21 14:41:14 -04:00
Ethan Frey
91bd7efb7b Fixed all imports in keys 2017-04-19 17:25:53 +02:00
Ethan Frey
0bfae964e1 Moved keys cmd to top level 2017-04-19 17:07:12 +02:00
Ethan Frey
9016390a6e Moved crypto code to top level again 2017-04-19 16:55:15 +02:00
Ethan Frey
68948a5f13 Import go-keys as subdir 2017-04-19 16:53:28 +02:00
Ethan Frey
17ed6d178d move go-crypto files pre-keys merge 2017-04-19 16:51:29 +02:00
Ethan Buchman
56e13d87f4 Merge pull request #71 from tendermint/develop
Develop
2017-04-18 23:41:35 -04:00
Ethan Buchman
1002a8c5d0 bump version 2017-04-18 23:31:30 -04:00
Ethan Buchman
1aa663d907 update glide 2017-04-18 23:31:12 -04:00
Ethan Buchman
8bb25ec5ed update paths 2017-04-18 18:17:02 -04:00
Ethan Buchman
2f8551d3b6 go-common -> tmlibs 2017-04-18 17:56:05 -04:00
Ethan Buchman
900be74e8f update import paths 2017-04-18 16:33:51 -04:00
Ethan Buchman
6f49ba4c3e merge go-process 2017-04-18 16:33:44 -04:00
Ethan Buchman
5b4dcddb59 Merge remote-tracking branch 'process/master' into unstable 2017-04-18 16:33:44 -04:00
Ethan Buchman
024fcb4fdb merge go-logger 2017-04-18 16:33:43 -04:00
Ethan Buchman
e8ab6b7496 Merge remote-tracking branch 'logger/master' into unstable 2017-04-18 16:33:43 -04:00
Ethan Buchman
44274eeb58 merge go-flowrate 2017-04-18 16:33:42 -04:00
Ethan Buchman
125e25a929 Merge remote-tracking branch 'flowrate/master' into unstable 2017-04-18 16:33:42 -04:00
Ethan Buchman
fe92e62a19 merge go-events 2017-04-18 16:33:40 -04:00
Ethan Buchman
3e8b7df789 Merge remote-tracking branch 'events/master' into unstable 2017-04-18 16:33:39 -04:00
Ethan Buchman
fdbb10827d merge go-db 2017-04-18 16:33:35 -04:00
Ethan Buchman
d234a164f7 Merge remote-tracking branch 'db/master' into unstable 2017-04-18 16:33:32 -04:00
Ethan Buchman
acbd7caaf8 merge go-clist 2017-04-18 16:33:27 -04:00
Ethan Buchman
7ed7422e7f Merge remote-tracking branch 'clist/master' into unstable 2017-04-18 16:33:27 -04:00
Ethan Buchman
a893bb119b merge go-autofile 2017-04-18 16:33:26 -04:00
Ethan Buchman
e01445ea94 Merge remote-tracking branch 'autofile/master' into unstable 2017-04-18 16:33:26 -04:00
Ethan Buchman
356657a37b move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
Ethan Buchman
5aecd32554 merge.sh file for the repo merge 2017-04-18 16:33:07 -04:00
Ethan Buchman
9643f60bc2 Merge pull request #5 from tendermint/iterate-data
Exposed an iterator to access all of the underlying key/value pairs for all databases.
2017-04-18 15:47:42 -04:00
Ethan Buchman
f9e3db0373 Merge pull request #11 from tendermint/develop
Develop
2017-04-18 15:39:03 -04:00
Anton Kaliaev
f285114579 add Erlang implementation to readme [ci skip] [circleci skip] 2017-04-15 11:00:47 +04:00
Ethan Buchman
0ca2c6fdb0 Merge pull request #9 from tendermint/develop
Develop
2017-04-13 18:50:47 -04:00
Ethan Buchman
714fdaee3b Merge pull request #9 from tendermint/bugfix/check-for-error-returned-by-impl
[service] check for error returned by impl
2017-04-13 13:52:23 -04:00
Ethan Frey
31eafe8f8e Update dependencies to newest develop branches 2017-04-10 22:24:54 +02:00
Ethan Frey
c410fc5e24 Add extra test for encoding with sig,for p2p test fail 2017-04-10 19:51:02 +02:00
Ethan Frey
aecc32d363 Make dependencies explicit in glide.yaml 2017-04-10 19:51:02 +02:00
Ethan Frey
9e57d521ef Add type assertions for sig/pub/privkey implemenetations 2017-04-10 19:51:02 +02:00
Jae Kwon
f17e6bf44c Fix bitcoin addr scheme 2017-04-10 19:51:02 +02:00
Jae Kwon
926741c0a1 remove coin param 2017-04-10 19:51:02 +02:00
Jae Kwon
a3324cc97b Cleanup; Implement .Wrap() 2017-04-10 19:51:02 +02:00
Ethan Frey
eb6fcef8d2 Better docs and naming thanks to bucky 2017-04-10 19:51:01 +02:00
Ethan Frey
5b94758d4c Make PubKey struct compatible with go-wire.JSONBytes/ReadJSON 2017-04-10 19:51:01 +02:00
Ethan Frey
66ecd7705f Use new naming scheme PubKey{PubKeyInner} 2017-04-10 19:51:01 +02:00
Ethan Frey
750b25c47a Update go-data, test embedding strategies 2017-04-10 19:41:30 +02:00
Ethan Frey
49569ac244 Wrap constructor to create xxxS structs and avoid recursion 2017-04-10 19:41:30 +02:00
Jae Kwon
e49fdf7be7 Add HD functions 2017-04-08 22:57:59 -07:00
Paul W. Homer
2feff1ea16 Commented the empty table in c_level_db, and cleaned up the mem_db Value call. 2017-04-01 15:44:41 -04:00
Paul W. Homer
4fdcf51467 Refactored the iterator to follow Go constructor conventions. 2017-03-30 11:51:11 -04:00
Ethan Frey
ae55713864 Move tx from light-client and add tests 2017-03-29 20:41:11 +02:00
Paul W. Homer
34e2d6638d Fixed a typo in LevelDB property names. 2017-03-29 09:09:01 -04:00
Anton Kaliaev
dec518eb06 update comment [ci skip] [circleci skip] 2017-03-29 16:03:05 +04:00
Ethan Frey
58e537a42d Refactor setting up the key manager from config 2017-03-28 19:05:33 +02:00
Ethan Buchman
6af2364fa9 Merge pull request #10 from tendermint/recreate-quit-channel-on-reset
Recreate Quit channel on reset
2017-03-28 12:26:02 -04:00
Anton Kaliaev
7a12594edb [service] recreate Quit channel on reset
don't think that user should do this thing him/herself
2017-03-28 13:56:48 +04:00
Anton Kaliaev
c46ffe39a8 [service] check for error returned by impl
otherwise, we mark it as started when it is not in fact
2017-03-27 20:46:46 +04:00
Anton Kaliaev
75a539ae3d Merge pull request #3 from silasdavis/master
From the department of pedantry
2017-03-27 15:23:47 +04:00
Ethan Frey
398ac046da Reorganize cobra cmd to enable better reuse 2017-03-23 21:23:05 +01:00
Paul W. Homer
097e0abca9 Added in locking 2017-03-23 14:46:40 -04:00
Paul W. Homer
6064c80250 Modified all db types to conform to the interface changes. 2017-03-23 11:37:46 -04:00
Ethan Buchman
6fddcdf245 hd test: check masters too 2017-03-22 20:13:16 -04:00
Ethan Buchman
c6be97c71c error testing the hd 2017-03-22 16:45:30 -04:00
Ethan Buchman
ce9c57fca8 hd test 2017-03-22 15:59:48 -04:00
Ethan Buchman
3a1313ab7d secp256k1: use compressed pubkey, bitcoin-style address 2017-03-22 01:18:56 -04:00
Ethan Frey
76ace96925 Create nested directories as needed to store keys 2017-03-20 09:55:07 +01:00
Ethan Frey
07ac3201c2 Merge pull request #4 from tendermint/glide
Added glide dependency handling
2017-03-20 09:41:51 +01:00
Paul W. Homer
d6205eb4ca Changed the iterations 2017-03-17 14:34:11 -04:00
Paul W. Homer
bb8104b624 Exposed the LevelDB iterator in the DB struct. 2017-03-17 13:27:20 -04:00
Ethan Buchman
af792eac77 readme: js-tmsp -> js-abci 2017-03-13 17:20:31 -04:00
Ethan Buchman
1a565b83ec fix readme 2017-03-13 17:18:10 -04:00
Ethan Buchman
c32338f29b Merge pull request #66 from tendermint/readme
update readme
2017-03-13 16:54:00 -04:00
Ethan Buchman
e6a5b060f9 update readme 2017-03-13 16:46:45 -04:00
Ethan Buchman
1236e8fb6e Merge pull request #65 from tendermint/develop
v0.4.0
2017-03-06 03:10:22 -05:00
Ethan Buchman
be5a4345a3 formatting and update CHANGELOG 2017-03-06 02:58:26 -05:00
Ethan Buchman
700a62c22e CHANGELOG 2017-03-06 02:53:15 -05:00
Ethan Buchman
dcb015dff6 repeat_timer: drain channel in Stop; done -> wg 2017-03-05 03:33:35 -05:00
Ethan Buchman
eac3f2bc14 Merge remote-tracking branch 'origin/master' into develop
Conflicts:
	LICENSE.md
2017-03-05 00:16:10 -05:00
Jae Kwon
286cbbd99d Update LICENSE.md 2017-03-04 17:12:18 -08:00
Jae Kwon
ab0cca734a Update LICENSE.md 2017-03-04 17:11:59 -08:00
Ethan Buchman
0b1ee4b673 version bump to 0.4.0 2017-03-03 18:43:08 -05:00
Ethan Buchman
eaeb2658ea fixes from review 2017-03-03 18:39:10 -05:00
Ethan Buchman
c1f5a96382 Merge branch 'master' into develop
Conflicts:
	README.md
2017-03-03 01:17:54 -05:00
Ethan Buchman
3f47cfac5f Merge pull request #4 from tendermint/develop
go-data support
2017-03-03 00:17:33 -05:00
Ethan Buchman
6141dc6eed Merge pull request #7 from tendermint/develop
Develop
2017-03-03 00:06:45 -05:00
Ethan Buchman
959efd3127 Merge branch 'master' into develop 2017-03-03 00:05:51 -05:00
Ethan Buchman
95c14fbd65 Merge branch 'master' into develop 2017-03-03 00:03:39 -05:00
Ethan Buchman
f8ffbfb2be Merge pull request #9 from tendermint/develop
Add test
2017-03-03 00:02:46 -05:00
Paul W. Homer
af7e312088 Added glide dependency handling 2017-03-02 17:16:15 -05:00
Ethan Frey
0c92c8516f Rename proxy to server for clarity 2017-02-28 21:53:05 +01:00
Ethan Frey
6389d208cc Key server API integrated in CLI 2017-02-28 21:33:27 +01:00
Ethan Frey
6ec2330eb8 Import keys server from light-client, with changes 2017-02-28 21:09:35 +01:00
Ethan Frey
e1c717a048 Add support for hex / base64 / btc (b58) encoding of binary data 2017-02-28 20:31:08 +01:00
Ethan Frey
c59e2d7d13 Expose address in keyinfo, add get command 2017-02-28 20:07:44 +01:00
Ethan Frey
d5931c9ee3 Set key algorithm on key creation 2017-02-28 19:43:18 +01:00
Ethan Frey
9c427e95e2 Add update cli command, cleanup 2017-02-28 19:02:24 +01:00
Ethan Frey
506ff7d85a Expose new and list via cli 2017-02-28 18:52:52 +01:00
Ethan Frey
78bb9f9cd8 Import keystore logic from light-client 2017-02-28 18:07:59 +01:00
Ethan Frey
d979bfc49e Add flag validation 2017-02-28 16:56:17 +01:00
Ethan Frey
f80957ad3c Basic cobra/viper cli framework 2017-02-28 16:30:15 +01:00
Ethan Frey
a816ff0bab Add test 2017-02-27 14:52:48 +01:00
Ethan Buchman
562b4cc9ef Merge pull request #3 from tendermint/feature/go-data
Use go-data for nice json un/marshaling
2017-02-23 19:14:53 -05:00
Ethan Frey
0e92dd5bb5 One name, type byte per algorithm 2017-02-24 00:31:43 +01:00
Ethan Frey
8c9b889ccf Support json encode/decode for nil values in S structs 2017-02-23 18:11:20 +01:00
Ethan Frey
b6a2c5949f Add helper methods for nil checks in structs 2017-02-23 15:35:04 +01:00
Ethan Frey
cbe35e07d1 Add more tests for de/en-coding public and private keys 2017-02-23 14:56:25 +01:00
Ethan Frey
6c2bf8c24b Clean up test cases -> testify 2017-02-23 13:20:30 +01:00
Ethan Frey
1bc1947e3f First tests of go-data encoding 2017-02-22 23:43:26 +01:00
Ethan Frey
e6d35ee641 Add structs for go-data support 2017-02-22 23:15:10 +01:00
Anton Kaliaev
33e52343d0 Merge branch '4gn3s-patch-1' into develop 2017-02-20 16:59:20 +04:00
Agnieszka Kramarek
b350b08021 Update README.md
Typo fixed
2017-02-20 16:58:50 +04:00
Ethan Buchman
1e8791bc9a Merge pull request #62 from wolfposd/patch-1
Update: jTMSP -> jABCI
2017-02-19 10:51:49 -05:00
Wolf
d299afe630 Update: jTMSP -> jABCI 2017-02-19 16:46:57 +01:00
Jae Kwon
f81a9c647d Update README.md 2017-02-18 07:36:14 +01:00
Ethan Buchman
31bdda27ad Query: LastHeight -> Height :) 2017-02-14 16:53:21 -05:00
Ethan Buchman
2a3f638495 Merge pull request #61 from tendermint/interface-fixes
Interface fixes
2017-02-13 20:19:24 -05:00
Ethan Buchman
e909cafa0b BaseApplication 2017-02-13 20:16:21 -05:00
Ethan Buchman
b6afa8d85b Query: Height -> LastHeight 2017-02-13 20:16:17 -05:00
Jae Kwon
5d673ecf31 Fix comment for BeginBlock hash 2017-02-12 18:38:10 -08:00
Ethan Buchman
b025c13f67 drop BlockchainAware 2017-02-06 19:20:02 -05:00
Ethan Buchman
a954f91e5f Merge pull request #60 from tendermint/readme
fixes #38 and #59
2017-02-06 18:37:33 -05:00
Ethan Buchman
dafcc3d3e3 fixes #38 and #59 2017-02-06 18:11:17 -05:00
Jae Kwon
48b17de829 Merge pull request #2 from alessio/master
Add LICENSE file
2017-01-28 08:01:48 -08:00
Jae Kwon
1c977f78fd Update LICENSE 2017-01-28 08:01:29 -08:00
Alessio Treglia
c3b8006166 Add LICENSE file 2017-01-28 12:42:01 +00:00
Jae Kwon
8df0bc3a40 Merge branch 'abci_proof' into develop 2017-01-27 22:27:32 -08:00
Jae Kwon
b9e2ad12e6 Merge pull request #58 from tendermint/abci_proof_jae
Updates to ABCI_Proof PR
2017-01-27 21:58:52 -08:00
Jae Kwon
339e135776 Add IsDirEmpty 2017-01-27 20:37:04 -08:00
Jae Kwon
2a4894310d Remove Proof message, replace with more flexible Query 2017-01-27 10:35:27 -08:00
Jae Kwon
4bdddf9829 First commit to demonstrate change 2017-01-23 20:54:24 -08:00
Jae Kwon
9745f07bee common -> cmn 2017-01-23 20:26:17 -08:00
Jae Kwon
a33b75fe8b Merge pull request #54 from roylee17/lint
Lint
2017-01-23 20:23:14 -08:00
Jae Kwon
6efadac330 Merge pull request #53 from roylee17/makefile
Makefile: add fmt and lint targets
2017-01-23 20:18:19 -08:00
Jae Kwon
f94ae5eeed TSP -> Socket 2017-01-23 20:14:14 -08:00
Jae Kwon
366479c7ad Merge branch 'readme' into hotfix_readme 2017-01-23 20:09:03 -08:00
Ethan Frey
fdc047ae7a Proof uses uint64 for blockHeight 2017-01-17 17:22:34 +01:00
Ethan Frey
e0309007ad Improve Makefile 2017-01-17 15:53:24 +01:00
Ethan Frey
dde413d44b Cleaned up text 2017-01-17 15:53:24 +01:00
Ethan Frey
732274b7f6 Add tests for client-server proofs over socket and grpc 2017-01-17 15:53:24 +01:00
Ethan Frey
cfc3f24751 Everything compiles, test proof in dummy app 2017-01-17 15:44:41 +01:00
Ethan Frey
7cd39dafea Update protocol buffers 2017-01-17 15:44:40 +01:00
Ethan Frey
58ea995032 Begin adding proof calls 2017-01-17 15:42:54 +01:00
Ethan Frey
98c4679f39 Fixed Makefile to cleanup after run 2017-01-17 15:41:11 +01:00
Tzu-Jung Lee
55cb08722d lint: s/+=1/++, remove else clauses 2017-01-17 00:30:36 -08:00
Tzu-Jung Lee
af2a66b226 test_app: unexport internal function.
This reverts commit 24c9b2761d7da5ab5084310f0cb3e51c7fc9738d.
2017-01-16 23:23:19 -08:00
Tzu-Jung Lee
9134905f42 cleanup: replace common.Exit with log.Crit or log.Fatal
Later we can pick another logger that has fatal, like zap?
2017-01-16 23:23:19 -08:00
Tzu-Jung Lee
1150bbfe36 lint: s/common.Fmt/fmt.Sprintf 2017-01-16 23:20:04 -08:00
Tzu-Jung Lee
fcaa545e1e lint: remove dot import (go-common)
Spell out the package explicitly.
This commit is totally textual, and does not change any logic.

The swiss-army knife package may serve a kick-start in early
stage development. But as the codebase growing, we might want
to retire it gradually:

  For simple wrapping functions, just inline it on the call site.
  For larger pice of code, make it an independent package.
2017-01-16 23:20:04 -08:00
Tzu-Jung Lee
c65bb21a51 Makefile: add 'build' target 2017-01-16 22:33:48 -08:00
Tzu-Jung Lee
aae3c91e88 fmt: run 'make fmt' 2017-01-16 22:03:27 -08:00
Tzu-Jung Lee
235b18d694 Makefile: add gmt and lint 2017-01-16 22:02:45 -08:00
Jae Kwon
05096de368 Add Result.String 2017-01-15 14:43:16 -08:00
Ethan Buchman
6526ab2137 Merge pull request #50 from tendermint/hotfix_make
Make sure we install before test, since test relies on counter etc
2017-01-13 13:17:24 -05:00
Jae Kwon
b9d1465488 Make sure we install before test, since test relies on counter etc 2017-01-13 10:12:38 -08:00
Ethan Buchman
68ef6bc1bf update README 2017-01-13 03:17:53 -05:00
Ethan Buchman
699d45bc67 Merge pull request #48 from tendermint/develop
move glide deps to master
2017-01-13 00:26:36 -05:00
Ethan Buchman
5626a1125a move glide deps to master 2017-01-13 00:24:38 -05:00
Ethan Buchman
72f6dacd22 fix tests 2017-01-12 22:32:20 -05:00
Ethan Buchman
068afb5b7f Merge pull request #36 from tendermint/develop
v0.3.0, for Tendermint v0.8.0
2017-01-12 22:03:00 -05:00
Ethan Buchman
b5ca28d60f Merge branch 'master' into develop
Conflicts:
	README.md
2017-01-12 21:44:09 -05:00
Ethan Buchman
b27edfd189 Merge pull request #1 from tendermint/develop
Include pwd dir to StartProcess
2017-01-12 21:39:27 -05:00
Ethan Buchman
fddee66d90 Merge pull request #8 from tendermint/develop
use mtx in OnStop
2017-01-12 21:38:04 -05:00
Ethan Buchman
996c483f23 Merge pull request #4 from tendermint/develop
C LevelDB
2017-01-12 21:37:57 -05:00
Ethan Buchman
e289af53b6 Merge pull request #6 from tendermint/develop
Develop
2017-01-12 21:37:18 -05:00
Ethan Buchman
42b7bfbf0c update version and glide 2017-01-12 21:20:09 -05:00
Ethan Buchman
624dca61b3 Merge pull request #47 from tendermint/rename
Rename
2017-01-12 16:06:40 -05:00
Ethan Buchman
5189a2248d TMSP -> ABCI 2017-01-12 16:04:32 -05:00
Ethan Buchman
80f377135b AppendTx -> DeliverTx 2017-01-12 15:27:08 -05:00
Ethan Buchman
2e414ebe6b Merge pull request #42 from tendermint/collapse_info
Flatten ResponseInfo
2017-01-12 15:20:59 -05:00
Ethan Buchman
490a96ef66 drop unneeded variable copy 2017-01-12 15:18:38 -05:00
Jae Kwon
f8167872d8 EndBlock also returns ResponseEndBlock 2017-01-12 14:50:41 -05:00
Jae Kwon
8b76f3dd00 Make fields in ResponseInfo be flat 2017-01-12 14:50:41 -05:00
Jae Kwon
0d82d26408 Frist commit on types.proto 2017-01-12 14:50:08 -05:00
Ethan Buchman
2337086736 use mtx in OnStop 2017-01-12 14:32:48 -05:00
Ethan Buchman
a7b7fe83d6 Merge pull request #46 from tendermint/updates
Updates
2017-01-12 01:11:11 -05:00
Ethan Buchman
831cb4adcd update glide 2017-01-12 01:08:31 -05:00
Ethan Buchman
e6b9a2b6aa response struct and persistent args 2017-01-12 01:04:25 -05:00
rigelrozanski
81b2697cce fix console exit, closes #35 2017-01-12 01:04:25 -05:00
rigelrozanski
c31df4081c added counter query support 2017-01-12 01:04:22 -05:00
Ethan Buchman
465c77e120 Merge pull request #43 from mappum/develop
tmsp-cli arg string handling + Make dummy query response values more clear
2017-01-12 00:23:33 -05:00
Matt Bell
4bb65366f4 Update CLI test string args 2017-01-03 19:26:37 -08:00
Matt Bell
cd6fa3018c Return errors from cmd functions instead of printing 2017-01-03 10:53:14 -08:00
Matt Bell
86a6deba3f Remove debug printing 2017-01-02 18:49:54 -08:00
Matt Bell
e748127b7f Don't include quotes in quoted string args 2017-01-02 18:49:10 -08:00
Matt Bell
115e6939d0 Require quotes or 0x<hex> for string args 2017-01-02 18:28:47 -08:00
Matt Bell
ab211d2dbe Include 'value' and 'valueHex' fields in dummy query response 2017-01-02 18:20:30 -08:00
Matt Bell
75ea378a6a Encode dummy query values as hex strings 2017-01-02 18:10:12 -08:00
Jae Kwon
c9b6b6e591 Merge pull request #39 from sjamayee/develop
link to TMSP Blog post
2017-01-02 12:37:48 -08:00
Jae Kwon
b0a17b1804 Fix blog link 2017-01-02 12:12:23 -08:00
Ethan Buchman
2645626c33 Merge pull request #3 from tendermint/swap_go_c
go and c strings were swapped
2016-12-22 21:07:31 -05:00
Ethan Buchman
33e35c4732 go and c strings were swapped 2016-12-22 15:44:51 -05:00
jac
5f6ad831b0 link to TMSP Blog post 2016-12-15 14:47:31 +01:00
Ethan Buchman
a552e49b50 Reverts commit f40b1b to a6a67e 2016-12-12 23:08:31 -05:00
Jae Kwon
c5f008d60f Fix TMSP tutorial outputs 2016-12-06 03:57:09 -08:00
Jae Kwon
b3e5d0afa1 Update glide.* 2016-12-06 03:22:53 -08:00
Jae Kwon
5e83e481bf Fix tests; Update go-merkle API 2016-12-06 02:15:32 -08:00
Jae Kwon
7f507d69fa Include pwd dir to StartProcess 2016-12-06 02:08:05 -08:00
Jae Kwon
0416e0aa9c Close opened files 2016-12-06 01:46:23 -08:00
Jae Kwon
70e694ee76 Fix ThrottleTimer null-pointer error / race condition 2016-12-06 01:39:04 -08:00
Jae Kwon
5e2a1d3e30 Fix tests; Support 'leveldb' for legacy 2016-11-30 20:22:35 -08:00
Jae Kwon
5ab5538d6c Move cleveldb to own file w/ build tag condition 'gcc' 2016-11-30 20:15:29 -08:00
Jae Kwon
226eb6554f Support for Run() convenience function 2016-11-29 16:55:32 -08:00
Jae Kwon
9f81134388 Add support for levigo bindings 2016-11-29 16:06:36 -08:00
Ethan Buchman
40448a3897 types: update LastBlockInfo and ConfigInfo 2016-11-23 18:27:27 -05:00
Ethan Buchman
2dce41ad6a types: pretty print validators 2016-11-23 18:22:44 -05:00
Ethan Buchman
e813b8c71d counter: fix tx buffer overflow 2016-11-23 18:22:22 -05:00
Ethan Buchman
f4e97a5db1 Merge pull request #37 from tendermint/valset
Valset
2016-11-22 21:10:26 -05:00
Ethan Buchman
37b5cca87c update cli example for new query result format 2016-11-22 21:06:50 -05:00
Ethan Buchman
ef3eb4a30e update glide 2016-11-22 21:06:39 -05:00
Ethan Buchman
dc13ec05a1 NewIAVLTree takes waldir 2016-11-22 20:44:41 -05:00
Ethan Buchman
b200b82418 dummy: valset changes and tests 2016-11-22 14:01:25 -05:00
Ethan Buchman
9a2d3e51ed heights are uint64 2016-11-22 14:00:31 -05:00
Jae Kwon
63186e34b3 Fix race condition 2016-11-21 20:26:47 -08:00
Jae Kwon
2a306419c8 Remove spurious fmt 2016-11-21 20:19:01 -08:00
Jae Kwon
f40b1b65f8 Add Tempdir 2016-11-21 20:03:59 -08:00
Jae Kwon
890e240730 Remove AutoFile tests 2016-11-21 20:03:59 -08:00
Jae Kwon
25dc9ae345 QuitService->BaseService 2016-11-21 20:03:59 -08:00
Jae Kwon
a6a67ea9b2 Remove AutoFile; Use go-autofile instead 2016-11-21 20:03:59 -08:00
Jae Kwon
6b4160f2a5 Add Tempdir 2016-11-21 20:01:11 -08:00
Jae Kwon
dd12bd8f1b Fix checkTotalSizeLimit bug; remove more than 1 file at a time 2016-11-21 19:57:17 -08:00
Jae Kwon
a528af55d3 Group is a BaseService; TotalSizeLimit enforced; tests fixed 2016-11-21 19:09:14 -08:00
Jae Kwon
d1848762cf Fix issue where buffered writes may split a line to two files 2016-11-20 17:19:15 -08:00
Ethan Buchman
3a70c07ed1 Merge pull request #29 from tendermint/info_and_header
Info and header
2016-11-16 16:26:58 -05:00
Ethan Buchman
0bdb3b887e fix chain_aware app 2016-11-16 16:22:52 -05:00
Ethan Buchman
60e0842ef9 Header.LastBlockID 2016-11-16 16:11:36 -05:00
Ethan Buchman
df299d03c4 block_height is int32 2016-11-16 13:32:18 -05:00
Ethan Buchman
ddb2b01631 BeginBlock(hash, header) 2016-11-16 13:32:18 -05:00
Ethan Buchman
7901825ad9 persistent dummy 2016-11-16 13:32:01 -05:00
Ethan Buchman
debbf122db add version/block/config to Info. add header to BeginBlock 2016-11-16 13:32:01 -05:00
Ethan Buchman
eece35eeeb glide: update go-common 2016-11-15 14:47:39 -05:00
Jae Kwon
1dafd3a89b Remove spurious fmt call 2016-11-15 14:39:13 -05:00
Ethan Buchman
6aa85b642e BeginBlock 2016-11-15 14:39:13 -05:00
Jae Kwon
7998ba668a QuitService->BaseService 2016-11-15 14:39:13 -05:00
Ethan Buchman
8374785c1d update glide, grpc to v4 2016-11-15 14:11:01 -05:00
Ethan Buchman
fe96cfc56d Merge pull request #34 from tendermint/glide
Glide
2016-11-10 02:43:53 +00:00
Ethan Buchman
1f9142873b add glide 2016-11-10 02:32:23 +00:00
Jae Kwon
dc8fa06e64 Add MakeSimpleSearchFunc 2016-11-05 17:58:50 -07:00
Jae Kwon
a20c98e619 Add Monitor.SetREMA() 2016-11-04 06:14:49 -07:00
Jae Kwon
1261fca160 FindLast 2016-10-30 04:29:40 -07:00
Jae Kwon
916f3d789b Size() returns 0 if file doesn't exist 2016-10-28 14:50:46 -07:00
Jae Kwon
5e9c5dc413 Add Group.WriteLine 2016-10-28 13:56:31 -07:00
Jae Kwon
fa3daa7abc Remove AutoFile tests 2016-10-28 12:11:23 -07:00
Jae Kwon
2781df39e5 QuitService->BaseService 2016-10-28 12:09:22 -07:00
Jae Kwon
0311042336 Add CHALLENGE 2016-10-28 09:10:33 -07:00
Jae Kwon
d741b81ab5 Add better docs for Group 2016-10-26 22:12:56 -07:00
Jae Kwon
44f2818a3d Remove AutoFile; Use go-autofile instead 2016-10-26 21:50:28 -07:00
Jae Kwon
c26b857900 Fix Search and add test 2016-10-26 21:50:07 -07:00
Jae Kwon
1859c4d5fe First commit 2016-10-26 16:23:19 -07:00
Jae Kwon
28b3d52948 first commit 2016-10-26 16:22:43 -07:00
Ethan Buchman
ab98bffbb1 codegangsta => urfave 2016-10-20 21:57:33 -04:00
Ethan Buchman
1c85cb98a4 Merge pull request #7 from tendermint/develop
EventSwitch is an interface
2016-10-20 21:23:35 -04:00
Jae Kwon
1c62bb6dad Merge pull request #5 from tendermint/develop
Reset() and SIGHUP for AutoFiles
2016-10-20 02:01:00 -07:00
Jae Kwon
1a24e6e237 Let SIGHUP close AutoFiles 2016-10-17 16:24:55 -07:00
Ethan Buchman
2e424ee663 service: Reset() for restarts 2016-10-17 16:24:55 -07:00
Ethan Buchman
1652dc8b3f EventSwitch is an interface 2016-10-10 03:20:42 -04:00
Jae Kwon
5d3eb0328a Update README.md 2016-09-28 09:57:04 +09:00
Ethan Buchman
538862321a bump version 2016-09-12 12:23:36 -04:00
Ethan Frey
dcd4ab5cd2 Make console more robust to typos 2016-09-12 10:21:20 +02:00
Ethan Buchman
ead192adbb test: more verbosity 2016-09-10 20:10:59 -04:00
Ethan Buchman
0e2a6b41f8 Merge pull request #30 from tendermint/develop
Develop
2016-09-10 19:04:30 -04:00
Ethan Buchman
47e06734f6 Merge pull request #4 from tendermint/throttle
throttle_timer: fix race, use mtx instead of atomic
2016-09-10 17:59:15 -04:00
Ethan Buchman
930880f574 throttle_timer: fix race, use mtx instead of atomic 2016-09-10 17:52:26 -04:00
Ethan Buchman
42e4f4693c client: safe error handling 2016-09-08 21:41:35 -04:00
Jae Kwon
9dc4dc1960 Add BitArray.Update() 2016-09-05 18:26:43 -07:00
Ethan Buchman
cb12ff94d3 Merge pull request #28 from tendermint/fix_circle
fix tests
2016-08-24 20:19:44 -04:00
Ethan Buchman
22894d2f60 fix tests 2016-08-24 20:16:55 -04:00
Ethan Buchman
3329868a1d grpc fix 2016-08-24 02:11:31 -04:00
Ethan Buchman
706d443617 Merge pull request #27 from tendermint/disconnect
Disconnect
2016-08-23 11:34:42 -04:00
Ethan Buchman
83920a1c37 fixes from review 2016-08-17 23:27:49 -04:00
Ethan Buchman
1b13f14e08 consolidate example tests; grpc fail fast 2016-08-15 15:04:32 -04:00
Ethan Buchman
a8066f9c82 return error if not running 2016-08-10 19:35:54 -04:00
Ethan Buchman
d3bdb49aae remote_client -> socket_client; use logger 2016-08-10 19:35:50 -04:00
Jae Kwon
4b11d62bdb Add Signature.Equals 2016-07-24 13:35:44 -07:00
Ethan Buchman
58bacfb04e Merge pull request #21 from tendermint/develop
Develop
2016-07-23 19:23:33 -04:00
Ethan Buchman
fbbf82ec64 update README.md 2016-07-23 19:05:46 -04:00
Ethan Buchman
3b329039d8 better testing. cli test for tutorial 2016-07-23 18:57:05 -04:00
Ethan Buchman
a263323d5c update readme. --verbose makes batch look like console 2016-07-23 17:37:09 -04:00
Ethan Buchman
3baa390bba reduce numTimes in test 2016-07-23 11:24:48 -04:00
Ethan Buchman
ba11348508 update make test 2016-07-22 01:23:13 -04:00
Silas Davis
b0c0631468 Spelling 2016-07-13 18:50:06 +01:00
Ethan Buchman
49a67aee8a add circle.yml. disable js test 2016-07-06 17:13:33 -04:00
Ethan Buchman
732634112b run grpc finishAsyncCall in go routine 2016-07-06 16:57:02 -04:00
Ethan Buchman
88f8141ab8 cleanup cli, drop expr 2016-07-01 20:22:58 -04:00
Ethan Buchman
3dabf304a1 fix race condition in repeat_timer 2016-06-26 01:00:51 -04:00
Ethan Buchman
cefb3a45c0 expose LvlNotice 2016-06-26 00:45:56 -04:00
Ethan Buchman
2c21c7be89 call reqRes.SetDone in grpc client 2016-06-22 14:25:18 -04:00
Ethan Buchman
48fa21511b Merge pull request #4 from benjaminbollen/issue1_concurreny_bug_in_remove_listener
Fixes #1 concurreny bug in remove listener
2016-06-21 10:48:51 -04:00
Benjamin Bollen
c15bcd487f fixes #1; events.go: claim full lock on delete listener 2016-06-17 14:53:19 +02:00
Benjamin Bollen
acabc4d3bb Introduce events_test.go with five unit tests asserting normal behaviour
and a sixth unit test to probe race conditions on RemoveListener.
2016-06-17 14:53:01 +02:00
Ethan Buchman
73e5c3cb7b update grpc version 2016-06-16 19:12:54 -04:00
Ethan Buchman
8c947760e6 grpc.SupportPackageIsVersion3 2016-06-16 19:04:59 -04:00
Jae Kwon
f41bc5f119 Merge pull request #13 from tendermint/protobuf
Protobuf + GRPC
2016-06-11 11:12:49 -07:00
Ethan Buchman
516a929e5f some cleanup 2016-05-24 22:40:47 -04:00
Ethan Buchman
1ab3c74718 silly grpc client 2016-05-23 14:45:07 -04:00
Ethan Buchman
f84f11ffe7 base grpc support 2016-05-18 18:29:52 -04:00
Ethan Buchman
c3cc5375be ignore mustConnect for now. fix test_counter 2016-05-17 22:45:45 -04:00
Ethan Buchman
5dc7bee57b Responses/Requests -> Value 2016-05-17 20:06:24 -04:00
Ethan Buchman
32f83f9494 fix up tmsp-cli, tests 2016-05-14 03:09:47 -04:00
Ethan Buchman
35f4f0e271 use real protobuf message types 2016-05-14 02:22:32 -04:00
Jae Kwon
529efe50ea No global config 2016-05-08 15:00:33 -07:00
Jae Kwon
31fdd21c7e No global config 2016-05-08 15:00:13 -07:00
Jae Kwon
7ffd289909 Conform to new codegangsta.cli ActionFunc interface 2016-05-05 14:11:18 -07:00
Jae Kwon
3910f871dd Trivial 2016-05-05 13:58:39 -07:00
Jae Kwon
9a8d40b87c Update README.md 2016-05-04 13:37:22 -07:00
Jae Kwon
41cfb7b677 Remove ReadSignature* methods 2016-04-21 18:05:15 -07:00
Jae Kwon
7e767e9548 Secp256k1 pubkeys are 64 bytes. Strip btcec prefix byte 2016-04-20 08:46:07 -07:00
Jae Kwon
c121163635 ReadSignature* 2016-04-19 08:49:41 -07:00
Jae Kwon
d57d5ff3c9 PrivKey.Equals 2016-04-19 01:26:40 -07:00
Jae Kwon
8b34fd2e51 Add secp256k1 support 2016-04-19 01:02:31 -07:00
Jae Kwon
d471b06bd8 Added C++ and Javascript impls 2016-04-15 15:01:05 -07:00
Jae Kwon
ca95184373 s/Invalid[Address,Amount]/Invalid[Input,Output]/g 2016-04-13 14:42:00 -07:00
Jae Kwon
82a411fca5 New TMSP message BeginBlock 2016-03-26 22:35:23 -07:00
Jae Kwon
121db71f48 Add ErrBaseUnknownPlugin 2016-03-24 14:17:48 -07:00
Jae Kwon
1dfc6950dd TMSPResult tweak 2016-03-24 11:27:04 -07:00
Jae Kwon
ccc55bd304 Add ErrUnknownAddress 2016-03-24 11:12:16 -07:00
Jae Kwon
062c33c109 TMSP Client is an interface 2016-03-24 10:42:25 -07:00
Jae Kwon
83fc4fc3b6 Allow late connecting 2016-03-23 21:07:03 -07:00
Jae Kwon
6785b9a3b6 CommitSync returns tmsp.Result 2016-03-23 02:50:29 -07:00
Jae Kwon
3f0d9b3f29 Signature bytes 2016-03-22 15:21:18 -07:00
Jae Kwon
5a3975d54a Add wire expression support 2016-03-22 15:18:03 -07:00
Jae Kwon
3d2d8c7d6a Result convenience methods; Shuffled Base* code types 2016-03-21 15:33:16 -07:00
Jae Kwon
8cac8600e5 Return NewServer listener start error 2016-03-20 17:38:03 -07:00
Jae Kwon
06a0ac8188 Add NewError -> Result with no data 2016-03-20 17:20:41 -07:00
Jae Kwon
55e2ce9de2 Group (code,data,log) return values into types.Result 2016-03-20 17:10:13 -07:00
Ethan Buchman
dcfa46af13 BitArray.IsEmpty() 2016-03-18 02:30:15 -04:00
Jae Kwon
eddde7f46a Added customized bcrypt 2016-03-17 20:37:30 -07:00
Jae Kwon
8152c18c35 Revert Address() scheme change 2016-03-15 15:58:43 -07:00
Jae Kwon
29a6d511b4 Add testutil; Clean gov return codes 2016-03-15 11:39:20 -07:00
Jae Kwon
9a95e7b7a5 Added Bytes() and *FromBytes() 2016-03-15 11:11:54 -07:00
Jae Kwon
185547efc1 Add ascii armor support 2016-03-13 14:00:27 -07:00
Jae Kwon
181aa56c87 Added symmetric encrypt/decrypt methods 2016-03-13 12:55:02 -07:00
Jae Kwon
f59fe0c8e0 s/Seed/MixEntropy/g 2016-03-13 10:14:24 -07:00
Jae Kwon
461c3b9785 Remove CRand* from go-common 2016-03-13 09:57:10 -07:00
Jae Kwon
264d2a3eef Add seed-able cryptographic random. 2016-03-13 09:40:15 -07:00
Jae Kwon
61c34ade0d Remove BeginBlock 2016-03-06 18:01:37 -08:00
Jae Kwon
84391b36d3 Conform to new go-config default config behavior 2016-03-06 12:31:22 -08:00
Jae Kwon
36c25f242f s/InitValidators/InitChain/g, s/SyncValidators/EndBlock/g, added BeginBlock 2016-03-05 19:18:34 -08:00
Jae Kwon
72540f9cac Fix tests to clean up after themselves 2016-02-29 21:53:04 -08:00
Jae Kwon
8b88496550 Merge branch 'validators' 2016-02-29 18:53:06 -08:00
Jae Kwon
dcabdad9b9 Implement Init/Sync Validators 2016-02-28 19:46:01 -08:00
Jae Kwon
1ffe780976 Initial update for Init/SyncValidators 2016-02-28 18:53:24 -08:00
Ethan Buchman
f23822bf55 export NewReqRes 2016-02-27 07:02:34 +00:00
Ethan Buchman
500c173604 nil app 2016-02-26 20:04:28 -05:00
Ethan Buchman
727fcd4ada get_hash -> commit; printResponse improvement 2016-02-23 13:36:18 -05:00
Jae Kwon
b2bd661a61 s/TMSPClient/Client/g 2016-02-21 23:55:45 -08:00
Jae Kwon
2c1aa7af2b s/StartListener/NewServer/g 2016-02-21 23:44:33 -08:00
Jae Kwon
1559ae1ac9 Add BitArray.Bytes() 2016-02-21 00:14:08 -08:00
Jae Kwon
90e38f08f4 Added counter test written in Golang 2016-02-14 14:59:53 -08:00
Jae Kwon
88fcacac7a s/GetHash/Commit/g 2016-02-14 13:11:06 -08:00
Jae Kwon
851b961daf Update README 2016-02-14 12:51:49 -08:00
Jae Kwon
089489cbf5 Merge branch 'blackstar' 2016-02-08 13:48:01 -08:00
Jae Kwon
b9499ad03e Implemented dummy query 2016-02-08 13:47:47 -08:00
Jae Kwon
adf0392e56 Callbacks for ReqRes 2016-02-08 13:30:30 -08:00
Jae Kwon
76ba23e4c0 Fix bug in GenPrivKeyEd25519FromSecret 2016-02-08 02:18:06 -08:00
Jae Kwon
62550f474f Merge branch 'master' of https://github.com/tendermint/go-crypto 2016-02-08 00:53:00 -08:00
Jae Kwon
372191dd5f KeyString() in PubKey; Fix tests 2016-02-08 00:50:52 -08:00
Jae Kwon
2d5e1e8340 Callbacks for ReqRes 2016-02-08 00:50:00 -08:00
Ethan Buchman
b35492d9e7 better response printing 2016-02-07 19:59:19 -08:00
Jae Kwon
cf0ad66d51 Compile new types.proto for new CodeType enums 2016-02-05 23:15:08 -08:00
Ethan Buchman
4901b71ade SetLogLevel 2016-02-05 23:00:03 +00:00
Jae Kwon
2281bba708 Add two new CodeTypes 2016-02-03 01:58:23 -08:00
Ethan Buchman
9364accf1f service: start/stop logs are info, ignored are debug 2016-02-03 02:04:00 -05:00
Ethan Buchman
02022e356a make ignore already stopped service Debug 2016-02-02 16:19:46 -05:00
Jae Kwon
69e587f57f Use protobuf enums for RetCode. s/RetCode/CodeType/g 2016-01-31 20:39:43 -08:00
Jae Kwon
012abc437b Use protobuf enums 2016-01-31 19:56:02 -08:00
Jae Kwon
028cc4aa06 Query returns Code 2016-01-31 18:11:24 -08:00
Jae Kwon
e110a04ae2 Fix benchmark -- needed to flush 2016-01-30 19:44:04 -08:00
Jae Kwon
2936c68339 Convert TMSP to use Protobuf 2016-01-30 19:36:33 -08:00
Jae Kwon
6132ad7d6e Do not exit upon error, for tmsp-cli console 2016-01-29 16:06:39 -08:00
Jae Kwon
799ae4c006 Move js example to js-tmsp/example 2016-01-29 11:47:13 -08:00
Jae Kwon
b21c6b5e5b s/logstr/logStr/g 2016-01-25 14:15:17 -08:00
Jae Kwon
9696a71f6e Log not error; Remove Listener TMSP messages...; Make counter BigEndian 2016-01-25 13:58:34 -08:00
Jae Kwon
c4b87dcf14 new_message 2016-01-23 20:49:15 -08:00
Jae Kwon
e2426d2944 Start TMSPClient automatically 2016-01-22 17:56:56 -08:00
Jae Kwon
53a8a40785 Swap Query return params 2016-01-22 16:18:35 -08:00
Jae Kwon
8ae0a0a481 Add Query; Add TMSPClient 2016-01-22 15:50:11 -08:00
Jae Kwon
3f812038a4 Add Query; Add benchmark tests 2016-01-18 14:37:42 -08:00
Jae Kwon
19f5a93cff Adjust Service log notice for duplicate stops 2016-01-18 13:19:11 -08:00
Jae Kwon
7b75ca7bb5 Remove SubscribeToEvent 2016-01-18 11:15:46 -08:00
Jae Kwon
ca259ce82a Conform to go-merkle version 0.2.0 2016-01-17 21:29:18 -08:00
Jae Kwon
a7878f1d0d Add basic test for level_db 2016-01-17 13:13:19 -08:00
Ethan Buchman
1fb7234ff5 fix test 2016-01-16 13:49:16 -05:00
Jae Kwon
e8ffe6bb4c Remove AssertIsEventData; Remove EventResult 2016-01-14 11:01:44 -08:00
Ethan Buchman
a5f26a8999 EventResult 2016-01-12 18:35:42 -05:00
Jae Kwon
44f22e351b Add RetCodeBadNonce and fix response formats 2016-01-12 14:06:31 -08:00
Ethan Buchman
089435d31b move from tendermint/tendermint 2016-01-12 16:21:43 -05:00
Ethan Buchman
e85e2842a0 Initial commit 2016-01-12 16:13:26 -05:00
Jae Kwon
8dacd4172e Fix bug where Unset halts ThrottleTimer 2016-01-11 17:12:38 -08:00
Jae Kwon
c58b1cbf8a Add ThrottleTimer.Unset 2016-01-10 08:12:10 -08:00
Jae Kwon
87b9866d1f Fix Makefile to get_deps then install 2016-01-09 19:05:41 -08:00
Jae Kwon
f15476b157 Remove TMSP Commit/Rollback; Add CheckTx 2016-01-08 17:07:19 -08:00
Ethan Buchman
aa3e87450a fix tests 2016-01-08 16:06:33 -05:00
Jae Kwon
271a424d42 Merge pull request #7 from readevalprint/python3
Python3 example
2016-01-05 14:54:40 -08:00
Jae Kwon
57ce0c12e8 Merge pull request #6 from readevalprint/pep8
Python Pep8 style fixes
2016-01-05 14:54:12 -08:00
tim watts
eece2ae7a5 use floor division 2016-01-05 22:37:22 +00:00
tim watts
3092d2c043 missing modulename and fix refactoring 2016-01-05 22:00:19 +00:00
tim watts
65a0156412 python3 example 2016-01-05 21:49:21 +00:00
tim watts
8267f2ba4a Fix except/pass 2016-01-03 16:42:58 +00:00
tim watts
06b48fe99f pep8 style fixes 2016-01-03 16:35:23 +00:00
Jae Kwon
ba01cfbb58 Remove spurious fmt.Print 2016-01-02 16:20:39 -08:00
Jae Kwon
1b7243a990 Update README to point to blog post only 2016-01-01 19:09:03 -08:00
Jae Kwon
0c4650f329 Update README.md
Added introduction by Zaki
2016-01-01 18:19:58 -08:00
Jae Kwon
980f02a500 Change license to Apache2.0 2015-12-23 14:19:50 -08:00
Jae Kwon
634527f5b6 Change license to Apache2.0 2015-12-23 14:18:53 -08:00
Jae Kwon
ea56ed5ea2 Change license to Apache2.0 2015-12-23 14:17:27 -08:00
Jae Kwon
b24269fefc Change license to Apache2.0 2015-12-23 14:16:29 -08:00
Jae Kwon
f592570310 Change license to Apache2.0 2015-12-23 14:14:41 -08:00
Jae Kwon
16e5e4e8c8 Change license format 2015-12-23 14:11:59 -08:00
Jae Kwon
da1ef93cef Added link to tendermint.com blog post 2015-12-21 17:41:35 -08:00
Jae Kwon
20913c5e0e Add .pyc to gitignore; Fix js example 2015-12-21 17:23:05 -08:00
Jae Kwon
cf3b287245 Remove spurious tmsp_cli.go 2015-12-21 16:36:50 -08:00
Jae Kwon
13c50a5fdf Merge pull request #5 from tendermint/js
Length prefixed tmsp messages; counter app in javascript
2015-12-21 16:35:10 -08:00
Jae Kwon
844c4a519d Fix tmsp-cli to conform to go-wire new TypeByte behavior; Rename tmsp_cli to tmsp-cli 2015-12-21 16:18:41 -08:00
Ethan Buchman
3fb3a81b92 fix js 2015-12-21 18:47:14 -05:00
Ethan Buchman
dc75b71f55 tmsp_cli -> tmsp-cli 2015-12-21 18:12:38 -05:00
Ethan Buchman
d560c1d455 example/js 2015-12-21 18:03:57 -05:00
Ethan Buchman
b7b4109413 msg prefix python 2015-12-21 18:03:57 -05:00
Jae Kwon
2d9abb06ca Conform to new go-wire TypeByte behavior 2015-12-21 09:58:27 -08:00
Jae Kwon
3393fc34c2 Use wire.*LengthPrefixed 2015-12-20 09:16:05 -08:00
Ethan Buchman
a357f3156a RetCodeEncodingError 2015-12-17 13:48:36 -08:00
Jae Kwon
4b67e9e9d2 Add Makefile 2015-12-17 13:46:04 -08:00
Jae Kwon
035966d273 Merge pull request #4 from tendermint/python
add counter app in python
2015-12-17 13:41:56 -08:00
Ethan Buchman
36b7045f5c example/golang 2015-12-14 20:00:48 -05:00
Ethan Buchman
af2a1a6fc1 python fixes, tests 2015-12-14 20:00:48 -05:00
Ethan Buchman
bb4a58aa0a add counter app in python 2015-12-14 19:58:51 -05:00
Jae Kwon
acdbd88e88 Add BypassHandler and NewBypass to bypass main filter 2015-12-09 09:38:40 -08:00
Jae Kwon
4a0469d3ec Make counter app use LittleEndian uint64 encoding 2015-12-08 21:52:40 -08:00
Jae Kwon
5c20d1b3e5 Add way to enforce serial order in counter app from command line 2015-12-08 21:12:11 -08:00
Ethan Buchman
36e89b606e fix test 2015-12-05 17:52:40 +00:00
Jae Kwon
21abda0602 Make Counter app return nil hash initially 2015-12-04 01:01:07 -08:00
Jae Kwon
3b50efbe02 WriteFile*() takes file mode 2015-12-03 23:56:50 -08:00
Jae Kwon
4b6741ca3b EnsureDir() takes file mode 2015-12-03 23:44:24 -08:00
Jae Kwon
7b1ebb9245 Update README.md 2015-12-03 15:47:20 -08:00
Jae Kwon
bbaacce472 Change server listener addr to 0.0.0.0 2015-12-02 00:25:39 -08:00
Jae Kwon
7931e2b9ca Change port 8080 to 46658 2015-12-01 15:27:50 -08:00
Jae Kwon
4fc7aa234f Merge pull request #3 from tendermint/console
tmsp cli enhancements and simple tests
2015-12-01 11:26:18 -08:00
Ethan Buchman
3e721456f5 tmsp batch and some tests 2015-12-01 01:49:54 -05:00
Ethan Buchman
86c2484c29 cmdInfo, cmdSetOption; append_tx can take hex 2015-11-30 23:49:18 -05:00
Ethan Buchman
93308a3e6f interactive tmsp console 2015-11-30 20:56:36 -05:00
Jae Kwon
7448cdc154 Add serial=on option for CounterApplication 2015-11-30 15:22:42 -08:00
Jae Kwon
e3d88d2d79 Add ScanRightDeleteRandom test; Add GCRandom test 2015-11-30 12:59:05 -08:00
Jae Kwon
dbd04eadeb Remove CList, moved to go-clist 2015-11-29 21:23:33 -08:00
Jae Kwon
d939cd964b First commit of CList 2015-11-29 21:22:55 -08:00
Jae Kwon
6a5b804523 Refactor CounterApplication to implement AppContext 2015-11-29 14:34:15 -08:00
Jae Kwon
5d994944c6 Refactor Application to Application & AppContext 2015-11-29 14:22:30 -08:00
Jae Kwon
8b9df7d685 Merge pull request #2 from tendermint/cli
refactor dummy; flush tmsp reqs
2015-11-29 13:07:43 -08:00
Ethan Buchman
fe782cb8ac server: allow multiple connections 2015-11-29 10:35:37 -05:00
Ethan Buchman
c21c2ed69b counter example 2015-11-29 03:43:49 -05:00
Ethan Buchman
2de72d26cf refactor dummy; flush tmsp reqs 2015-11-27 18:45:27 -05:00
Jae Kwon
80c7e26bee Fix memory-leak in CList; Patched with DetachPrev/DetachHead 2015-11-27 14:09:15 -08:00
Jae Kwon
76189fde0d Add Remove() implementation, CList is doubly-linked 2015-11-27 13:04:24 -08:00
Jae Kwon
e40c4834a8 Replace SetEventsMode with SetOption 2015-11-27 10:14:46 -08:00
Jae Kwon
9a72da4fcd Add .gitignore file 2015-11-27 09:57:08 -08:00
Jae Kwon
edf3abaf8f Merge pull request #1 from tendermint/retcode
retcode.Error() from go generate
2015-11-27 08:51:06 -08:00
Jae Kwon
32937f2815 Add Apache2.0 license 2015-11-27 08:51:49 -08:00
Ethan Buchman
4d0eb1d95a retcode.Error() from go generate 2015-11-27 11:07:16 -05:00
Jae Kwon
c65e9e7d91 Added CList 2015-11-25 16:50:28 -08:00
Jae Kwon
201bf2374b Update README; Remove GetEvents() from Application 2015-11-16 15:50:26 -08:00
Jae Kwon
d319c5be0d Conform to go-wire 1.0 2015-11-10 12:49:07 -08:00
Jae Kwon
32b3a27a9a Conform to new go-wire 1.0 2015-11-10 11:53:35 -08:00
Jae Kwon
e8505a714b Handle RequestInfo in handleRequest 2015-11-09 18:17:00 -08:00
Jae Kwon
5aec38bdc6 Fix DummyyApplication usage bug; Should call New 2015-11-09 18:16:35 -08:00
Jae Kwon
cce812b1fa Remove retcode from echo; Add Info message 2015-11-09 16:29:45 -08:00
Jae Kwon
ef93c95853 Added new Flush request/response type 2015-11-08 15:18:58 -08:00
Jae Kwon
0bd4061cf6 initial commit 2015-11-07 20:42:02 -08:00
Jae Kwon
0424228e97 Added net.go Connect() 2015-11-05 15:00:42 -08:00
Jae Kwon
70b9a368ca ... 2015-11-05 14:21:33 -08:00
Jae Kwon
db87630689 initial commit 2015-11-05 10:54:58 -08:00
Jae Kwon
31a456c8d4 update package name 2015-10-25 13:45:13 -07:00
Jae Kwon
fcdea621bf first commit 2015-10-25 13:42:49 -07:00
Jae Kwon
b072ed3173 ... 2015-10-22 12:33:53 -07:00
Jae Kwon
28d39f8726 ... 2015-10-22 12:31:02 -07:00
Jae Kwon
6b54e7b8d9 Added License 2015-10-22 12:30:20 -07:00
Jae Kwon
cfeac977fd first commit 2015-10-21 18:19:14 -07:00
Jae Kwon
16372365c4 First commit 2015-10-21 12:15:19 -07:00
Maxim Khitrov
cca7078d47 Fix project name in LICENSE 2014-04-18 21:45:27 -04:00
Maxim Khitrov
3524264add Add LICENSE and README files 2014-04-18 20:43:33 -04:00
Maxim Khitrov
6a20af8766 Rename package to 'flowrate' 2014-04-18 20:41:01 -04:00
Maxim Khitrov
10e10fd81d Rename 'flowcontrol' directory 2014-04-18 20:32:46 -04:00
Maxim Khitrov
bec34fc8d7 Import flowcontrol package from Google Code 2014-04-18 20:31:57 -04:00
741 changed files with 65194 additions and 13524 deletions

224
.circleci/config.yml Normal file
View File

@@ -0,0 +1,224 @@
version: 2
defaults: &defaults
working_directory: /go/src/github.com/tendermint/tendermint
docker:
- image: circleci/golang:1.10.3
environment:
GOBIN: /tmp/workspace/bin
jobs:
setup_dependencies:
<<: *defaults
steps:
- run: mkdir -p /tmp/workspace/bin
- run: mkdir -p /tmp/workspace/profiles
- checkout
- restore_cache:
keys:
- v2-pkg-cache
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run:
name: binaries
command: |
export PATH="$GOBIN:$PATH"
make install install_abci
- persist_to_workspace:
root: /tmp/workspace
paths:
- bin
- profiles
- save_cache:
key: v2-pkg-cache
paths:
- /go/pkg
- save_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
paths:
- /go/src/github.com/tendermint/tendermint
build_slate:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: slate docs
command: |
set -ex
export PATH="$GOBIN:$PATH"
make build-slate
lint:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: metalinter
command: |
set -ex
export PATH="$GOBIN:$PATH"
make metalinter
test_abci_apps:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Run abci apps tests
command: |
export PATH="$GOBIN:$PATH"
bash abci/tests/test_app/test.sh
# if this test fails, fix it and update the docs at:
# https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.md
test_abci_cli:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Run abci-cli tests
command: |
export PATH="$GOBIN:$PATH"
bash abci/tests/test_cli/test.sh
test_apps:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils
- run:
name: Run tests
command: bash test/app/test.sh
test_cover:
<<: *defaults
parallelism: 4
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: mkdir -p /tmp/logs
- run:
name: Run tests
command: |
for pkg in $(go list github.com/tendermint/tendermint/... | grep -v /vendor/ | circleci tests split --split-by=timings); do
id=$(basename "$pkg")
GOCACHE=off go test -v -timeout 5m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log"
done
- persist_to_workspace:
root: /tmp/workspace
paths:
- "profiles/*"
- store_artifacts:
path: /tmp/logs
test_persistence:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-pkg-cache
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Run tests
command: bash test/persist/test_failure_indices.sh
test_p2p:
environment:
GOBIN: /home/circleci/.go_workspace/bin
GOPATH: /home/circleci/.go_workspace
machine:
image: circleci/classic:latest
steps:
- checkout
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- run: bash test/p2p/circleci.sh
upload_coverage:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v2-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: gather
command: |
set -ex
echo "mode: atomic" > coverage.txt
for prof in $(ls /tmp/workspace/profiles/); do
tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt
done
- run:
name: upload
command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
workflows:
version: 2
test-suite:
jobs:
- setup_dependencies
- lint:
requires:
- setup_dependencies
- test_abci_apps:
requires:
- setup_dependencies
- test_abci_cli:
requires:
- setup_dependencies
- test_apps:
requires:
- setup_dependencies
- test_cover:
requires:
- setup_dependencies
- test_persistence:
requires:
- setup_dependencies
- test_p2p
- upload_coverage:
requires:
- test_cover

View File

@@ -1,26 +0,0 @@
#
# This codecov.yml is the default configuration for
# all repositories on Codecov. You may adjust the settings
# below in your own codecov.yml in your repository.
#
coverage:
precision: 2
round: down
range: 70...100
status:
# Learn more at https://codecov.io/docs#yaml_default_commit_status
project:
default:
threshold: 1% # allow this much decrease on project
changes: false
comment:
layout: "header, diff"
behavior: default # update if exists else create new
ignore:
- "docs"
- "*.md"
- "*.rst"

6
.github/CODEOWNERS vendored
View File

@@ -1,5 +1,7 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/
# Everything goes through Bucky. For now.
* @ebuchman
# Everything goes through Bucky, Anton, Alex. For now.
* @ebuchman @melekes @xla
# Precious documentation
/docs/ @zramsay @jolesbi

View File

@@ -19,10 +19,6 @@ in a case of bug.
**ABCI app** (name for built-in, URL for self-written if it's publicly available):
**Merkleeyes version** (use `git rev-parse --verify HEAD`, skip if you don't use it):
**Environment**:
- **OS** (e.g. from /etc/os-release):
- **Install tools**:
@@ -37,5 +33,10 @@ in a case of bug.
**How to reproduce it** (as minimally and precisely as possible):
**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)**:
**`/dump_consensus_state` output for consensus bugs**
**Anything else do we need to know**:

6
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,6 @@
<!-- Thanks for filing a PR! Before hitting the button, please check the following items.-->
* [ ] Updated all relevant documentation in docs
* [ ] Updated all code comments where relevant
* [ ] Wrote tests
* [ ] Updated CHANGELOG.md

13
.gitignore vendored
View File

@@ -5,7 +5,6 @@
.DS_Store
build/*
rpc/test/.tendermint
.debora
.tendermint
remote_dump
.revision
@@ -13,10 +12,18 @@ vendor
.vagrant
test/p2p/data/
test/logs
.glide
coverage.txt
docs/_build
docs/tools
*.log
abci-cli
abci/types/types.pb.go
docs/node_modules/
scripts/wal2json/wal2json
scripts/cutWALUntil/cutWALUntil
.idea/
*.iml
libs/pubsub/query/fuzz_test/output
shunit2

View File

@@ -1,31 +1,465 @@
# Changelog
## Roadmap
## 0.22.2
*July 10th, 2018*
IMPROVEMENTS
- More cleanup post repo merge!
- [docs] Include `ecosystem.json` and `tendermint-bft.md` from deprecated `aib-data` repository.
- [config] Add `instrumentation.max_open_connections`, which limits the number
of requests in flight to Prometheus server (if enabled). Default: 3.
BUG FIXES
- [rpc] Allow unquoted integers in requests
- NOTE: this is only for URI requests. JSONRPC requests and all responses
will use quoted integers (the proto3 JSON standard).
- [consensus] Fix halt on shutdown
## 0.22.1
*July 5th, 2018*
IMPROVEMENTS
* Cleanup post repo-merge.
* [docs] Various improvements.
BUG FIXES
* [state] Return error when EndBlock returns a 0-power validator that isn't
already in the validator set.
* [consensus] Shut down WAL properly.
## 0.22.0
*July 2nd, 2018*
BREAKING CHANGES:
- Upgrade the header to support better proofs on validtors, results, evidence, and possibly more
- Better support for injecting randomness
- Pass evidence/voteInfo through ABCI
- Upgrade consensus for more real-time use of evidence
- [config]
* Remove `max_block_size_txs` and `max_block_size_bytes` in favor of
consensus params from the genesis file.
* Rename `skip_upnp` to `upnp`, and turn it off by default.
* Change `max_packet_msg_size` back to `max_packet_msg_payload_size`
- [rpc]
* All integers are encoded as strings (part of the update for Amino v0.10.1)
* `syncing` is now called `catching_up`
- [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`)
FEATURES:
- Peer reputation management
- Use the chain as its own CA for nodes and validators
- Tooling to run multiple blockchains/apps, possibly in a single process
- State syncing (without transaction replay)
- Add authentication and rate-limitting to the RPC
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
IMPROVEMENTS:
- Improve subtleties around mempool caching and logic
- Consensus optimizations:
- cache block parts for faster agreement after round changes
- propagate block parts rarest first
- Better testing of the consensus state machine (ie. use a DSL)
- Auto compiled serialization/deserialization code instead of go-wire reflection
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:
- Graceful handling/recovery for apps that have non-determinism or fail to halt
- Graceful handling/recovery for violations of safety, or liveness
- [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" 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
*June 21th, 2018*
BREAKING CHANGES
- [config] Change default ports from 4665X to 2665X. Ports over 32768 are
ephemeral and reserved for use by the kernel.
- [cmd] `unsafe_reset_all` removes the addrbook.json
IMPROVEMENT
- [pubsub] Set default capacity to 0
- [docs] Various improvements
BUG FIXES
- [consensus] Fix an issue where we don't make blocks after `fast_sync` when `create_empty_blocks=false`
- [mempool] Fix #1761 where we don't process txs if `cache_size=0`
- [rpc] Fix memory leak in Websocket (when using `/subscribe` method)
- [config] Escape paths in config - fixes config paths on Windows
## 0.20.0
*June 6th, 2018*
This is the first in a series of breaking releases coming to Tendermint after
soliciting developer feedback and conducting security audits.
This release does not break any blockchain data structures or
protocols other than the ABCI messages between Tendermint and the application.
Applications that upgrade for ABCI v0.11.0 should be able to continue running Tendermint
v0.20.0 on blockchains created with v0.19.X
BREAKING CHANGES
- [abci] Upgrade to
[v0.11.0](https://github.com/tendermint/abci/blob/master/CHANGELOG.md#0110)
- [abci] Change Query path for filtering peers by node ID from
`p2p/filter/pubkey/<id>` to `p2p/filter/id/<id>`
## 0.19.9
*June 5th, 2018*
BREAKING CHANGES
- [types/priv_validator] Moved to top level `privval` package
FEATURES
- [config] Collapse PeerConfig into P2PConfig
- [docs] Add quick-install script
- [docs/spec] Add table of Amino prefixes
BUG FIXES
- [rpc] Return 404 for unknown endpoints
- [consensus] Flush WAL on stop
- [evidence] Don't send evidence to peers that are behind
- [p2p] Fix memory leak on peer disconnects
- [rpc] Fix panic when `per_page=0`
## 0.19.8
*June 4th, 2018*
BREAKING:
- [p2p] Remove `auth_enc` config option, peer connections are always auth
encrypted. Technically a breaking change but seems no one was using it and
arguably a bug fix :)
BUG FIXES
- [mempool] Fix deadlock under high load when `skip_timeout_commit=true` and
`create_empty_blocks=false`
## 0.19.7
*May 31st, 2018*
BREAKING:
- [libs/pubsub] TagMap#Get returns a string value
- [libs/pubsub] NewTagMap accepts a map of strings
FEATURES
- [rpc] the RPC documentation is now published to https://tendermint.github.io/slate
- [p2p] AllowDuplicateIP config option to refuse connections from same IP.
- true by default for now, false by default in next breaking release
- [docs] Add docs for query, tx indexing, events, pubsub
- [docs] Add some notes about running Tendermint in production
IMPROVEMENTS:
- [consensus] Consensus reactor now receives events from a separate synchronous event bus,
which is not dependant on external RPC load
- [consensus/wal] do not look for height in older files if we've seen height - 1
- [docs] Various cleanup and link fixes
## 0.19.6
*May 29th, 2018*
BUG FIXES
- [blockchain] Fix fast-sync deadlock during high peer turnover
BUG FIX:
- [evidence] Dont send peers evidence from heights they haven't synced to yet
- [p2p] Refuse connections to more than one peer with the same IP
- [docs] Various fixes
## 0.19.5
*May 20th, 2018*
BREAKING CHANGES
- [rpc/client] TxSearch and UnconfirmedTxs have new arguments (see below)
- [rpc/client] TxSearch returns ResultTxSearch
- [version] Breaking changes to Go APIs will not be reflected in breaking
version change, but will be included in changelog.
FEATURES
- [rpc] `/tx_search` takes `page` (starts at 1) and `per_page` (max 100, default 30) args to paginate results
- [rpc] `/unconfirmed_txs` takes `limit` (max 100, default 30) arg to limit the output
- [config] `mempool.size` and `mempool.cache_size` options
IMPROVEMENTS
- [docs] Lots of updates
- [consensus] Only Fsync() the WAL before executing msgs from ourselves
BUG FIXES
- [mempool] Enforce upper bound on number of transactions
## 0.19.4 (May 17th, 2018)
IMPROVEMENTS
- [state] Improve tx indexing by using batches
- [consensus, state] Improve logging (more consensus logs, fewer tx logs)
- [spec] Moved to `docs/spec` (TODO cleanup the rest of the docs ...)
BUG FIXES
- [consensus] Fix issue #1575 where a late proposer can get stuck
## 0.19.3 (May 14th, 2018)
FEATURES
- [rpc] New `/consensus_state` returns just the votes seen at the current height
IMPROVEMENTS
- [rpc] Add stringified votes and fraction of power voted to `/dump_consensus_state`
- [rpc] Add PeerStateStats to `/dump_consensus_state`
BUG FIXES
- [cmd] Set GenesisTime during `tendermint init`
- [consensus] fix ValidBlock rules
## 0.19.2 (April 30th, 2018)
FEATURES:
- [p2p] Allow peers with different Minor versions to connect
- [rpc] `/net_info` includes `n_peers`
IMPROVEMENTS:
- [p2p] Various code comments, cleanup, error types
- [p2p] Change some Error logs to Debug
BUG FIXES:
- [p2p] Fix reconnect to persistent peer when first dial fails
- [p2p] Validate NodeInfo.ListenAddr
- [p2p] Only allow (MaxNumPeers - MaxNumOutboundPeers) inbound peers
- [p2p/pex] Limit max msg size to 64kB
- [p2p] Fix panic when pex=false
- [p2p] Allow multiple IPs per ID in AddrBook
- [p2p] Fix before/after bugs in addrbook isBad()
## 0.19.1 (April 27th, 2018)
Note this release includes some small breaking changes in the RPC and one in the
config that are really bug fixes. v0.19.1 will work with existing chains, and make Tendermint
easier to use and debug. With <3
BREAKING (MINOR)
- [config] Removed `wal_light` setting. If you really needed this, let us know
FEATURES:
- [networks] moved in tooling from devops repo: terraform and ansible scripts for deploying testnets !
- [cmd] Added `gen_node_key` command
BUG FIXES
Some of these are breaking in the RPC response, but they're really bugs!
- [spec] Document address format and pubkey encoding pre and post Amino
- [rpc] Lower case JSON field names
- [rpc] Fix missing entries, improve, and lower case the fields in `/dump_consensus_state`
- [rpc] Fix NodeInfo.Channels format to hex
- [rpc] Add Validator address to `/status`
- [rpc] Fix `prove` in ABCIQuery
- [cmd] MarshalJSONIndent on init
## 0.19.0 (April 13th, 2018)
BREAKING:
- [cmd] improved `testnet` command; now it can fill in `persistent_peers` for you in the config file and much more (see `tendermint testnet --help` for details)
- [cmd] `show_node_id` now returns an error if there is no node key
- [rpc]: changed the output format for the `/status` endpoint (see https://godoc.org/github.com/tendermint/tendermint/rpc/core#Status)
Upgrade from go-wire to go-amino. This is a sweeping change that breaks everything that is
serialized to disk or over the network.
See github.com/tendermint/go-amino for details on the new format.
See `scripts/wire2amino.go` for a tool to upgrade
genesis/priv_validator/node_key JSON files.
FEATURES
- [test] docker-compose for local testnet setup (thanks Greg!)
## 0.18.0 (April 6th, 2018)
BREAKING:
- [types] Merkle tree uses different encoding for varints (see tmlibs v0.8.0)
- [types] ValidtorSet.GetByAddress returns -1 if no validator found
- [p2p] require all addresses come with an ID no matter what
- [rpc] Listening address must contain tcp:// or unix:// prefix
FEATURES:
- [rpc] StartHTTPAndTLSServer (not used yet)
- [rpc] Include validator's voting power in `/status`
- [rpc] `/tx` and `/tx_search` responses now include the transaction hash
- [rpc] Include peer NodeIDs in `/net_info`
IMPROVEMENTS:
- [config] trim whitespace from elements of lists (like `persistent_peers`)
- [rpc] `/tx_search` results are sorted by height
- [p2p] do not try to connect to ourselves (ok, maybe only once)
- [p2p] seeds respond with a bias towards good peers
BUG FIXES:
- [rpc] fix subscribing using an abci.ResponseDeliverTx tag
- [rpc] fix tx_indexers matchRange
- [rpc] fix unsubscribing (see tmlibs v0.8.0)
## 0.17.1 (March 27th, 2018)
BUG FIXES:
- [types] Actually support `app_state` in genesis as `AppStateJSON`
## 0.17.0 (March 27th, 2018)
BREAKING:
- [types] WriteSignBytes -> SignBytes
IMPROVEMENTS:
- [all] renamed `dummy` (`persistent_dummy`) to `kvstore` (`persistent_kvstore`) (name "dummy" is deprecated and will not work in the next breaking release)
- [docs] note on determinism (docs/determinism.rst)
- [genesis] `app_options` field is deprecated. please rename it to `app_state` in your genesis file(s). `app_options` will not work in the next breaking release
- [p2p] dial seeds directly without potential peers
- [p2p] exponential backoff for addrs in the address book
- [p2p] mark peer as good if it contributed enough votes or block parts
- [p2p] stop peer if it sends incorrect data, msg to unknown channel, msg we did not expect
- [p2p] when `auth_enc` is true, all dialed peers must have a node ID in their address
- [spec] various improvements
- switched from glide to dep internally for package management
- [wire] prep work for upgrading to new go-wire (which is now called go-amino)
FEATURES:
- [config] exposed `auth_enc` flag to enable/disable encryption
- [config] added the `--p2p.private_peer_ids` flag and `PrivatePeerIDs` config variable (see config for description)
- [rpc] added `/health` endpoint, which returns empty result for now
- [types/priv_validator] new format and socket client, allowing for remote signing
BUG FIXES:
- [consensus] fix liveness bug by introducing ValidBlock mechanism
## 0.16.0 (February 20th, 2018)
BREAKING CHANGES:
- [config] use $TMHOME/config for all config and json files
- [p2p] old `--p2p.seeds` is now `--p2p.persistent_peers` (persistent peers to which TM will always connect to)
- [p2p] now `--p2p.seeds` only used for getting addresses (if addrbook is empty; not persistent)
- [p2p] NodeInfo: remove RemoteAddr and add Channels
- we must have at least one overlapping channel with peer
- we only send msgs for channels the peer advertised
- [p2p/conn] pong timeout
- [lite] comment out IAVL related code
FEATURES:
- [p2p] added new `/dial_peers&persistent=_` **unsafe** endpoint
- [p2p] persistent node key in `$THMHOME/config/node_key.json`
- [p2p] introduce peer ID and authenticate peers by ID using addresses like `ID@IP:PORT`
- [p2p/pex] new seed mode crawls the network and serves as a seed.
- [config] MempoolConfig.CacheSize
- [config] P2P.SeedMode (`--p2p.seed_mode`)
IMPROVEMENT:
- [p2p/pex] stricter rules in the PEX reactor for better handling of abuse
- [p2p] various improvements to code structure including subpackages for `pex` and `conn`
- [docs] new spec!
- [all] speed up the tests!
BUG FIX:
- [blockchain] StopPeerForError on timeout
- [consensus] StopPeerForError on a bad Maj23 message
- [state] flush mempool conn before calling commit
- [types] fix priv val signing things that only differ by timestamp
- [mempool] fix memory leak causing zombie peers
- [p2p/conn] fix potential deadlock
## 0.15.0 (December 29, 2017)
BREAKING CHANGES:
- [p2p] enable the Peer Exchange reactor by default
- [types] add Timestamp field to Proposal/Vote
- [types] add new fields to Header: TotalTxs, ConsensusParamsHash, LastResultsHash, EvidenceHash
- [types] add Evidence to Block
- [types] simplify ValidateBasic
- [state] updates to support changes to the header
- [state] Enforce <1/3 of validator set can change at a time
FEATURES:
- [state] Send indices of absent validators and addresses of byzantine validators in BeginBlock
- [state] Historical ConsensusParams and ABCIResponses
- [docs] Specification for the base Tendermint data structures.
- [evidence] New evidence reactor for gossiping and managing evidence
- [rpc] `/block_results?height=X` returns the DeliverTx results for a given height.
IMPROVEMENTS:
- [consensus] Better handling of corrupt WAL file
BUG FIXES:
- [lite] fix race
- [state] validate block.Header.ValidatorsHash
- [p2p] allow seed addresses to be prefixed with eg. `tcp://`
- [p2p] use consistent key to refer to peers so we dont try to connect to existing peers
- [cmd] fix `tendermint init` to ignore files that are there and generate files that aren't.
## 0.14.0 (December 11, 2017)
BREAKING CHANGES:
- consensus/wal: removed separator
- rpc/client: changed Subscribe/Unsubscribe/UnsubscribeAll funcs signatures to be identical to event bus.
FEATURES:
- new `tendermint lite` command (and `lite/proxy` pkg) for running a light-client RPC proxy.
NOTE it is currently insecure and its APIs are not yet covered by semver
IMPROVEMENTS:
- rpc/client: can act as event bus subscriber (See https://github.com/tendermint/tendermint/issues/945).
- p2p: use exponential backoff from seconds to hours when attempting to reconnect to persistent peer
- config: moniker defaults to the machine's hostname instead of "anonymous"
BUG FIXES:
- p2p: no longer exit if one of the seed addresses is incorrect
## 0.13.0 (December 6, 2017)

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`
@@ -34,27 +34,44 @@ Please don't make Pull Requests to `master`.
## Dependencies
We use [glide](https://github.com/masterminds/glide) to manage dependencies.
That said, the master branch of every Tendermint repository should just build with `go get`, which means they should be kept up-to-date with their dependencies so we can get away with telling people they can just `go get` our software.
Since some dependencies are not under our control, a third party may break our build, in which case we can fall back on `glide install`. Even for dependencies under our control, glide helps us keeps multiple repos in sync as they evolve. Anything with an executable, such as apps, tools, and the core, should use glide.
We use [dep](https://github.com/golang/dep) to manage dependencies.
Run `bash scripts/glide/status.sh` to get a list of vendored dependencies that may not be up-to-date.
That said, the master branch of every Tendermint repository should just build
with `go get`, which means they should be kept up-to-date with their
dependencies so we can get away with telling people they can just `go get` our
software.
Since some dependencies are not under our control, a third party may break our
build, in which case we can fall back on `dep ensure` (or `make
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 vendor dependencies that may not be
up-to-date.
## Vagrant
If you are a [Vagrant](https://www.vagrantup.com/) user, all you have to do to get started hacking Tendermint is:
If you are a [Vagrant](https://www.vagrantup.com/) user, you can get started
hacking Tendermint with the commands below.
NOTE: In case you installed Vagrant in 2017, you might need to run
`vagrant box update` to upgrade to the latest `ubuntu/xenial64`.
```
vagrant up
vagrant ssh
cd ~/go/src/github.com/tendermint/tendermint
make test
```
## Testing
All repos should be hooked up to circle.
If they have `.go` files in the root directory, they will be automatically tested by circle using `go test -v -race ./...`. If not, they will need a `circle.yml`. Ideally, every repo has a `Makefile` that defines `make test` and includes its continuous integration status using a badge in the `README.md`.
All repos should be hooked up to [CircleCI](https://circleci.com/).
If they have `.go` files in the root directory, they will be automatically
tested by circle using `go test -v -race ./...`. If not, they will need a
`circle.yml`. Ideally, every repo has a `Makefile` that defines `make test` and
includes its continuous integration status using a badge in the `README.md`.
## Branching Model and Release
@@ -68,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:
@@ -93,8 +110,8 @@ 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
- delete the hotfix-vX.X.X branch
- delete the hotfix-vX.X.X branch

1
DOCKER/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
tendermint

View File

@@ -1,45 +1,39 @@
FROM alpine:3.6
FROM alpine:3.7
MAINTAINER Greg Szabo <greg@tendermint.com>
# This is the release of tendermint to pull in.
ENV TM_VERSION 0.12.0
ENV TM_SHA256SUM be17469e92f04fc2a3663f891da28edbaa6c37c4d2f746736571887f4790555a
# Tendermint will be looking for genesis file in /tendermint (unless you change
# `genesis_file` in config.toml). You can put your config.toml and private
# validator file into /tendermint.
# Tendermint will be looking for the genesis file in /tendermint/config/genesis.json
# (unless you change `genesis_file` in config.toml). You can put your config.toml and
# private validator file into /tendermint/config.
#
# The /tendermint/data dir is used by tendermint to store state.
ENV DATA_ROOT /tendermint
ENV TMHOME $DATA_ROOT
# Set user right away for determinism
RUN addgroup tmuser && \
adduser -S -G tmuser tmuser
# Create directory for persistence and give our user ownership
RUN mkdir -p $DATA_ROOT && \
chown -R tmuser:tmuser $DATA_ROOT
ENV TMHOME /tendermint
# OS environment setup
# Set user right away for determinism, create directory for persistence and give our user ownership
# jq and curl used for extracting `pub_key` from private validator while
# deploying tendermint with Kubernetes. It is nice to have bash so the users
# could execute bash commands.
RUN apk add --no-cache bash curl jq
RUN apk update && \
apk upgrade && \
apk --no-cache add curl jq bash && \
addgroup tmuser && \
adduser -S -G tmuser tmuser -h "$TMHOME"
RUN apk add --no-cache openssl && \
wget https://s3-us-west-2.amazonaws.com/tendermint/binaries/tendermint/v${TM_VERSION}/tendermint_${TM_VERSION}_linux_amd64.zip && \
echo "${TM_SHA256SUM} tendermint_${TM_VERSION}_linux_amd64.zip" | sha256sum -c && \
unzip -d /bin tendermint_${TM_VERSION}_linux_amd64.zip && \
apk del openssl && \
rm -f tendermint_${TM_VERSION}_linux_amd64.zip
# Run the container with tmuser by default. (UID=100, GID=1000)
USER tmuser
# Expose the data directory as a volume since there's mutable state in there
VOLUME $DATA_ROOT
VOLUME [ $TMHOME ]
# p2p port
EXPOSE 46656
# rpc port
EXPOSE 46657
WORKDIR $TMHOME
ENTRYPOINT ["tendermint"]
# p2p and rpc port
EXPOSE 26656 26657
ENTRYPOINT ["/usr/bin/tendermint"]
CMD ["node", "--moniker=`hostname`"]
STOPSIGNAL SIGTERM
ARG BINARY=tendermint
COPY $BINARY /usr/bin/tendermint

23
DOCKER/Dockerfile.abci Normal file
View File

@@ -0,0 +1,23 @@
FROM golang:latest
RUN mkdir -p /go/src/github.com/tendermint/abci
WORKDIR /go/src/github.com/tendermint/abci
COPY Makefile /go/src/github.com/tendermint/abci/
# see make protoc for details on ldconfig
RUN make get_protoc && ldconfig
# killall is used in tests
RUN apt-get update && apt-get install -y \
psmisc \
&& rm -rf /var/lib/apt/lists/*
COPY Gopkg.toml /go/src/github.com/tendermint/abci/
COPY Gopkg.lock /go/src/github.com/tendermint/abci/
RUN make get_tools
# see https://github.com/golang/dep/issues/1312
RUN dep ensure -vendor-only
COPY . /go/src/github.com/tendermint/abci

View File

@@ -1,4 +1,4 @@
FROM alpine:3.6
FROM alpine:3.7
ENV DATA_ROOT /tendermint
ENV TMHOME $DATA_ROOT
@@ -18,18 +18,18 @@ RUN mkdir -p /go/src/github.com/tendermint/tendermint && \
cd /go/src/github.com/tendermint/tendermint && \
git clone https://github.com/tendermint/tendermint . && \
git checkout develop && \
make get_tools && \
make get_vendor_deps && \
make install && \
glide cc && \
cd - && \
rm -rf /go/src/github.com/tendermint/tendermint && \
apk del go build-base git
VOLUME $DATA_ROOT
EXPOSE 46656
EXPOSE 46657
EXPOSE 26656
EXPOSE 26657
ENTRYPOINT ["tendermint"]
CMD ["node", "--moniker=`hostname`", "--proxy_app=dummy"]
CMD ["node", "--moniker=`hostname`", "--proxy_app=kvstore"]

18
DOCKER/Dockerfile.testing Normal file
View File

@@ -0,0 +1,18 @@
FROM golang:1.10.1
# Grab deps (jq, hexdump, xxd, killall)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
jq bsdmainutils vim-common psmisc netcat
# Add testing deps for curl
RUN echo 'deb http://httpredir.debian.org/debian testing main non-free contrib' >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y --no-install-recommends curl
VOLUME /go
EXPOSE 26656
EXPOSE 26657

View File

@@ -7,6 +7,9 @@ push:
build_develop:
docker build -t "tendermint/tendermint:develop" -f Dockerfile.develop .
build_testing:
docker build --tag tendermint/testing -f ./Dockerfile.testing .
push_develop:
docker push "tendermint/tendermint:develop"

View File

@@ -1,6 +1,12 @@
# Supported tags and respective `Dockerfile` links
# Docker
- `0.12.0`, `latest` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/70d8afa6e952e24c573ece345560a5971bf2cc0e/DOCKER/Dockerfile)
## Supported tags and respective `Dockerfile` links
- `0.17.1`, `latest` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/208ac32fa266657bd6c304e84ec828aa252bb0b8/DOCKER/Dockerfile)
- `0.15.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/170777300ea92dc21a8aec1abc16cb51812513a4/DOCKER/Dockerfile)
- `0.13.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/a28b3fff49dce2fb31f90abb2fc693834e0029c2/DOCKER/Dockerfile)
- `0.12.1` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/457c688346b565e90735431619ca3ca597ef9007/DOCKER/Dockerfile)
- `0.12.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/70d8afa6e952e24c573ece345560a5971bf2cc0e/DOCKER/Dockerfile)
- `0.11.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/9177cc1f64ca88a4a0243c5d1773d10fba67e201/DOCKER/Dockerfile)
- `0.10.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/e5342f4054ab784b2cd6150e14f01053d7c8deb2/DOCKER/Dockerfile)
- `0.9.1`, `0.9`, [(Dockerfile)](https://github.com/tendermint/tendermint/blob/809e0e8c5933604ba8b2d096803ada7c5ec4dfd3/DOCKER/Dockerfile)
@@ -10,10 +16,10 @@
`develop` tag points to the [develop](https://github.com/tendermint/tendermint/tree/develop) branch.
# Quick reference
## Quick reference
* **Where to get help:**
https://tendermint.com/community
https://cosmos.network/community
* **Where to file issues:**
https://github.com/tendermint/tendermint/issues
@@ -21,7 +27,7 @@
* **Supported Docker versions:**
[the latest release](https://github.com/moby/moby/releases) (down to 1.6 on a best-effort basis)
# Tendermint
## Tendermint
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.
@@ -29,29 +35,33 @@ For more background, see the [introduction](https://tendermint.readthedocs.io/en
To get started developing applications, see the [application developers guide](https://tendermint.readthedocs.io/en/master/getting-started.html).
# How to use this image
## How to use this image
## Start one instance of the Tendermint core with the `dummy` app
### Start one instance of the Tendermint core with the `kvstore` app
A very simple example of a built-in app and Tendermint core in one container.
A quick example of a built-in app and Tendermint core in one container.
```
docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init
docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app=dummy
docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app=kvstore
```
## mintnet-kubernetes
## Local cluster
If you want to see many containers talking to each other, consider using [mintnet-kubernetes](https://github.com/tendermint/tools/tree/master/mintnet-kubernetes), which is a tool for running Tendermint-based applications on a Kubernetes cluster.
To run a 4-node network, see the `Makefile` in the root of [the repo](https://github.com/tendermint/tendermint/master/Makefile) and run:
# License
```
make build-linux
make build-docker-localnode
make localnet-start
```
View [license information](https://raw.githubusercontent.com/tendermint/tendermint/master/LICENSE) for the software contained in this image.
Note that this will build and use a different image than the ones provided here.
# User Feedback
## License
- Tendermint's license is [Apache 2.0](https://github.com/tendermint/tendermint/master/LICENSE).
## Contributing
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
Before you start to code, we recommend discussing your plans through a [GitHub](https://github.com/tendermint/tendermint/issues) issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.
Contributions are most welcome! See the [contributing file](https://github.com/tendermint/tendermint/blob/master/CONTRIBUTING.md) for more information.

419
Gopkg.lock generated Normal file
View File

@@ -0,0 +1,419 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/beorn7/perks"
packages = ["quantile"]
revision = "3a771d992973f24aa725d07868b467d1ddfceafb"
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcd"
packages = ["btcec"]
revision = "86fed781132ac890ee03e906e4ecd5d6fa180c64"
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcutil"
packages = [
"base58",
"bech32"
]
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
[[projects]]
name = "github.com/davecgh/go-spew"
packages = ["spew"]
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
branch = "master"
name = "github.com/ebuchman/fail-test"
packages = ["."]
revision = "95f809107225be108efcf10a3509e4ea6ceef3c4"
[[projects]]
branch = "master"
name = "github.com/fortytw2/leaktest"
packages = ["."]
revision = "b008db64ef8daabb22ff6daa557f33b41d8f6ccd"
[[projects]]
name = "github.com/fsnotify/fsnotify"
packages = ["."]
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
name = "github.com/go-kit/kit"
packages = [
"log",
"log/level",
"log/term",
"metrics",
"metrics/discard",
"metrics/internal/lv",
"metrics/prometheus"
]
revision = "4dc7be5d2d12881735283bcab7352178e190fc71"
version = "v0.6.0"
[[projects]]
name = "github.com/go-logfmt/logfmt"
packages = ["."]
revision = "390ab7935ee28ec6b286364bba9b4dd6410cb3d5"
version = "v0.3.0"
[[projects]]
name = "github.com/go-stack/stack"
packages = ["."]
revision = "259ab82a6cad3992b4e21ff5cac294ccb06474bc"
version = "v1.7.0"
[[projects]]
name = "github.com/gogo/protobuf"
packages = [
"gogoproto",
"jsonpb",
"proto",
"protoc-gen-gogo/descriptor",
"sortkeys",
"types"
]
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
version = "v1.0.0"
[[projects]]
name = "github.com/golang/protobuf"
packages = [
"proto",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/timestamp"
]
revision = "925541529c1fa6821df4e44ce2723319eb2be768"
version = "v1.0.0"
[[projects]]
branch = "master"
name = "github.com/golang/snappy"
packages = ["."]
revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a"
[[projects]]
name = "github.com/gorilla/websocket"
packages = ["."]
revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
version = "v1.2.0"
[[projects]]
branch = "master"
name = "github.com/hashicorp/hcl"
packages = [
".",
"hcl/ast",
"hcl/parser",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
"json/parser",
"json/scanner",
"json/token"
]
revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168"
[[projects]]
name = "github.com/inconshreveable/mousetrap"
packages = ["."]
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
version = "v1.0"
[[projects]]
branch = "master"
name = "github.com/jmhodges/levigo"
packages = ["."]
revision = "c42d9e0ca023e2198120196f842701bb4c55d7b9"
[[projects]]
branch = "master"
name = "github.com/kr/logfmt"
packages = ["."]
revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0"
[[projects]]
name = "github.com/magiconair/properties"
packages = ["."]
revision = "c2353362d570a7bfa228149c62842019201cfb71"
version = "v1.8.0"
[[projects]]
name = "github.com/matttproud/golang_protobuf_extensions"
packages = ["pbutil"]
revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
version = "v1.0.1"
[[projects]]
branch = "master"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
revision = "bb74f1db0675b241733089d5a1faa5dd8b0ef57b"
[[projects]]
name = "github.com/pelletier/go-toml"
packages = ["."]
revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194"
version = "v1.2.0"
[[projects]]
name = "github.com/pkg/errors"
packages = ["."]
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
version = "v0.8.0"
[[projects]]
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
branch = "master"
name = "github.com/prometheus/client_golang"
packages = [
"prometheus",
"prometheus/promhttp"
]
revision = "d6a9817c4afc94d51115e4a30d449056a3fbf547"
[[projects]]
branch = "master"
name = "github.com/prometheus/client_model"
packages = ["go"]
revision = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c"
[[projects]]
branch = "master"
name = "github.com/prometheus/common"
packages = [
"expfmt",
"internal/bitbucket.org/ww/goautoneg",
"model"
]
revision = "7600349dcfe1abd18d72d3a1770870d9800a7801"
[[projects]]
branch = "master"
name = "github.com/prometheus/procfs"
packages = [
".",
"internal/util",
"nfs",
"xfs"
]
revision = "40f013a808ec4fa79def444a1a56de4d1727efcb"
[[projects]]
branch = "master"
name = "github.com/rcrowley/go-metrics"
packages = ["."]
revision = "e2704e165165ec55d062f5919b4b29494e9fa790"
[[projects]]
name = "github.com/spf13/afero"
packages = [
".",
"mem"
]
revision = "787d034dfe70e44075ccc060d346146ef53270ad"
version = "v1.1.1"
[[projects]]
name = "github.com/spf13/cast"
packages = ["."]
revision = "8965335b8c7107321228e3e3702cab9832751bac"
version = "v1.2.0"
[[projects]]
name = "github.com/spf13/cobra"
packages = ["."]
revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b"
version = "v0.0.1"
[[projects]]
branch = "master"
name = "github.com/spf13/jwalterweatherman"
packages = ["."]
revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394"
[[projects]]
name = "github.com/spf13/pflag"
packages = ["."]
revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
version = "v1.0.1"
[[projects]]
name = "github.com/spf13/viper"
packages = ["."]
revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7"
version = "v1.0.0"
[[projects]]
name = "github.com/stretchr/testify"
packages = [
"assert",
"require"
]
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
[[projects]]
branch = "master"
name = "github.com/syndtr/goleveldb"
packages = [
"leveldb",
"leveldb/cache",
"leveldb/comparer",
"leveldb/errors",
"leveldb/filter",
"leveldb/iterator",
"leveldb/journal",
"leveldb/memdb",
"leveldb/opt",
"leveldb/storage",
"leveldb/table",
"leveldb/util"
]
revision = "e2150783cd35f5b607daca48afd8c57ec54cc995"
[[projects]]
branch = "master"
name = "github.com/tendermint/ed25519"
packages = [
".",
"edwards25519",
"extra25519"
]
revision = "d8387025d2b9d158cf4efb07e7ebf814bcce2057"
[[projects]]
name = "github.com/tendermint/go-amino"
packages = ["."]
revision = "2106ca61d91029c931fd54968c2bb02dc96b1412"
version = "0.10.1"
[[projects]]
branch = "master"
name = "golang.org/x/crypto"
packages = [
"bcrypt",
"blowfish",
"chacha20poly1305",
"curve25519",
"hkdf",
"internal/chacha20",
"internal/subtle",
"nacl/box",
"nacl/secretbox",
"openpgp/armor",
"openpgp/errors",
"poly1305",
"ripemd160",
"salsa20/salsa"
]
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = [
"context",
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"internal/timeseries",
"netutil",
"trace"
]
revision = "4cb1c02c05b0e749b0365f61ae859a8e0cfceed9"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = [
"cpu",
"unix"
]
revision = "7138fd3d9dc8335c567ca206f4333fb75eb05d56"
[[projects]]
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable"
]
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"]
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
[[projects]]
name = "google.golang.org/grpc"
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"codes",
"connectivity",
"credentials",
"encoding",
"encoding/proto",
"grpclb/grpc_lb_v1/messages",
"grpclog",
"internal",
"keepalive",
"metadata",
"naming",
"peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap",
"transport"
]
revision = "d11072e7ca9811b1100b80ca0269ac831f06d024"
version = "v1.11.3"
[[projects]]
name = "gopkg.in/yaml.v2"
packages = ["."]
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
version = "v2.2.1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "6e854634d6c203278ce83bef7725cecbcf90023b0d0e440fb3374acedacbd5ad"
solver-name = "gps-cdcl"
solver-version = 1

95
Gopkg.toml Normal file
View File

@@ -0,0 +1,95 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
name = "github.com/ebuchman/fail-test"
branch = "master"
[[constraint]]
name = "github.com/fortytw2/leaktest"
branch = "master"
[[constraint]]
name = "github.com/go-kit/kit"
version = "=0.6.0"
[[constraint]]
name = "github.com/gogo/protobuf"
version = "=1.0.0"
[[constraint]]
name = "github.com/golang/protobuf"
version = "=1.0.0"
[[constraint]]
name = "github.com/gorilla/websocket"
version = "~1.2.0"
[[constraint]]
name = "github.com/pkg/errors"
version = "=0.8.0"
[[constraint]]
name = "github.com/rcrowley/go-metrics"
branch = "master"
[[constraint]]
name = "github.com/spf13/cobra"
version = "=0.0.1"
[[constraint]]
name = "github.com/spf13/viper"
version = "=1.0.0"
[[constraint]]
name = "github.com/stretchr/testify"
version = "~1.2.1"
[[constraint]]
name = "github.com/tendermint/go-amino"
version = "~0.10.1"
[[constraint]]
name = "google.golang.org/grpc"
version = "~1.11.3"
# this got updated and broke, so locked to an old working commit ...
[[override]]
name = "google.golang.org/genproto"
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
[prune]
go-tests = true
unused-packages = true
[[constraint]]
name = "github.com/prometheus/client_golang"
branch = "master"
[[constraint]]
branch = "master"
name = "golang.org/x/net"

314
Makefile
View File

@@ -1,41 +1,197 @@
GOTOOLS = \
github.com/mitchellh/gox \
github.com/tcnksm/ghr \
github.com/alecthomas/gometalinter
github.com/mitchellh/gox \
github.com/golang/dep/cmd/dep \
gopkg.in/alecthomas/gometalinter.v2 \
github.com/gogo/protobuf/protoc-gen-gogo \
github.com/gogo/protobuf/gogoproto \
github.com/square/certstrap
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
BUILD_TAGS?=tendermint
TMHOME = $${TMHOME:-$$HOME/.tendermint}
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD`"
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short HEAD`"
all: check build test install
all: get_vendor_deps install test
check: check_tools ensure_deps
install:
CGO_ENABLED=0 go install $(BUILD_FLAGS) ./cmd/tendermint
########################################
### Build Tendermint
build:
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/
CGO_ENABLED=0 go build $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o build/tendermint ./cmd/tendermint/
build_race:
CGO_ENABLED=0 go build -race $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint
CGO_ENABLED=0 go build -race $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o build/tendermint ./cmd/tendermint
install:
CGO_ENABLED=0 go install $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' ./cmd/tendermint
########################################
### Build ABCI
protoc_abci:
## If you get the following error,
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## See https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --gogo_out=plugins=grpc:. abci/types/*.proto
@echo "--> adding nolint declarations to protobuf generated files"
@awk '/package abci/types/ { print "//nolint: gas"; print; next }1' abci/types/types.pb.go > abci/types/types.pb.go.new
@mv abci/types/types.pb.go.new abci/types/types.pb.go
build_abci:
@go build -i ./abci/cmd/...
install_abci:
@go install ./abci/cmd/...
########################################
### Distribution
# dist builds binaries for all platforms and packages them for distribution
# TODO add abci to these scripts
dist:
@BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'"
test:
@echo "--> Running linter"
@make metalinter_test
@echo "--> Running go test"
@go test $(PACKAGES)
########################################
### Tools & dependencies
test_race:
@echo "--> Running go test --race"
@go test -v -race $(PACKAGES)
check_tools:
@# https://stackoverflow.com/a/25668869
@echo "Found tools: $(foreach tool,$(notdir $(GOTOOLS)),\
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
get_tools:
@echo "--> Installing tools"
go get -u -v $(GOTOOLS)
@gometalinter.v2 --install
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
#Run this from CI
get_vendor_deps:
@rm -rf vendor/
@echo "--> Running dep"
@dep ensure -vendor-only
#Run this locally.
ensure_deps:
@rm -rf vendor/
@echo "--> Running dep"
@dep ensure
#For ABCI and libs
get_protoc:
@# https://github.com/google/protobuf/releases
curl -L https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz | tar xvz && \
cd protobuf-3.4.1 && \
DIST_LANG=cpp ./configure && \
make && \
make install && \
cd .. && \
rm -rf protobuf-3.4.1
draw_deps:
@# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
get_deps_bin_size:
@# Copy of build recipe with additional flags to perform binary size analysis
$(eval $(shell go build -work -a $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o build/tendermint ./cmd/tendermint/ 2>&1))
@find $(WORK) -type f -name "*.a" | xargs -I{} du -hxs "{}" | sort -rh | sed -e s:${WORK}/::g > deps_bin_size.log
@echo "Results can be found here: $(CURDIR)/deps_bin_size.log"
########################################
### Libs
protoc_libs:
## If you get the following error,
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## See https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --go_out=plugins=grpc:. libs/common/*.proto
@echo "--> adding nolint declarations to protobuf generated files"
@awk '/package libs/common/ { print "//nolint: gas"; print; next }1' libs/common/types.pb.go > libs/common/types.pb.go.new
@mv libs/common/types.pb.go.new libs/common/types.pb.go
gen_certs: clean_certs
## Generating certificates for TLS testing...
certstrap init --common-name "tendermint.com" --passphrase ""
certstrap request-cert -ip "::" --passphrase ""
certstrap sign "::" --CA "tendermint.com" --passphrase ""
mv out/::.crt out/::.key db/remotedb
clean_certs:
## Cleaning TLS testing certificates...
rm -rf out
rm -f db/remotedb/::.crt db/remotedb/::.key
test_libs: gen_certs
GOCACHE=off go test -tags gcc $(shell go list ./... | grep -v vendor)
make clean_certs
grpc_dbserver:
protoc -I db/remotedb/proto/ db/remotedb/proto/defs.proto --go_out=plugins=grpc:db/remotedb/proto
########################################
### Testing
## required to be run first by most tests
build_docker_test_image:
docker build -t tester -f ./test/docker/Dockerfile .
### coverage, app, persistence, and libs tests
test_cover:
# run the go unit tests with coverage
bash test/test_cover.sh
test_apps:
# run the app tests using bash
# requires `abci-cli` and `tendermint` binaries installed
bash test/app/test.sh
test_abci_apps:
bash abci/tests/test_app/test.sh
test_abci_cli:
# test the cli against the examples in the tutorial at:
# ./docs/abci-cli.md
# if test fails, update the docs ^
@ bash abci/tests/test_cli/test.sh
test_persistence:
# run the persistence tests using bash
# requires `abci-cli` installed
docker run --name run_persistence -t tester bash test/persist/test_failure_indices.sh
# TODO undockerize
# bash test/persist/test_failure_indices.sh
test_p2p:
docker rm -f rsyslog || true
rm -rf test/logs || true
mkdir test/logs
cd test/
docker run -d -v "logs:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog
cd ..
# requires 'tester' the image from above
bash test/p2p/test.sh tester
test_integrations:
@bash ./test/test.sh
make build_docker_test_image
make get_tools
make get_vendor_deps
make install
make test_cover
make test_apps
make test_abci_apps
make test_abci_cli
make test_libs
make test_persistence
make test_p2p
test_release:
@go test -tags release $(PACKAGES)
@@ -43,55 +199,35 @@ test_release:
test100:
@for i in {1..100}; do make test; done
draw_deps:
# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
vagrant_test:
vagrant up
vagrant ssh -c 'make test_integrations'
list_deps:
@go list -f '{{join .Deps "\n"}}' ./... | \
grep -v /vendor/ | sort | uniq | \
xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
### go tests
test:
@echo "--> Running go test"
@go test $(PACKAGES)
get_deps:
@echo "--> Running go get"
@go get -v -d $(PACKAGES)
@go list -f '{{join .TestImports "\n"}}' ./... | \
grep -v /vendor/ | sort | uniq | \
xargs go get -v -d
test_race:
@echo "--> Running go test --race"
@go test -v -race $(PACKAGES)
update_deps:
@echo "--> Updating dependencies"
@go get -d -u ./...
get_vendor_deps:
@hash glide 2>/dev/null || go get github.com/Masterminds/glide
@rm -rf vendor/
@echo "--> Running glide install"
@glide install
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
tools:
@echo "--> Installing tools"
@go get $(GOTOOLS)
@gometalinter --install
########################################
### Formatting, linting, and vetting
metalinter:
@gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
fmt:
@go fmt ./...
metalinter_test:
@gometalinter --vendor --deadline=600s --disable-all \
metalinter:
@echo "--> Running linter"
@gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=deadcode \
--enable=gosimple \
--enable=misspell \
--enable=safesql \
./...
# --enable=gas \
#--enable=gas \
#--enable=maligned \
#--enable=dupl \
#--enable=errcheck \
@@ -99,7 +235,6 @@ metalinter_test:
#--enable=gocyclo \
#--enable=goimports \
#--enable=golint \ <== comments on anything exported
#--enable=gosimple \
#--enable=gotype \
#--enable=ineffassign \
#--enable=interfacer \
@@ -113,4 +248,63 @@ metalinter_test:
#--enable=vet \
#--enable=vetshadow \
.PHONY: install build build_race dist test test_race test_integrations test100 draw_deps list_deps get_deps get_vendor_deps update_deps update_tools tools test_release
metalinter_all:
@echo "--> Running linter (all)"
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
###########################################################
### Docker image
build-docker:
cp build/tendermint DOCKER/tendermint
docker build --label=tendermint --tag="tendermint/tendermint" DOCKER
rm -rf DOCKER/tendermint
###########################################################
### Local testnet using docker
# Build linux binary on other platforms
build-linux:
GOOS=linux GOARCH=amd64 $(MAKE) build
build-docker-localnode:
cd networks/local
make
# Run a 4-node testnet locally
localnet-start: localnet-stop
@if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2 ; fi
docker-compose up
# Stop testnet
localnet-stop:
docker-compose down
###########################################################
### Remote full-nodes (sentry) using terraform and ansible
# Server management
sentry-start:
@if [ -z "$(DO_API_TOKEN)" ]; then echo "DO_API_TOKEN environment variable not set." ; false ; fi
@if ! [ -f $(HOME)/.ssh/id_rsa.pub ]; then ssh-keygen ; fi
cd networks/remote/terraform && terraform init && terraform apply -var DO_API_TOKEN="$(DO_API_TOKEN)" -var SSH_KEY_FILE="$(HOME)/.ssh/id_rsa.pub"
@if ! [ -f $(CURDIR)/build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --v 0 --n 4 --o . ; fi
cd networks/remote/ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory/digital_ocean.py -l sentrynet install.yml
@echo "Next step: Add your validator setup in the genesis.json and config.tml files and run \"make sentry-config\". (Public key of validator, chain ID, peer IP and node ID.)"
# Configuration management
sentry-config:
cd networks/remote/ansible && ansible-playbook -i inventory/digital_ocean.py -l sentrynet config.yml -e BINARY=$(CURDIR)/build/tendermint -e CONFIGDIR=$(CURDIR)/build
sentry-stop:
@if [ -z "$(DO_API_TOKEN)" ]; then echo "DO_API_TOKEN environment variable not set." ; false ; fi
cd networks/remote/terraform && terraform destroy -var DO_API_TOKEN="$(DO_API_TOKEN)" -var SSH_KEY_FILE="$(HOME)/.ssh/id_rsa.pub"
# meant for the CI, inspect script & adapt accordingly
build-slate:
bash scripts/slate.sh
# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: check build build_race build_abci dist install install_abci check_tools get_tools update_tools get_vendor_deps draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop build-slate

View File

@@ -9,7 +9,7 @@ Or [Blockchain](https://en.wikipedia.org/wiki/Blockchain_(database)) for short.
https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667
)](https://godoc.org/github.com/tendermint/tendermint)
[![Go version](https://img.shields.io/badge/go-1.9.2-blue.svg)](https://github.com/moovweb/gvm)
[![Rocket.Chat](https://demo.rocket.chat/images/join-chat.svg)](https://cosmos.rocket.chat/)
[![riot.im](https://img.shields.io/badge/riot.im-JOIN%20CHAT-green.svg)](https://riot.im/app/#/room/#tendermint:matrix.org)
[![license](https://img.shields.io/github/license/tendermint/tendermint.svg)](https://github.com/tendermint/tendermint/blob/master/LICENSE)
[![](https://tokei.rs/b1/github/tendermint/tendermint?category=lines)](https://github.com/tendermint/tendermint)
@@ -19,35 +19,60 @@ Branch | Tests | Coverage
master | [![CircleCI](https://circleci.com/gh/tendermint/tendermint/tree/master.svg?style=shield)](https://circleci.com/gh/tendermint/tendermint/tree/master) | [![codecov](https://codecov.io/gh/tendermint/tendermint/branch/master/graph/badge.svg)](https://codecov.io/gh/tendermint/tendermint)
develop | [![CircleCI](https://circleci.com/gh/tendermint/tendermint/tree/develop.svg?style=shield)](https://circleci.com/gh/tendermint/tendermint/tree/develop) | [![codecov](https://codecov.io/gh/tendermint/tendermint/branch/develop/graph/badge.svg)](https://codecov.io/gh/tendermint/tendermint)
_NOTE: This is alpha software. Please contact us if you intend to run it in production._
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.
For more information, from introduction to install to application development, [Read The Docs](https://tendermint.readthedocs.io/en/master/).
For protocol details, see [the specification](/docs/spec).
## A Note on Production Readiness
While Tendermint is being used in production in private, permissioned
environments, we are still working actively to harden and audit it in preparation
for use in public blockchains, such as the [Cosmos Network](https://cosmos.network/).
We are also still making breaking changes to the protocol and the APIs.
Thus we tag the releases as *alpha software*.
In any case, if you intend to run Tendermint in production,
please [contact us](https://riot.im/app/#/room/#tendermint:matrix.org) :)
## Security
To report a security vulnerability, see our [bug bounty
program](https://tendermint.com/security).
For examples of the kinds of bugs we're looking for, see [SECURITY.md](SECURITY.md)
## Minimum requirements
Requirement|Notes
---|---
Go version | Go1.9 or higher
## Install
To download pre-built binaries, see our [downloads page](https://tendermint.com/downloads).
See the [install instructions](/docs/install.md)
To install from source, you should be able to:
## Quick Start
`go get -u github.com/tendermint/tendermint/cmd/tendermint`
For more details (or if it fails), [read the docs](https://tendermint.readthedocs.io/en/master/install.html).
- [Single node](/docs/using-tendermint.md)
- [Local cluster using docker-compose](/networks/local)
- [Remote cluster using terraform and ansible](/docs/terraform-and-ansible.md)
- [Join the public testnet](https://cosmos.network/testnet)
## Resources
### Tendermint Core
All resources involving the use of, building application on, or developing for, tendermint, can be found at [Read The Docs](https://tendermint.readthedocs.io/en/master/). Additional information about some - and eventually all - of the sub-projects below, can be found at Read The Docs.
For details about the blockchain data structures and the p2p protocols, see the
the [Tendermint specification](/docs/spec).
For details on using the software, [Read The Docs](https://tendermint.readthedocs.io/en/master/).
Additional information about some - and eventually all - of the sub-projects below, can be found at Read The Docs.
### 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/go-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
@@ -55,8 +80,8 @@ All resources involving the use of, building application on, or developing for,
### Applications
* [Ethermint](http://github.com/tendermint/ethermint); Ethereum on Tendermint
* [Cosmos SDK](http://github.com/cosmos/cosmos-sdk); a cryptocurrency application framework
* [Ethermint](http://github.com/tendermint/ethermint); Ethereum on Tendermint
* [Many more](https://tendermint.readthedocs.io/en/master/ecosystem.html#abci-applications)
### More
@@ -79,7 +104,11 @@ According to SemVer, anything in the public API can change at any time before ve
To provide some stability to Tendermint users in these 0.X.X days, the MINOR version is used
to signal breaking changes across a subset of the total public API. This subset includes all
interfaces exposed to other processes (cli, rpc, p2p, etc.), as well as parts of the following packages:
interfaces exposed to other processes (cli, rpc, p2p, etc.), but does not
include the in-process Go APIs.
That said, breaking changes in the following packages will be documented in the
CHANGELOG even if they don't lead to MINOR version bumps:
- types
- rpc/client
@@ -87,8 +116,8 @@ interfaces exposed to other processes (cli, rpc, p2p, etc.), as well as parts of
- 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

23
ROADMAP.md Normal file
View File

@@ -0,0 +1,23 @@
# Roadmap
BREAKING CHANGES:
- Better support for injecting randomness
- Upgrade consensus for more real-time use of evidence
FEATURES:
- Use the chain as its own CA for nodes and validators
- Tooling to run multiple blockchains/apps, possibly in a single process
- State syncing (without transaction replay)
- Add authentication and rate-limitting to the RPC
IMPROVEMENTS:
- Improve subtleties around mempool caching and logic
- Consensus optimizations:
- cache block parts for faster agreement after round changes
- propagate block parts rarest first
- Better testing of the consensus state machine (ie. use a DSL)
- Auto compiled serialization/deserialization code instead of go-wire reflection
BUG FIXES:
- Graceful handling/recovery for apps that have non-determinism or fail to halt
- Graceful handling/recovery for violations of safety, or liveness

71
SECURITY.md Normal file
View File

@@ -0,0 +1,71 @@
# Security
As part of our [Coordinated Vulnerability Disclosure
Policy](https://tendermint.com/security), we operate a bug bounty.
See the policy for more details on submissions and rewards.
Here is a list of examples of the kinds of bugs we're most interested in:
## Specification
- Conceptual flaws
- Ambiguities, inconsistencies, or incorrect statements
- Mis-match between specification and implementation of any component
## Consensus
Assuming less than 1/3 of the voting power is Byzantine (malicious):
- Validation of blockchain data structures, including blocks, block parts,
votes, and so on
- Execution of blocks
- Validator set changes
- Proposer round robin
- Two nodes committing conflicting blocks for the same height (safety failure)
- A correct node signing conflicting votes
- A node halting (liveness failure)
- Syncing new and old nodes
## Networking
- Authenticated encryption (MITM, information leakage)
- Eclipse attacks
- Sybil attacks
- Long-range attacks
- Denial-of-Service
## RPC
- Write-access to anything besides sending transactions
- Denial-of-Service
- Leakage of secrets
## Denial-of-Service
Attacks may come through the P2P network or the RPC:
- Amplification attacks
- Resource abuse
- Deadlocks and race conditions
- Panics and unhandled errors
## Libraries
- Serialization (Amino)
- Reading/Writing files and databases
- Logging and monitoring
## Cryptography
- Elliptic curves for validator signatures
- Hash algorithms and Merkle trees for block validation
- Authenticated encryption for P2P connections
## Light Client
- Validation of blockchain data structures
- Correctly validating an incorrect proof
- Incorrectly validating a correct proof
- Syncing validator set changes

45
Vagrantfile vendored
View File

@@ -2,7 +2,7 @@
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |v|
v.memory = 4096
@@ -11,29 +11,48 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y --no-install-recommends wget curl jq shellcheck bsdmainutils psmisc
wget -qO- https://get.docker.com/ | sh
# install base requirements
apt-get install -y --no-install-recommends wget curl jq zip \
make shellcheck bsdmainutils psmisc
apt-get install -y language-pack-en
# install docker
apt-get install -y --no-install-recommends apt-transport-https \
ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get install -y docker-ce
usermod -a -G docker vagrant
# install go
wget -q https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz
tar -xvf go1.10.1.linux-amd64.tar.gz
mv go /usr/local
rm -f go1.10.1.linux-amd64.tar.gz
# cleanup
apt-get autoremove -y
apt-get install -y --no-install-recommends git
curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz
tar -xvf go1.9.linux-amd64.tar.gz
rm -rf /usr/local/go
mv go /usr/local
rm -f go1.9.linux-amd64.tar.gz
mkdir -p /home/vagrant/go/bin
echo 'export PATH=$PATH:/usr/local/go/bin:/home/vagrant/go/bin' >> /home/vagrant/.bash_profile
# set env variables
echo 'export GOROOT=/usr/local/go' >> /home/vagrant/.bash_profile
echo 'export GOPATH=/home/vagrant/go' >> /home/vagrant/.bash_profile
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> /home/vagrant/.bash_profile
echo 'export LC_ALL=en_US.UTF-8' >> /home/vagrant/.bash_profile
echo 'cd go/src/github.com/tendermint/tendermint' >> /home/vagrant/.bash_profile
mkdir -p /home/vagrant/go/bin
mkdir -p /home/vagrant/go/src/github.com/tendermint
ln -s /vagrant /home/vagrant/go/src/github.com/tendermint/tendermint
chown -R vagrant:vagrant /home/vagrant/go
chown vagrant:vagrant /home/vagrant/.bash_profile
su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_vendor_deps'
# get all deps and tools, ready to install/test
su - vagrant -c 'source /home/vagrant/.bash_profile'
su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_tools && make get_vendor_deps'
SHELL
end

168
abci/README.md Normal file
View File

@@ -0,0 +1,168 @@
# Application BlockChain Interface (ABCI)
[![CircleCI](https://circleci.com/gh/tendermint/abci.svg?style=svg)](https://circleci.com/gh/tendermint/abci)
Blockchains are systems for multi-master state machine replication.
**ABCI** is an interface that defines the boundary between the replication engine (the blockchain),
and the state machine (the application).
Using a socket protocol, a consensus engine running in one process
can manage an application state running in another.
Previously, the ABCI was referred to as TMSP.
The community has provided a number of addtional implementations, see the [Tendermint Ecosystem](https://tendermint.com/ecosystem)
## Specification
A detailed description of the ABCI methods and message types is contained in:
- [A prose specification](specification.md)
- [A protobuf file](https://github.com/tendermint/abci/blob/master/types/types.proto)
- [A Go interface](https://github.com/tendermint/abci/blob/master/types/application.go).
For more background information on ABCI, motivations, and tendermint, please visit [the documentation](http://tendermint.readthedocs.io/en/master/).
The two guides to focus on are the `Application Development Guide` and `Using ABCI-CLI`.
## Protocl Buffers
To compile the protobuf file, run:
```
make protoc
```
See `protoc --help` and [the Protocol Buffers site](https://developers.google.com/protocol-buffers)
for details on compiling for other languages. Note we also include a [GRPC](http://www.grpc.io/docs)
service definition.
## Install ABCI-CLI
The `abci-cli` is a simple tool for debugging ABCI servers and running some
example apps. To install it:
```
go get github.com/tendermint/abci
cd $GOPATH/src/github.com/tendermint/abci
make get_vendor_deps
make install
```
## Implementation
We provide three implementations of the ABCI in Go:
- Golang in-process
- ABCI-socket
- GRPC
Note the GRPC version is maintained primarily to simplify onboarding and prototyping and is not receiving the same
attention to security and performance as the others
### In Process
The simplest implementation just uses function calls within Go.
This means ABCI applications written in Golang can be compiled with TendermintCore and run as a single binary.
See the [examples](#examples) below for more information.
### Socket (TSP)
ABCI is best implemented as a streaming protocol.
The socket implementation provides for asynchronous, ordered message passing over unix or tcp.
Messages are serialized using Protobuf3 and length-prefixed with a [signed Varint](https://developers.google.com/protocol-buffers/docs/encoding?csw=1#signed-integers)
For example, if the Protobuf3 encoded ABCI message is `0xDEADBEEF` (4 bytes), the length-prefixed message is `0x08DEADBEEF`, since `0x08` is the signed varint
encoding of `4`. If the Protobuf3 encoded ABCI message is 65535 bytes long, the length-prefixed message would be like `0xFEFF07...`.
Note the benefit of using this `varint` encoding over the old version (where integers were encoded as `<len of len><big endian len>` is that
it is the standard way to encode integers in Protobuf. It is also generally shorter.
### GRPC
GRPC is an rpc framework native to Protocol Buffers with support in many languages.
Implementing the ABCI using GRPC can allow for faster prototyping, but is expected to be much slower than
the ordered, asynchronous socket protocol. The implementation has also not received as much testing or review.
Note the length-prefixing used in the socket implementation does not apply for GRPC.
## Usage
The `abci-cli` tool wraps an ABCI client and can be used for probing/testing an ABCI server.
For instance, `abci-cli test` will run a test sequence against a listening server running the Counter application (see below).
It can also be used to run some example applications.
See [the documentation](http://tendermint.readthedocs.io/en/master/) for more details.
### Examples
Check out the variety of example applications in the [example directory](example/).
It also contains the code refered to by the `counter` and `kvstore` apps; these apps come
built into the `abci-cli` binary.
#### Counter
The `abci-cli counter` application illustrates nonce checking in transactions. It's code looks like:
```golang
func cmdCounter(cmd *cobra.Command, args []string) error {
app := counter.NewCounterApplication(flagSerial)
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Start the listener
srv, err := server.NewServer(flagAddrC, flagAbci, app)
if err != nil {
return err
}
srv.SetLogger(logger.With("module", "abci-server"))
if err := srv.Start(); err != nil {
return err
}
// Wait forever
cmn.TrapSignal(func() {
// Cleanup
srv.Stop()
})
return nil
}
```
and can be found in [this file](cmd/abci-cli/abci-cli.go).
#### kvstore
The `abci-cli kvstore` application, which illustrates a simple key-value Merkle tree
```golang
func cmdKVStore(cmd *cobra.Command, args []string) error {
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Create the application - in memory or persisted to disk
var app types.Application
if flagPersist == "" {
app = kvstore.NewKVStoreApplication()
} else {
app = kvstore.NewPersistentKVStoreApplication(flagPersist)
app.(*kvstore.PersistentKVStoreApplication).SetLogger(logger.With("module", "kvstore"))
}
// Start the listener
srv, err := server.NewServer(flagAddrD, flagAbci, app)
if err != nil {
return err
}
srv.SetLogger(logger.With("module", "abci-server"))
if err := srv.Start(); err != nil {
return err
}
// Wait forever
cmn.TrapSignal(func() {
// Cleanup
srv.Stop()
})
return nil
}
```

129
abci/client/client.go Normal file
View File

@@ -0,0 +1,129 @@
package abcicli
import (
"fmt"
"sync"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
const (
dialRetryIntervalSeconds = 3
echoRetryIntervalSeconds = 1
)
// Client defines an interface for an ABCI client.
// All `Async` methods return a `ReqRes` object.
// All `Sync` methods return the appropriate protobuf ResponseXxx struct and an error.
// Note these are client errors, eg. ABCI socket connectivity issues.
// Application-related errors are reflected in response via ABCI error codes and logs.
type Client interface {
cmn.Service
SetResponseCallback(Callback)
Error() error
FlushAsync() *ReqRes
EchoAsync(msg string) *ReqRes
InfoAsync(types.RequestInfo) *ReqRes
SetOptionAsync(types.RequestSetOption) *ReqRes
DeliverTxAsync(tx []byte) *ReqRes
CheckTxAsync(tx []byte) *ReqRes
QueryAsync(types.RequestQuery) *ReqRes
CommitAsync() *ReqRes
InitChainAsync(types.RequestInitChain) *ReqRes
BeginBlockAsync(types.RequestBeginBlock) *ReqRes
EndBlockAsync(types.RequestEndBlock) *ReqRes
FlushSync() error
EchoSync(msg string) (*types.ResponseEcho, error)
InfoSync(types.RequestInfo) (*types.ResponseInfo, error)
SetOptionSync(types.RequestSetOption) (*types.ResponseSetOption, error)
DeliverTxSync(tx []byte) (*types.ResponseDeliverTx, error)
CheckTxSync(tx []byte) (*types.ResponseCheckTx, error)
QuerySync(types.RequestQuery) (*types.ResponseQuery, error)
CommitSync() (*types.ResponseCommit, error)
InitChainSync(types.RequestInitChain) (*types.ResponseInitChain, error)
BeginBlockSync(types.RequestBeginBlock) (*types.ResponseBeginBlock, error)
EndBlockSync(types.RequestEndBlock) (*types.ResponseEndBlock, error)
}
//----------------------------------------
// NewClient returns a new ABCI client of the specified transport type.
// It returns an error if the transport is not "socket" or "grpc"
func NewClient(addr, transport string, mustConnect bool) (client Client, err error) {
switch transport {
case "socket":
client = NewSocketClient(addr, mustConnect)
case "grpc":
client = NewGRPCClient(addr, mustConnect)
default:
err = fmt.Errorf("Unknown abci transport %s", transport)
}
return
}
//----------------------------------------
type Callback func(*types.Request, *types.Response)
//----------------------------------------
type ReqRes struct {
*types.Request
*sync.WaitGroup
*types.Response // Not set atomically, so be sure to use WaitGroup.
mtx sync.Mutex
done bool // Gets set to true once *after* WaitGroup.Done().
cb func(*types.Response) // A single callback that may be set.
}
func NewReqRes(req *types.Request) *ReqRes {
return &ReqRes{
Request: req,
WaitGroup: waitGroup1(),
Response: nil,
done: false,
cb: nil,
}
}
// Sets the callback for this ReqRes atomically.
// If reqRes is already done, calls cb immediately.
// NOTE: reqRes.cb should not change if reqRes.done.
// NOTE: only one callback is supported.
func (reqRes *ReqRes) SetCallback(cb func(res *types.Response)) {
reqRes.mtx.Lock()
if reqRes.done {
reqRes.mtx.Unlock()
cb(reqRes.Response)
return
}
defer reqRes.mtx.Unlock()
reqRes.cb = cb
}
func (reqRes *ReqRes) GetCallback() func(*types.Response) {
reqRes.mtx.Lock()
defer reqRes.mtx.Unlock()
return reqRes.cb
}
// NOTE: it should be safe to read reqRes.cb without locks after this.
func (reqRes *ReqRes) SetDone() {
reqRes.mtx.Lock()
reqRes.done = true
reqRes.mtx.Unlock()
}
func waitGroup1() (wg *sync.WaitGroup) {
wg = &sync.WaitGroup{}
wg.Add(1)
return
}

301
abci/client/grpc_client.go Normal file
View File

@@ -0,0 +1,301 @@
package abcicli
import (
"fmt"
"net"
"sync"
"time"
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
var _ Client = (*grpcClient)(nil)
// A stripped copy of the remoteClient that makes
// synchronous calls using grpc
type grpcClient struct {
cmn.BaseService
mustConnect bool
client types.ABCIApplicationClient
mtx sync.Mutex
addr string
err error
resCb func(*types.Request, *types.Response) // listens to all callbacks
}
func NewGRPCClient(addr string, mustConnect bool) *grpcClient {
cli := &grpcClient{
addr: addr,
mustConnect: mustConnect,
}
cli.BaseService = *cmn.NewBaseService(nil, "grpcClient", cli)
return cli
}
func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
return cmn.Connect(addr)
}
func (cli *grpcClient) OnStart() error {
if err := cli.BaseService.OnStart(); err != nil {
return err
}
RETRY_LOOP:
for {
conn, err := grpc.Dial(cli.addr, grpc.WithInsecure(), grpc.WithDialer(dialerFunc))
if err != nil {
if cli.mustConnect {
return err
}
cli.Logger.Error(fmt.Sprintf("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
time.Sleep(time.Second * dialRetryIntervalSeconds)
continue RETRY_LOOP
}
cli.Logger.Info("Dialed server. Waiting for echo.", "addr", cli.addr)
client := types.NewABCIApplicationClient(conn)
ENSURE_CONNECTED:
for {
_, err := client.Echo(context.Background(), &types.RequestEcho{"hello"}, grpc.FailFast(true))
if err == nil {
break ENSURE_CONNECTED
}
cli.Logger.Error("Echo failed", "err", err)
time.Sleep(time.Second * echoRetryIntervalSeconds)
}
cli.client = client
return nil
}
}
func (cli *grpcClient) OnStop() {
cli.BaseService.OnStop()
cli.mtx.Lock()
defer cli.mtx.Unlock()
// TODO: how to close conn? its not a net.Conn and grpc doesn't expose a Close()
/*if cli.client.conn != nil {
cli.client.conn.Close()
}*/
}
func (cli *grpcClient) StopForError(err error) {
cli.mtx.Lock()
if !cli.IsRunning() {
return
}
if cli.err == nil {
cli.err = err
}
cli.mtx.Unlock()
cli.Logger.Error(fmt.Sprintf("Stopping abci.grpcClient for error: %v", err.Error()))
cli.Stop()
}
func (cli *grpcClient) Error() error {
cli.mtx.Lock()
defer cli.mtx.Unlock()
return cli.err
}
// Set listener for all responses
// NOTE: callback may get internally generated flush responses.
func (cli *grpcClient) SetResponseCallback(resCb Callback) {
cli.mtx.Lock()
defer cli.mtx.Unlock()
cli.resCb = resCb
}
//----------------------------------------
// GRPC calls are synchronous, but some callbacks expect to be called asynchronously
// (eg. the mempool expects to be able to lock to remove bad txs from cache).
// To accommodate, we finish each call in its own go-routine,
// which is expensive, but easy - if you want something better, use the socket protocol!
// maybe one day, if people really want it, we use grpc streams,
// but hopefully not :D
func (cli *grpcClient) EchoAsync(msg string) *ReqRes {
req := types.ToRequestEcho(msg)
res, err := cli.client.Echo(context.Background(), req.GetEcho(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_Echo{res}})
}
func (cli *grpcClient) FlushAsync() *ReqRes {
req := types.ToRequestFlush()
res, err := cli.client.Flush(context.Background(), req.GetFlush(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_Flush{res}})
}
func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes {
req := types.ToRequestInfo(params)
res, err := cli.client.Info(context.Background(), req.GetInfo(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_Info{res}})
}
func (cli *grpcClient) SetOptionAsync(params types.RequestSetOption) *ReqRes {
req := types.ToRequestSetOption(params)
res, err := cli.client.SetOption(context.Background(), req.GetSetOption(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_SetOption{res}})
}
func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes {
req := types.ToRequestDeliverTx(tx)
res, err := cli.client.DeliverTx(context.Background(), req.GetDeliverTx(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_DeliverTx{res}})
}
func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
req := types.ToRequestCheckTx(tx)
res, err := cli.client.CheckTx(context.Background(), req.GetCheckTx(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_CheckTx{res}})
}
func (cli *grpcClient) QueryAsync(params types.RequestQuery) *ReqRes {
req := types.ToRequestQuery(params)
res, err := cli.client.Query(context.Background(), req.GetQuery(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_Query{res}})
}
func (cli *grpcClient) CommitAsync() *ReqRes {
req := types.ToRequestCommit()
res, err := cli.client.Commit(context.Background(), req.GetCommit(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_Commit{res}})
}
func (cli *grpcClient) InitChainAsync(params types.RequestInitChain) *ReqRes {
req := types.ToRequestInitChain(params)
res, err := cli.client.InitChain(context.Background(), req.GetInitChain(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_InitChain{res}})
}
func (cli *grpcClient) BeginBlockAsync(params types.RequestBeginBlock) *ReqRes {
req := types.ToRequestBeginBlock(params)
res, err := cli.client.BeginBlock(context.Background(), req.GetBeginBlock(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_BeginBlock{res}})
}
func (cli *grpcClient) EndBlockAsync(params types.RequestEndBlock) *ReqRes {
req := types.ToRequestEndBlock(params)
res, err := cli.client.EndBlock(context.Background(), req.GetEndBlock(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_EndBlock{res}})
}
func (cli *grpcClient) finishAsyncCall(req *types.Request, res *types.Response) *ReqRes {
reqres := NewReqRes(req)
reqres.Response = res // Set response
reqres.Done() // Release waiters
reqres.SetDone() // so reqRes.SetCallback will run the callback
// go routine for callbacks
go func() {
// Notify reqRes listener if set
if cb := reqres.GetCallback(); cb != nil {
cb(res)
}
// Notify client listener if set
if cli.resCb != nil {
cli.resCb(reqres.Request, res)
}
}()
return reqres
}
//----------------------------------------
func (cli *grpcClient) FlushSync() error {
return nil
}
func (cli *grpcClient) EchoSync(msg string) (*types.ResponseEcho, error) {
reqres := cli.EchoAsync(msg)
// StopForError should already have been called if error is set
return reqres.Response.GetEcho(), cli.Error()
}
func (cli *grpcClient) InfoSync(req types.RequestInfo) (*types.ResponseInfo, error) {
reqres := cli.InfoAsync(req)
return reqres.Response.GetInfo(), cli.Error()
}
func (cli *grpcClient) SetOptionSync(req types.RequestSetOption) (*types.ResponseSetOption, error) {
reqres := cli.SetOptionAsync(req)
return reqres.Response.GetSetOption(), cli.Error()
}
func (cli *grpcClient) DeliverTxSync(tx []byte) (*types.ResponseDeliverTx, error) {
reqres := cli.DeliverTxAsync(tx)
return reqres.Response.GetDeliverTx(), cli.Error()
}
func (cli *grpcClient) CheckTxSync(tx []byte) (*types.ResponseCheckTx, error) {
reqres := cli.CheckTxAsync(tx)
return reqres.Response.GetCheckTx(), cli.Error()
}
func (cli *grpcClient) QuerySync(req types.RequestQuery) (*types.ResponseQuery, error) {
reqres := cli.QueryAsync(req)
return reqres.Response.GetQuery(), cli.Error()
}
func (cli *grpcClient) CommitSync() (*types.ResponseCommit, error) {
reqres := cli.CommitAsync()
return reqres.Response.GetCommit(), cli.Error()
}
func (cli *grpcClient) InitChainSync(params types.RequestInitChain) (*types.ResponseInitChain, error) {
reqres := cli.InitChainAsync(params)
return reqres.Response.GetInitChain(), cli.Error()
}
func (cli *grpcClient) BeginBlockSync(params types.RequestBeginBlock) (*types.ResponseBeginBlock, error) {
reqres := cli.BeginBlockAsync(params)
return reqres.Response.GetBeginBlock(), cli.Error()
}
func (cli *grpcClient) EndBlockSync(params types.RequestEndBlock) (*types.ResponseEndBlock, error) {
reqres := cli.EndBlockAsync(params)
return reqres.Response.GetEndBlock(), cli.Error()
}

230
abci/client/local_client.go Normal file
View File

@@ -0,0 +1,230 @@
package abcicli
import (
"sync"
types "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
var _ Client = (*localClient)(nil)
type localClient struct {
cmn.BaseService
mtx *sync.Mutex
types.Application
Callback
}
func NewLocalClient(mtx *sync.Mutex, app types.Application) *localClient {
if mtx == nil {
mtx = new(sync.Mutex)
}
cli := &localClient{
mtx: mtx,
Application: app,
}
cli.BaseService = *cmn.NewBaseService(nil, "localClient", cli)
return cli
}
func (app *localClient) SetResponseCallback(cb Callback) {
app.mtx.Lock()
defer app.mtx.Unlock()
app.Callback = cb
}
// TODO: change types.Application to include Error()?
func (app *localClient) Error() error {
return nil
}
func (app *localClient) FlushAsync() *ReqRes {
// Do nothing
return newLocalReqRes(types.ToRequestFlush(), nil)
}
func (app *localClient) EchoAsync(msg string) *ReqRes {
return app.callback(
types.ToRequestEcho(msg),
types.ToResponseEcho(msg),
)
}
func (app *localClient) InfoAsync(req types.RequestInfo) *ReqRes {
app.mtx.Lock()
res := app.Application.Info(req)
app.mtx.Unlock()
return app.callback(
types.ToRequestInfo(req),
types.ToResponseInfo(res),
)
}
func (app *localClient) SetOptionAsync(req types.RequestSetOption) *ReqRes {
app.mtx.Lock()
res := app.Application.SetOption(req)
app.mtx.Unlock()
return app.callback(
types.ToRequestSetOption(req),
types.ToResponseSetOption(res),
)
}
func (app *localClient) DeliverTxAsync(tx []byte) *ReqRes {
app.mtx.Lock()
res := app.Application.DeliverTx(tx)
app.mtx.Unlock()
return app.callback(
types.ToRequestDeliverTx(tx),
types.ToResponseDeliverTx(res),
)
}
func (app *localClient) CheckTxAsync(tx []byte) *ReqRes {
app.mtx.Lock()
res := app.Application.CheckTx(tx)
app.mtx.Unlock()
return app.callback(
types.ToRequestCheckTx(tx),
types.ToResponseCheckTx(res),
)
}
func (app *localClient) QueryAsync(req types.RequestQuery) *ReqRes {
app.mtx.Lock()
res := app.Application.Query(req)
app.mtx.Unlock()
return app.callback(
types.ToRequestQuery(req),
types.ToResponseQuery(res),
)
}
func (app *localClient) CommitAsync() *ReqRes {
app.mtx.Lock()
res := app.Application.Commit()
app.mtx.Unlock()
return app.callback(
types.ToRequestCommit(),
types.ToResponseCommit(res),
)
}
func (app *localClient) InitChainAsync(req types.RequestInitChain) *ReqRes {
app.mtx.Lock()
res := app.Application.InitChain(req)
reqRes := app.callback(
types.ToRequestInitChain(req),
types.ToResponseInitChain(res),
)
app.mtx.Unlock()
return reqRes
}
func (app *localClient) BeginBlockAsync(req types.RequestBeginBlock) *ReqRes {
app.mtx.Lock()
res := app.Application.BeginBlock(req)
app.mtx.Unlock()
return app.callback(
types.ToRequestBeginBlock(req),
types.ToResponseBeginBlock(res),
)
}
func (app *localClient) EndBlockAsync(req types.RequestEndBlock) *ReqRes {
app.mtx.Lock()
res := app.Application.EndBlock(req)
app.mtx.Unlock()
return app.callback(
types.ToRequestEndBlock(req),
types.ToResponseEndBlock(res),
)
}
//-------------------------------------------------------
func (app *localClient) FlushSync() error {
return nil
}
func (app *localClient) EchoSync(msg string) (*types.ResponseEcho, error) {
return &types.ResponseEcho{msg}, nil
}
func (app *localClient) InfoSync(req types.RequestInfo) (*types.ResponseInfo, error) {
app.mtx.Lock()
res := app.Application.Info(req)
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) SetOptionSync(req types.RequestSetOption) (*types.ResponseSetOption, error) {
app.mtx.Lock()
res := app.Application.SetOption(req)
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) DeliverTxSync(tx []byte) (*types.ResponseDeliverTx, error) {
app.mtx.Lock()
res := app.Application.DeliverTx(tx)
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) CheckTxSync(tx []byte) (*types.ResponseCheckTx, error) {
app.mtx.Lock()
res := app.Application.CheckTx(tx)
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) QuerySync(req types.RequestQuery) (*types.ResponseQuery, error) {
app.mtx.Lock()
res := app.Application.Query(req)
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) CommitSync() (*types.ResponseCommit, error) {
app.mtx.Lock()
res := app.Application.Commit()
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) InitChainSync(req types.RequestInitChain) (*types.ResponseInitChain, error) {
app.mtx.Lock()
res := app.Application.InitChain(req)
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) BeginBlockSync(req types.RequestBeginBlock) (*types.ResponseBeginBlock, error) {
app.mtx.Lock()
res := app.Application.BeginBlock(req)
app.mtx.Unlock()
return &res, nil
}
func (app *localClient) EndBlockSync(req types.RequestEndBlock) (*types.ResponseEndBlock, error) {
app.mtx.Lock()
res := app.Application.EndBlock(req)
app.mtx.Unlock()
return &res, nil
}
//-------------------------------------------------------
func (app *localClient) callback(req *types.Request, res *types.Response) *ReqRes {
app.Callback(req, res)
return newLocalReqRes(req, res)
}
func newLocalReqRes(req *types.Request, res *types.Response) *ReqRes {
reqRes := NewReqRes(req)
reqRes.Response = res
reqRes.SetDone()
return reqRes
}

View File

@@ -0,0 +1,399 @@
package abcicli
import (
"bufio"
"container/list"
"errors"
"fmt"
"net"
"reflect"
"sync"
"time"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
const reqQueueSize = 256 // TODO make configurable
// const maxResponseSize = 1048576 // 1MB TODO make configurable
const flushThrottleMS = 20 // Don't wait longer than...
var _ Client = (*socketClient)(nil)
// This is goroutine-safe, but users should beware that
// the application in general is not meant to be interfaced
// with concurrent callers.
type socketClient struct {
cmn.BaseService
reqQueue chan *ReqRes
flushTimer *cmn.ThrottleTimer
mustConnect bool
mtx sync.Mutex
addr string
conn net.Conn
err error
reqSent *list.List
resCb func(*types.Request, *types.Response) // listens to all callbacks
}
func NewSocketClient(addr string, mustConnect bool) *socketClient {
cli := &socketClient{
reqQueue: make(chan *ReqRes, reqQueueSize),
flushTimer: cmn.NewThrottleTimer("socketClient", flushThrottleMS),
mustConnect: mustConnect,
addr: addr,
reqSent: list.New(),
resCb: nil,
}
cli.BaseService = *cmn.NewBaseService(nil, "socketClient", cli)
return cli
}
func (cli *socketClient) OnStart() error {
if err := cli.BaseService.OnStart(); err != nil {
return err
}
var err error
var conn net.Conn
RETRY_LOOP:
for {
conn, err = cmn.Connect(cli.addr)
if err != nil {
if cli.mustConnect {
return err
}
cli.Logger.Error(fmt.Sprintf("abci.socketClient failed to connect to %v. Retrying...", cli.addr))
time.Sleep(time.Second * dialRetryIntervalSeconds)
continue RETRY_LOOP
}
cli.conn = conn
go cli.sendRequestsRoutine(conn)
go cli.recvResponseRoutine(conn)
return nil
}
}
func (cli *socketClient) OnStop() {
cli.BaseService.OnStop()
cli.mtx.Lock()
defer cli.mtx.Unlock()
if cli.conn != nil {
cli.conn.Close()
}
cli.flushQueue()
}
// Stop the client and set the error
func (cli *socketClient) StopForError(err error) {
if !cli.IsRunning() {
return
}
cli.mtx.Lock()
if cli.err == nil {
cli.err = err
}
cli.mtx.Unlock()
cli.Logger.Error(fmt.Sprintf("Stopping abci.socketClient for error: %v", err.Error()))
cli.Stop()
}
func (cli *socketClient) Error() error {
cli.mtx.Lock()
defer cli.mtx.Unlock()
return cli.err
}
// Set listener for all responses
// NOTE: callback may get internally generated flush responses.
func (cli *socketClient) SetResponseCallback(resCb Callback) {
cli.mtx.Lock()
defer cli.mtx.Unlock()
cli.resCb = resCb
}
//----------------------------------------
func (cli *socketClient) sendRequestsRoutine(conn net.Conn) {
w := bufio.NewWriter(conn)
for {
select {
case <-cli.flushTimer.Ch:
select {
case cli.reqQueue <- NewReqRes(types.ToRequestFlush()):
default:
// Probably will fill the buffer, or retry later.
}
case <-cli.Quit():
return
case reqres := <-cli.reqQueue:
cli.willSendReq(reqres)
err := types.WriteMessage(reqres.Request, w)
if err != nil {
cli.StopForError(fmt.Errorf("Error writing msg: %v", err))
return
}
// cli.Logger.Debug("Sent request", "requestType", reflect.TypeOf(reqres.Request), "request", reqres.Request)
if _, ok := reqres.Request.Value.(*types.Request_Flush); ok {
err = w.Flush()
if err != nil {
cli.StopForError(fmt.Errorf("Error flushing writer: %v", err))
return
}
}
}
}
}
func (cli *socketClient) recvResponseRoutine(conn net.Conn) {
r := bufio.NewReader(conn) // Buffer reads
for {
var res = &types.Response{}
err := types.ReadMessage(r, res)
if err != nil {
cli.StopForError(err)
return
}
switch r := res.Value.(type) {
case *types.Response_Exception:
// XXX After setting cli.err, release waiters (e.g. reqres.Done())
cli.StopForError(errors.New(r.Exception.Error))
return
default:
// cli.Logger.Debug("Received response", "responseType", reflect.TypeOf(res), "response", res)
err := cli.didRecvResponse(res)
if err != nil {
cli.StopForError(err)
return
}
}
}
}
func (cli *socketClient) willSendReq(reqres *ReqRes) {
cli.mtx.Lock()
defer cli.mtx.Unlock()
cli.reqSent.PushBack(reqres)
}
func (cli *socketClient) didRecvResponse(res *types.Response) error {
cli.mtx.Lock()
defer cli.mtx.Unlock()
// Get the first ReqRes
next := cli.reqSent.Front()
if next == nil {
return fmt.Errorf("Unexpected result type %v when nothing expected", reflect.TypeOf(res.Value))
}
reqres := next.Value.(*ReqRes)
if !resMatchesReq(reqres.Request, res) {
return fmt.Errorf("Unexpected result type %v when response to %v expected",
reflect.TypeOf(res.Value), reflect.TypeOf(reqres.Request.Value))
}
reqres.Response = res // Set response
reqres.Done() // Release waiters
cli.reqSent.Remove(next) // Pop first item from linked list
// Notify reqRes listener if set
if cb := reqres.GetCallback(); cb != nil {
cb(res)
}
// Notify client listener if set
if cli.resCb != nil {
cli.resCb(reqres.Request, res)
}
return nil
}
//----------------------------------------
func (cli *socketClient) EchoAsync(msg string) *ReqRes {
return cli.queueRequest(types.ToRequestEcho(msg))
}
func (cli *socketClient) FlushAsync() *ReqRes {
return cli.queueRequest(types.ToRequestFlush())
}
func (cli *socketClient) InfoAsync(req types.RequestInfo) *ReqRes {
return cli.queueRequest(types.ToRequestInfo(req))
}
func (cli *socketClient) SetOptionAsync(req types.RequestSetOption) *ReqRes {
return cli.queueRequest(types.ToRequestSetOption(req))
}
func (cli *socketClient) DeliverTxAsync(tx []byte) *ReqRes {
return cli.queueRequest(types.ToRequestDeliverTx(tx))
}
func (cli *socketClient) CheckTxAsync(tx []byte) *ReqRes {
return cli.queueRequest(types.ToRequestCheckTx(tx))
}
func (cli *socketClient) QueryAsync(req types.RequestQuery) *ReqRes {
return cli.queueRequest(types.ToRequestQuery(req))
}
func (cli *socketClient) CommitAsync() *ReqRes {
return cli.queueRequest(types.ToRequestCommit())
}
func (cli *socketClient) InitChainAsync(req types.RequestInitChain) *ReqRes {
return cli.queueRequest(types.ToRequestInitChain(req))
}
func (cli *socketClient) BeginBlockAsync(req types.RequestBeginBlock) *ReqRes {
return cli.queueRequest(types.ToRequestBeginBlock(req))
}
func (cli *socketClient) EndBlockAsync(req types.RequestEndBlock) *ReqRes {
return cli.queueRequest(types.ToRequestEndBlock(req))
}
//----------------------------------------
func (cli *socketClient) FlushSync() error {
reqRes := cli.queueRequest(types.ToRequestFlush())
if err := cli.Error(); err != nil {
return err
}
reqRes.Wait() // NOTE: if we don't flush the queue, its possible to get stuck here
return cli.Error()
}
func (cli *socketClient) EchoSync(msg string) (*types.ResponseEcho, error) {
reqres := cli.queueRequest(types.ToRequestEcho(msg))
cli.FlushSync()
return reqres.Response.GetEcho(), cli.Error()
}
func (cli *socketClient) InfoSync(req types.RequestInfo) (*types.ResponseInfo, error) {
reqres := cli.queueRequest(types.ToRequestInfo(req))
cli.FlushSync()
return reqres.Response.GetInfo(), cli.Error()
}
func (cli *socketClient) SetOptionSync(req types.RequestSetOption) (*types.ResponseSetOption, error) {
reqres := cli.queueRequest(types.ToRequestSetOption(req))
cli.FlushSync()
return reqres.Response.GetSetOption(), cli.Error()
}
func (cli *socketClient) DeliverTxSync(tx []byte) (*types.ResponseDeliverTx, error) {
reqres := cli.queueRequest(types.ToRequestDeliverTx(tx))
cli.FlushSync()
return reqres.Response.GetDeliverTx(), cli.Error()
}
func (cli *socketClient) CheckTxSync(tx []byte) (*types.ResponseCheckTx, error) {
reqres := cli.queueRequest(types.ToRequestCheckTx(tx))
cli.FlushSync()
return reqres.Response.GetCheckTx(), cli.Error()
}
func (cli *socketClient) QuerySync(req types.RequestQuery) (*types.ResponseQuery, error) {
reqres := cli.queueRequest(types.ToRequestQuery(req))
cli.FlushSync()
return reqres.Response.GetQuery(), cli.Error()
}
func (cli *socketClient) CommitSync() (*types.ResponseCommit, error) {
reqres := cli.queueRequest(types.ToRequestCommit())
cli.FlushSync()
return reqres.Response.GetCommit(), cli.Error()
}
func (cli *socketClient) InitChainSync(req types.RequestInitChain) (*types.ResponseInitChain, error) {
reqres := cli.queueRequest(types.ToRequestInitChain(req))
cli.FlushSync()
return reqres.Response.GetInitChain(), cli.Error()
}
func (cli *socketClient) BeginBlockSync(req types.RequestBeginBlock) (*types.ResponseBeginBlock, error) {
reqres := cli.queueRequest(types.ToRequestBeginBlock(req))
cli.FlushSync()
return reqres.Response.GetBeginBlock(), cli.Error()
}
func (cli *socketClient) EndBlockSync(req types.RequestEndBlock) (*types.ResponseEndBlock, error) {
reqres := cli.queueRequest(types.ToRequestEndBlock(req))
cli.FlushSync()
return reqres.Response.GetEndBlock(), cli.Error()
}
//----------------------------------------
func (cli *socketClient) queueRequest(req *types.Request) *ReqRes {
reqres := NewReqRes(req)
// TODO: set cli.err if reqQueue times out
cli.reqQueue <- reqres
// Maybe auto-flush, or unset auto-flush
switch req.Value.(type) {
case *types.Request_Flush:
cli.flushTimer.Unset()
default:
cli.flushTimer.Set()
}
return reqres
}
func (cli *socketClient) flushQueue() {
LOOP:
for {
select {
case reqres := <-cli.reqQueue:
reqres.Done()
default:
break LOOP
}
}
}
//----------------------------------------
func resMatchesReq(req *types.Request, res *types.Response) (ok bool) {
switch req.Value.(type) {
case *types.Request_Echo:
_, ok = res.Value.(*types.Response_Echo)
case *types.Request_Flush:
_, ok = res.Value.(*types.Response_Flush)
case *types.Request_Info:
_, ok = res.Value.(*types.Response_Info)
case *types.Request_SetOption:
_, ok = res.Value.(*types.Response_SetOption)
case *types.Request_DeliverTx:
_, ok = res.Value.(*types.Response_DeliverTx)
case *types.Request_CheckTx:
_, ok = res.Value.(*types.Response_CheckTx)
case *types.Request_Commit:
_, ok = res.Value.(*types.Response_Commit)
case *types.Request_Query:
_, ok = res.Value.(*types.Response_Query)
case *types.Request_InitChain:
_, ok = res.Value.(*types.Response_InitChain)
case *types.Request_BeginBlock:
_, ok = res.Value.(*types.Response_BeginBlock)
case *types.Request_EndBlock:
_, ok = res.Value.(*types.Response_EndBlock)
}
return ok
}

View File

@@ -0,0 +1,28 @@
package abcicli_test
import (
"errors"
"testing"
"time"
"github.com/tendermint/tendermint/abci/client"
)
func TestSocketClientStopForErrorDeadlock(t *testing.T) {
c := abcicli.NewSocketClient(":80", false)
err := errors.New("foo-tendermint")
// See Issue https://github.com/tendermint/abci/issues/114
doneChan := make(chan bool)
go func() {
defer close(doneChan)
c.StopForError(err)
c.StopForError(err)
}()
select {
case <-doneChan:
case <-time.After(time.Second * 4):
t.Fatalf("Test took too long, potential deadlock still exists")
}
}

View File

@@ -0,0 +1,765 @@
package main
import (
"bufio"
"encoding/hex"
"errors"
"fmt"
"io"
"os"
"strings"
"github.com/spf13/cobra"
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"
"github.com/tendermint/tendermint/abci/example/counter"
"github.com/tendermint/tendermint/abci/example/kvstore"
"github.com/tendermint/tendermint/abci/server"
servertest "github.com/tendermint/tendermint/abci/tests/server"
"github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/abci/version"
)
// client is a global variable so it can be reused by the console
var (
client abcicli.Client
logger log.Logger
)
// flags
var (
// global
flagAddress string
flagAbci string
flagVerbose bool // for the println output
flagLogLevel string // for the logger
// query
flagPath string
flagHeight int
flagProve bool
// counter
flagSerial bool
// kvstore
flagPersist string
)
var RootCmd = &cobra.Command{
Use: "abci-cli",
Short: "the ABCI CLI tool wraps an ABCI client",
Long: "the ABCI CLI tool wraps an ABCI client and is used for testing ABCI servers",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
switch cmd.Use {
case "counter", "kvstore", "dummy": // for the examples apps, don't pre-run
return nil
case "version": // skip running for version command
return nil
}
if logger == nil {
allowLevel, err := log.AllowLevel(flagLogLevel)
if err != nil {
return err
}
logger = log.NewFilter(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), allowLevel)
}
if client == nil {
var err error
client, err = abcicli.NewClient(flagAddress, flagAbci, false)
if err != nil {
return err
}
client.SetLogger(logger.With("module", "abci-client"))
if err := client.Start(); err != nil {
return err
}
}
return nil
},
}
// Structure for data passed to print response.
type response struct {
// generic abci response
Data []byte
Code uint32
Info string
Log string
Query *queryResponse
}
type queryResponse struct {
Key []byte
Value []byte
Height int64
Proof []byte
}
func Execute() error {
addGlobalFlags()
addCommands()
return RootCmd.Execute()
}
func addGlobalFlags() {
RootCmd.PersistentFlags().StringVarP(&flagAddress, "address", "", "tcp://0.0.0.0:26658", "address of application socket")
RootCmd.PersistentFlags().StringVarP(&flagAbci, "abci", "", "socket", "either socket or grpc")
RootCmd.PersistentFlags().BoolVarP(&flagVerbose, "verbose", "v", false, "print the command and results as if it were a console session")
RootCmd.PersistentFlags().StringVarP(&flagLogLevel, "log_level", "", "debug", "set the logger level")
}
func addQueryFlags() {
queryCmd.PersistentFlags().StringVarP(&flagPath, "path", "", "/store", "path to prefix query with")
queryCmd.PersistentFlags().IntVarP(&flagHeight, "height", "", 0, "height to query the blockchain at")
queryCmd.PersistentFlags().BoolVarP(&flagProve, "prove", "", false, "whether or not to return a merkle proof of the query result")
}
func addCounterFlags() {
counterCmd.PersistentFlags().BoolVarP(&flagSerial, "serial", "", false, "enforce incrementing (serial) transactions")
}
func addDummyFlags() {
dummyCmd.PersistentFlags().StringVarP(&flagPersist, "persist", "", "", "directory to use for a database")
}
func addKVStoreFlags() {
kvstoreCmd.PersistentFlags().StringVarP(&flagPersist, "persist", "", "", "directory to use for a database")
}
func addCommands() {
RootCmd.AddCommand(batchCmd)
RootCmd.AddCommand(consoleCmd)
RootCmd.AddCommand(echoCmd)
RootCmd.AddCommand(infoCmd)
RootCmd.AddCommand(setOptionCmd)
RootCmd.AddCommand(deliverTxCmd)
RootCmd.AddCommand(checkTxCmd)
RootCmd.AddCommand(commitCmd)
RootCmd.AddCommand(versionCmd)
RootCmd.AddCommand(testCmd)
addQueryFlags()
RootCmd.AddCommand(queryCmd)
// examples
addCounterFlags()
RootCmd.AddCommand(counterCmd)
// deprecated, left for backwards compatibility
addDummyFlags()
RootCmd.AddCommand(dummyCmd)
// replaces dummy, see issue #196
addKVStoreFlags()
RootCmd.AddCommand(kvstoreCmd)
}
var batchCmd = &cobra.Command{
Use: "batch",
Short: "run a batch of abci commands against an application",
Long: `run a batch of abci commands against an application
This command is run by piping in a file containing a series of commands
you'd like to run:
abci-cli batch < example.file
where example.file looks something like:
set_option serial on
check_tx 0x00
check_tx 0xff
deliver_tx 0x00
check_tx 0x00
deliver_tx 0x01
deliver_tx 0x04
info
`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdBatch(cmd, args)
},
}
var consoleCmd = &cobra.Command{
Use: "console",
Short: "start an interactive ABCI console for multiple commands",
Long: `start an interactive ABCI console for multiple commands
This command opens an interactive console for running any of the other commands
without opening a new connection each time
`,
Args: cobra.ExactArgs(0),
ValidArgs: []string{"echo", "info", "set_option", "deliver_tx", "check_tx", "commit", "query"},
RunE: func(cmd *cobra.Command, args []string) error {
return cmdConsole(cmd, args)
},
}
var echoCmd = &cobra.Command{
Use: "echo",
Short: "have the application echo a message",
Long: "have the application echo a message",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdEcho(cmd, args)
},
}
var infoCmd = &cobra.Command{
Use: "info",
Short: "get some info about the application",
Long: "get some info about the application",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdInfo(cmd, args)
},
}
var setOptionCmd = &cobra.Command{
Use: "set_option",
Short: "set an option on the application",
Long: "set an option on the application",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdSetOption(cmd, args)
},
}
var deliverTxCmd = &cobra.Command{
Use: "deliver_tx",
Short: "deliver a new transaction to the application",
Long: "deliver a new transaction to the application",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdDeliverTx(cmd, args)
},
}
var checkTxCmd = &cobra.Command{
Use: "check_tx",
Short: "validate a transaction",
Long: "validate a transaction",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdCheckTx(cmd, args)
},
}
var commitCmd = &cobra.Command{
Use: "commit",
Short: "commit the application state and return the Merkle root hash",
Long: "commit the application state and return the Merkle root hash",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdCommit(cmd, args)
},
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "print ABCI console version",
Long: "print ABCI console version",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(version.Version)
return nil
},
}
var queryCmd = &cobra.Command{
Use: "query",
Short: "query the application state",
Long: "query the application state",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdQuery(cmd, args)
},
}
var counterCmd = &cobra.Command{
Use: "counter",
Short: "ABCI demo example",
Long: "ABCI demo example",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdCounter(cmd, args)
},
}
// deprecated, left for backwards compatibility
var dummyCmd = &cobra.Command{
Use: "dummy",
Deprecated: "use: [abci-cli kvstore] instead",
Short: "ABCI demo example",
Long: "ABCI demo example",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdKVStore(cmd, args)
},
}
var kvstoreCmd = &cobra.Command{
Use: "kvstore",
Short: "ABCI demo example",
Long: "ABCI demo example",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdKVStore(cmd, args)
},
}
var testCmd = &cobra.Command{
Use: "test",
Short: "run integration tests",
Long: "run integration tests",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdTest(cmd, args)
},
}
// Generates new Args array based off of previous call args to maintain flag persistence
func persistentArgs(line []byte) []string {
// generate the arguments to run from original os.Args
// to maintain flag arguments
args := os.Args
args = args[:len(args)-1] // remove the previous command argument
if len(line) > 0 { // prevents introduction of extra space leading to argument parse errors
args = append(args, strings.Split(string(line), " ")...)
}
return args
}
//--------------------------------------------------------------------------------
func compose(fs []func() error) error {
if len(fs) == 0 {
return nil
} else {
err := fs[0]()
if err == nil {
return compose(fs[1:])
} else {
return err
}
}
}
func cmdTest(cmd *cobra.Command, args []string) error {
return compose(
[]func() error{
func() error { return servertest.InitChain(client) },
func() error { return servertest.SetOption(client, "serial", "on") },
func() error { return servertest.Commit(client, nil) },
func() error { return servertest.DeliverTx(client, []byte("abc"), code.CodeTypeBadNonce, nil) },
func() error { return servertest.Commit(client, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x00}, code.CodeTypeOK, nil) },
func() error { return servertest.Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1}) },
func() error { return servertest.DeliverTx(client, []byte{0x00}, code.CodeTypeBadNonce, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x01}, code.CodeTypeOK, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x00, 0x02}, code.CodeTypeOK, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x00, 0x03}, code.CodeTypeOK, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x00, 0x00, 0x04}, code.CodeTypeOK, nil) },
func() error {
return servertest.DeliverTx(client, []byte{0x00, 0x00, 0x06}, code.CodeTypeBadNonce, nil)
},
func() error { return servertest.Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5}) },
})
}
func cmdBatch(cmd *cobra.Command, args []string) error {
bufReader := bufio.NewReader(os.Stdin)
for {
line, more, err := bufReader.ReadLine()
if more {
return errors.New("Input line is too long")
} else if err == io.EOF {
break
} else if len(line) == 0 {
continue
} else if err != nil {
return err
}
cmdArgs := persistentArgs(line)
if err := muxOnCommands(cmd, cmdArgs); err != nil {
return err
}
fmt.Println()
}
return nil
}
func cmdConsole(cmd *cobra.Command, args []string) error {
for {
fmt.Printf("> ")
bufReader := bufio.NewReader(os.Stdin)
line, more, err := bufReader.ReadLine()
if more {
return errors.New("Input is too long")
} else if err != nil {
return err
}
pArgs := persistentArgs(line)
if err := muxOnCommands(cmd, pArgs); err != nil {
return err
}
}
return nil
}
func muxOnCommands(cmd *cobra.Command, pArgs []string) error {
if len(pArgs) < 2 {
return errors.New("expecting persistent args of the form: abci-cli [command] <...>")
}
// TODO: this parsing is fragile
args := []string{}
for i := 0; i < len(pArgs); i++ {
arg := pArgs[i]
// check for flags
if strings.HasPrefix(arg, "-") {
// if it has an equal, we can just skip
if strings.Contains(arg, "=") {
continue
}
// if its a boolean, we can just skip
_, err := cmd.Flags().GetBool(strings.TrimLeft(arg, "-"))
if err == nil {
continue
}
// otherwise, we need to skip the next one too
i += 1
continue
}
// append the actual arg
args = append(args, arg)
}
var subCommand string
var actualArgs []string
if len(args) > 1 {
subCommand = args[1]
}
if len(args) > 2 {
actualArgs = args[2:]
}
cmd.Use = subCommand // for later print statements ...
switch strings.ToLower(subCommand) {
case "check_tx":
return cmdCheckTx(cmd, actualArgs)
case "commit":
return cmdCommit(cmd, actualArgs)
case "deliver_tx":
return cmdDeliverTx(cmd, actualArgs)
case "echo":
return cmdEcho(cmd, actualArgs)
case "info":
return cmdInfo(cmd, actualArgs)
case "query":
return cmdQuery(cmd, actualArgs)
case "set_option":
return cmdSetOption(cmd, actualArgs)
default:
return cmdUnimplemented(cmd, pArgs)
}
}
func cmdUnimplemented(cmd *cobra.Command, args []string) error {
// TODO: Print out all the sub-commands available
msg := "unimplemented command"
if err := cmd.Help(); err != nil {
msg = err.Error()
}
if len(args) > 0 {
msg += fmt.Sprintf(" args: [%s]", strings.Join(args, " "))
}
printResponse(cmd, args, response{
Code: codeBad,
Log: msg,
})
return nil
}
// Have the application echo a message
func cmdEcho(cmd *cobra.Command, args []string) error {
msg := ""
if len(args) > 0 {
msg = args[0]
}
res, err := client.EchoSync(msg)
if err != nil {
return err
}
printResponse(cmd, args, response{
Data: []byte(res.Message),
})
return nil
}
// Get some info from the application
func cmdInfo(cmd *cobra.Command, args []string) error {
var version string
if len(args) == 1 {
version = args[0]
}
res, err := client.InfoSync(types.RequestInfo{version})
if err != nil {
return err
}
printResponse(cmd, args, response{
Data: []byte(res.Data),
})
return nil
}
const codeBad uint32 = 10
// Set an option on the application
func cmdSetOption(cmd *cobra.Command, args []string) error {
if len(args) < 2 {
printResponse(cmd, args, response{
Code: codeBad,
Log: "want at least arguments of the form: <key> <value>",
})
return nil
}
key, val := args[0], args[1]
_, err := client.SetOptionSync(types.RequestSetOption{key, val})
if err != nil {
return err
}
printResponse(cmd, args, response{Log: "OK (SetOption doesn't return anything.)"}) // NOTE: Nothing to show...
return nil
}
// Append a new tx to application
func cmdDeliverTx(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
printResponse(cmd, args, response{
Code: codeBad,
Log: "want the tx",
})
return nil
}
txBytes, err := stringOrHexToBytes(args[0])
if err != nil {
return err
}
res, err := client.DeliverTxSync(txBytes)
if err != nil {
return err
}
printResponse(cmd, args, response{
Code: res.Code,
Data: res.Data,
Info: res.Info,
Log: res.Log,
})
return nil
}
// Validate a tx
func cmdCheckTx(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
printResponse(cmd, args, response{
Code: codeBad,
Info: "want the tx",
})
return nil
}
txBytes, err := stringOrHexToBytes(args[0])
if err != nil {
return err
}
res, err := client.CheckTxSync(txBytes)
if err != nil {
return err
}
printResponse(cmd, args, response{
Code: res.Code,
Data: res.Data,
Info: res.Info,
Log: res.Log,
})
return nil
}
// Get application Merkle root hash
func cmdCommit(cmd *cobra.Command, args []string) error {
res, err := client.CommitSync()
if err != nil {
return err
}
printResponse(cmd, args, response{
Data: res.Data,
})
return nil
}
// Query application state
func cmdQuery(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
printResponse(cmd, args, response{
Code: codeBad,
Info: "want the query",
Log: "",
})
return nil
}
queryBytes, err := stringOrHexToBytes(args[0])
if err != nil {
return err
}
resQuery, err := client.QuerySync(types.RequestQuery{
Data: queryBytes,
Path: flagPath,
Height: int64(flagHeight),
Prove: flagProve,
})
if err != nil {
return err
}
printResponse(cmd, args, response{
Code: resQuery.Code,
Info: resQuery.Info,
Log: resQuery.Log,
Query: &queryResponse{
Key: resQuery.Key,
Value: resQuery.Value,
Height: resQuery.Height,
Proof: resQuery.Proof,
},
})
return nil
}
func cmdCounter(cmd *cobra.Command, args []string) error {
app := counter.NewCounterApplication(flagSerial)
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Start the listener
srv, err := server.NewServer(flagAddress, flagAbci, app)
if err != nil {
return err
}
srv.SetLogger(logger.With("module", "abci-server"))
if err := srv.Start(); err != nil {
return err
}
// Wait forever
cmn.TrapSignal(func() {
// Cleanup
srv.Stop()
})
return nil
}
func cmdKVStore(cmd *cobra.Command, args []string) error {
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Create the application - in memory or persisted to disk
var app types.Application
if flagPersist == "" {
app = kvstore.NewKVStoreApplication()
} else {
app = kvstore.NewPersistentKVStoreApplication(flagPersist)
app.(*kvstore.PersistentKVStoreApplication).SetLogger(logger.With("module", "kvstore"))
}
// Start the listener
srv, err := server.NewServer(flagAddress, flagAbci, app)
if err != nil {
return err
}
srv.SetLogger(logger.With("module", "abci-server"))
if err := srv.Start(); err != nil {
return err
}
// Wait forever
cmn.TrapSignal(func() {
// Cleanup
srv.Stop()
})
return nil
}
//--------------------------------------------------------------------------------
func printResponse(cmd *cobra.Command, args []string, rsp response) {
if flagVerbose {
fmt.Println(">", cmd.Use, strings.Join(args, " "))
}
// Always print the status code.
if rsp.Code == types.CodeTypeOK {
fmt.Printf("-> code: OK\n")
} else {
fmt.Printf("-> code: %d\n", rsp.Code)
}
if len(rsp.Data) != 0 {
// Do no print this line when using the commit command
// because the string comes out as gibberish
if cmd.Use != "commit" {
fmt.Printf("-> data: %s\n", rsp.Data)
}
fmt.Printf("-> data.hex: 0x%X\n", rsp.Data)
}
if rsp.Log != "" {
fmt.Printf("-> log: %s\n", rsp.Log)
}
if rsp.Query != nil {
fmt.Printf("-> height: %d\n", rsp.Query.Height)
if rsp.Query.Key != nil {
fmt.Printf("-> key: %s\n", rsp.Query.Key)
fmt.Printf("-> key.hex: %X\n", rsp.Query.Key)
}
if rsp.Query.Value != nil {
fmt.Printf("-> value: %s\n", rsp.Query.Value)
fmt.Printf("-> value.hex: %X\n", rsp.Query.Value)
}
if rsp.Query.Proof != nil {
fmt.Printf("-> proof: %X\n", rsp.Query.Proof)
}
}
}
// NOTE: s is interpreted as a string unless prefixed with 0x
func stringOrHexToBytes(s string) ([]byte, error) {
if len(s) > 2 && strings.ToLower(s[:2]) == "0x" {
b, err := hex.DecodeString(s[2:])
if err != nil {
err = fmt.Errorf("Error decoding hex argument: %s", err.Error())
return nil, err
}
return b, nil
}
if !strings.HasPrefix(s, "\"") || !strings.HasSuffix(s, "\"") {
err := fmt.Errorf("Invalid string arg: \"%s\". Must be quoted or a \"0x\"-prefixed hex string", s)
return nil, err
}
return []byte(s[1 : len(s)-1]), nil
}

14
abci/cmd/abci-cli/main.go Normal file
View File

@@ -0,0 +1,14 @@
package main
import (
"fmt"
"os"
)
func main() {
err := Execute()
if err != nil {
fmt.Print(err)
os.Exit(1)
}
}

View File

@@ -0,0 +1,9 @@
package code
// Return codes for the examples
const (
CodeTypeOK uint32 = 0
CodeTypeEncodingError uint32 = 1
CodeTypeBadNonce uint32 = 2
CodeTypeUnauthorized uint32 = 3
)

View File

@@ -0,0 +1,104 @@
package counter
import (
"encoding/binary"
"fmt"
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
type CounterApplication struct {
types.BaseApplication
hashCount int
txCount int
serial bool
}
func NewCounterApplication(serial bool) *CounterApplication {
return &CounterApplication{serial: serial}
}
func (app *CounterApplication) Info(req types.RequestInfo) types.ResponseInfo {
return types.ResponseInfo{Data: cmn.Fmt("{\"hashes\":%v,\"txs\":%v}", app.hashCount, app.txCount)}
}
func (app *CounterApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption {
key, value := req.Key, req.Value
if key == "serial" && value == "on" {
app.serial = true
} else {
/*
TODO Panic and have the ABCI server pass an exception.
The client can call SetOptionSync() and get an `error`.
return types.ResponseSetOption{
Error: cmn.Fmt("Unknown key (%s) or value (%s)", key, value),
}
*/
return types.ResponseSetOption{}
}
return types.ResponseSetOption{}
}
func (app *CounterApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
if app.serial {
if len(tx) > 8 {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Max tx size is 8 bytes, got %d", len(tx))}
}
tx8 := make([]byte, 8)
copy(tx8[len(tx8)-len(tx):], tx)
txValue := binary.BigEndian.Uint64(tx8)
if txValue != uint64(app.txCount) {
return types.ResponseDeliverTx{
Code: code.CodeTypeBadNonce,
Log: fmt.Sprintf("Invalid nonce. Expected %v, got %v", app.txCount, txValue)}
}
}
app.txCount++
return types.ResponseDeliverTx{Code: code.CodeTypeOK}
}
func (app *CounterApplication) CheckTx(tx []byte) types.ResponseCheckTx {
if app.serial {
if len(tx) > 8 {
return types.ResponseCheckTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Max tx size is 8 bytes, got %d", len(tx))}
}
tx8 := make([]byte, 8)
copy(tx8[len(tx8)-len(tx):], tx)
txValue := binary.BigEndian.Uint64(tx8)
if txValue < uint64(app.txCount) {
return types.ResponseCheckTx{
Code: code.CodeTypeBadNonce,
Log: fmt.Sprintf("Invalid nonce. Expected >= %v, got %v", app.txCount, txValue)}
}
}
return types.ResponseCheckTx{Code: code.CodeTypeOK}
}
func (app *CounterApplication) Commit() (resp types.ResponseCommit) {
app.hashCount++
if app.txCount == 0 {
return types.ResponseCommit{}
}
hash := make([]byte, 8)
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return types.ResponseCommit{Data: hash}
}
func (app *CounterApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {
switch reqQuery.Path {
case "hash":
return types.ResponseQuery{Value: []byte(cmn.Fmt("%v", app.hashCount))}
case "tx":
return types.ResponseQuery{Value: []byte(cmn.Fmt("%v", app.txCount))}
default:
return types.ResponseQuery{Log: cmn.Fmt("Invalid query path. Expected hash or tx, got %v", reqQuery.Path)}
}
}

3
abci/example/example.go Normal file
View File

@@ -0,0 +1,3 @@
package example
// so the go tool doesn't return errors about no buildable go files ...

View File

@@ -0,0 +1,154 @@
package example
import (
"fmt"
"net"
"reflect"
"testing"
"time"
"google.golang.org/grpc"
"golang.org/x/net/context"
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"
"github.com/tendermint/tendermint/abci/example/kvstore"
abciserver "github.com/tendermint/tendermint/abci/server"
"github.com/tendermint/tendermint/abci/types"
)
func TestKVStore(t *testing.T) {
fmt.Println("### Testing KVStore")
testStream(t, kvstore.NewKVStoreApplication())
}
func TestBaseApp(t *testing.T) {
fmt.Println("### Testing BaseApp")
testStream(t, types.NewBaseApplication())
}
func TestGRPC(t *testing.T) {
fmt.Println("### Testing GRPC")
testGRPCSync(t, types.NewGRPCApplication(types.NewBaseApplication()))
}
func testStream(t *testing.T, app types.Application) {
numDeliverTxs := 200000
// Start the listener
server := abciserver.NewSocketServer("unix://test.sock", app)
server.SetLogger(log.TestingLogger().With("module", "abci-server"))
if err := server.Start(); err != nil {
t.Fatalf("Error starting socket server: %v", err.Error())
}
defer server.Stop()
// Connect to the socket
client := abcicli.NewSocketClient("unix://test.sock", false)
client.SetLogger(log.TestingLogger().With("module", "abci-client"))
if err := client.Start(); err != nil {
t.Fatalf("Error starting socket client: %v", err.Error())
}
defer client.Stop()
done := make(chan struct{})
counter := 0
client.SetResponseCallback(func(req *types.Request, res *types.Response) {
// Process response
switch r := res.Value.(type) {
case *types.Response_DeliverTx:
counter++
if r.DeliverTx.Code != code.CodeTypeOK {
t.Error("DeliverTx failed with ret_code", r.DeliverTx.Code)
}
if counter > numDeliverTxs {
t.Fatalf("Too many DeliverTx responses. Got %d, expected %d", counter, numDeliverTxs)
}
if counter == numDeliverTxs {
go func() {
time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow
close(done)
}()
return
}
case *types.Response_Flush:
// ignore
default:
t.Error("Unexpected response type", reflect.TypeOf(res.Value))
}
})
// Write requests
for counter := 0; counter < numDeliverTxs; counter++ {
// Send request
reqRes := client.DeliverTxAsync([]byte("test"))
_ = reqRes
// check err ?
// Sometimes send flush messages
if counter%123 == 0 {
client.FlushAsync()
// check err ?
}
}
// Send final flush message
client.FlushAsync()
<-done
}
//-------------------------
// test grpc
func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
return cmn.Connect(addr)
}
func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
numDeliverTxs := 2000
// Start the listener
server := abciserver.NewGRPCServer("unix://test.sock", app)
server.SetLogger(log.TestingLogger().With("module", "abci-server"))
if err := server.Start(); err != nil {
t.Fatalf("Error starting GRPC server: %v", err.Error())
}
defer server.Stop()
// Connect to the socket
conn, err := grpc.Dial("unix://test.sock", grpc.WithInsecure(), grpc.WithDialer(dialerFunc))
if err != nil {
t.Fatalf("Error dialing GRPC server: %v", err.Error())
}
defer conn.Close()
client := types.NewABCIApplicationClient(conn)
// Write requests
for counter := 0; counter < numDeliverTxs; counter++ {
// Send request
response, err := client.DeliverTx(context.Background(), &types.RequestDeliverTx{[]byte("test")})
if err != nil {
t.Fatalf("Error in GRPC DeliverTx: %v", err.Error())
}
counter++
if response.Code != code.CodeTypeOK {
t.Error("DeliverTx failed with ret_code", response.Code)
}
if counter > numDeliverTxs {
t.Fatal("Too many DeliverTx responses")
}
t.Log("response", counter)
if counter == numDeliverTxs {
go func() {
time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow
}()
}
}
}

1
abci/example/js/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

View File

@@ -0,0 +1 @@
This example has been moved here: https://github.com/tendermint/js-abci/tree/master/example

View File

@@ -0,0 +1,31 @@
# KVStore
There are two app's here: the KVStoreApplication and the PersistentKVStoreApplication.
## KVStoreApplication
The KVStoreApplication is a simple merkle key-value store.
Transactions of the form `key=value` are stored as key-value pairs in the tree.
Transactions without an `=` sign set the value to the key.
The app has no replay protection (other than what the mempool provides).
## PersistentKVStoreApplication
The PersistentKVStoreApplication wraps the KVStoreApplication
and provides two additional features:
1) persistence of state across app restarts (using Tendermint's ABCI-Handshake mechanism)
2) validator set changes
The state is persisted in leveldb along with the last block committed,
and the Handshake allows any necessary blocks to be replayed.
Validator set changes are effected using the following transaction format:
```
val:pubkey1/power1,addr2/power2,addr3/power3"
```
where `power1` is the new voting power for the validator with `pubkey1` (possibly a new one).
There is no sybil protection against new validators joining.
Validators can be removed by setting their power to `0`.

View File

@@ -0,0 +1,38 @@
package kvstore
import (
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
// RandVal creates one random validator, with a key derived
// from the input value
func RandVal(i int) types.Validator {
addr := cmn.RandBytes(20)
pubkey := cmn.RandBytes(32)
power := cmn.RandUint16() + 1
v := types.Ed25519Validator(pubkey, int64(power))
v.Address = addr
return v
}
// RandVals returns a list of cnt validators for initializing
// the application. Note that the keys are deterministically
// derived from the index in the array, while the power is
// random (Change this if not desired)
func RandVals(cnt int) []types.Validator {
res := make([]types.Validator, cnt)
for i := 0; i < cnt; i++ {
res[i] = RandVal(i)
}
return res
}
// InitKVStore initializes the kvstore app with some data,
// which allows tests to pass and is fine as long as you
// don't make any tx that modify the validator state
func InitKVStore(app *PersistentKVStoreApplication) {
app.InitChain(types.RequestInitChain{
Validators: RandVals(1),
})
}

View File

@@ -0,0 +1,126 @@
package kvstore
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
)
var (
stateKey = []byte("stateKey")
kvPairPrefixKey = []byte("kvPairKey:")
)
type State struct {
db dbm.DB
Size int64 `json:"size"`
Height int64 `json:"height"`
AppHash []byte `json:"app_hash"`
}
func loadState(db dbm.DB) State {
stateBytes := db.Get(stateKey)
var state State
if len(stateBytes) != 0 {
err := json.Unmarshal(stateBytes, &state)
if err != nil {
panic(err)
}
}
state.db = db
return state
}
func saveState(state State) {
stateBytes, err := json.Marshal(state)
if err != nil {
panic(err)
}
state.db.Set(stateKey, stateBytes)
}
func prefixKey(key []byte) []byte {
return append(kvPairPrefixKey, key...)
}
//---------------------------------------------------
var _ types.Application = (*KVStoreApplication)(nil)
type KVStoreApplication struct {
types.BaseApplication
state State
}
func NewKVStoreApplication() *KVStoreApplication {
state := loadState(dbm.NewMemDB())
return &KVStoreApplication{state: state}
}
func (app *KVStoreApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
return types.ResponseInfo{Data: fmt.Sprintf("{\"size\":%v}", app.state.Size)}
}
// tx is either "key=value" or just arbitrary bytes
func (app *KVStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
var key, value []byte
parts := bytes.Split(tx, []byte("="))
if len(parts) == 2 {
key, value = parts[0], parts[1]
} else {
key, value = tx, tx
}
app.state.db.Set(prefixKey(key), value)
app.state.Size += 1
tags := []cmn.KVPair{
{[]byte("app.creator"), []byte("jae")},
{[]byte("app.key"), key},
}
return types.ResponseDeliverTx{Code: code.CodeTypeOK, Tags: tags}
}
func (app *KVStoreApplication) CheckTx(tx []byte) types.ResponseCheckTx {
return types.ResponseCheckTx{Code: code.CodeTypeOK}
}
func (app *KVStoreApplication) Commit() types.ResponseCommit {
// Using a memdb - just return the big endian size of the db
appHash := make([]byte, 8)
binary.PutVarint(appHash, app.state.Size)
app.state.AppHash = appHash
app.state.Height += 1
saveState(app.state)
return types.ResponseCommit{Data: appHash}
}
func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
if reqQuery.Prove {
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Index = -1 // TODO make Proof return index
resQuery.Key = reqQuery.Data
resQuery.Value = value
if value != nil {
resQuery.Log = "exists"
} else {
resQuery.Log = "does not exist"
}
return
} else {
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Value = value
if value != nil {
resQuery.Log = "exists"
} else {
resQuery.Log = "does not exist"
}
return
}
}

View File

@@ -0,0 +1,310 @@
package kvstore
import (
"bytes"
"io/ioutil"
"sort"
"testing"
"github.com/stretchr/testify/require"
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"
abciserver "github.com/tendermint/tendermint/abci/server"
"github.com/tendermint/tendermint/abci/types"
)
func testKVStore(t *testing.T, app types.Application, tx []byte, key, value string) {
ar := app.DeliverTx(tx)
require.False(t, ar.IsErr(), ar)
// repeating tx doesn't raise error
ar = app.DeliverTx(tx)
require.False(t, ar.IsErr(), ar)
// make sure query is fine
resQuery := app.Query(types.RequestQuery{
Path: "/store",
Data: []byte(key),
})
require.Equal(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
// make sure proof is fine
resQuery = app.Query(types.RequestQuery{
Path: "/store",
Data: []byte(key),
Prove: true,
})
require.EqualValues(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
}
func TestKVStoreKV(t *testing.T) {
kvstore := NewKVStoreApplication()
key := "abc"
value := key
tx := []byte(key)
testKVStore(t, kvstore, tx, key, value)
value = "def"
tx = []byte(key + "=" + value)
testKVStore(t, kvstore, tx, key, value)
}
func TestPersistentKVStoreKV(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO
if err != nil {
t.Fatal(err)
}
kvstore := NewPersistentKVStoreApplication(dir)
key := "abc"
value := key
tx := []byte(key)
testKVStore(t, kvstore, tx, key, value)
value = "def"
tx = []byte(key + "=" + value)
testKVStore(t, kvstore, tx, key, value)
}
func TestPersistentKVStoreInfo(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO
if err != nil {
t.Fatal(err)
}
kvstore := NewPersistentKVStoreApplication(dir)
InitKVStore(kvstore)
height := int64(0)
resInfo := kvstore.Info(types.RequestInfo{})
if resInfo.LastBlockHeight != height {
t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight)
}
// make and apply block
height = int64(1)
hash := []byte("foo")
header := types.Header{
Height: int64(height),
}
kvstore.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
kvstore.EndBlock(types.RequestEndBlock{header.Height})
kvstore.Commit()
resInfo = kvstore.Info(types.RequestInfo{})
if resInfo.LastBlockHeight != height {
t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight)
}
}
// add a validator, remove a validator, update a validator
func TestValUpdates(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-kvstore-test") // TODO
if err != nil {
t.Fatal(err)
}
kvstore := NewPersistentKVStoreApplication(dir)
// init with some validators
total := 10
nInit := 5
vals := RandVals(total)
// iniitalize with the first nInit
kvstore.InitChain(types.RequestInitChain{
Validators: vals[:nInit],
})
vals1, vals2 := vals[:nInit], kvstore.Validators()
valsEqual(t, vals1, vals2)
var v1, v2, v3 types.Validator
// add some validators
v1, v2 = vals[nInit], vals[nInit+1]
diff := []types.Validator{v1, v2}
tx1 := MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 := MakeValSetChangeTx(v2.PubKey, v2.Power)
makeApplyBlock(t, kvstore, 1, diff, tx1, tx2)
vals1, vals2 = vals[:nInit+2], kvstore.Validators()
valsEqual(t, vals1, vals2)
// remove some validators
v1, v2, v3 = vals[nInit-2], vals[nInit-1], vals[nInit]
v1.Power = 0
v2.Power = 0
v3.Power = 0
diff = []types.Validator{v1, v2, v3}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 = MakeValSetChangeTx(v2.PubKey, v2.Power)
tx3 := MakeValSetChangeTx(v3.PubKey, v3.Power)
makeApplyBlock(t, kvstore, 2, diff, tx1, tx2, tx3)
vals1 = append(vals[:nInit-2], vals[nInit+1])
vals2 = kvstore.Validators()
valsEqual(t, vals1, vals2)
// update some validators
v1 = vals[0]
if v1.Power == 5 {
v1.Power = 6
} else {
v1.Power = 5
}
diff = []types.Validator{v1}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
makeApplyBlock(t, kvstore, 3, diff, tx1)
vals1 = append([]types.Validator{v1}, vals1[1:]...)
vals2 = kvstore.Validators()
valsEqual(t, vals1, vals2)
}
func makeApplyBlock(t *testing.T, kvstore types.Application, heightInt int, diff []types.Validator, txs ...[]byte) {
// make and apply block
height := int64(heightInt)
hash := []byte("foo")
header := types.Header{
Height: height,
}
kvstore.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
for _, tx := range txs {
if r := kvstore.DeliverTx(tx); r.IsErr() {
t.Fatal(r)
}
}
resEndBlock := kvstore.EndBlock(types.RequestEndBlock{header.Height})
kvstore.Commit()
valsEqual(t, diff, resEndBlock.ValidatorUpdates)
}
// order doesn't matter
func valsEqual(t *testing.T, vals1, vals2 []types.Validator) {
if len(vals1) != len(vals2) {
t.Fatalf("vals dont match in len. got %d, expected %d", len(vals2), len(vals1))
}
sort.Sort(types.Validators(vals1))
sort.Sort(types.Validators(vals2))
for i, v1 := range vals1 {
v2 := vals2[i]
if !bytes.Equal(v1.PubKey.Data, v2.PubKey.Data) ||
v1.Power != v2.Power {
t.Fatalf("vals dont match at index %d. got %X/%d , expected %X/%d", i, v2.PubKey, v2.Power, v1.PubKey, v1.Power)
}
}
}
func makeSocketClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) {
// Start the listener
socket := cmn.Fmt("unix://%s.sock", name)
logger := log.TestingLogger()
server := abciserver.NewSocketServer(socket, app)
server.SetLogger(logger.With("module", "abci-server"))
if err := server.Start(); err != nil {
return nil, nil, err
}
// Connect to the socket
client := abcicli.NewSocketClient(socket, false)
client.SetLogger(logger.With("module", "abci-client"))
if err := client.Start(); err != nil {
server.Stop()
return nil, nil, err
}
return client, server, nil
}
func makeGRPCClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) {
// Start the listener
socket := cmn.Fmt("unix://%s.sock", name)
logger := log.TestingLogger()
gapp := types.NewGRPCApplication(app)
server := abciserver.NewGRPCServer(socket, gapp)
server.SetLogger(logger.With("module", "abci-server"))
if err := server.Start(); err != nil {
return nil, nil, err
}
client := abcicli.NewGRPCClient(socket, true)
client.SetLogger(logger.With("module", "abci-client"))
if err := client.Start(); err != nil {
server.Stop()
return nil, nil, err
}
return client, server, nil
}
func TestClientServer(t *testing.T) {
// set up socket app
kvstore := NewKVStoreApplication()
client, server, err := makeSocketClientServer(kvstore, "kvstore-socket")
require.Nil(t, err)
defer server.Stop()
defer client.Stop()
runClientTests(t, client)
// set up grpc app
kvstore = NewKVStoreApplication()
gclient, gserver, err := makeGRPCClientServer(kvstore, "kvstore-grpc")
require.Nil(t, err)
defer gserver.Stop()
defer gclient.Stop()
runClientTests(t, gclient)
}
func runClientTests(t *testing.T, client abcicli.Client) {
// run some tests....
key := "abc"
value := key
tx := []byte(key)
testClient(t, client, tx, key, value)
value = "def"
tx = []byte(key + "=" + value)
testClient(t, client, tx, key, value)
}
func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string) {
ar, err := app.DeliverTxSync(tx)
require.NoError(t, err)
require.False(t, ar.IsErr(), ar)
// repeating tx doesn't raise error
ar, err = app.DeliverTxSync(tx)
require.NoError(t, err)
require.False(t, ar.IsErr(), ar)
// make sure query is fine
resQuery, err := app.QuerySync(types.RequestQuery{
Path: "/store",
Data: []byte(key),
})
require.Nil(t, err)
require.Equal(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
// make sure proof is fine
resQuery, err = app.QuerySync(types.RequestQuery{
Path: "/store",
Data: []byte(key),
Prove: true,
})
require.Nil(t, err)
require.Equal(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
}

View File

@@ -0,0 +1,200 @@
package kvstore
import (
"bytes"
"encoding/hex"
"fmt"
"strconv"
"strings"
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
)
const (
ValidatorSetChangePrefix string = "val:"
)
//-----------------------------------------
var _ types.Application = (*PersistentKVStoreApplication)(nil)
type PersistentKVStoreApplication struct {
app *KVStoreApplication
// validator set
ValUpdates []types.Validator
logger log.Logger
}
func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication {
name := "kvstore"
db, err := dbm.NewGoLevelDB(name, dbDir)
if err != nil {
panic(err)
}
state := loadState(db)
return &PersistentKVStoreApplication{
app: &KVStoreApplication{state: state},
logger: log.NewNopLogger(),
}
}
func (app *PersistentKVStoreApplication) SetLogger(l log.Logger) {
app.logger = l
}
func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo {
res := app.app.Info(req)
res.LastBlockHeight = app.app.state.Height
res.LastBlockAppHash = app.app.state.AppHash
return res
}
func (app *PersistentKVStoreApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption {
return app.app.SetOption(req)
}
// tx is either "val:pubkey/power" or "key=value" or just arbitrary bytes
func (app *PersistentKVStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
// if it starts with "val:", update the validator set
// format is "val:pubkey/power"
if isValidatorTx(tx) {
// update validators in the merkle tree
// and in app.ValUpdates
return app.execValidatorTx(tx)
}
// otherwise, update the key-value store
return app.app.DeliverTx(tx)
}
func (app *PersistentKVStoreApplication) CheckTx(tx []byte) types.ResponseCheckTx {
return app.app.CheckTx(tx)
}
// Commit will panic if InitChain was not called
func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit {
return app.app.Commit()
}
func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {
return app.app.Query(reqQuery)
}
// Save the validators in the merkle tree
func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain {
for _, v := range req.Validators {
r := app.updateValidator(v)
if r.IsErr() {
app.logger.Error("Error updating validators", "r", r)
}
}
return types.ResponseInitChain{}
}
// Track the block hash and header information
func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
// reset valset changes
app.ValUpdates = make([]types.Validator, 0)
return types.ResponseBeginBlock{}
}
// Update the validator set
func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
return types.ResponseEndBlock{ValidatorUpdates: app.ValUpdates}
}
//---------------------------------------------
// update validators
func (app *PersistentKVStoreApplication) Validators() (validators []types.Validator) {
itr := app.app.state.db.Iterator(nil, nil)
for ; itr.Valid(); itr.Next() {
if isValidatorTx(itr.Key()) {
validator := new(types.Validator)
err := types.ReadMessage(bytes.NewBuffer(itr.Value()), validator)
if err != nil {
panic(err)
}
validators = append(validators, *validator)
}
}
return
}
func MakeValSetChangeTx(pubkey types.PubKey, power int64) []byte {
return []byte(cmn.Fmt("val:%X/%d", pubkey.Data, power))
}
func isValidatorTx(tx []byte) bool {
return strings.HasPrefix(string(tx), ValidatorSetChangePrefix)
}
// format is "val:pubkey/power"
// pubkey is raw 32-byte ed25519 key
func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.ResponseDeliverTx {
tx = tx[len(ValidatorSetChangePrefix):]
//get the pubkey and power
pubKeyAndPower := strings.Split(string(tx), "/")
if len(pubKeyAndPower) != 2 {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Expected 'pubkey/power'. Got %v", pubKeyAndPower)}
}
pubkeyS, powerS := pubKeyAndPower[0], pubKeyAndPower[1]
// decode the pubkey
pubkey, err := hex.DecodeString(pubkeyS)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Pubkey (%s) is invalid hex", pubkeyS)}
}
// decode the power
power, err := strconv.ParseInt(powerS, 10, 64)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Power (%s) is not an int", powerS)}
}
// update
return app.updateValidator(types.Ed25519Validator(pubkey, int64(power)))
}
// add, update, or remove a validator
func (app *PersistentKVStoreApplication) updateValidator(v types.Validator) types.ResponseDeliverTx {
key := []byte("val:" + string(v.PubKey.Data))
if v.Power == 0 {
// remove validator
if !app.app.state.db.Has(key) {
return types.ResponseDeliverTx{
Code: code.CodeTypeUnauthorized,
Log: fmt.Sprintf("Cannot remove non-existent validator %X", key)}
}
app.app.state.db.Delete(key)
} else {
// add or update validator
value := bytes.NewBuffer(make([]byte, 0))
if err := types.WriteMessage(&v, value); err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Error encoding validator: %v", err)}
}
app.app.state.db.Set(key, value.Bytes())
}
// we only update the changes array if we successfully updated the tree
app.ValUpdates = append(app.ValUpdates, v)
return types.ResponseDeliverTx{Code: code.CodeTypeOK}
}

View File

View File

@@ -0,0 +1,50 @@
from wire import decode_string
# map type_byte to message name
message_types = {
0x01: "echo",
0x02: "flush",
0x03: "info",
0x04: "set_option",
0x21: "deliver_tx",
0x22: "check_tx",
0x23: "commit",
0x24: "add_listener",
0x25: "rm_listener",
}
# return the decoded arguments of abci messages
class RequestDecoder():
def __init__(self, reader):
self.reader = reader
def echo(self):
return decode_string(self.reader)
def flush(self):
return
def info(self):
return
def set_option(self):
return decode_string(self.reader), decode_string(self.reader)
def deliver_tx(self):
return decode_string(self.reader)
def check_tx(self):
return decode_string(self.reader)
def commit(self):
return
def add_listener(self):
# TODO
return
def rm_listener(self):
# TODO
return

View File

@@ -0,0 +1,56 @@
# Simple read() method around a bytearray
class BytesBuffer():
def __init__(self, b):
self.buf = b
self.readCount = 0
def count(self):
return self.readCount
def reset_count(self):
self.readCount = 0
def size(self):
return len(self.buf)
def peek(self):
return self.buf[0]
def write(self, b):
# b should be castable to byte array
self.buf += bytearray(b)
def read(self, n):
if len(self.buf) < n:
print "reader err: buf less than n"
# TODO: exception
return
self.readCount += n
r = self.buf[:n]
self.buf = self.buf[n:]
return r
# Buffer bytes off a tcp connection and read them off in chunks
class ConnReader():
def __init__(self, conn):
self.conn = conn
self.buf = bytearray()
# blocking
def read(self, n):
while n > len(self.buf):
moreBuf = self.conn.recv(1024)
if not moreBuf:
raise IOError("dead connection")
self.buf = self.buf + bytearray(moreBuf)
r = self.buf[:n]
self.buf = self.buf[n:]
return r

View File

@@ -0,0 +1,202 @@
import socket
import select
import sys
from wire import decode_varint, encode
from reader import BytesBuffer
from msg import RequestDecoder, message_types
# hold the asyncronous state of a connection
# ie. we may not get enough bytes on one read to decode the message
class Connection():
def __init__(self, fd, app):
self.fd = fd
self.app = app
self.recBuf = BytesBuffer(bytearray())
self.resBuf = BytesBuffer(bytearray())
self.msgLength = 0
self.decoder = RequestDecoder(self.recBuf)
self.inProgress = False # are we in the middle of a message
def recv(this):
data = this.fd.recv(1024)
if not data: # what about len(data) == 0
raise IOError("dead connection")
this.recBuf.write(data)
# ABCI server responds to messges by calling methods on the app
class ABCIServer():
def __init__(self, app, port=5410):
self.app = app
# map conn file descriptors to (app, reqBuf, resBuf, msgDecoder)
self.appMap = {}
self.port = port
self.listen_backlog = 10
self.listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.listener.setblocking(0)
self.listener.bind(('', port))
self.listener.listen(self.listen_backlog)
self.shutdown = False
self.read_list = [self.listener]
self.write_list = []
def handle_new_connection(self, r):
new_fd, new_addr = r.accept()
new_fd.setblocking(0) # non-blocking
self.read_list.append(new_fd)
self.write_list.append(new_fd)
print 'new connection to', new_addr
self.appMap[new_fd] = Connection(new_fd, self.app)
def handle_conn_closed(self, r):
self.read_list.remove(r)
self.write_list.remove(r)
r.close()
print "connection closed"
def handle_recv(self, r):
# app, recBuf, resBuf, conn
conn = self.appMap[r]
while True:
try:
print "recv loop"
# check if we need more data first
if conn.inProgress:
if (conn.msgLength == 0 or conn.recBuf.size() < conn.msgLength):
conn.recv()
else:
if conn.recBuf.size() == 0:
conn.recv()
conn.inProgress = True
# see if we have enough to get the message length
if conn.msgLength == 0:
ll = conn.recBuf.peek()
if conn.recBuf.size() < 1 + ll:
# we don't have enough bytes to read the length yet
return
print "decoding msg length"
conn.msgLength = decode_varint(conn.recBuf)
# see if we have enough to decode the message
if conn.recBuf.size() < conn.msgLength:
return
# now we can decode the message
# first read the request type and get the particular msg
# decoder
typeByte = conn.recBuf.read(1)
typeByte = int(typeByte[0])
resTypeByte = typeByte + 0x10
req_type = message_types[typeByte]
if req_type == "flush":
# messages are length prefixed
conn.resBuf.write(encode(1))
conn.resBuf.write([resTypeByte])
conn.fd.send(str(conn.resBuf.buf))
conn.msgLength = 0
conn.inProgress = False
conn.resBuf = BytesBuffer(bytearray())
return
decoder = getattr(conn.decoder, req_type)
print "decoding args"
req_args = decoder()
print "got args", req_args
# done decoding message
conn.msgLength = 0
conn.inProgress = False
req_f = getattr(conn.app, req_type)
if req_args is None:
res = req_f()
elif isinstance(req_args, tuple):
res = req_f(*req_args)
else:
res = req_f(req_args)
if isinstance(res, tuple):
res, ret_code = res
else:
ret_code = res
res = None
print "called", req_type, "ret code:", ret_code
if ret_code != 0:
print "non-zero retcode:", ret_code
if req_type in ("echo", "info"): # these dont return a ret code
enc = encode(res)
# messages are length prefixed
conn.resBuf.write(encode(len(enc) + 1))
conn.resBuf.write([resTypeByte])
conn.resBuf.write(enc)
else:
enc, encRet = encode(res), encode(ret_code)
# messages are length prefixed
conn.resBuf.write(encode(len(enc) + len(encRet) + 1))
conn.resBuf.write([resTypeByte])
conn.resBuf.write(encRet)
conn.resBuf.write(enc)
except TypeError as e:
print "TypeError on reading from connection:", e
self.handle_conn_closed(r)
return
except ValueError as e:
print "ValueError on reading from connection:", e
self.handle_conn_closed(r)
return
except IOError as e:
print "IOError on reading from connection:", e
self.handle_conn_closed(r)
return
except Exception as e:
# sys.exc_info()[0] # TODO better
print "error reading from connection", str(e)
self.handle_conn_closed(r)
return
def main_loop(self):
while not self.shutdown:
r_list, w_list, _ = select.select(
self.read_list, self.write_list, [], 2.5)
for r in r_list:
if (r == self.listener):
try:
self.handle_new_connection(r)
# undo adding to read list ...
except NameError as e:
print "Could not connect due to NameError:", e
except TypeError as e:
print "Could not connect due to TypeError:", e
except:
print "Could not connect due to unexpected error:", sys.exc_info()[0]
else:
self.handle_recv(r)
def handle_shutdown(self):
for r in self.read_list:
r.close()
for w in self.write_list:
try:
w.close()
except Exception as e:
print(e) # TODO: add logging
self.shutdown = True

View File

@@ -0,0 +1,115 @@
# the decoder works off a reader
# the encoder returns bytearray
def hex2bytes(h):
return bytearray(h.decode('hex'))
def bytes2hex(b):
if type(b) in (str, unicode):
return "".join([hex(ord(c))[2:].zfill(2) for c in b])
else:
return bytes2hex(b.decode())
# expects uvarint64 (no crazy big nums!)
def uvarint_size(i):
if i == 0:
return 0
for j in xrange(1, 8):
if i < 1 << j * 8:
return j
return 8
# expects i < 2**size
def encode_big_endian(i, size):
if size == 0:
return bytearray()
return encode_big_endian(i / 256, size - 1) + bytearray([i % 256])
def decode_big_endian(reader, size):
if size == 0:
return 0
firstByte = reader.read(1)[0]
return firstByte * (256 ** (size - 1)) + decode_big_endian(reader, size - 1)
# ints are max 16 bytes long
def encode_varint(i):
negate = False
if i < 0:
negate = True
i = -i
size = uvarint_size(i)
if size == 0:
return bytearray([0])
big_end = encode_big_endian(i, size)
if negate:
size += 0xF0
return bytearray([size]) + big_end
# returns the int and whats left of the byte array
def decode_varint(reader):
size = reader.read(1)[0]
if size == 0:
return 0
negate = True if size > int(0xF0) else False
if negate:
size = size - 0xF0
i = decode_big_endian(reader, size)
if negate:
i = i * (-1)
return i
def encode_string(s):
size = encode_varint(len(s))
return size + bytearray(s)
def decode_string(reader):
length = decode_varint(reader)
return str(reader.read(length))
def encode_list(s):
b = bytearray()
map(b.extend, map(encode, s))
return encode_varint(len(s)) + b
def encode(s):
if s is None:
return bytearray()
if isinstance(s, int):
return encode_varint(s)
elif isinstance(s, str):
return encode_string(s)
elif isinstance(s, list):
return encode_list(s)
else:
print "UNSUPPORTED TYPE!", type(s), s
if __name__ == '__main__':
ns = [100, 100, 1000, 256]
ss = [2, 5, 5, 2]
bs = map(encode_big_endian, ns, ss)
ds = map(decode_big_endian, bs, ss)
print ns
print [i[0] for i in ds]
ss = ["abc", "hi there jim", "ok now what"]
e = map(encode_string, ss)
d = map(decode_string, e)
print ss
print [i[0] for i in d]

View File

@@ -0,0 +1,82 @@
import sys
from abci.wire import hex2bytes, decode_big_endian, encode_big_endian
from abci.server import ABCIServer
from abci.reader import BytesBuffer
class CounterApplication():
def __init__(self):
sys.exit("The python example is out of date. Upgrading the Python examples is currently left as an exercise to you.")
self.hashCount = 0
self.txCount = 0
self.serial = False
def echo(self, msg):
return msg, 0
def info(self):
return ["hashes:%d, txs:%d" % (self.hashCount, self.txCount)], 0
def set_option(self, key, value):
if key == "serial" and value == "on":
self.serial = True
return 0
def deliver_tx(self, txBytes):
if self.serial:
txByteArray = bytearray(txBytes)
if len(txBytes) >= 2 and txBytes[:2] == "0x":
txByteArray = hex2bytes(txBytes[2:])
txValue = decode_big_endian(
BytesBuffer(txByteArray), len(txBytes))
if txValue != self.txCount:
return None, 6
self.txCount += 1
return None, 0
def check_tx(self, txBytes):
if self.serial:
txByteArray = bytearray(txBytes)
if len(txBytes) >= 2 and txBytes[:2] == "0x":
txByteArray = hex2bytes(txBytes[2:])
txValue = decode_big_endian(
BytesBuffer(txByteArray), len(txBytes))
if txValue < self.txCount:
return 6
return 0
def commit(self):
self.hashCount += 1
if self.txCount == 0:
return "", 0
h = encode_big_endian(self.txCount, 8)
h.reverse()
return str(h), 0
def add_listener(self):
return 0
def rm_listener(self):
return 0
def event(self):
return
if __name__ == '__main__':
l = len(sys.argv)
if l == 1:
port = 26658
elif l == 2:
port = int(sys.argv[1])
else:
print "too many arguments"
quit()
print 'ABCI Demo APP (Python)'
app = CounterApplication()
server = ABCIServer(app, port)
server.main_loop()

View File

View File

@@ -0,0 +1,50 @@
from .wire import decode_string
# map type_byte to message name
message_types = {
0x01: "echo",
0x02: "flush",
0x03: "info",
0x04: "set_option",
0x21: "deliver_tx",
0x22: "check_tx",
0x23: "commit",
0x24: "add_listener",
0x25: "rm_listener",
}
# return the decoded arguments of abci messages
class RequestDecoder():
def __init__(self, reader):
self.reader = reader
def echo(self):
return decode_string(self.reader)
def flush(self):
return
def info(self):
return
def set_option(self):
return decode_string(self.reader), decode_string(self.reader)
def deliver_tx(self):
return decode_string(self.reader)
def check_tx(self):
return decode_string(self.reader)
def commit(self):
return
def add_listener(self):
# TODO
return
def rm_listener(self):
# TODO
return

View File

@@ -0,0 +1,56 @@
# Simple read() method around a bytearray
class BytesBuffer():
def __init__(self, b):
self.buf = b
self.readCount = 0
def count(self):
return self.readCount
def reset_count(self):
self.readCount = 0
def size(self):
return len(self.buf)
def peek(self):
return self.buf[0]
def write(self, b):
# b should be castable to byte array
self.buf += bytearray(b)
def read(self, n):
if len(self.buf) < n:
print("reader err: buf less than n")
# TODO: exception
return
self.readCount += n
r = self.buf[:n]
self.buf = self.buf[n:]
return r
# Buffer bytes off a tcp connection and read them off in chunks
class ConnReader():
def __init__(self, conn):
self.conn = conn
self.buf = bytearray()
# blocking
def read(self, n):
while n > len(self.buf):
moreBuf = self.conn.recv(1024)
if not moreBuf:
raise IOError("dead connection")
self.buf = self.buf + bytearray(moreBuf)
r = self.buf[:n]
self.buf = self.buf[n:]
return r

View File

@@ -0,0 +1,196 @@
import socket
import select
import sys
import logging
from .wire import decode_varint, encode
from .reader import BytesBuffer
from .msg import RequestDecoder, message_types
# hold the asyncronous state of a connection
# ie. we may not get enough bytes on one read to decode the message
logger = logging.getLogger(__name__)
class Connection():
def __init__(self, fd, app):
self.fd = fd
self.app = app
self.recBuf = BytesBuffer(bytearray())
self.resBuf = BytesBuffer(bytearray())
self.msgLength = 0
self.decoder = RequestDecoder(self.recBuf)
self.inProgress = False # are we in the middle of a message
def recv(this):
data = this.fd.recv(1024)
if not data: # what about len(data) == 0
raise IOError("dead connection")
this.recBuf.write(data)
# ABCI server responds to messges by calling methods on the app
class ABCIServer():
def __init__(self, app, port=5410):
self.app = app
# map conn file descriptors to (app, reqBuf, resBuf, msgDecoder)
self.appMap = {}
self.port = port
self.listen_backlog = 10
self.listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.listener.setblocking(0)
self.listener.bind(('', port))
self.listener.listen(self.listen_backlog)
self.shutdown = False
self.read_list = [self.listener]
self.write_list = []
def handle_new_connection(self, r):
new_fd, new_addr = r.accept()
new_fd.setblocking(0) # non-blocking
self.read_list.append(new_fd)
self.write_list.append(new_fd)
print('new connection to', new_addr)
self.appMap[new_fd] = Connection(new_fd, self.app)
def handle_conn_closed(self, r):
self.read_list.remove(r)
self.write_list.remove(r)
r.close()
print("connection closed")
def handle_recv(self, r):
# app, recBuf, resBuf, conn
conn = self.appMap[r]
while True:
try:
print("recv loop")
# check if we need more data first
if conn.inProgress:
if (conn.msgLength == 0 or conn.recBuf.size() < conn.msgLength):
conn.recv()
else:
if conn.recBuf.size() == 0:
conn.recv()
conn.inProgress = True
# see if we have enough to get the message length
if conn.msgLength == 0:
ll = conn.recBuf.peek()
if conn.recBuf.size() < 1 + ll:
# we don't have enough bytes to read the length yet
return
print("decoding msg length")
conn.msgLength = decode_varint(conn.recBuf)
# see if we have enough to decode the message
if conn.recBuf.size() < conn.msgLength:
return
# now we can decode the message
# first read the request type and get the particular msg
# decoder
typeByte = conn.recBuf.read(1)
typeByte = int(typeByte[0])
resTypeByte = typeByte + 0x10
req_type = message_types[typeByte]
if req_type == "flush":
# messages are length prefixed
conn.resBuf.write(encode(1))
conn.resBuf.write([resTypeByte])
conn.fd.send(conn.resBuf.buf)
conn.msgLength = 0
conn.inProgress = False
conn.resBuf = BytesBuffer(bytearray())
return
decoder = getattr(conn.decoder, req_type)
print("decoding args")
req_args = decoder()
print("got args", req_args)
# done decoding message
conn.msgLength = 0
conn.inProgress = False
req_f = getattr(conn.app, req_type)
if req_args is None:
res = req_f()
elif isinstance(req_args, tuple):
res = req_f(*req_args)
else:
res = req_f(req_args)
if isinstance(res, tuple):
res, ret_code = res
else:
ret_code = res
res = None
print("called", req_type, "ret code:", ret_code, 'res:', res)
if ret_code != 0:
print("non-zero retcode:", ret_code)
if req_type in ("echo", "info"): # these dont return a ret code
enc = encode(res)
# messages are length prefixed
conn.resBuf.write(encode(len(enc) + 1))
conn.resBuf.write([resTypeByte])
conn.resBuf.write(enc)
else:
enc, encRet = encode(res), encode(ret_code)
# messages are length prefixed
conn.resBuf.write(encode(len(enc) + len(encRet) + 1))
conn.resBuf.write([resTypeByte])
conn.resBuf.write(encRet)
conn.resBuf.write(enc)
except IOError as e:
print("IOError on reading from connection:", e)
self.handle_conn_closed(r)
return
except Exception as e:
logger.exception("error reading from connection")
self.handle_conn_closed(r)
return
def main_loop(self):
while not self.shutdown:
r_list, w_list, _ = select.select(
self.read_list, self.write_list, [], 2.5)
for r in r_list:
if (r == self.listener):
try:
self.handle_new_connection(r)
# undo adding to read list ...
except NameError as e:
print("Could not connect due to NameError:", e)
except TypeError as e:
print("Could not connect due to TypeError:", e)
except:
print("Could not connect due to unexpected error:", sys.exc_info()[0])
else:
self.handle_recv(r)
def handle_shutdown(self):
for r in self.read_list:
r.close()
for w in self.write_list:
try:
w.close()
except Exception as e:
print(e) # TODO: add logging
self.shutdown = True

View File

@@ -0,0 +1,119 @@
# the decoder works off a reader
# the encoder returns bytearray
def hex2bytes(h):
return bytearray(h.decode('hex'))
def bytes2hex(b):
if type(b) in (str, str):
return "".join([hex(ord(c))[2:].zfill(2) for c in b])
else:
return bytes2hex(b.decode())
# expects uvarint64 (no crazy big nums!)
def uvarint_size(i):
if i == 0:
return 0
for j in range(1, 8):
if i < 1 << j * 8:
return j
return 8
# expects i < 2**size
def encode_big_endian(i, size):
if size == 0:
return bytearray()
return encode_big_endian(i // 256, size - 1) + bytearray([i % 256])
def decode_big_endian(reader, size):
if size == 0:
return 0
firstByte = reader.read(1)[0]
return firstByte * (256 ** (size - 1)) + decode_big_endian(reader, size - 1)
# ints are max 16 bytes long
def encode_varint(i):
negate = False
if i < 0:
negate = True
i = -i
size = uvarint_size(i)
if size == 0:
return bytearray([0])
big_end = encode_big_endian(i, size)
if negate:
size += 0xF0
return bytearray([size]) + big_end
# returns the int and whats left of the byte array
def decode_varint(reader):
size = reader.read(1)[0]
if size == 0:
return 0
negate = True if size > int(0xF0) else False
if negate:
size = size - 0xF0
i = decode_big_endian(reader, size)
if negate:
i = i * (-1)
return i
def encode_string(s):
size = encode_varint(len(s))
return size + bytearray(s, 'utf8')
def decode_string(reader):
length = decode_varint(reader)
raw_data = reader.read(length)
return raw_data.decode()
def encode_list(s):
b = bytearray()
list(map(b.extend, list(map(encode, s))))
return encode_varint(len(s)) + b
def encode(s):
print('encoding', repr(s))
if s is None:
return bytearray()
if isinstance(s, int):
return encode_varint(s)
elif isinstance(s, str):
return encode_string(s)
elif isinstance(s, list):
return encode_list(s)
elif isinstance(s, bytearray):
return encode_string(s)
else:
print("UNSUPPORTED TYPE!", type(s), s)
if __name__ == '__main__':
ns = [100, 100, 1000, 256]
ss = [2, 5, 5, 2]
bs = list(map(encode_big_endian, ns, ss))
ds = list(map(decode_big_endian, bs, ss))
print(ns)
print([i[0] for i in ds])
ss = ["abc", "hi there jim", "ok now what"]
e = list(map(encode_string, ss))
d = list(map(decode_string, e))
print(ss)
print([i[0] for i in d])

View File

@@ -0,0 +1,82 @@
import sys
from abci.wire import hex2bytes, decode_big_endian, encode_big_endian
from abci.server import ABCIServer
from abci.reader import BytesBuffer
class CounterApplication():
def __init__(self):
sys.exit("The python example is out of date. Upgrading the Python examples is currently left as an exercise to you.")
self.hashCount = 0
self.txCount = 0
self.serial = False
def echo(self, msg):
return msg, 0
def info(self):
return ["hashes:%d, txs:%d" % (self.hashCount, self.txCount)], 0
def set_option(self, key, value):
if key == "serial" and value == "on":
self.serial = True
return 0
def deliver_tx(self, txBytes):
if self.serial:
txByteArray = bytearray(txBytes)
if len(txBytes) >= 2 and txBytes[:2] == "0x":
txByteArray = hex2bytes(txBytes[2:])
txValue = decode_big_endian(
BytesBuffer(txByteArray), len(txBytes))
if txValue != self.txCount:
return None, 6
self.txCount += 1
return None, 0
def check_tx(self, txBytes):
if self.serial:
txByteArray = bytearray(txBytes)
if len(txBytes) >= 2 and txBytes[:2] == "0x":
txByteArray = hex2bytes(txBytes[2:])
txValue = decode_big_endian(
BytesBuffer(txByteArray), len(txBytes))
if txValue < self.txCount:
return 6
return 0
def commit(self):
self.hashCount += 1
if self.txCount == 0:
return "", 0
h = encode_big_endian(self.txCount, 8)
h.reverse()
return h.decode(), 0
def add_listener(self):
return 0
def rm_listener(self):
return 0
def event(self):
return
if __name__ == '__main__':
l = len(sys.argv)
if l == 1:
port = 26658
elif l == 2:
port = int(sys.argv[1])
else:
print("too many arguments")
quit()
print('ABCI Demo APP (Python)')
app = CounterApplication()
server = ABCIServer(app, port)
server.main_loop()

View File

@@ -0,0 +1,57 @@
package server
import (
"net"
"google.golang.org/grpc"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
type GRPCServer struct {
cmn.BaseService
proto string
addr string
listener net.Listener
server *grpc.Server
app types.ABCIApplicationServer
}
// NewGRPCServer returns a new gRPC ABCI server
func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) cmn.Service {
proto, addr := cmn.ProtocolAndAddress(protoAddr)
s := &GRPCServer{
proto: proto,
addr: addr,
listener: nil,
app: app,
}
s.BaseService = *cmn.NewBaseService(nil, "ABCIServer", s)
return s
}
// OnStart starts the gRPC service
func (s *GRPCServer) OnStart() error {
if err := s.BaseService.OnStart(); err != nil {
return err
}
ln, err := net.Listen(s.proto, s.addr)
if err != nil {
return err
}
s.Logger.Info("Listening", "proto", s.proto, "addr", s.addr)
s.listener = ln
s.server = grpc.NewServer()
types.RegisterABCIApplicationServer(s.server, s.app)
go s.server.Serve(s.listener)
return nil
}
// OnStop stops the gRPC server
func (s *GRPCServer) OnStop() {
s.BaseService.OnStop()
s.server.Stop()
}

31
abci/server/server.go Normal file
View File

@@ -0,0 +1,31 @@
/*
Package server is used to start a new ABCI server.
It contains two server implementation:
* gRPC server
* socket server
*/
package server
import (
"fmt"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
func NewServer(protoAddr, transport string, app types.Application) (cmn.Service, error) {
var s cmn.Service
var err error
switch transport {
case "socket":
s = NewSocketServer(protoAddr, app)
case "grpc":
s = NewGRPCServer(protoAddr, types.NewGRPCApplication(app))
default:
err = fmt.Errorf("Unknown server type %s", transport)
}
return s, err
}

View File

@@ -0,0 +1,226 @@
package server
import (
"bufio"
"fmt"
"io"
"net"
"sync"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
// var maxNumberConnections = 2
type SocketServer struct {
cmn.BaseService
proto string
addr string
listener net.Listener
connsMtx sync.Mutex
conns map[int]net.Conn
nextConnID int
appMtx sync.Mutex
app types.Application
}
func NewSocketServer(protoAddr string, app types.Application) cmn.Service {
proto, addr := cmn.ProtocolAndAddress(protoAddr)
s := &SocketServer{
proto: proto,
addr: addr,
listener: nil,
app: app,
conns: make(map[int]net.Conn),
}
s.BaseService = *cmn.NewBaseService(nil, "ABCIServer", s)
return s
}
func (s *SocketServer) OnStart() error {
if err := s.BaseService.OnStart(); err != nil {
return err
}
ln, err := net.Listen(s.proto, s.addr)
if err != nil {
return err
}
s.listener = ln
go s.acceptConnectionsRoutine()
return nil
}
func (s *SocketServer) OnStop() {
s.BaseService.OnStop()
if err := s.listener.Close(); err != nil {
s.Logger.Error("Error closing listener", "err", err)
}
s.connsMtx.Lock()
defer s.connsMtx.Unlock()
for id, conn := range s.conns {
delete(s.conns, id)
if err := conn.Close(); err != nil {
s.Logger.Error("Error closing connection", "id", id, "conn", conn, "err", err)
}
}
}
func (s *SocketServer) addConn(conn net.Conn) int {
s.connsMtx.Lock()
defer s.connsMtx.Unlock()
connID := s.nextConnID
s.nextConnID++
s.conns[connID] = conn
return connID
}
// deletes conn even if close errs
func (s *SocketServer) rmConn(connID int) error {
s.connsMtx.Lock()
defer s.connsMtx.Unlock()
conn, ok := s.conns[connID]
if !ok {
return fmt.Errorf("Connection %d does not exist", connID)
}
delete(s.conns, connID)
return conn.Close()
}
func (s *SocketServer) acceptConnectionsRoutine() {
for {
// Accept a connection
s.Logger.Info("Waiting for new connection...")
conn, err := s.listener.Accept()
if err != nil {
if !s.IsRunning() {
return // Ignore error from listener closing.
}
s.Logger.Error("Failed to accept connection: " + err.Error())
continue
}
s.Logger.Info("Accepted a new connection")
connID := s.addConn(conn)
closeConn := make(chan error, 2) // Push to signal connection closed
responses := make(chan *types.Response, 1000) // A channel to buffer responses
// Read requests from conn and deal with them
go s.handleRequests(closeConn, conn, responses)
// Pull responses from 'responses' and write them to conn.
go s.handleResponses(closeConn, conn, responses)
// Wait until signal to close connection
go s.waitForClose(closeConn, connID)
}
}
func (s *SocketServer) waitForClose(closeConn chan error, connID int) {
err := <-closeConn
if err == io.EOF {
s.Logger.Error("Connection was closed by client")
} else if err != nil {
s.Logger.Error("Connection error", "error", err)
} else {
// never happens
s.Logger.Error("Connection was closed.")
}
// Close the connection
if err := s.rmConn(connID); err != nil {
s.Logger.Error("Error in closing connection", "error", err)
}
}
// Read requests from conn and deal with them
func (s *SocketServer) handleRequests(closeConn chan error, conn net.Conn, responses chan<- *types.Response) {
var count int
var bufReader = bufio.NewReader(conn)
for {
var req = &types.Request{}
err := types.ReadMessage(bufReader, req)
if err != nil {
if err == io.EOF {
closeConn <- err
} else {
closeConn <- fmt.Errorf("Error reading message: %v", err.Error())
}
return
}
s.appMtx.Lock()
count++
s.handleRequest(req, responses)
s.appMtx.Unlock()
}
}
func (s *SocketServer) handleRequest(req *types.Request, responses chan<- *types.Response) {
switch r := req.Value.(type) {
case *types.Request_Echo:
responses <- types.ToResponseEcho(r.Echo.Message)
case *types.Request_Flush:
responses <- types.ToResponseFlush()
case *types.Request_Info:
res := s.app.Info(*r.Info)
responses <- types.ToResponseInfo(res)
case *types.Request_SetOption:
res := s.app.SetOption(*r.SetOption)
responses <- types.ToResponseSetOption(res)
case *types.Request_DeliverTx:
res := s.app.DeliverTx(r.DeliverTx.Tx)
responses <- types.ToResponseDeliverTx(res)
case *types.Request_CheckTx:
res := s.app.CheckTx(r.CheckTx.Tx)
responses <- types.ToResponseCheckTx(res)
case *types.Request_Commit:
res := s.app.Commit()
responses <- types.ToResponseCommit(res)
case *types.Request_Query:
res := s.app.Query(*r.Query)
responses <- types.ToResponseQuery(res)
case *types.Request_InitChain:
res := s.app.InitChain(*r.InitChain)
responses <- types.ToResponseInitChain(res)
case *types.Request_BeginBlock:
res := s.app.BeginBlock(*r.BeginBlock)
responses <- types.ToResponseBeginBlock(res)
case *types.Request_EndBlock:
res := s.app.EndBlock(*r.EndBlock)
responses <- types.ToResponseEndBlock(res)
default:
responses <- types.ToResponseException("Unknown request")
}
}
// Pull responses from 'responses' and write them to conn.
func (s *SocketServer) handleResponses(closeConn chan error, conn net.Conn, responses <-chan *types.Response) {
var count int
var bufWriter = bufio.NewWriter(conn)
for {
var res = <-responses
err := types.WriteMessage(res, bufWriter)
if err != nil {
closeConn <- fmt.Errorf("Error writing message: %v", err.Error())
return
}
if _, ok := res.Value.(*types.Response_Flush); ok {
err = bufWriter.Flush()
if err != nil {
closeConn <- fmt.Errorf("Error flushing write buffer: %v", err.Error())
return
}
}
count++
}
}

View File

@@ -0,0 +1 @@
package benchmarks

View File

@@ -0,0 +1,55 @@
package main
import (
"bufio"
"fmt"
"log"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
func main() {
conn, err := cmn.Connect("unix://test.sock")
if err != nil {
log.Fatal(err.Error())
}
// Read a bunch of responses
go func() {
counter := 0
for {
var res = &types.Response{}
err := types.ReadMessage(conn, res)
if err != nil {
log.Fatal(err.Error())
}
counter++
if counter%1000 == 0 {
fmt.Println("Read", counter)
}
}
}()
// Write a bunch of requests
counter := 0
for i := 0; ; i++ {
var bufWriter = bufio.NewWriter(conn)
var req = types.ToRequestEcho("foobar")
err := types.WriteMessage(req, bufWriter)
if err != nil {
log.Fatal(err.Error())
}
err = bufWriter.Flush()
if err != nil {
log.Fatal(err.Error())
}
counter++
if counter%1000 == 0 {
fmt.Println("Write", counter)
}
}
}

View File

@@ -0,0 +1,69 @@
package main
import (
"bufio"
"fmt"
"log"
"net"
"reflect"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
func main() {
conn, err := cmn.Connect("unix://test.sock")
if err != nil {
log.Fatal(err.Error())
}
// Make a bunch of requests
counter := 0
for i := 0; ; i++ {
req := types.ToRequestEcho("foobar")
_, err := makeRequest(conn, req)
if err != nil {
log.Fatal(err.Error())
}
counter++
if counter%1000 == 0 {
fmt.Println(counter)
}
}
}
func makeRequest(conn net.Conn, req *types.Request) (*types.Response, error) {
var bufWriter = bufio.NewWriter(conn)
// Write desired request
err := types.WriteMessage(req, bufWriter)
if err != nil {
return nil, err
}
err = types.WriteMessage(types.ToRequestFlush(), bufWriter)
if err != nil {
return nil, err
}
err = bufWriter.Flush()
if err != nil {
return nil, err
}
// Read desired response
var res = &types.Response{}
err = types.ReadMessage(conn, res)
if err != nil {
return nil, err
}
var resFlush = &types.Response{}
err = types.ReadMessage(conn, resFlush)
if err != nil {
return nil, err
}
if _, ok := resFlush.Value.(*types.Response_Flush); !ok {
return nil, fmt.Errorf("Expected flush response but got something else: %v", reflect.TypeOf(resFlush))
}
return res, nil
}

View File

@@ -0,0 +1,27 @@
package tests
import (
"testing"
"github.com/stretchr/testify/assert"
abciclient "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/example/kvstore"
abciserver "github.com/tendermint/tendermint/abci/server"
)
func TestClientServerNoAddrPrefix(t *testing.T) {
addr := "localhost:26658"
transport := "socket"
app := kvstore.NewKVStoreApplication()
server, err := abciserver.NewServer(addr, transport, app)
assert.NoError(t, err, "expected no error on NewServer")
err = server.Start()
assert.NoError(t, err, "expected no error on server.Start")
client, err := abciclient.NewClient(addr, transport, true)
assert.NoError(t, err, "expected no error on NewClient")
err = client.Start()
assert.NoError(t, err, "expected no error on client.Start")
}

View File

@@ -0,0 +1,96 @@
package testsuite
import (
"bytes"
"errors"
"fmt"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
func InitChain(client abcicli.Client) error {
total := 10
vals := make([]types.Validator, total)
for i := 0; i < total; i++ {
pubkey := cmn.RandBytes(33)
power := cmn.RandInt()
vals[i] = types.Ed25519Validator(pubkey, int64(power))
}
_, err := client.InitChainSync(types.RequestInitChain{
Validators: vals,
})
if err != nil {
fmt.Printf("Failed test: InitChain - %v\n", err)
return err
}
fmt.Println("Passed test: InitChain")
return nil
}
func SetOption(client abcicli.Client, key, value string) error {
_, err := client.SetOptionSync(types.RequestSetOption{Key: key, Value: value})
if err != nil {
fmt.Println("Failed test: SetOption")
fmt.Printf("error while setting %v=%v: \nerror: %v\n", key, value, err)
return err
}
fmt.Println("Passed test: SetOption")
return nil
}
func Commit(client abcicli.Client, hashExp []byte) error {
res, err := client.CommitSync()
data := res.Data
if err != nil {
fmt.Println("Failed test: Commit")
fmt.Printf("error while committing: %v\n", err)
return err
}
if !bytes.Equal(data, hashExp) {
fmt.Println("Failed test: Commit")
fmt.Printf("Commit hash was unexpected. Got %X expected %X\n", data, hashExp)
return errors.New("CommitTx failed")
}
fmt.Println("Passed test: Commit")
return nil
}
func DeliverTx(client abcicli.Client, txBytes []byte, codeExp uint32, dataExp []byte) error {
res, _ := client.DeliverTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log
if code != codeExp {
fmt.Println("Failed test: DeliverTx")
fmt.Printf("DeliverTx response code was unexpected. Got %v expected %v. Log: %v\n",
code, codeExp, log)
return errors.New("DeliverTx error")
}
if !bytes.Equal(data, dataExp) {
fmt.Println("Failed test: DeliverTx")
fmt.Printf("DeliverTx response data was unexpected. Got %X expected %X\n",
data, dataExp)
return errors.New("DeliverTx error")
}
fmt.Println("Passed test: DeliverTx")
return nil
}
func CheckTx(client abcicli.Client, txBytes []byte, codeExp uint32, dataExp []byte) error {
res, _ := client.CheckTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log
if code != codeExp {
fmt.Println("Failed test: CheckTx")
fmt.Printf("CheckTx response code was unexpected. Got %v expected %v. Log: %v\n",
code, codeExp, log)
return errors.New("CheckTx")
}
if !bytes.Equal(data, dataExp) {
fmt.Println("Failed test: CheckTx")
fmt.Printf("CheckTx response data was unexpected. Got %X expected %X\n",
data, dataExp)
return errors.New("CheckTx")
}
fmt.Println("Passed test: CheckTx")
return nil
}

View File

@@ -0,0 +1,78 @@
package main
import (
"bytes"
"fmt"
"os"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
)
func startClient(abciType string) abcicli.Client {
// Start client
client, err := abcicli.NewClient("tcp://127.0.0.1:26658", abciType, true)
if err != nil {
panic(err.Error())
}
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
client.SetLogger(logger.With("module", "abcicli"))
if err := client.Start(); err != nil {
panicf("connecting to abci_app: %v", err.Error())
}
return client
}
func setOption(client abcicli.Client, key, value string) {
_, err := client.SetOptionSync(types.RequestSetOption{key, value})
if err != nil {
panicf("setting %v=%v: \nerr: %v", key, value, err)
}
}
func commit(client abcicli.Client, hashExp []byte) {
res, err := client.CommitSync()
if err != nil {
panicf("client error: %v", err)
}
if !bytes.Equal(res.Data, hashExp) {
panicf("Commit hash was unexpected. Got %X expected %X", res.Data, hashExp)
}
}
func deliverTx(client abcicli.Client, txBytes []byte, codeExp uint32, dataExp []byte) {
res, err := client.DeliverTxSync(txBytes)
if err != nil {
panicf("client error: %v", err)
}
if res.Code != codeExp {
panicf("DeliverTx response code was unexpected. Got %v expected %v. Log: %v", res.Code, codeExp, res.Log)
}
if !bytes.Equal(res.Data, dataExp) {
panicf("DeliverTx response data was unexpected. Got %X expected %X", res.Data, dataExp)
}
}
/*func checkTx(client abcicli.Client, txBytes []byte, codeExp uint32, dataExp []byte) {
res, err := client.CheckTxSync(txBytes)
if err != nil {
panicf("client error: %v", err)
}
if res.IsErr() {
panicf("checking tx %X: %v\nlog: %v", txBytes, res.Log)
}
if res.Code != codeExp {
panicf("CheckTx response code was unexpected. Got %v expected %v. Log: %v",
res.Code, codeExp, res.Log)
}
if !bytes.Equal(res.Data, dataExp) {
panicf("CheckTx response data was unexpected. Got %X expected %X",
res.Data, dataExp)
}
}*/
func panicf(format string, a ...interface{}) {
panic(fmt.Sprintf(format, a...))
}

View File

@@ -0,0 +1,84 @@
package main
import (
"fmt"
"log"
"os"
"os/exec"
"time"
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
)
var abciType string
func init() {
abciType = os.Getenv("ABCI")
if abciType == "" {
abciType = "socket"
}
}
func main() {
testCounter()
}
const (
maxABCIConnectTries = 10
)
func ensureABCIIsUp(typ string, n int) error {
var err error
cmdString := "abci-cli echo hello"
if typ == "grpc" {
cmdString = "abci-cli --abci grpc echo hello"
}
for i := 0; i < n; i++ {
cmd := exec.Command("bash", "-c", cmdString) // nolint: gas
_, err = cmd.CombinedOutput()
if err == nil {
break
}
<-time.After(500 * time.Millisecond)
}
return err
}
func testCounter() {
abciApp := os.Getenv("ABCI_APP")
if abciApp == "" {
panic("No ABCI_APP specified")
}
fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType)
cmd := exec.Command("bash", "-c", fmt.Sprintf("abci-cli %s", abciApp)) // nolint: gas
cmd.Stdout = os.Stdout
if err := cmd.Start(); err != nil {
log.Fatalf("starting %q err: %v", abciApp, err)
}
defer cmd.Wait()
defer cmd.Process.Kill()
if err := ensureABCIIsUp(abciType, maxABCIConnectTries); err != nil {
log.Fatalf("echo failed: %v", err)
}
client := startClient(abciType)
defer client.Stop()
setOption(client, "serial", "on")
commit(client, nil)
deliverTx(client, []byte("abc"), code.CodeTypeBadNonce, nil)
commit(client, nil)
deliverTx(client, []byte{0x00}, types.CodeTypeOK, nil)
commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1})
deliverTx(client, []byte{0x00}, code.CodeTypeBadNonce, nil)
deliverTx(client, []byte{0x01}, types.CodeTypeOK, nil)
deliverTx(client, []byte{0x00, 0x02}, types.CodeTypeOK, nil)
deliverTx(client, []byte{0x00, 0x03}, types.CodeTypeOK, nil)
deliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeTypeOK, nil)
deliverTx(client, []byte{0x00, 0x00, 0x06}, code.CodeTypeBadNonce, nil)
commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5})
}

27
abci/tests/test_app/test.sh Executable file
View File

@@ -0,0 +1,27 @@
#! /bin/bash
set -e
# These tests spawn the counter app and server by execing the ABCI_APP command and run some simple client tests against it
# Get the directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Change into that dir because we expect that.
cd "$DIR"
echo "RUN COUNTER OVER SOCKET"
# test golang counter
ABCI_APP="counter" go run ./*.go
echo "----------------------"
echo "RUN COUNTER OVER GRPC"
# test golang counter via grpc
ABCI_APP="counter --abci=grpc" ABCI="grpc" go run ./*.go
echo "----------------------"
# test nodejs counter
# TODO: fix node app
#ABCI_APP="node $GOPATH/src/github.com/tendermint/js-abci/example/app.js" go test -test.run TestCounter

View File

@@ -0,0 +1,10 @@
echo hello
info
commit
deliver_tx "abc"
info
commit
query "abc"
deliver_tx "def=xyz"
commit
query "def"

View File

@@ -0,0 +1,47 @@
> echo hello
-> code: OK
-> data: hello
-> data.hex: 0x68656C6C6F
> info
-> code: OK
-> data: {"size":0}
-> data.hex: 0x7B2273697A65223A307D
> commit
-> code: OK
-> data.hex: 0x0000000000000000
> deliver_tx "abc"
-> code: OK
> info
-> code: OK
-> data: {"size":1}
-> data.hex: 0x7B2273697A65223A317D
> commit
-> code: OK
-> data.hex: 0x0200000000000000
> query "abc"
-> code: OK
-> log: exists
-> height: 0
-> value: abc
-> value.hex: 616263
> deliver_tx "def=xyz"
-> code: OK
> commit
-> code: OK
-> data.hex: 0x0400000000000000
> query "def"
-> code: OK
-> log: exists
-> height: 0
-> value: xyz
-> value.hex: 78797A

View File

@@ -0,0 +1,8 @@
set_option serial on
check_tx 0x00
check_tx 0xff
deliver_tx 0x00
check_tx 0x00
deliver_tx 0x01
deliver_tx 0x04
info

View File

@@ -0,0 +1,29 @@
> set_option serial on
-> code: OK
-> log: OK (SetOption doesn't return anything.)
> check_tx 0x00
-> code: OK
> check_tx 0xff
-> code: OK
> deliver_tx 0x00
-> code: OK
> check_tx 0x00
-> code: 2
-> log: Invalid nonce. Expected >= 1, got 0
> deliver_tx 0x01
-> code: OK
> deliver_tx 0x04
-> code: 2
-> log: Invalid nonce. Expected 2, got 4
> info
-> code: OK
-> data: {"hashes":0,"txs":2}
-> data.hex: 0x7B22686173686573223A302C22747873223A327D

42
abci/tests/test_cli/test.sh Executable file
View File

@@ -0,0 +1,42 @@
#! /bin/bash
set -e
# Get the root directory.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )"
# Change into that dir because we expect that.
cd "$DIR" || exit
function testExample() {
N=$1
INPUT=$2
APP="$3 $4"
echo "Example $N: $APP"
$APP &> /dev/null &
sleep 2
abci-cli --log_level=error --verbose batch < "$INPUT" > "${INPUT}.out.new"
killall "$3"
pre=$(shasum < "${INPUT}.out")
post=$(shasum < "${INPUT}.out.new")
if [[ "$pre" != "$post" ]]; then
echo "You broke the tutorial"
echo "Got:"
cat "${INPUT}.out.new"
echo "Expected:"
cat "${INPUT}.out"
exit 1
fi
rm "${INPUT}".out.new
}
testExample 1 tests/test_cli/ex1.abci abci-cli kvstore
testExample 2 tests/test_cli/ex2.abci abci-cli counter
echo ""
echo "PASS"

1
abci/tests/tests.go Normal file
View File

@@ -0,0 +1 @@
package tests

138
abci/types/application.go Normal file
View File

@@ -0,0 +1,138 @@
package types // nolint: goimports
import (
context "golang.org/x/net/context"
)
// Application is an interface that enables any finite, deterministic state machine
// to be driven by a blockchain-based replication engine via the ABCI.
// All methods take a RequestXxx argument and return a ResponseXxx argument,
// except CheckTx/DeliverTx, which take `tx []byte`, and `Commit`, which takes nothing.
type Application interface {
// Info/Query Connection
Info(RequestInfo) ResponseInfo // Return application info
SetOption(RequestSetOption) ResponseSetOption // Set application option
Query(RequestQuery) ResponseQuery // Query for state
// Mempool Connection
CheckTx(tx []byte) ResponseCheckTx // Validate a tx for the mempool
// Consensus Connection
InitChain(RequestInitChain) ResponseInitChain // Initialize blockchain with validators and other info from TendermintCore
BeginBlock(RequestBeginBlock) ResponseBeginBlock // Signals the beginning of a block
DeliverTx(tx []byte) ResponseDeliverTx // Deliver a tx for full processing
EndBlock(RequestEndBlock) ResponseEndBlock // Signals the end of a block, returns changes to the validator set
Commit() ResponseCommit // Commit the state and return the application Merkle root hash
}
//-------------------------------------------------------
// BaseApplication is a base form of Application
var _ Application = (*BaseApplication)(nil)
type BaseApplication struct {
}
func NewBaseApplication() *BaseApplication {
return &BaseApplication{}
}
func (BaseApplication) Info(req RequestInfo) ResponseInfo {
return ResponseInfo{}
}
func (BaseApplication) SetOption(req RequestSetOption) ResponseSetOption {
return ResponseSetOption{}
}
func (BaseApplication) DeliverTx(tx []byte) ResponseDeliverTx {
return ResponseDeliverTx{Code: CodeTypeOK}
}
func (BaseApplication) CheckTx(tx []byte) ResponseCheckTx {
return ResponseCheckTx{Code: CodeTypeOK}
}
func (BaseApplication) Commit() ResponseCommit {
return ResponseCommit{}
}
func (BaseApplication) Query(req RequestQuery) ResponseQuery {
return ResponseQuery{Code: CodeTypeOK}
}
func (BaseApplication) InitChain(req RequestInitChain) ResponseInitChain {
return ResponseInitChain{}
}
func (BaseApplication) BeginBlock(req RequestBeginBlock) ResponseBeginBlock {
return ResponseBeginBlock{}
}
func (BaseApplication) EndBlock(req RequestEndBlock) ResponseEndBlock {
return ResponseEndBlock{}
}
//-------------------------------------------------------
// GRPCApplication is a GRPC wrapper for Application
type GRPCApplication struct {
app Application
}
func NewGRPCApplication(app Application) *GRPCApplication {
return &GRPCApplication{app}
}
func (app *GRPCApplication) Echo(ctx context.Context, req *RequestEcho) (*ResponseEcho, error) {
return &ResponseEcho{req.Message}, nil
}
func (app *GRPCApplication) Flush(ctx context.Context, req *RequestFlush) (*ResponseFlush, error) {
return &ResponseFlush{}, nil
}
func (app *GRPCApplication) Info(ctx context.Context, req *RequestInfo) (*ResponseInfo, error) {
res := app.app.Info(*req)
return &res, nil
}
func (app *GRPCApplication) SetOption(ctx context.Context, req *RequestSetOption) (*ResponseSetOption, error) {
res := app.app.SetOption(*req)
return &res, nil
}
func (app *GRPCApplication) DeliverTx(ctx context.Context, req *RequestDeliverTx) (*ResponseDeliverTx, error) {
res := app.app.DeliverTx(req.Tx)
return &res, nil
}
func (app *GRPCApplication) CheckTx(ctx context.Context, req *RequestCheckTx) (*ResponseCheckTx, error) {
res := app.app.CheckTx(req.Tx)
return &res, nil
}
func (app *GRPCApplication) Query(ctx context.Context, req *RequestQuery) (*ResponseQuery, error) {
res := app.app.Query(*req)
return &res, nil
}
func (app *GRPCApplication) Commit(ctx context.Context, req *RequestCommit) (*ResponseCommit, error) {
res := app.app.Commit()
return &res, nil
}
func (app *GRPCApplication) InitChain(ctx context.Context, req *RequestInitChain) (*ResponseInitChain, error) {
res := app.app.InitChain(*req)
return &res, nil
}
func (app *GRPCApplication) BeginBlock(ctx context.Context, req *RequestBeginBlock) (*ResponseBeginBlock, error) {
res := app.app.BeginBlock(*req)
return &res, nil
}
func (app *GRPCApplication) EndBlock(ctx context.Context, req *RequestEndBlock) (*ResponseEndBlock, error) {
res := app.app.EndBlock(*req)
return &res, nil
}

210
abci/types/messages.go Normal file
View File

@@ -0,0 +1,210 @@
package types
import (
"bufio"
"encoding/binary"
"io"
"github.com/gogo/protobuf/proto"
)
const (
maxMsgSize = 104857600 // 100MB
)
// WriteMessage writes a varint length-delimited protobuf message.
func WriteMessage(msg proto.Message, w io.Writer) error {
bz, err := proto.Marshal(msg)
if err != nil {
return err
}
return encodeByteSlice(w, bz)
}
// ReadMessage reads a varint length-delimited protobuf message.
func ReadMessage(r io.Reader, msg proto.Message) error {
return readProtoMsg(r, msg, maxMsgSize)
}
func readProtoMsg(r io.Reader, msg proto.Message, maxSize int) error {
// binary.ReadVarint takes an io.ByteReader, eg. a bufio.Reader
reader, ok := r.(*bufio.Reader)
if !ok {
reader = bufio.NewReader(r)
}
length64, err := binary.ReadVarint(reader)
if err != nil {
return err
}
length := int(length64)
if length < 0 || length > maxSize {
return io.ErrShortBuffer
}
buf := make([]byte, length)
if _, err := io.ReadFull(reader, buf); err != nil {
return err
}
return proto.Unmarshal(buf, msg)
}
//-----------------------------------------------------------------------
// NOTE: we copied wire.EncodeByteSlice from go-wire rather than keep
// go-wire as a dep
func encodeByteSlice(w io.Writer, bz []byte) (err error) {
err = encodeVarint(w, int64(len(bz)))
if err != nil {
return
}
_, err = w.Write(bz)
return
}
func encodeVarint(w io.Writer, i int64) (err error) {
var buf [10]byte
n := binary.PutVarint(buf[:], i)
_, err = w.Write(buf[0:n])
return
}
//----------------------------------------
func ToRequestEcho(message string) *Request {
return &Request{
Value: &Request_Echo{&RequestEcho{message}},
}
}
func ToRequestFlush() *Request {
return &Request{
Value: &Request_Flush{&RequestFlush{}},
}
}
func ToRequestInfo(req RequestInfo) *Request {
return &Request{
Value: &Request_Info{&req},
}
}
func ToRequestSetOption(req RequestSetOption) *Request {
return &Request{
Value: &Request_SetOption{&req},
}
}
func ToRequestDeliverTx(tx []byte) *Request {
return &Request{
Value: &Request_DeliverTx{&RequestDeliverTx{tx}},
}
}
func ToRequestCheckTx(tx []byte) *Request {
return &Request{
Value: &Request_CheckTx{&RequestCheckTx{tx}},
}
}
func ToRequestCommit() *Request {
return &Request{
Value: &Request_Commit{&RequestCommit{}},
}
}
func ToRequestQuery(req RequestQuery) *Request {
return &Request{
Value: &Request_Query{&req},
}
}
func ToRequestInitChain(req RequestInitChain) *Request {
return &Request{
Value: &Request_InitChain{&req},
}
}
func ToRequestBeginBlock(req RequestBeginBlock) *Request {
return &Request{
Value: &Request_BeginBlock{&req},
}
}
func ToRequestEndBlock(req RequestEndBlock) *Request {
return &Request{
Value: &Request_EndBlock{&req},
}
}
//----------------------------------------
func ToResponseException(errStr string) *Response {
return &Response{
Value: &Response_Exception{&ResponseException{errStr}},
}
}
func ToResponseEcho(message string) *Response {
return &Response{
Value: &Response_Echo{&ResponseEcho{message}},
}
}
func ToResponseFlush() *Response {
return &Response{
Value: &Response_Flush{&ResponseFlush{}},
}
}
func ToResponseInfo(res ResponseInfo) *Response {
return &Response{
Value: &Response_Info{&res},
}
}
func ToResponseSetOption(res ResponseSetOption) *Response {
return &Response{
Value: &Response_SetOption{&res},
}
}
func ToResponseDeliverTx(res ResponseDeliverTx) *Response {
return &Response{
Value: &Response_DeliverTx{&res},
}
}
func ToResponseCheckTx(res ResponseCheckTx) *Response {
return &Response{
Value: &Response_CheckTx{&res},
}
}
func ToResponseCommit(res ResponseCommit) *Response {
return &Response{
Value: &Response_Commit{&res},
}
}
func ToResponseQuery(res ResponseQuery) *Response {
return &Response{
Value: &Response_Query{&res},
}
}
func ToResponseInitChain(res ResponseInitChain) *Response {
return &Response{
Value: &Response_InitChain{&res},
}
}
func ToResponseBeginBlock(res ResponseBeginBlock) *Response {
return &Response{
Value: &Response_BeginBlock{&res},
}
}
func ToResponseEndBlock(res ResponseEndBlock) *Response {
return &Response{
Value: &Response_EndBlock{&res},
}
}

104
abci/types/messages_test.go Normal file
View File

@@ -0,0 +1,104 @@
package types
import (
"bytes"
"encoding/json"
"strings"
"testing"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
cmn "github.com/tendermint/tendermint/libs/common"
)
func TestMarshalJSON(t *testing.T) {
b, err := json.Marshal(&ResponseDeliverTx{})
assert.Nil(t, err)
// Do not include empty fields.
assert.False(t, strings.Contains(string(b), "code"))
r1 := ResponseCheckTx{
Code: 1,
Data: []byte("hello"),
GasWanted: 43,
Tags: []cmn.KVPair{
{[]byte("pho"), []byte("bo")},
},
}
b, err = json.Marshal(&r1)
assert.Nil(t, err)
var r2 ResponseCheckTx
err = json.Unmarshal(b, &r2)
assert.Nil(t, err)
assert.Equal(t, r1, r2)
}
func TestWriteReadMessageSimple(t *testing.T) {
cases := []proto.Message{
&RequestEcho{
Message: "Hello",
},
}
for _, c := range cases {
buf := new(bytes.Buffer)
err := WriteMessage(c, buf)
assert.Nil(t, err)
msg := new(RequestEcho)
err = ReadMessage(buf, msg)
assert.Nil(t, err)
assert.Equal(t, c, msg)
}
}
func TestWriteReadMessage(t *testing.T) {
cases := []proto.Message{
&Header{
NumTxs: 4,
},
// TODO: add the rest
}
for _, c := range cases {
buf := new(bytes.Buffer)
err := WriteMessage(c, buf)
assert.Nil(t, err)
msg := new(Header)
err = ReadMessage(buf, msg)
assert.Nil(t, err)
assert.Equal(t, c, msg)
}
}
func TestWriteReadMessage2(t *testing.T) {
phrase := "hello-world"
cases := []proto.Message{
&ResponseCheckTx{
Data: []byte(phrase),
Log: phrase,
GasWanted: 10,
Tags: []cmn.KVPair{
cmn.KVPair{[]byte("abc"), []byte("def")},
},
// Fee: cmn.KI64Pair{
},
// TODO: add the rest
}
for _, c := range cases {
buf := new(bytes.Buffer)
err := WriteMessage(c, buf)
assert.Nil(t, err)
msg := new(ResponseCheckTx)
err = ReadMessage(buf, msg)
assert.Nil(t, err)
assert.Equal(t, c, msg)
}
}

View File

@@ -0,0 +1,55 @@
// +build ignore
package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"regexp"
"strings"
)
// This script replaces most `[]byte` with `data.Bytes` in a `.pb.go` file.
// It was written before we realized we could use `gogo/protobuf` to achieve
// this more natively. So it's here for safe keeping in case we ever need to
// abandon `gogo/protobuf`.
func main() {
bytePattern := regexp.MustCompile("[[][]]byte")
const oldPath = "types/types.pb.go"
const tmpPath = "types/types.pb.new"
content, err := ioutil.ReadFile(oldPath)
if err != nil {
panic("cannot read " + oldPath)
os.Exit(1)
}
lines := bytes.Split(content, []byte("\n"))
outFile, _ := os.Create(tmpPath)
wroteImport := false
for _, line_bytes := range lines {
line := string(line_bytes)
gotPackageLine := strings.HasPrefix(line, "package ")
writeImportTime := strings.HasPrefix(line, "import ")
containsDescriptor := strings.Contains(line, "Descriptor")
containsByteArray := strings.Contains(line, "[]byte")
if containsByteArray && !containsDescriptor {
line = string(bytePattern.ReplaceAll([]byte(line), []byte("data.Bytes")))
}
if writeImportTime && !wroteImport {
wroteImport = true
fmt.Fprintf(outFile, "import \"github.com/tendermint/go-wire/data\"\n")
}
if gotPackageLine {
fmt.Fprintf(outFile, "%s\n", "//nolint: gas")
}
fmt.Fprintf(outFile, "%s\n", line)
}
outFile.Close()
os.Remove(oldPath)
os.Rename(tmpPath, oldPath)
exec.Command("goimports", "-w", oldPath)
}

16
abci/types/pubkey.go Normal file
View File

@@ -0,0 +1,16 @@
package types
const (
PubKeyEd25519 = "ed25519"
)
func Ed25519Validator(pubkey []byte, power int64) Validator {
return Validator{
// Address:
PubKey: PubKey{
Type: PubKeyEd25519,
Data: pubkey,
},
Power: power,
}
}

121
abci/types/result.go Normal file
View File

@@ -0,0 +1,121 @@
package types
import (
"bytes"
"encoding/json"
"github.com/gogo/protobuf/jsonpb"
)
const (
CodeTypeOK uint32 = 0
)
// IsOK returns true if Code is OK.
func (r ResponseCheckTx) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseCheckTx) IsErr() bool {
return r.Code != CodeTypeOK
}
// IsOK returns true if Code is OK.
func (r ResponseDeliverTx) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseDeliverTx) IsErr() bool {
return r.Code != CodeTypeOK
}
// IsOK returns true if Code is OK.
func (r ResponseQuery) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseQuery) IsErr() bool {
return r.Code != CodeTypeOK
}
//---------------------------------------------------------------------------
// override JSON marshalling so we dont emit defaults (ie. disable omitempty)
// note we need Unmarshal functions too because protobuf had the bright idea
// to marshal int64->string. cool. cool, cool, cool: https://developers.google.com/protocol-buffers/docs/proto3#json
var (
jsonpbMarshaller = jsonpb.Marshaler{
EnumsAsInts: true,
EmitDefaults: false,
}
jsonpbUnmarshaller = jsonpb.Unmarshaler{}
)
func (r *ResponseSetOption) MarshalJSON() ([]byte, error) {
s, err := jsonpbMarshaller.MarshalToString(r)
return []byte(s), err
}
func (r *ResponseSetOption) UnmarshalJSON(b []byte) error {
reader := bytes.NewBuffer(b)
return jsonpbUnmarshaller.Unmarshal(reader, r)
}
func (r *ResponseCheckTx) MarshalJSON() ([]byte, error) {
s, err := jsonpbMarshaller.MarshalToString(r)
return []byte(s), err
}
func (r *ResponseCheckTx) UnmarshalJSON(b []byte) error {
reader := bytes.NewBuffer(b)
return jsonpbUnmarshaller.Unmarshal(reader, r)
}
func (r *ResponseDeliverTx) MarshalJSON() ([]byte, error) {
s, err := jsonpbMarshaller.MarshalToString(r)
return []byte(s), err
}
func (r *ResponseDeliverTx) UnmarshalJSON(b []byte) error {
reader := bytes.NewBuffer(b)
return jsonpbUnmarshaller.Unmarshal(reader, r)
}
func (r *ResponseQuery) MarshalJSON() ([]byte, error) {
s, err := jsonpbMarshaller.MarshalToString(r)
return []byte(s), err
}
func (r *ResponseQuery) UnmarshalJSON(b []byte) error {
reader := bytes.NewBuffer(b)
return jsonpbUnmarshaller.Unmarshal(reader, r)
}
func (r *ResponseCommit) MarshalJSON() ([]byte, error) {
s, err := jsonpbMarshaller.MarshalToString(r)
return []byte(s), err
}
func (r *ResponseCommit) UnmarshalJSON(b []byte) error {
reader := bytes.NewBuffer(b)
return jsonpbUnmarshaller.Unmarshal(reader, r)
}
// Some compile time assertions to ensure we don't
// have accidental runtime surprises later on.
// jsonEncodingRoundTripper ensures that asserted
// interfaces implement both MarshalJSON and UnmarshalJSON
type jsonRoundTripper interface {
json.Marshaler
json.Unmarshaler
}
var _ jsonRoundTripper = (*ResponseCommit)(nil)
var _ jsonRoundTripper = (*ResponseQuery)(nil)
var _ jsonRoundTripper = (*ResponseDeliverTx)(nil)
var _ jsonRoundTripper = (*ResponseCheckTx)(nil)
var _ jsonRoundTripper = (*ResponseSetOption)(nil)

2455
abci/types/types.pb.go Normal file

File diff suppressed because it is too large Load Diff

282
abci/types/types.proto Normal file
View File

@@ -0,0 +1,282 @@
syntax = "proto3";
package types;
// For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/tendermint/tmlibs/common/types.proto";
// This file is copied from http://github.com/tendermint/abci
// NOTE: When using custom types, mind the warnings.
// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
//----------------------------------------
// Request types
message Request {
oneof value {
RequestEcho echo = 2;
RequestFlush flush = 3;
RequestInfo info = 4;
RequestSetOption set_option = 5;
RequestInitChain init_chain = 6;
RequestQuery query = 7;
RequestBeginBlock begin_block = 8;
RequestCheckTx check_tx = 9;
RequestDeliverTx deliver_tx = 19;
RequestEndBlock end_block = 11;
RequestCommit commit = 12;
}
}
message RequestEcho {
string message = 1;
}
message RequestFlush {
}
message RequestInfo {
string version = 1;
}
// nondeterministic
message RequestSetOption {
string key = 1;
string value = 2;
}
message RequestInitChain {
int64 time = 1;
string chain_id = 2;
ConsensusParams consensus_params = 3;
repeated Validator validators = 4 [(gogoproto.nullable)=false];
bytes app_state_bytes = 5;
}
message RequestQuery {
bytes data = 1;
string path = 2;
int64 height = 3;
bool prove = 4;
}
message RequestBeginBlock {
bytes hash = 1;
Header header = 2 [(gogoproto.nullable)=false];
repeated SigningValidator validators = 3 [(gogoproto.nullable)=false];
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false];
}
message RequestCheckTx {
bytes tx = 1;
}
message RequestDeliverTx {
bytes tx = 1;
}
message RequestEndBlock {
int64 height = 1;
}
message RequestCommit {
}
//----------------------------------------
// Response types
message Response {
oneof value {
ResponseException exception = 1;
ResponseEcho echo = 2;
ResponseFlush flush = 3;
ResponseInfo info = 4;
ResponseSetOption set_option = 5;
ResponseInitChain init_chain = 6;
ResponseQuery query = 7;
ResponseBeginBlock begin_block = 8;
ResponseCheckTx check_tx = 9;
ResponseDeliverTx deliver_tx = 10;
ResponseEndBlock end_block = 11;
ResponseCommit commit = 12;
}
}
// nondeterministic
message ResponseException {
string error = 1;
}
message ResponseEcho {
string message = 1;
}
message ResponseFlush {
}
message ResponseInfo {
string data = 1;
string version = 2;
int64 last_block_height = 3;
bytes last_block_app_hash = 4;
}
// nondeterministic
message ResponseSetOption {
uint32 code = 1;
// bytes data = 2;
string log = 3;
string info = 4;
}
message ResponseInitChain {
ConsensusParams consensus_params = 1;
repeated Validator validators = 2 [(gogoproto.nullable)=false];
}
message ResponseQuery {
uint32 code = 1;
// bytes data = 2; // use "value" instead.
string log = 3; // nondeterministic
string info = 4; // nondeterministic
int64 index = 5;
bytes key = 6;
bytes value = 7;
bytes proof = 8;
int64 height = 9;
}
message ResponseBeginBlock {
repeated common.KVPair tags = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
}
message ResponseCheckTx {
uint32 code = 1;
bytes data = 2;
string log = 3; // nondeterministic
string info = 4; // nondeterministic
int64 gas_wanted = 5;
int64 gas_used = 6;
repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
}
message ResponseDeliverTx {
uint32 code = 1;
bytes data = 2;
string log = 3; // nondeterministic
string info = 4; // nondeterministic
int64 gas_wanted = 5;
int64 gas_used = 6;
repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
}
message ResponseEndBlock {
repeated Validator validator_updates = 1 [(gogoproto.nullable)=false];
ConsensusParams consensus_param_updates = 2;
repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
}
message ResponseCommit {
// reserve 1
bytes data = 2;
}
//----------------------------------------
// Misc.
// ConsensusParams contains all consensus-relevant parameters
// that can be adjusted by the abci app
message ConsensusParams {
BlockSize block_size = 1;
TxSize tx_size = 2;
BlockGossip block_gossip = 3;
}
// BlockSize contain limits on the block size.
message BlockSize {
int32 max_bytes = 1;
int32 max_txs = 2;
int64 max_gas = 3;
}
// TxSize contain limits on the tx size.
message TxSize {
int32 max_bytes = 1;
int64 max_gas = 2;
}
// BlockGossip determine consensus critical
// elements of how blocks are gossiped
message BlockGossip {
// Note: must not be 0
int32 block_part_size_bytes = 1;
}
//----------------------------------------
// Blockchain Types
// just the minimum the app might need
message Header {
// basics
string chain_id = 1 [(gogoproto.customname)="ChainID"];
int64 height = 2;
int64 time = 3;
// txs
int32 num_txs = 4;
int64 total_txs = 5;
// hashes
bytes last_block_hash = 6;
bytes validators_hash = 7;
bytes app_hash = 8;
// consensus
Validator proposer = 9 [(gogoproto.nullable)=false];
}
// Validator
message Validator {
bytes address = 1;
PubKey pub_key = 2 [(gogoproto.nullable)=false];
int64 power = 3;
}
// Validator with an extra bool
message SigningValidator {
Validator validator = 1 [(gogoproto.nullable)=false];
bool signed_last_block = 2;
}
message PubKey {
string type = 1;
bytes data = 2;
}
message Evidence {
string type = 1;
Validator validator = 2 [(gogoproto.nullable)=false];
int64 height = 3;
int64 time = 4;
int64 total_voting_power = 5;
}
//----------------------------------------
// Service Definition
service ABCIApplication {
rpc Echo(RequestEcho) returns (ResponseEcho) ;
rpc Flush(RequestFlush) returns (ResponseFlush);
rpc Info(RequestInfo) returns (ResponseInfo);
rpc SetOption(RequestSetOption) returns (ResponseSetOption);
rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
rpc Query(RequestQuery) returns (ResponseQuery);
rpc Commit(RequestCommit) returns (ResponseCommit);
rpc InitChain(RequestInitChain) returns (ResponseInitChain);
rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
}

31
abci/types/types_test.go Normal file
View File

@@ -0,0 +1,31 @@
package types
import (
"testing"
asrt "github.com/stretchr/testify/assert"
)
func TestConsensusParams(t *testing.T) {
assert := asrt.New(t)
params := &ConsensusParams{
BlockSize: &BlockSize{MaxGas: 12345},
BlockGossip: &BlockGossip{BlockPartSizeBytes: 54321},
}
var noParams *ConsensusParams // nil
// no error with nil fields
assert.Nil(noParams.GetBlockSize())
assert.EqualValues(noParams.GetBlockSize().GetMaxGas(), 0)
// get values with real fields
assert.NotNil(params.GetBlockSize())
assert.EqualValues(params.GetBlockSize().GetMaxTxs(), 0)
assert.EqualValues(params.GetBlockSize().GetMaxGas(), 12345)
assert.NotNil(params.GetBlockGossip())
assert.EqualValues(params.GetBlockGossip().GetBlockPartSizeBytes(), 54321)
assert.Nil(params.GetTxSize())
assert.EqualValues(params.GetTxSize().GetMaxBytes(), 0)
}

59
abci/types/util.go Normal file
View File

@@ -0,0 +1,59 @@
package types
import (
"bytes"
"encoding/json"
"sort"
cmn "github.com/tendermint/tendermint/libs/common"
)
//------------------------------------------------------------------------------
// Validators is a list of validators that implements the Sort interface
type Validators []Validator
var _ sort.Interface = (Validators)(nil)
// All these methods for Validators:
// Len, Less and Swap
// are for Validators to implement sort.Interface
// which will be used by the sort package.
// See Issue https://github.com/tendermint/abci/issues/212
func (v Validators) Len() int {
return len(v)
}
// XXX: doesn't distinguish same validator with different power
func (v Validators) Less(i, j int) bool {
return bytes.Compare(v[i].PubKey.Data, v[j].PubKey.Data) <= 0
}
func (v Validators) Swap(i, j int) {
v1 := v[i]
v[i] = v[j]
v[j] = v1
}
func ValidatorsString(vs Validators) string {
s := make([]validatorPretty, len(vs))
for i, v := range vs {
s[i] = validatorPretty{
Address: v.Address,
PubKey: v.PubKey.Data,
Power: v.Power,
}
}
b, err := json.Marshal(s)
if err != nil {
panic(err.Error())
}
return string(b)
}
type validatorPretty struct {
Address cmn.HexBytes `json:"address"`
PubKey []byte `json:"pub_key"`
Power int64 `json:"power"`
}

9
abci/version/version.go Normal file
View File

@@ -0,0 +1,9 @@
package version
// NOTE: we should probably be versioning the ABCI and the abci-cli separately
const Maj = "0"
const Min = "12"
const Fix = "0"
const Version = "0.12.0"

13
appveyor.yml Normal file
View File

@@ -0,0 +1,13 @@
version: 1.0.{build}
configuration: Release
platform:
- x64
- x86
clone_folder: c:\go\path\src\github.com\tendermint\tendermint
before_build:
- cmd: set GOPATH=%GOROOT%\path
- cmd: set PATH=%GOPATH%\bin;%PATH%
- cmd: make get_vendor_deps
build_script:
- cmd: make test
test: off

View File

@@ -14,7 +14,7 @@ if [ ! -d $DATA ]; then
echo "starting node"
tendermint node \
--home $DATA \
--proxy_app dummy \
--proxy_app kvstore \
--p2p.laddr tcp://127.0.0.1:56656 \
--rpc.laddr tcp://127.0.0.1:56657 \
--log_level error &
@@ -35,7 +35,7 @@ cp -R $DATA $HOME1
echo "starting validator node"
tendermint node \
--home $HOME1 \
--proxy_app dummy \
--proxy_app kvstore \
--p2p.laddr tcp://127.0.0.1:56656 \
--rpc.laddr tcp://127.0.0.1:56657 \
--log_level error &
@@ -48,10 +48,10 @@ cp $HOME1/genesis.json $HOME2
printf "starting downloader node"
tendermint node \
--home $HOME2 \
--proxy_app dummy \
--proxy_app kvstore \
--p2p.laddr tcp://127.0.0.1:56666 \
--rpc.laddr tcp://127.0.0.1:56667 \
--p2p.seeds 127.0.0.1:56656 \
--p2p.persistent_peers 127.0.0.1:56656 \
--log_level error &
# wait for node to start up so we only count time where we are actually syncing

View File

@@ -4,37 +4,45 @@ import (
"testing"
"time"
"github.com/tendermint/go-crypto"
"github.com/tendermint/go-wire"
"github.com/tendermint/go-amino"
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"
)
func BenchmarkEncodeStatusWire(b *testing.B) {
b.StopTimer()
pubKey := crypto.GenPrivKeyEd25519().PubKey()
cdc := amino.NewCodec()
ctypes.RegisterAmino(cdc)
nodeKey := p2p.NodeKey{PrivKey: crypto.GenPrivKeyEd25519()}
status := &ctypes.ResultStatus{
NodeInfo: &p2p.NodeInfo{
PubKey: pubKey.Unwrap().(crypto.PubKeyEd25519),
NodeInfo: p2p.NodeInfo{
ID: nodeKey.ID(),
Moniker: "SOMENAME",
Network: "SOMENAME",
RemoteAddr: "SOMEADDR",
ListenAddr: "SOMEADDR",
Version: "SOMEVER",
Other: []string{"SOMESTRING", "OTHERSTRING"},
},
PubKey: pubKey,
LatestBlockHash: []byte("SOMEBYTES"),
LatestBlockHeight: 123,
LatestBlockTime: time.Unix(0, 1234),
SyncInfo: ctypes.SyncInfo{
LatestBlockHash: []byte("SOMEBYTES"),
LatestBlockHeight: 123,
LatestBlockTime: time.Unix(0, 1234),
},
ValidatorInfo: ctypes.ValidatorInfo{
PubKey: nodeKey.PubKey(),
},
}
b.StartTimer()
counter := 0
for i := 0; i < b.N; i++ {
jsonBytes := wire.JSONBytes(status)
jsonBytes, err := cdc.MarshalJSON(status)
if err != nil {
panic(err)
}
counter += len(jsonBytes)
}
@@ -42,12 +50,13 @@ func BenchmarkEncodeStatusWire(b *testing.B) {
func BenchmarkEncodeNodeInfoWire(b *testing.B) {
b.StopTimer()
pubKey := crypto.GenPrivKeyEd25519().PubKey().Unwrap().(crypto.PubKeyEd25519)
nodeInfo := &p2p.NodeInfo{
PubKey: pubKey,
cdc := amino.NewCodec()
ctypes.RegisterAmino(cdc)
nodeKey := p2p.NodeKey{PrivKey: crypto.GenPrivKeyEd25519()}
nodeInfo := p2p.NodeInfo{
ID: nodeKey.ID(),
Moniker: "SOMENAME",
Network: "SOMENAME",
RemoteAddr: "SOMEADDR",
ListenAddr: "SOMEADDR",
Version: "SOMEVER",
Other: []string{"SOMESTRING", "OTHERSTRING"},
@@ -56,19 +65,23 @@ func BenchmarkEncodeNodeInfoWire(b *testing.B) {
counter := 0
for i := 0; i < b.N; i++ {
jsonBytes := wire.JSONBytes(nodeInfo)
jsonBytes, err := cdc.MarshalJSON(nodeInfo)
if err != nil {
panic(err)
}
counter += len(jsonBytes)
}
}
func BenchmarkEncodeNodeInfoBinary(b *testing.B) {
b.StopTimer()
pubKey := crypto.GenPrivKeyEd25519().PubKey().Unwrap().(crypto.PubKeyEd25519)
nodeInfo := &p2p.NodeInfo{
PubKey: pubKey,
cdc := amino.NewCodec()
ctypes.RegisterAmino(cdc)
nodeKey := p2p.NodeKey{PrivKey: crypto.GenPrivKeyEd25519()}
nodeInfo := p2p.NodeInfo{
ID: nodeKey.ID(),
Moniker: "SOMENAME",
Network: "SOMENAME",
RemoteAddr: "SOMEADDR",
ListenAddr: "SOMEADDR",
Version: "SOMEVER",
Other: []string{"SOMESTRING", "OTHERSTRING"},
@@ -77,7 +90,7 @@ func BenchmarkEncodeNodeInfoBinary(b *testing.B) {
counter := 0
for i := 0; i < b.N; i++ {
jsonBytes := wire.BinaryBytes(nodeInfo)
jsonBytes := cdc.MustMarshalBinaryBare(nodeInfo)
counter += len(jsonBytes)
}
@@ -85,16 +98,20 @@ func BenchmarkEncodeNodeInfoBinary(b *testing.B) {
func BenchmarkEncodeNodeInfoProto(b *testing.B) {
b.StopTimer()
pubKey := crypto.GenPrivKeyEd25519().PubKey().Unwrap().(crypto.PubKeyEd25519)
pubKey2 := &proto.PubKey{Ed25519: &proto.PubKeyEd25519{Bytes: pubKey[:]}}
nodeInfo := &proto.NodeInfo{
PubKey: pubKey2,
Moniker: "SOMENAME",
Network: "SOMENAME",
RemoteAddr: "SOMEADDR",
ListenAddr: "SOMEADDR",
Version: "SOMEVER",
Other: []string{"SOMESTRING", "OTHERSTRING"},
nodeKey := p2p.NodeKey{PrivKey: crypto.GenPrivKeyEd25519()}
nodeID := string(nodeKey.ID())
someName := "SOMENAME"
someAddr := "SOMEADDR"
someVer := "SOMEVER"
someString := "SOMESTRING"
otherString := "OTHERSTRING"
nodeInfo := proto.NodeInfo{
Id: &proto.ID{Id: &nodeID},
Moniker: &someName,
Network: &someName,
ListenAddr: &someAddr,
Version: &someVer,
Other: []string{someString, otherString},
}
b.StartTimer()

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) {

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) {

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@ message ResultStatus {
}
message NodeInfo {
required PubKey pubKey = 1;
required ID id = 1;
required string moniker = 2;
required string network = 3;
required string remoteAddr = 4;
@@ -16,6 +16,10 @@ message NodeInfo {
repeated string other = 7;
}
message ID {
required string id = 1;
}
message PubKey {
optional PubKeyEd25519 ed25519 = 1;
}

View File

@@ -7,11 +7,11 @@ 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() {
wsc := rpcclient.NewWSClient("127.0.0.1:46657", "/websocket")
wsc := rpcclient.NewWSClient("127.0.0.1:26657", "/websocket")
err := wsc.Start()
if err != nil {
cmn.Exit(err.Error())

View File

@@ -1,18 +1,22 @@
package blockchain
import (
"errors"
"fmt"
"math"
"sync"
"sync/atomic"
"time"
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"
cmn "github.com/tendermint/tmlibs/common"
flow "github.com/tendermint/tmlibs/flowrate"
"github.com/tendermint/tmlibs/log"
)
/*
eg, L = latency = 0.1s
P = num peers = 10
FN = num full nodes
@@ -22,7 +26,6 @@ eg, L = latency = 0.1s
B/S = CB/P/BS = 12.8 blocks/s
12.8 * 0.1 = 1.28 blocks on conn
*/
const (
@@ -30,10 +33,20 @@ const (
maxTotalRequesters = 1000
maxPendingRequests = maxTotalRequesters
maxPendingRequestsPerPeer = 50
minRecvRate = 10240 // 10Kb/s
// Minimum recv rate to ensure we're receiving blocks from a peer fast
// enough. If a peer is not sending us data at at least that rate, we
// consider them to have timedout and we disconnect.
//
// Assuming a DSL connection (not a good choice) 128 Kbps (upload) ~ 15 KB/s,
// sending data across atlantic ~ 7.5 KB/s.
minRecvRate = 7680
// Maximum difference between current and new block's height.
maxDiffBetweenCurrentAndReceivedBlockHeight = 100
)
var peerTimeoutSeconds = time.Duration(15) // not const so we can override with tests
var peerTimeout = 15 * time.Second // not const so we can override with tests
/*
Peers self report their heights when we join the block pool.
@@ -54,25 +67,27 @@ type BlockPool struct {
// block requests
requesters map[int64]*bpRequester
height int64 // the lowest key in requesters.
numPending int32 // number of requests pending assignment or block response
// peers
peers map[string]*bpPeer
peers map[p2p.ID]*bpPeer
maxPeerHeight int64
// atomic
numPending int32 // number of requests pending assignment or block response
requestsCh chan<- BlockRequest
timeoutsCh chan<- string
errorsCh chan<- peerError
}
func NewBlockPool(start int64, requestsCh chan<- BlockRequest, timeoutsCh chan<- string) *BlockPool {
func NewBlockPool(start int64, requestsCh chan<- BlockRequest, errorsCh chan<- peerError) *BlockPool {
bp := &BlockPool{
peers: make(map[string]*bpPeer),
peers: make(map[p2p.ID]*bpPeer),
requesters: make(map[int64]*bpRequester),
height: start,
numPending: 0,
requestsCh: requestsCh,
timeoutsCh: timeoutsCh,
errorsCh: errorsCh,
}
bp.BaseService = *cmn.NewBaseService(nil, "BlockPool", bp)
return bp
@@ -88,7 +103,6 @@ func (pool *BlockPool) OnStop() {}
// Run spawns requesters as needed.
func (pool *BlockPool) makeRequestersRoutine() {
for {
if !pool.IsRunning() {
break
@@ -119,10 +133,14 @@ func (pool *BlockPool) removeTimedoutPeers() {
for _, peer := range pool.peers {
if !peer.didTimeout && peer.numPending > 0 {
curRate := peer.recvMonitor.Status().CurRate
// XXX remove curRate != 0
// curRate can be 0 on start
if curRate != 0 && curRate < minRecvRate {
pool.sendTimeout(peer.id)
pool.Logger.Error("SendTimeout", "peer", peer.id, "reason", "curRate too low")
err := errors.New("peer is not sending us data fast enough")
pool.sendError(err, peer.id)
pool.Logger.Error("SendTimeout", "peer", peer.id,
"reason", err,
"curRate", fmt.Sprintf("%d KB/s", curRate/1024),
"minRate", fmt.Sprintf("%d KB/s", minRecvRate/1024))
peer.didTimeout = true
}
}
@@ -136,7 +154,7 @@ func (pool *BlockPool) GetStatus() (height int64, numPending int32, lenRequester
pool.mtx.Lock()
defer pool.mtx.Unlock()
return pool.height, pool.numPending, len(pool.requesters)
return pool.height, atomic.LoadInt32(&pool.numPending), len(pool.requesters)
}
// TODO: relax conditions, prevent abuse.
@@ -189,40 +207,48 @@ func (pool *BlockPool) PopRequest() {
delete(pool.requesters, pool.height)
pool.height++
} else {
cmn.PanicSanity(cmn.Fmt("Expected requester to pop, got nothing at height %v", pool.height))
panic(fmt.Sprintf("Expected requester to pop, got nothing at height %v", pool.height))
}
}
// Invalidates the block at pool.height,
// Remove the peer and redo request from others.
func (pool *BlockPool) RedoRequest(height int64) {
// Returns the ID of the removed peer.
func (pool *BlockPool) RedoRequest(height int64) p2p.ID {
pool.mtx.Lock()
defer pool.mtx.Unlock()
request := pool.requesters[height]
if request.block == nil {
cmn.PanicSanity("Expected block to be non-nil")
panic("Expected block to be non-nil")
}
// RemovePeer will redo all requesters associated with this peer.
// TODO: record this malfeasance
pool.removePeer(request.peerID)
return request.peerID
}
// TODO: ensure that blocks come in order for each peer.
func (pool *BlockPool) AddBlock(peerID string, block *types.Block, blockSize int) {
func (pool *BlockPool) AddBlock(peerID p2p.ID, block *types.Block, blockSize int) {
pool.mtx.Lock()
defer pool.mtx.Unlock()
requester := pool.requesters[block.Height]
if requester == nil {
// a block we didn't expect.
// TODO:if height is too far ahead, punish peer
pool.Logger.Info("peer sent us a block we didn't expect", "peer", peerID, "curHeight", pool.height, "blockHeight", block.Height)
diff := pool.height - block.Height
if diff < 0 {
diff *= -1
}
if diff > maxDiffBetweenCurrentAndReceivedBlockHeight {
pool.sendError(errors.New("peer sent us a block we didn't expect with a height too far ahead/behind"), peerID)
}
return
}
if requester.setBlock(block, peerID) {
pool.numPending--
atomic.AddInt32(&pool.numPending, -1)
peer := pool.peers[peerID]
if peer != nil {
peer.decrPending(blockSize)
@@ -240,7 +266,7 @@ func (pool *BlockPool) MaxPeerHeight() int64 {
}
// Sets the peer's alleged blockchain height.
func (pool *BlockPool) SetPeerHeight(peerID string, height int64) {
func (pool *BlockPool) SetPeerHeight(peerID p2p.ID, height int64) {
pool.mtx.Lock()
defer pool.mtx.Unlock()
@@ -258,20 +284,17 @@ func (pool *BlockPool) SetPeerHeight(peerID string, height int64) {
}
}
func (pool *BlockPool) RemovePeer(peerID string) {
func (pool *BlockPool) RemovePeer(peerID p2p.ID) {
pool.mtx.Lock()
defer pool.mtx.Unlock()
pool.removePeer(peerID)
}
func (pool *BlockPool) removePeer(peerID string) {
func (pool *BlockPool) removePeer(peerID p2p.ID) {
for _, requester := range pool.requesters {
if requester.getPeerID() == peerID {
if requester.getBlock() != nil {
pool.numPending++
}
go requester.redo() // pick another peer and ...
requester.redo()
}
}
delete(pool.peers, peerID)
@@ -309,7 +332,7 @@ func (pool *BlockPool) makeNextRequester() {
// request.SetLogger(pool.Logger.With("height", nextHeight))
pool.requesters[nextHeight] = request
pool.numPending++
atomic.AddInt32(&pool.numPending, 1)
err := request.Start()
if err != nil {
@@ -321,23 +344,23 @@ func (pool *BlockPool) requestersLen() int64 {
return int64(len(pool.requesters))
}
func (pool *BlockPool) sendRequest(height int64, peerID string) {
func (pool *BlockPool) sendRequest(height int64, peerID p2p.ID) {
if !pool.IsRunning() {
return
}
pool.requestsCh <- BlockRequest{height, peerID}
}
func (pool *BlockPool) sendTimeout(peerID string) {
func (pool *BlockPool) sendError(err error, peerID p2p.ID) {
if !pool.IsRunning() {
return
}
pool.timeoutsCh <- peerID
pool.errorsCh <- peerError{err, peerID}
}
// unused by tendermint; left for debugging purposes
func (pool *BlockPool) debug() string {
pool.mtx.Lock() // Lock
pool.mtx.Lock()
defer pool.mtx.Unlock()
str := ""
@@ -357,7 +380,7 @@ func (pool *BlockPool) debug() string {
type bpPeer struct {
pool *BlockPool
id string
id p2p.ID
recvMonitor *flow.Monitor
height int64
@@ -368,7 +391,7 @@ type bpPeer struct {
logger log.Logger
}
func newBPPeer(pool *BlockPool, peerID string, height int64) *bpPeer {
func newBPPeer(pool *BlockPool, peerID p2p.ID, height int64) *bpPeer {
peer := &bpPeer{
pool: pool,
id: peerID,
@@ -391,9 +414,9 @@ func (peer *bpPeer) resetMonitor() {
func (peer *bpPeer) resetTimeout() {
if peer.timeout == nil {
peer.timeout = time.AfterFunc(time.Second*peerTimeoutSeconds, peer.onTimeout)
peer.timeout = time.AfterFunc(peerTimeout, peer.onTimeout)
} else {
peer.timeout.Reset(time.Second * peerTimeoutSeconds)
peer.timeout.Reset(peerTimeout)
}
}
@@ -419,8 +442,9 @@ func (peer *bpPeer) onTimeout() {
peer.pool.mtx.Lock()
defer peer.pool.mtx.Unlock()
peer.pool.sendTimeout(peer.id)
peer.logger.Error("SendTimeout", "reason", "onTimeout")
err := errors.New("peer did not send us anything")
peer.pool.sendError(err, peer.id)
peer.logger.Error("SendTimeout", "reason", err, "timeout", peerTimeout)
peer.didTimeout = true
}
@@ -434,7 +458,7 @@ type bpRequester struct {
redoCh chan struct{}
mtx sync.Mutex
peerID string
peerID p2p.ID
block *types.Block
}
@@ -442,8 +466,8 @@ func newBPRequester(pool *BlockPool, height int64) *bpRequester {
bpr := &bpRequester{
pool: pool,
height: height,
gotBlockCh: make(chan struct{}),
redoCh: make(chan struct{}),
gotBlockCh: make(chan struct{}, 1),
redoCh: make(chan struct{}, 1),
peerID: "",
block: nil,
@@ -457,8 +481,8 @@ func (bpr *bpRequester) OnStart() error {
return nil
}
// Returns true if the peer matches
func (bpr *bpRequester) setBlock(block *types.Block, peerID string) bool {
// Returns true if the peer matches and block doesn't already exist.
func (bpr *bpRequester) setBlock(block *types.Block, peerID p2p.ID) bool {
bpr.mtx.Lock()
if bpr.block != nil || bpr.peerID != peerID {
bpr.mtx.Unlock()
@@ -467,7 +491,10 @@ func (bpr *bpRequester) setBlock(block *types.Block, peerID string) bool {
bpr.block = block
bpr.mtx.Unlock()
bpr.gotBlockCh <- struct{}{}
select {
case bpr.gotBlockCh <- struct{}{}:
default:
}
return true
}
@@ -477,23 +504,33 @@ func (bpr *bpRequester) getBlock() *types.Block {
return bpr.block
}
func (bpr *bpRequester) getPeerID() string {
func (bpr *bpRequester) getPeerID() p2p.ID {
bpr.mtx.Lock()
defer bpr.mtx.Unlock()
return bpr.peerID
}
// This is called from the requestRoutine, upon redo().
func (bpr *bpRequester) reset() {
bpr.mtx.Lock()
defer bpr.mtx.Unlock()
if bpr.block != nil {
atomic.AddInt32(&bpr.pool.numPending, 1)
}
bpr.peerID = ""
bpr.block = nil
bpr.mtx.Unlock()
}
// Tells bpRequester to pick another peer and try again.
// NOTE: blocking
// NOTE: Nonblocking, and does nothing if another redo
// was already requested.
func (bpr *bpRequester) redo() {
bpr.redoCh <- struct{}{}
select {
case bpr.redoCh <- struct{}{}:
default:
}
}
// Responsible for making more requests as necessary
@@ -502,7 +539,7 @@ func (bpr *bpRequester) requestRoutine() {
OUTER_LOOP:
for {
// Pick a peer to send request to.
var peer *bpPeer = nil
var peer *bpPeer
PICK_PEER_LOOP:
for {
if !bpr.IsRunning() || !bpr.pool.IsRunning() {
@@ -522,26 +559,21 @@ OUTER_LOOP:
// Send request and wait.
bpr.pool.sendRequest(bpr.height, peer.id)
select {
case <-bpr.pool.Quit:
bpr.Stop()
return
case <-bpr.Quit:
return
case <-bpr.redoCh:
bpr.reset()
continue OUTER_LOOP // When peer is removed
case <-bpr.gotBlockCh:
// We got the block, now see if it's good.
WAIT_LOOP:
for {
select {
case <-bpr.pool.Quit:
case <-bpr.pool.Quit():
bpr.Stop()
return
case <-bpr.Quit:
case <-bpr.Quit():
return
case <-bpr.redoCh:
bpr.reset()
continue OUTER_LOOP
case <-bpr.gotBlockCh:
// We got a block!
// Continue the for-loop and wait til Quit.
continue WAIT_LOOP
}
}
}
@@ -551,5 +583,5 @@ OUTER_LOOP:
type BlockRequest struct {
Height int64
PeerID string
PeerID p2p.ID
}

View File

@@ -5,24 +5,26 @@ import (
"testing"
"time"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
)
func init() {
peerTimeoutSeconds = time.Duration(2)
peerTimeout = 2 * time.Second
}
type testPeer struct {
id string
id p2p.ID
height int64
}
func makePeers(numPeers int, minHeight, maxHeight int64) map[string]testPeer {
peers := make(map[string]testPeer, numPeers)
func makePeers(numPeers int, minHeight, maxHeight int64) map[p2p.ID]testPeer {
peers := make(map[p2p.ID]testPeer, numPeers)
for i := 0; i < numPeers; i++ {
peerID := cmn.RandStr(12)
peerID := p2p.ID(cmn.RandStr(12))
height := minHeight + rand.Int63n(maxHeight-minHeight)
peers[peerID] = testPeer{peerID, height}
}
@@ -32,9 +34,9 @@ func makePeers(numPeers int, minHeight, maxHeight int64) map[string]testPeer {
func TestBasic(t *testing.T) {
start := int64(42)
peers := makePeers(10, start+1, 1000)
timeoutsCh := make(chan string, 100)
requestsCh := make(chan BlockRequest, 100)
pool := NewBlockPool(start, requestsCh, timeoutsCh)
errorsCh := make(chan peerError, 1000)
requestsCh := make(chan BlockRequest, 1000)
pool := NewBlockPool(start, requestsCh, errorsCh)
pool.SetLogger(log.TestingLogger())
err := pool.Start()
@@ -69,8 +71,8 @@ func TestBasic(t *testing.T) {
// Pull from channels
for {
select {
case peerID := <-timeoutsCh:
t.Errorf("timeout: %v", peerID)
case err := <-errorsCh:
t.Error(err)
case request := <-requestsCh:
t.Logf("Pulled new BlockRequest %v", request)
if request.Height == 300 {
@@ -89,9 +91,9 @@ func TestBasic(t *testing.T) {
func TestTimeout(t *testing.T) {
start := int64(42)
peers := makePeers(10, start+1, 1000)
timeoutsCh := make(chan string, 100)
requestsCh := make(chan BlockRequest, 100)
pool := NewBlockPool(start, requestsCh, timeoutsCh)
errorsCh := make(chan peerError, 1000)
requestsCh := make(chan BlockRequest, 1000)
pool := NewBlockPool(start, requestsCh, errorsCh)
pool.SetLogger(log.TestingLogger())
err := pool.Start()
if err != nil {
@@ -127,12 +129,13 @@ func TestTimeout(t *testing.T) {
// Pull from channels
counter := 0
timedOut := map[string]struct{}{}
timedOut := map[p2p.ID]struct{}{}
for {
select {
case peerID := <-timeoutsCh:
t.Logf("Peer %v timeouted", peerID)
if _, ok := timedOut[peerID]; !ok {
case err := <-errorsCh:
t.Log(err)
// consider error to be always timeout here
if _, ok := timedOut[err.peerID]; !ok {
counter++
if counter == len(peers) {
return // Done!

View File

@@ -1,26 +1,24 @@
package blockchain
import (
"bytes"
"errors"
"fmt"
"reflect"
"time"
wire "github.com/tendermint/go-wire"
amino "github.com/tendermint/go-amino"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
)
const (
// BlockchainChannel is a channel for blocks and status updates (`BlockStore` height)
BlockchainChannel = byte(0x40)
defaultChannelCapacity = 1000
trySyncIntervalMS = 50
trySyncIntervalMS = 50
// stop syncing when last block's time is
// within this much of the system time.
// stopSyncingDurationMinutes = 10
@@ -29,49 +27,73 @@ const (
statusUpdateIntervalSeconds = 10
// check if we should switch to consensus reactor
switchToConsensusIntervalSeconds = 1
// NOTE: keep up to date with bcBlockResponseMessage
bcBlockResponseMessagePrefixSize = 4
bcBlockResponseMessageFieldKeySize = 1
maxMsgSize = types.MaxBlockSizeBytes +
bcBlockResponseMessagePrefixSize +
bcBlockResponseMessageFieldKeySize
)
type consensusReactor interface {
// for when we switch from blockchain reactor and fast sync to
// the consensus machine
SwitchToConsensus(*sm.State, int)
SwitchToConsensus(sm.State, int)
}
type peerError struct {
err error
peerID p2p.ID
}
func (e peerError) Error() string {
return fmt.Sprintf("error with peer %v: %s", e.peerID, e.err.Error())
}
// BlockchainReactor handles long-term catchup syncing.
type BlockchainReactor struct {
p2p.BaseReactor
state *sm.State
proxyAppConn proxy.AppConnConsensus // same as consensus.proxyAppConn
store *BlockStore
pool *BlockPool
fastSync bool
requestsCh chan BlockRequest
timeoutsCh chan string
// immutable
initialState sm.State
eventBus *types.EventBus
blockExec *sm.BlockExecutor
store *BlockStore
pool *BlockPool
fastSync bool
requestsCh <-chan BlockRequest
errorsCh <-chan peerError
}
// NewBlockchainReactor returns new reactor instance.
func NewBlockchainReactor(state *sm.State, proxyAppConn proxy.AppConnConsensus, store *BlockStore, fastSync bool) *BlockchainReactor {
func NewBlockchainReactor(state sm.State, blockExec *sm.BlockExecutor, store *BlockStore,
fastSync bool) *BlockchainReactor {
if state.LastBlockHeight != store.Height() {
cmn.PanicSanity(cmn.Fmt("state (%v) and store (%v) height mismatch", state.LastBlockHeight, store.Height()))
panic(fmt.Sprintf("state (%v) and store (%v) height mismatch", state.LastBlockHeight,
store.Height()))
}
requestsCh := make(chan BlockRequest, defaultChannelCapacity)
timeoutsCh := make(chan string, defaultChannelCapacity)
const capacity = 1000 // must be bigger than peers count
requestsCh := make(chan BlockRequest, capacity)
errorsCh := make(chan peerError, capacity) // so we don't block in #Receive#pool.AddBlock
pool := NewBlockPool(
store.Height()+1,
requestsCh,
timeoutsCh,
errorsCh,
)
bcR := &BlockchainReactor{
state: state,
proxyAppConn: proxyAppConn,
initialState: state,
blockExec: blockExec,
store: store,
pool: pool,
fastSync: fastSync,
requestsCh: requestsCh,
timeoutsCh: timeoutsCh,
errorsCh: errorsCh,
}
bcR.BaseReactor = *p2p.NewBaseReactor("BlockchainReactor", bcR)
return bcR
@@ -108,16 +130,19 @@ func (bcR *BlockchainReactor) OnStop() {
func (bcR *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor {
return []*p2p.ChannelDescriptor{
{
ID: BlockchainChannel,
Priority: 10,
SendQueueCapacity: 1000,
ID: BlockchainChannel,
Priority: 10,
SendQueueCapacity: 1000,
RecvBufferCapacity: 50 * 4096,
RecvMessageCapacity: maxMsgSize,
},
}
}
// AddPeer implements Reactor by sending our state to peer.
func (bcR *BlockchainReactor) AddPeer(peer p2p.Peer) {
if !peer.Send(BlockchainChannel, struct{ BlockchainMessage }{&bcStatusResponseMessage{bcR.store.Height()}}) {
msgBytes := cdc.MustMarshalBinaryBare(&bcStatusResponseMessage{bcR.store.Height()})
if !peer.Send(BlockchainChannel, msgBytes) {
// doing nothing, will try later in `poolRoutine`
}
// peer is added to the pool once we receive the first
@@ -126,38 +151,39 @@ func (bcR *BlockchainReactor) AddPeer(peer p2p.Peer) {
// RemovePeer implements Reactor by removing peer from the pool.
func (bcR *BlockchainReactor) RemovePeer(peer p2p.Peer, reason interface{}) {
bcR.pool.RemovePeer(peer.Key())
bcR.pool.RemovePeer(peer.ID())
}
// respondToPeer loads a block and sends it to the requesting peer,
// if we have it. Otherwise, we'll respond saying we don't have it.
// According to the Tendermint spec, if all nodes are honest,
// no node should be requesting for a block that's non-existent.
func (bcR *BlockchainReactor) respondToPeer(msg *bcBlockRequestMessage, src p2p.Peer) (queued bool) {
func (bcR *BlockchainReactor) respondToPeer(msg *bcBlockRequestMessage,
src p2p.Peer) (queued bool) {
block := bcR.store.LoadBlock(msg.Height)
if block != nil {
msg := &bcBlockResponseMessage{Block: block}
return src.TrySend(BlockchainChannel, struct{ BlockchainMessage }{msg})
msgBytes := cdc.MustMarshalBinaryBare(&bcBlockResponseMessage{Block: block})
return src.TrySend(BlockchainChannel, msgBytes)
}
bcR.Logger.Info("Peer asking for a block we don't have", "src", src, "height", msg.Height)
return src.TrySend(BlockchainChannel, struct{ BlockchainMessage }{
&bcNoBlockResponseMessage{Height: msg.Height},
})
msgBytes := cdc.MustMarshalBinaryBare(&bcNoBlockResponseMessage{Height: msg.Height})
return src.TrySend(BlockchainChannel, msgBytes)
}
// Receive implements Reactor by handling 4 types of messages (look below).
func (bcR *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
_, msg, err := DecodeMessage(msgBytes, bcR.maxMsgSize())
msg, err := decodeMsg(msgBytes)
if err != nil {
bcR.Logger.Error("Error decoding message", "err", err)
bcR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
bcR.Switch.StopPeerForError(src, err)
return
}
bcR.Logger.Debug("Receive", "src", src, "chID", chID, "msg", msg)
// TODO: improve logic to satisfy megacheck
switch msg := msg.(type) {
case *bcBlockRequestMessage:
if queued := bcR.respondToPeer(msg, src); !queued {
@@ -165,27 +191,22 @@ func (bcR *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
}
case *bcBlockResponseMessage:
// Got a block.
bcR.pool.AddBlock(src.Key(), msg.Block, len(msgBytes))
bcR.pool.AddBlock(src.ID(), msg.Block, len(msgBytes))
case *bcStatusRequestMessage:
// Send peer our state.
queued := src.TrySend(BlockchainChannel, struct{ BlockchainMessage }{&bcStatusResponseMessage{bcR.store.Height()}})
msgBytes := cdc.MustMarshalBinaryBare(&bcStatusResponseMessage{bcR.store.Height()})
queued := src.TrySend(BlockchainChannel, msgBytes)
if !queued {
// sorry
}
case *bcStatusResponseMessage:
// Got a peer status. Unverified.
bcR.pool.SetPeerHeight(src.Key(), msg.Height)
bcR.pool.SetPeerHeight(src.ID(), msg.Height)
default:
bcR.Logger.Error(cmn.Fmt("Unknown message type %v", reflect.TypeOf(msg)))
}
}
// maxMsgSize returns the maximum allowable size of a
// message on the blockchain reactor.
func (bcR *BlockchainReactor) maxMsgSize() int {
return bcR.state.Params.BlockSizeParams.MaxBytes + 2
}
// Handle messages from the poolReactor telling the reactor what to do.
// NOTE: Don't sleep in the FOR_LOOP or otherwise slow it down!
// (Except for the SYNC_LOOP, which is the primary purpose and must be synchronous.)
@@ -197,7 +218,8 @@ func (bcR *BlockchainReactor) poolRoutine() {
blocksSynced := 0
chainID := bcR.state.ChainID
chainID := bcR.initialState.ChainID
state := bcR.initialState
lastHundred := time.Now()
lastRate := 0.0
@@ -205,23 +227,22 @@ func (bcR *BlockchainReactor) poolRoutine() {
FOR_LOOP:
for {
select {
case request := <-bcR.requestsCh: // chan BlockRequest
case request := <-bcR.requestsCh:
peer := bcR.Switch.Peers().Get(request.PeerID)
if peer == nil {
continue FOR_LOOP // Peer has since been disconnected.
}
msg := &bcBlockRequestMessage{request.Height}
queued := peer.TrySend(BlockchainChannel, struct{ BlockchainMessage }{msg})
msgBytes := cdc.MustMarshalBinaryBare(&bcBlockRequestMessage{request.Height})
queued := peer.TrySend(BlockchainChannel, msgBytes)
if !queued {
// We couldn't make the request, send-queue full.
// The pool handles timeouts, just let it go.
continue FOR_LOOP
}
case peerID := <-bcR.timeoutsCh: // chan string
// Peer timed out.
peer := bcR.Switch.Peers().Get(peerID)
case err := <-bcR.errorsCh:
peer := bcR.Switch.Peers().Get(err.peerID)
if peer != nil {
bcR.Switch.StopPeerForError(peer, errors.New("BlockchainReactor Timeout"))
bcR.Switch.StopPeerForError(peer, err)
}
case <-statusUpdateTicker.C:
// ask for status updates
@@ -236,7 +257,7 @@ FOR_LOOP:
bcR.pool.Stop()
conR := bcR.Switch.Reactor("CONSENSUS").(consensusReactor)
conR.SwitchToConsensus(bcR.state, blocksSynced)
conR.SwitchToConsensus(state, blocksSynced)
break FOR_LOOP
}
@@ -251,33 +272,39 @@ FOR_LOOP:
// We need both to sync the first block.
break SYNC_LOOP
}
firstParts := first.MakePartSet(bcR.state.Params.BlockPartSizeBytes)
firstParts := first.MakePartSet(state.ConsensusParams.BlockPartSizeBytes)
firstPartsHeader := firstParts.Header()
firstID := types.BlockID{first.Hash(), firstPartsHeader}
// Finally, verify the first block using the second's commit
// NOTE: we can probably make this more efficient, but note that calling
// first.Hash() doesn't verify the tx contents, so MakePartSet() is
// currently necessary.
err := bcR.state.Validators.VerifyCommit(
chainID, types.BlockID{first.Hash(), firstPartsHeader}, first.Height, second.LastCommit)
err := state.Validators.VerifyCommit(
chainID, firstID, first.Height, second.LastCommit)
if err != nil {
bcR.Logger.Error("Error in validation", "err", err)
bcR.pool.RedoRequest(first.Height)
peerID := bcR.pool.RedoRequest(first.Height)
peer := bcR.Switch.Peers().Get(peerID)
if peer != nil {
bcR.Switch.StopPeerForError(peer, fmt.Errorf("BlockchainReactor validation error: %v", err))
}
break SYNC_LOOP
} else {
bcR.pool.PopRequest()
// TODO: batch saves so we dont persist to disk every block
bcR.store.SaveBlock(first, firstParts, second.LastCommit)
// TODO: should we be firing events? need to fire NewBlock events manually ...
// NOTE: we could improve performance if we
// didn't make the app commit to disk every block
// ... but we would need a way to get the hash without it persisting
err := bcR.state.ApplyBlock(bcR.eventBus, bcR.proxyAppConn, first, firstPartsHeader, types.MockMempool{})
// TODO: same thing for app - but we would need a way to
// get the hash without persisting the state
var err error
state, err = bcR.blockExec.ApplyBlock(state, firstID, first)
if err != nil {
// TODO This is bad, are we zombie?
cmn.PanicQ(cmn.Fmt("Failed to process committed block (%d:%X): %v", first.Height, first.Hash(), err))
cmn.PanicQ(cmn.Fmt("Failed to process committed block (%d:%X): %v",
first.Height, first.Hash(), err))
}
blocksSynced += 1
blocksSynced++
if blocksSynced%100 == 0 {
lastRate = 0.9*lastRate + 0.1*(100/time.Since(lastHundred).Seconds())
@@ -288,7 +315,7 @@ FOR_LOOP:
}
}
continue FOR_LOOP
case <-bcR.Quit:
case <-bcR.Quit():
break FOR_LOOP
}
}
@@ -296,48 +323,31 @@ FOR_LOOP:
// BroadcastStatusRequest broadcasts `BlockStore` height.
func (bcR *BlockchainReactor) BroadcastStatusRequest() error {
bcR.Switch.Broadcast(BlockchainChannel, struct{ BlockchainMessage }{&bcStatusRequestMessage{bcR.store.Height()}})
msgBytes := cdc.MustMarshalBinaryBare(&bcStatusRequestMessage{bcR.store.Height()})
bcR.Switch.Broadcast(BlockchainChannel, msgBytes)
return nil
}
// SetEventBus sets event bus.
func (bcR *BlockchainReactor) SetEventBus(b *types.EventBus) {
bcR.eventBus = b
}
//-----------------------------------------------------------------------------
// Messages
const (
msgTypeBlockRequest = byte(0x10)
msgTypeBlockResponse = byte(0x11)
msgTypeNoBlockResponse = byte(0x12)
msgTypeStatusResponse = byte(0x20)
msgTypeStatusRequest = byte(0x21)
)
// BlockchainMessage is a generic message for this reactor.
type BlockchainMessage interface{}
var _ = wire.RegisterInterface(
struct{ BlockchainMessage }{},
wire.ConcreteType{&bcBlockRequestMessage{}, msgTypeBlockRequest},
wire.ConcreteType{&bcBlockResponseMessage{}, msgTypeBlockResponse},
wire.ConcreteType{&bcNoBlockResponseMessage{}, msgTypeNoBlockResponse},
wire.ConcreteType{&bcStatusResponseMessage{}, msgTypeStatusResponse},
wire.ConcreteType{&bcStatusRequestMessage{}, msgTypeStatusRequest},
)
func RegisterBlockchainMessages(cdc *amino.Codec) {
cdc.RegisterInterface((*BlockchainMessage)(nil), nil)
cdc.RegisterConcrete(&bcBlockRequestMessage{}, "tendermint/mempool/BlockRequest", nil)
cdc.RegisterConcrete(&bcBlockResponseMessage{}, "tendermint/mempool/BlockResponse", nil)
cdc.RegisterConcrete(&bcNoBlockResponseMessage{}, "tendermint/mempool/NoBlockResponse", nil)
cdc.RegisterConcrete(&bcStatusResponseMessage{}, "tendermint/mempool/StatusResponse", nil)
cdc.RegisterConcrete(&bcStatusRequestMessage{}, "tendermint/mempool/StatusRequest", nil)
}
// DecodeMessage decodes BlockchainMessage.
// TODO: ensure that bz is completely read.
func DecodeMessage(bz []byte, maxSize int) (msgType byte, msg BlockchainMessage, err error) {
msgType = bz[0]
n := int(0)
r := bytes.NewReader(bz)
msg = wire.ReadBinary(struct{ BlockchainMessage }{}, r, maxSize, &n, &err).(struct{ BlockchainMessage }).BlockchainMessage
if err != nil && n != len(bz) {
err = errors.New("DecodeMessage() had bytes left over")
func decodeMsg(bz []byte) (msg BlockchainMessage, err error) {
if len(bz) > maxMsgSize {
return msg, fmt.Errorf("Msg exceeds max size (%d > %d)", len(bz), maxMsgSize)
}
err = cdc.UnmarshalBinaryBare(bz, &msg)
return
}
@@ -361,7 +371,6 @@ func (brm *bcNoBlockResponseMessage) String() string {
//-------------------------------------
// NOTE: keep up-to-date with maxBlockchainResponseSize
type bcBlockResponseMessage struct {
Block *types.Block
}

View File

@@ -1,33 +1,44 @@
package blockchain
import (
"net"
"testing"
wire "github.com/tendermint/go-wire"
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"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
)
func newBlockchainReactor(maxBlockHeight int64) *BlockchainReactor {
logger := log.TestingLogger()
func makeStateAndBlockStore(logger log.Logger) (sm.State, *BlockStore) {
config := cfg.ResetTestRoot("blockchain_reactor_test")
// blockDB := dbm.NewDebugDB("blockDB", dbm.NewMemDB())
// stateDB := dbm.NewDebugDB("stateDB", dbm.NewMemDB())
blockDB := dbm.NewMemDB()
stateDB := dbm.NewMemDB()
blockStore := NewBlockStore(blockDB)
state, err := sm.LoadStateFromDBOrGenesisFile(stateDB, config.GenesisFile())
if err != nil {
panic(cmn.ErrorWrap(err, "error constructing state from genesis file"))
}
return state, blockStore
}
blockStore := NewBlockStore(dbm.NewMemDB())
// Get State
state, _ := sm.GetState(dbm.NewMemDB(), config.GenesisFile())
state.SetLogger(logger.With("module", "state"))
state.Save()
func newBlockchainReactor(logger log.Logger, maxBlockHeight int64) *BlockchainReactor {
state, blockStore := makeStateAndBlockStore(logger)
// Make the blockchainReactor itself
fastSync := true
bcReactor := NewBlockchainReactor(state.Copy(), nil, blockStore, fastSync)
var nilApp proxy.AppConnConsensus
blockExec := sm.NewBlockExecutor(dbm.NewMemDB(), log.TestingLogger(), nilApp,
sm.MockMempool{}, sm.MockEvidencePool{})
bcReactor := NewBlockchainReactor(state.Copy(), blockExec, blockStore, fastSync)
bcReactor.SetLogger(logger.With("module", "blockchain"))
// Next: we need to set a switch in order for peers to be added in
@@ -37,22 +48,22 @@ func newBlockchainReactor(maxBlockHeight int64) *BlockchainReactor {
for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ {
firstBlock := makeBlock(blockHeight, state)
secondBlock := makeBlock(blockHeight+1, state)
firstParts := firstBlock.MakePartSet(state.Params.BlockGossipParams.BlockPartSizeBytes)
firstParts := firstBlock.MakePartSet(state.ConsensusParams.BlockGossip.BlockPartSizeBytes)
blockStore.SaveBlock(firstBlock, firstParts, secondBlock.LastCommit)
}
return bcReactor
}
func TestNoBlockMessageResponse(t *testing.T) {
func TestNoBlockResponse(t *testing.T) {
maxBlockHeight := int64(20)
bcr := newBlockchainReactor(maxBlockHeight)
bcr := newBlockchainReactor(log.TestingLogger(), maxBlockHeight)
bcr.Start()
defer bcr.Stop()
// Add some peers in
peer := newbcrTestPeer(cmn.RandStr(12))
peer := newbcrTestPeer(p2p.ID(cmn.RandStr(12)))
bcr.AddPeer(peer)
chID := byte(0x01)
@@ -67,12 +78,13 @@ func TestNoBlockMessageResponse(t *testing.T) {
{100, false},
}
// receive a request message from peer,
// wait for our response to be received on the peer
for _, tt := range tests {
reqBlockMsg := &bcBlockRequestMessage{tt.height}
reqBlockBytes := wire.BinaryBytes(struct{ BlockchainMessage }{reqBlockMsg})
reqBlockBytes := cdc.MustMarshalBinaryBare(reqBlockMsg)
bcr.Receive(chID, peer, reqBlockBytes)
value := peer.lastValue()
msg := value.(struct{ BlockchainMessage }).BlockchainMessage
msg := peer.lastBlockchainMessage()
if tt.existent {
if blockMsg, ok := msg.(*bcBlockResponseMessage); !ok {
@@ -90,6 +102,49 @@ func TestNoBlockMessageResponse(t *testing.T) {
}
}
/*
// NOTE: This is too hard to test without
// an easy way to add test peer to switch
// or without significant refactoring of the module.
// Alternatively we could actually dial a TCP conn but
// that seems extreme.
func TestBadBlockStopsPeer(t *testing.T) {
maxBlockHeight := int64(20)
bcr := newBlockchainReactor(log.TestingLogger(), maxBlockHeight)
bcr.Start()
defer bcr.Stop()
// Add some peers in
peer := newbcrTestPeer(p2p.ID(cmn.RandStr(12)))
// XXX: This doesn't add the peer to anything,
// so it's hard to check that it's later removed
bcr.AddPeer(peer)
assert.True(t, bcr.Switch.Peers().Size() > 0)
// send a bad block from the peer
// default blocks already dont have commits, so should fail
block := bcr.store.LoadBlock(3)
msg := &bcBlockResponseMessage{Block: block}
peer.Send(BlockchainChannel, struct{ BlockchainMessage }{msg})
ticker := time.NewTicker(time.Millisecond * 10)
timer := time.NewTimer(time.Second * 2)
LOOP:
for {
select {
case <-ticker.C:
if bcr.Switch.Peers().Size() == 0 {
break LOOP
}
case <-timer.C:
t.Fatal("Timed out waiting to disconnect peer")
}
}
}
*/
//----------------------------------------------
// utility funcs
@@ -100,52 +155,54 @@ func makeTxs(height int64) (txs []types.Tx) {
return txs
}
func makeBlock(height int64, state *sm.State) *types.Block {
prevHash := state.LastBlockID.Hash
prevParts := types.PartSetHeader{}
valHash := state.Validators.Hash()
prevBlockID := types.BlockID{prevHash, prevParts}
block, _ := types.MakeBlock(height, "test_chain", makeTxs(height),
new(types.Commit), prevBlockID, valHash, state.AppHash, state.Params.BlockGossipParams.BlockPartSizeBytes)
func makeBlock(height int64, state sm.State) *types.Block {
block, _ := state.MakeBlock(height, makeTxs(height), new(types.Commit))
return block
}
// The Test peer
type bcrTestPeer struct {
cmn.Service
key string
ch chan interface{}
cmn.BaseService
id p2p.ID
ch chan interface{}
}
var _ p2p.Peer = (*bcrTestPeer)(nil)
func newbcrTestPeer(key string) *bcrTestPeer {
return &bcrTestPeer{
Service: cmn.NewBaseService(nil, "bcrTestPeer", nil),
key: key,
ch: make(chan interface{}, 2),
func newbcrTestPeer(id p2p.ID) *bcrTestPeer {
bcr := &bcrTestPeer{
id: id,
ch: make(chan interface{}, 2),
}
bcr.BaseService = *cmn.NewBaseService(nil, "bcrTestPeer", bcr)
return bcr
}
func (tp *bcrTestPeer) lastValue() interface{} { return <-tp.ch }
func (tp *bcrTestPeer) lastBlockchainMessage() interface{} { return <-tp.ch }
func (tp *bcrTestPeer) TrySend(chID byte, value interface{}) bool {
if _, ok := value.(struct{ BlockchainMessage }).BlockchainMessage.(*bcStatusResponseMessage); ok {
func (tp *bcrTestPeer) TrySend(chID byte, msgBytes []byte) bool {
var msg BlockchainMessage
err := cdc.UnmarshalBinaryBare(msgBytes, &msg)
if err != nil {
panic(cmn.ErrorWrap(err, "Error while trying to parse a BlockchainMessage"))
}
if _, ok := msg.(*bcStatusResponseMessage); ok {
// Discard status response messages since they skew our results
// We only want to deal with:
// + bcBlockResponseMessage
// + bcNoBlockResponseMessage
} else {
tp.ch <- value
tp.ch <- msg
}
return true
}
func (tp *bcrTestPeer) Send(chID byte, data interface{}) bool { return tp.TrySend(chID, data) }
func (tp *bcrTestPeer) NodeInfo() *p2p.NodeInfo { return nil }
func (tp *bcrTestPeer) Status() p2p.ConnectionStatus { return p2p.ConnectionStatus{} }
func (tp *bcrTestPeer) Key() string { return tp.key }
func (tp *bcrTestPeer) IsOutbound() bool { return false }
func (tp *bcrTestPeer) IsPersistent() bool { return true }
func (tp *bcrTestPeer) Get(s string) interface{} { return s }
func (tp *bcrTestPeer) Set(string, interface{}) {}
func (tp *bcrTestPeer) Send(chID byte, msgBytes []byte) bool { return tp.TrySend(chID, msgBytes) }
func (tp *bcrTestPeer) NodeInfo() p2p.NodeInfo { return p2p.NodeInfo{} }
func (tp *bcrTestPeer) Status() p2p.ConnectionStatus { return p2p.ConnectionStatus{} }
func (tp *bcrTestPeer) ID() p2p.ID { return tp.id }
func (tp *bcrTestPeer) IsOutbound() bool { return false }
func (tp *bcrTestPeer) IsPersistent() bool { return true }
func (tp *bcrTestPeer) Get(s string) interface{} { return s }
func (tp *bcrTestPeer) Set(string, interface{}) {}
func (tp *bcrTestPeer) RemoteIP() net.IP { return []byte{127, 0, 0, 1} }

View File

@@ -1,20 +1,17 @@
package blockchain
import (
"bytes"
"encoding/json"
"fmt"
"io"
"sync"
wire "github.com/tendermint/go-wire"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
)
/*
Simple low level store for blocks.
BlockStore is a simple low level store for blocks.
There are three types of information stored:
- BlockMeta: Meta information about each block
@@ -23,7 +20,7 @@ There are three types of information stored:
Currently the precommit signatures are duplicated in the Block parts as
well as the Commit. In the future this may change, perhaps by moving
the Commit data outside the Block.
the Commit data outside the Block. (TODO)
// NOTE: BlockStore methods will panic if they encounter errors
// deserializing loaded data, indicating probable corruption on disk.
@@ -35,6 +32,8 @@ type BlockStore struct {
height int64
}
// NewBlockStore returns a new BlockStore with the given DB,
// initialized to the last height that was committed to the DB.
func NewBlockStore(db dbm.DB) *BlockStore {
bsjson := LoadBlockStoreStateJSON(db)
return &BlockStore{
@@ -43,112 +42,113 @@ func NewBlockStore(db dbm.DB) *BlockStore {
}
}
// Height() returns the last known contiguous block height.
// Height returns the last known contiguous block height.
func (bs *BlockStore) Height() int64 {
bs.mtx.RLock()
defer bs.mtx.RUnlock()
return bs.height
}
func (bs *BlockStore) GetReader(key []byte) io.Reader {
bytez := bs.db.Get(key)
if bytez == nil {
return nil
}
return bytes.NewReader(bytez)
}
// LoadBlock returns the block with the given height.
// If no block is found for that height, it returns nil.
func (bs *BlockStore) LoadBlock(height int64) *types.Block {
var n int
var err error
r := bs.GetReader(calcBlockMetaKey(height))
if r == nil {
var blockMeta = bs.LoadBlockMeta(height)
if blockMeta == nil {
return nil
}
blockMeta := wire.ReadBinary(&types.BlockMeta{}, r, 0, &n, &err).(*types.BlockMeta)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block meta: %v", err))
}
bytez := []byte{}
var block = new(types.Block)
buf := []byte{}
for i := 0; i < blockMeta.BlockID.PartsHeader.Total; i++ {
part := bs.LoadBlockPart(height, i)
bytez = append(bytez, part.Bytes...)
buf = append(buf, part.Bytes...)
}
block := wire.ReadBinary(&types.Block{}, bytes.NewReader(bytez), 0, &n, &err).(*types.Block)
err := cdc.UnmarshalBinary(buf, block)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block: %v", err))
// NOTE: The existence of meta should imply the existence of the
// block. So, make sure meta is only saved after blocks are saved.
panic(cmn.ErrorWrap(err, "Error reading block"))
}
return block
}
// LoadBlockPart returns the Part at the given index
// from the block at the given height.
// If no part is found for the given height and index, it returns nil.
func (bs *BlockStore) LoadBlockPart(height int64, index int) *types.Part {
var n int
var err error
r := bs.GetReader(calcBlockPartKey(height, index))
if r == nil {
var part = new(types.Part)
bz := bs.db.Get(calcBlockPartKey(height, index))
if len(bz) == 0 {
return nil
}
part := wire.ReadBinary(&types.Part{}, r, 0, &n, &err).(*types.Part)
err := cdc.UnmarshalBinaryBare(bz, part)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block part: %v", err))
panic(cmn.ErrorWrap(err, "Error reading block part"))
}
return part
}
// LoadBlockMeta returns the BlockMeta for the given height.
// If no block is found for the given height, it returns nil.
func (bs *BlockStore) LoadBlockMeta(height int64) *types.BlockMeta {
var n int
var err error
r := bs.GetReader(calcBlockMetaKey(height))
if r == nil {
var blockMeta = new(types.BlockMeta)
bz := bs.db.Get(calcBlockMetaKey(height))
if len(bz) == 0 {
return nil
}
blockMeta := wire.ReadBinary(&types.BlockMeta{}, r, 0, &n, &err).(*types.BlockMeta)
err := cdc.UnmarshalBinaryBare(bz, blockMeta)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block meta: %v", err))
panic(cmn.ErrorWrap(err, "Error reading block meta"))
}
return blockMeta
}
// The +2/3 and other Precommit-votes for block at `height`.
// This Commit comes from block.LastCommit for `height+1`.
// LoadBlockCommit returns the Commit for the given height.
// This commit consists of the +2/3 and other Precommit-votes for block at `height`,
// and it comes from the block.LastCommit for `height+1`.
// If no commit is found for the given height, it returns nil.
func (bs *BlockStore) LoadBlockCommit(height int64) *types.Commit {
var n int
var err error
r := bs.GetReader(calcBlockCommitKey(height))
if r == nil {
var commit = new(types.Commit)
bz := bs.db.Get(calcBlockCommitKey(height))
if len(bz) == 0 {
return nil
}
commit := wire.ReadBinary(&types.Commit{}, r, 0, &n, &err).(*types.Commit)
err := cdc.UnmarshalBinaryBare(bz, commit)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading commit: %v", err))
panic(cmn.ErrorWrap(err, "Error reading block commit"))
}
return commit
}
// NOTE: the Precommit-vote heights are for the block at `height`
// LoadSeenCommit returns the locally seen Commit for the given height.
// This is useful when we've seen a commit, but there has not yet been
// a new block at `height + 1` that includes this commit in its block.LastCommit.
func (bs *BlockStore) LoadSeenCommit(height int64) *types.Commit {
var n int
var err error
r := bs.GetReader(calcSeenCommitKey(height))
if r == nil {
var commit = new(types.Commit)
bz := bs.db.Get(calcSeenCommitKey(height))
if len(bz) == 0 {
return nil
}
commit := wire.ReadBinary(&types.Commit{}, r, 0, &n, &err).(*types.Commit)
err := cdc.UnmarshalBinaryBare(bz, commit)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading commit: %v", err))
panic(cmn.ErrorWrap(err, "Error reading block seen commit"))
}
return commit
}
// SaveBlock persists the given block, blockParts, and seenCommit to the underlying db.
// blockParts: Must be parts of the block
// seenCommit: The +2/3 precommits that were seen which committed at height.
// If all the nodes restart after committing a block,
// we need this to reload the precommits to catch-up nodes to the
// most recent height. Otherwise they'd stall at H-1.
func (bs *BlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) {
if block == nil {
cmn.PanicSanity("BlockStore can only save a non-nil block")
}
height := block.Height
if height != bs.Height()+1 {
cmn.PanicSanity(cmn.Fmt("BlockStore can only save contiguous blocks. Wanted %v, got %v", bs.Height()+1, height))
if g, w := height, bs.Height()+1; g != w {
cmn.PanicSanity(cmn.Fmt("BlockStore can only save contiguous blocks. Wanted %v, got %v", w, g))
}
if !blockParts.IsComplete() {
cmn.PanicSanity(cmn.Fmt("BlockStore can only save complete block part sets"))
@@ -156,21 +156,22 @@ func (bs *BlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, s
// Save block meta
blockMeta := types.NewBlockMeta(block, blockParts)
metaBytes := wire.BinaryBytes(blockMeta)
metaBytes := cdc.MustMarshalBinaryBare(blockMeta)
bs.db.Set(calcBlockMetaKey(height), metaBytes)
// Save block parts
for i := 0; i < blockParts.Total(); i++ {
bs.saveBlockPart(height, i, blockParts.GetPart(i))
part := blockParts.GetPart(i)
bs.saveBlockPart(height, i, part)
}
// Save block commit (duplicate and separate from the Block)
blockCommitBytes := wire.BinaryBytes(block.LastCommit)
blockCommitBytes := cdc.MustMarshalBinaryBare(block.LastCommit)
bs.db.Set(calcBlockCommitKey(height-1), blockCommitBytes)
// Save seen commit (seen +2/3 precommits for block)
// NOTE: we can delete this at a later height
seenCommitBytes := wire.BinaryBytes(seenCommit)
seenCommitBytes := cdc.MustMarshalBinaryBare(seenCommit)
bs.db.Set(calcSeenCommitKey(height), seenCommitBytes)
// Save new BlockStoreStateJSON descriptor
@@ -189,7 +190,7 @@ func (bs *BlockStore) saveBlockPart(height int64, index int, part *types.Part) {
if height != bs.Height()+1 {
cmn.PanicSanity(cmn.Fmt("BlockStore can only save contiguous blocks. Wanted %v, got %v", bs.Height()+1, height))
}
partBytes := wire.BinaryBytes(part)
partBytes := cdc.MustMarshalBinaryBare(part)
bs.db.Set(calcBlockPartKey(height, index), partBytes)
}
@@ -216,28 +217,31 @@ func calcSeenCommitKey(height int64) []byte {
var blockStoreKey = []byte("blockStore")
type BlockStoreStateJSON struct {
Height int64
Height int64 `json:"height"`
}
// Save persists the blockStore state to the database as JSON.
func (bsj BlockStoreStateJSON) Save(db dbm.DB) {
bytes, err := json.Marshal(bsj)
bytes, err := cdc.MarshalJSON(bsj)
if err != nil {
cmn.PanicSanity(cmn.Fmt("Could not marshal state bytes: %v", err))
}
db.SetSync(blockStoreKey, bytes)
}
// LoadBlockStoreStateJSON returns the BlockStoreStateJSON as loaded from disk.
// If no BlockStoreStateJSON was previously persisted, it returns the zero value.
func LoadBlockStoreStateJSON(db dbm.DB) BlockStoreStateJSON {
bytes := db.Get(blockStoreKey)
if bytes == nil {
if len(bytes) == 0 {
return BlockStoreStateJSON{
Height: 0,
}
}
bsj := BlockStoreStateJSON{}
err := json.Unmarshal(bytes, &bsj)
err := cdc.UnmarshalJSON(bytes, &bsj)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Could not unmarshal bytes: %X", bytes))
panic(fmt.Sprintf("Could not unmarshal bytes: %X", bytes))
}
return bsj
}

383
blockchain/store_test.go Normal file
View File

@@ -0,0 +1,383 @@
package blockchain
import (
"bytes"
"fmt"
"runtime/debug"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/types"
)
func TestLoadBlockStoreStateJSON(t *testing.T) {
db := db.NewMemDB()
bsj := &BlockStoreStateJSON{Height: 1000}
bsj.Save(db)
retrBSJ := LoadBlockStoreStateJSON(db)
assert.Equal(t, *bsj, retrBSJ, "expected the retrieved DBs to match")
}
func TestNewBlockStore(t *testing.T) {
db := db.NewMemDB()
db.Set(blockStoreKey, []byte(`{"height": "10000"}`))
bs := NewBlockStore(db)
require.Equal(t, int64(10000), bs.Height(), "failed to properly parse blockstore")
panicCausers := []struct {
data []byte
wantErr string
}{
{[]byte("artful-doger"), "not unmarshal bytes"},
{[]byte(" "), "unmarshal bytes"},
}
for i, tt := range panicCausers {
// Expecting a panic here on trying to parse an invalid blockStore
_, _, panicErr := doFn(func() (interface{}, error) {
db.Set(blockStoreKey, tt.data)
_ = NewBlockStore(db)
return nil, nil
})
require.NotNil(t, panicErr, "#%d panicCauser: %q expected a panic", i, tt.data)
assert.Contains(t, panicErr.Error(), tt.wantErr, "#%d data: %q", i, tt.data)
}
db.Set(blockStoreKey, nil)
bs = NewBlockStore(db)
assert.Equal(t, bs.Height(), int64(0), "expecting nil bytes to be unmarshaled alright")
}
func freshBlockStore() (*BlockStore, db.DB) {
db := db.NewMemDB()
return NewBlockStore(db), db
}
var (
state, _ = makeStateAndBlockStore(log.NewTMLogger(new(bytes.Buffer)))
block = makeBlock(1, state)
partSet = block.MakePartSet(2)
part1 = partSet.GetPart(0)
part2 = partSet.GetPart(1)
seenCommit1 = &types.Commit{Precommits: []*types.Vote{{Height: 10,
Timestamp: time.Now().UTC()}}}
)
// TODO: This test should be simplified ...
func TestBlockStoreSaveLoadBlock(t *testing.T) {
state, bs := makeStateAndBlockStore(log.NewTMLogger(new(bytes.Buffer)))
require.Equal(t, bs.Height(), int64(0), "initially the height should be zero")
// check there are no blocks at various heights
noBlockHeights := []int64{0, -1, 100, 1000, 2}
for i, height := range noBlockHeights {
if g := bs.LoadBlock(height); g != nil {
t.Errorf("#%d: height(%d) got a block; want nil", i, height)
}
}
// save a block
block := makeBlock(bs.Height()+1, state)
validPartSet := block.MakePartSet(2)
seenCommit := &types.Commit{Precommits: []*types.Vote{{Height: 10,
Timestamp: time.Now().UTC()}}}
bs.SaveBlock(block, partSet, seenCommit)
require.Equal(t, bs.Height(), block.Header.Height, "expecting the new height to be changed")
incompletePartSet := types.NewPartSetFromHeader(types.PartSetHeader{Total: 2})
uncontiguousPartSet := types.NewPartSetFromHeader(types.PartSetHeader{Total: 0})
uncontiguousPartSet.AddPart(part2)
header1 := types.Header{
Height: 1,
NumTxs: 100,
ChainID: "block_test",
Time: time.Now(),
}
header2 := header1
header2.Height = 4
// End of setup, test data
commitAtH10 := &types.Commit{Precommits: []*types.Vote{{Height: 10,
Timestamp: time.Now().UTC()}}}
tuples := []struct {
block *types.Block
parts *types.PartSet
seenCommit *types.Commit
wantErr bool
wantPanic string
corruptBlockInDB bool
corruptCommitInDB bool
corruptSeenCommitInDB bool
eraseCommitInDB bool
eraseSeenCommitInDB bool
}{
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
},
{
block: nil,
wantPanic: "only save a non-nil block",
},
{
block: newBlock(&header2, commitAtH10),
parts: uncontiguousPartSet,
wantPanic: "only save contiguous blocks", // and incomplete and uncontiguous parts
},
{
block: newBlock(&header1, commitAtH10),
parts: incompletePartSet,
wantPanic: "only save complete block", // incomplete parts
},
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
corruptCommitInDB: true, // Corrupt the DB's commit entry
wantPanic: "unmarshal to types.Commit failed",
},
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
wantPanic: "unmarshal to types.BlockMeta failed",
corruptBlockInDB: true, // Corrupt the DB's block entry
},
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
// Expecting no error and we want a nil back
eraseSeenCommitInDB: true,
},
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
corruptSeenCommitInDB: true,
wantPanic: "unmarshal to types.Commit failed",
},
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
// Expecting no error and we want a nil back
eraseCommitInDB: true,
},
}
type quad struct {
block *types.Block
commit *types.Commit
meta *types.BlockMeta
seenCommit *types.Commit
}
for i, tuple := range tuples {
bs, db := freshBlockStore()
// SaveBlock
res, err, panicErr := doFn(func() (interface{}, error) {
bs.SaveBlock(tuple.block, tuple.parts, tuple.seenCommit)
if tuple.block == nil {
return nil, nil
}
if tuple.corruptBlockInDB {
db.Set(calcBlockMetaKey(tuple.block.Height), []byte("block-bogus"))
}
bBlock := bs.LoadBlock(tuple.block.Height)
bBlockMeta := bs.LoadBlockMeta(tuple.block.Height)
if tuple.eraseSeenCommitInDB {
db.Delete(calcSeenCommitKey(tuple.block.Height))
}
if tuple.corruptSeenCommitInDB {
db.Set(calcSeenCommitKey(tuple.block.Height), []byte("bogus-seen-commit"))
}
bSeenCommit := bs.LoadSeenCommit(tuple.block.Height)
commitHeight := tuple.block.Height - 1
if tuple.eraseCommitInDB {
db.Delete(calcBlockCommitKey(commitHeight))
}
if tuple.corruptCommitInDB {
db.Set(calcBlockCommitKey(commitHeight), []byte("foo-bogus"))
}
bCommit := bs.LoadBlockCommit(commitHeight)
return &quad{block: bBlock, seenCommit: bSeenCommit, commit: bCommit,
meta: bBlockMeta}, nil
})
if subStr := tuple.wantPanic; subStr != "" {
if panicErr == nil {
t.Errorf("#%d: want a non-nil panic", i)
} else if got := panicErr.Error(); !strings.Contains(got, subStr) {
t.Errorf("#%d:\n\tgotErr: %q\nwant substring: %q", i, got, subStr)
}
continue
}
if tuple.wantErr {
if err == nil {
t.Errorf("#%d: got nil error", i)
}
continue
}
assert.Nil(t, panicErr, "#%d: unexpected panic", i)
assert.Nil(t, err, "#%d: expecting a non-nil error", i)
qua, ok := res.(*quad)
if !ok || qua == nil {
t.Errorf("#%d: got nil quad back; gotType=%T", i, res)
continue
}
if tuple.eraseSeenCommitInDB {
assert.Nil(t, qua.seenCommit,
"erased the seenCommit in the DB hence we should get back a nil seenCommit")
}
if tuple.eraseCommitInDB {
assert.Nil(t, qua.commit,
"erased the commit in the DB hence we should get back a nil commit")
}
}
}
func TestLoadBlockPart(t *testing.T) {
bs, db := freshBlockStore()
height, index := int64(10), 1
loadPart := func() (interface{}, error) {
part := bs.LoadBlockPart(height, index)
return part, nil
}
// Initially no contents.
// 1. Requesting for a non-existent block shouldn't fail
res, _, panicErr := doFn(loadPart)
require.Nil(t, panicErr, "a non-existent block part shouldn't cause a panic")
require.Nil(t, res, "a non-existent block part should return nil")
// 2. Next save a corrupted block then try to load it
db.Set(calcBlockPartKey(height, index), []byte("Tendermint"))
res, _, panicErr = doFn(loadPart)
require.NotNil(t, panicErr, "expecting a non-nil panic")
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))
gotPart, _, panicErr := doFn(loadPart)
require.Nil(t, panicErr, "an existent and proper block should not panic")
require.Nil(t, res, "a properly saved block should return a proper block")
require.Equal(t, gotPart.(*types.Part).Hash(), part1.Hash(),
"expecting successful retrieval of previously saved block")
}
func TestLoadBlockMeta(t *testing.T) {
bs, db := freshBlockStore()
height := int64(10)
loadMeta := func() (interface{}, error) {
meta := bs.LoadBlockMeta(height)
return meta, nil
}
// Initially no contents.
// 1. Requesting for a non-existent blockMeta shouldn't fail
res, _, panicErr := doFn(loadMeta)
require.Nil(t, panicErr, "a non-existent blockMeta shouldn't cause a panic")
require.Nil(t, res, "a non-existent blockMeta should return nil")
// 2. Next save a corrupted blockMeta then try to load it
db.Set(calcBlockMetaKey(height), []byte("Tendermint-Meta"))
res, _, panicErr = doFn(loadMeta)
require.NotNil(t, panicErr, "expecting a non-nil panic")
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{}
db.Set(calcBlockMetaKey(height), cdc.MustMarshalBinaryBare(meta))
gotMeta, _, panicErr := doFn(loadMeta)
require.Nil(t, panicErr, "an existent and proper block should not panic")
require.Nil(t, res, "a properly saved blockMeta should return a proper blocMeta ")
require.Equal(t, cdc.MustMarshalBinaryBare(meta), cdc.MustMarshalBinaryBare(gotMeta),
"expecting successful retrieval of previously saved blockMeta")
}
func TestBlockFetchAtHeight(t *testing.T) {
state, bs := makeStateAndBlockStore(log.NewTMLogger(new(bytes.Buffer)))
require.Equal(t, bs.Height(), int64(0), "initially the height should be zero")
block := makeBlock(bs.Height()+1, state)
partSet := block.MakePartSet(2)
seenCommit := &types.Commit{Precommits: []*types.Vote{{Height: 10,
Timestamp: time.Now().UTC()}}}
bs.SaveBlock(block, partSet, seenCommit)
require.Equal(t, bs.Height(), block.Header.Height, "expecting the new height to be changed")
blockAtHeight := bs.LoadBlock(bs.Height())
bz1 := cdc.MustMarshalBinaryBare(block)
bz2 := cdc.MustMarshalBinaryBare(blockAtHeight)
require.Equal(t, bz1, bz2)
require.Equal(t, block.Hash(), blockAtHeight.Hash(),
"expecting a successful load of the last saved block")
blockAtHeightPlus1 := bs.LoadBlock(bs.Height() + 1)
require.Nil(t, blockAtHeightPlus1, "expecting an unsuccessful load of Height()+1")
blockAtHeightPlus2 := bs.LoadBlock(bs.Height() + 2)
require.Nil(t, blockAtHeightPlus2, "expecting an unsuccessful load of Height()+2")
}
func doFn(fn func() (interface{}, error)) (res interface{}, err error, panicErr error) {
defer func() {
if r := recover(); r != nil {
switch e := r.(type) {
case error:
panicErr = e
case string:
panicErr = fmt.Errorf("%s", e)
default:
if st, ok := r.(fmt.Stringer); ok {
panicErr = fmt.Errorf("%s", st)
} else {
panicErr = fmt.Errorf("%s", debug.Stack())
}
}
}
}()
res, err = fn()
return res, err, panicErr
}
func newBlock(hdr *types.Header, lastCommit *types.Commit) *types.Block {
return &types.Block{
Header: hdr,
LastCommit: lastCommit,
}
}

13
blockchain/wire.go Normal file
View File

@@ -0,0 +1,13 @@
package blockchain
import (
"github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/crypto"
)
var cdc = amino.NewCodec()
func init() {
RegisterBlockchainMessages(cdc)
crypto.RegisterAmino(cdc)
}

View File

@@ -1,33 +0,0 @@
---
machine:
environment:
MACH_PREFIX: tendermint-test-mach
DOCKER_VERSION: 1.10.0
DOCKER_MACHINE_VERSION: 0.9.0
GOPATH: "$HOME/.go_project"
PROJECT_PARENT_PATH: "$GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME"
PROJECT_PATH: "$PROJECT_PARENT_PATH/$CIRCLE_PROJECT_REPONAME"
hosts:
localhost: 127.0.0.1
dependencies:
override:
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | sudo bash -s -- $DOCKER_VERSION
- sudo start docker
- sudo curl -sSL -o /usr/bin/docker-machine "https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_VERSION/docker-machine-`uname -s`-`uname -m`"; sudo chmod 0755 /usr/bin/docker-machine
- mkdir -p "$PROJECT_PARENT_PATH"
- ln -sf "$HOME/$CIRCLE_PROJECT_REPONAME/" "$PROJECT_PATH"
post:
- go version
- docker version
- docker-machine version
test:
override:
- cd "$PROJECT_PATH" && set -o pipefail && make test_integrations 2>&1 | tee test_integrations.log:
timeout: 1800
post:
- cd "$PROJECT_PATH" && mv test_integrations.log "${CIRCLE_ARTIFACTS}"
- cd "$PROJECT_PATH" && bash <(curl -s https://codecov.io/bash) -f coverage.txt
- cd "$PROJECT_PATH" && mv coverage.txt "${CIRCLE_ARTIFACTS}"
- cd "$PROJECT_PATH" && cp test/logs/messages "${CIRCLE_ARTIFACTS}/docker_logs.txt"

View File

@@ -0,0 +1,53 @@
package main
import (
"flag"
"os"
crypto "github.com/tendermint/tendermint/crypto"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/privval"
)
func main() {
var (
addr = flag.String("addr", ":26659", "Address of client to connect to")
chainID = flag.String("chain-id", "mychain", "chain id")
privValPath = flag.String("priv", "", "priv val file path")
logger = log.NewTMLogger(
log.NewSyncWriter(os.Stdout),
).With("module", "priv_val")
)
flag.Parse()
logger.Info(
"Starting private validator",
"addr", *addr,
"chainID", *chainID,
"privPath", *privValPath,
)
pv := privval.LoadFilePV(*privValPath)
rs := privval.NewRemoteSigner(
logger,
*chainID,
*addr,
pv,
crypto.GenPrivKeyEd25519(),
)
err := rs.Start()
if err != nil {
panic(err)
}
cmn.TrapSignal(func() {
err := rs.Stop()
if err != nil {
panic(err)
}
})
}

View File

@@ -0,0 +1,32 @@
package commands
import (
"fmt"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/p2p"
cmn "github.com/tendermint/tendermint/libs/common"
)
// GenNodeKeyCmd allows the generation of a node key. It prints node's ID to
// the standard output.
var GenNodeKeyCmd = &cobra.Command{
Use: "gen_node_key",
Short: "Generate a node key for this node and print its ID",
RunE: genNodeKey,
}
func genNodeKey(cmd *cobra.Command, args []string) error {
nodeKeyFile := config.NodeKeyFile()
if cmn.FileExists(nodeKeyFile) {
return fmt.Errorf("node key at %s already exists", nodeKeyFile)
}
nodeKey, err := p2p.LoadOrGenNodeKey(nodeKeyFile)
if err != nil {
return err
}
fmt.Println(nodeKey.ID())
return nil
}

View File

@@ -1,12 +1,11 @@
package commands
import (
"encoding/json"
"fmt"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/privval"
)
// GenValidatorCmd allows the generation of a keypair for a
@@ -18,11 +17,11 @@ var GenValidatorCmd = &cobra.Command{
}
func genValidator(cmd *cobra.Command, args []string) {
privValidator := types.GenPrivValidatorFS("")
privValidatorJSONBytes, err := json.MarshalIndent(privValidator, "", "\t")
pv := privval.GenFilePV("")
jsbz, err := cdc.MarshalJSON(pv)
if err != nil {
panic(err)
}
fmt.Printf(`%v
`, string(privValidatorJSONBytes))
`, string(jsbz))
}

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