Compare commits

..

733 Commits

Author SHA1 Message Date
Ethan Buchman
2aa2b63cad Merge pull request #1942 from tendermint/release/v0.22.3
Release/v0.22.3
2018-07-10 14:12:56 -04:00
Ethan Buchman
17c924de7e changelog, version 2018-07-10 11:56:22 -04:00
Ethan Buchman
ebe97d3956 dep: pin all deps to version or commit 2018-07-10 11:56:19 -04:00
Ethan Buchman
9d81a74429 dev version 2018-07-10 10:12:55 -04:00
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
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
Zach Ramsay
003d8956a5 rm dead docs file 2018-06-22 18:23:45 -04: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
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
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
ValarDragon
1d66e34dc8 Bech32: Wrap error messages 2018-06-09 16:22:52 -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
Anton Kaliaev
f0c44d1bd0 [autofile] include call to group#Close in tests 2018-06-06 11:52:59 +04: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
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
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
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
d24a30858e no gogo proto 2018-05-24 00:10:35 -04:00
Ethan Buchman
c3b72ea708 Merge pull request #210 from tendermint/bucky/tmhash
tmhash
2018-05-22 12:09:52 -04: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
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
468be0f8d6 mv remotedb, proto, grpcdb all under db/remotedb 2018-05-14 15:49:00 -04:00
Ethan Buchman
45caff1a20 changelog and version 2018-05-14 15:21:29 -04: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
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
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
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
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
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
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
mossid
50c521e706 expose KVPair 2018-04-05 21:56:29 +02:00
mossid
2861f795f5 add SimpleProofsFromMap 2018-04-05 21:30:15 +02:00
Jae Kwon
2e24b64fc1 Add IsEmpty; Publish 0.8.1 2018-04-05 03:14:53 -07: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
Ethan Buchman
5c3d3f0875 Merge pull request #194 from Tilkal/random-missing-methods
Random missing methods
2018-04-03 23:52:16 +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
f457435199 HexBytes formatting; Make computeHashFromAunts more defensive 2018-04-03 07:02:19 -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
Thomas Corbière
3375dac049 add Float64() and RandFloat64(). 2018-04-03 14:09:50 +02: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
Ethan Buchman
a557bb4d0b Merge pull request #185 from tendermint/bucky/merge-master
Bucky/merge master
2018-04-02 22:26:22 +03:00
Jae Kwon
382e99d06e Add IsTypedNil 2018-04-02 01:47:42 -07:00
Ethan Buchman
41302c206a Merge branch 'master' into develop
* Update changelog
2018-03-31 19:36:05 +03:00
Anton Kaliaev
898216d419 add SplitAndTrim func (#183)
Refs https://github.com/tendermint/tendermint/issues/1380
2018-03-29 12:04:01 +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
Christopher Goes
6e26392209 Return config parse errors (#182) 2018-03-28 15:35:52 +02:00
Jae Kwon
e9cf47606c Merge panics into errors in Parallel 2018-03-25 00:04:47 +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
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
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
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
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
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
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
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
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
Jae Kwon
b1cc688a61 encodeByteSlice uses uvarint for length instead of varint (#161) 2018-03-12 09:46:31 +04:00
Simon Vadée
066fe82a92 pubsub implements service.OnReset (#156) 2018-03-06 11:29:18 +04:00
Zaki Manian
26f2ab65f8 Switch to dep from glide (#155) 2018-02-27 16:01:49 +04: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
c6163bdab2 version bump and changelog 2018-02-19 17:05:36 -05:00
Ethan Buchman
a0f652dc2e Merge pull request #151 from tendermint/fix/nit
minor nit
2018-02-14 11:57:38 -05:00
Ethan Buchman
737c30c19d minor nit 2018-02-12 19:12:24 -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
a57340ffb5 add Quit method to Service interface
remove deprecated QuitService
2018-02-12 11:40:42 +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
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
35bb398b1f Merge pull request #147 from tendermint/reduce-bitArray-fragility
common/BitArray: reduce fragility with methods
2018-02-08 15:31:30 -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
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
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
1d7fc78ea1 update glide 2018-02-02 23:49:14 -05:00
Ethan Buchman
690d6c6070 cli: WriteDemoConfig -> WriteConfigVals 2018-02-02 23:05:28 -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
cbc63518e5 Export DbBackendType in order to fix IAVL tests 2018-02-02 18:50:24 +01:00
Adrian Brink
2e76546223 Clean up glide.yaml 2018-02-02 18:09:48 +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
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
Zach
fa8c374aff Merge branch 'master' into develop 2018-01-25 00:10:39 +00: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
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
f2bfa83b42 Merge pull request #116 from tendermint/remove-logger-package
remove deprecated logger package
2017-12-29 20:50:03 -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
91b4b534ad Merge pull request #118 from tendermint/develop
v0.6.0
2017-12-29 11:05:12 -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
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
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
Jae Kwon
e47ce81422 Comment fixes from Emmanuel 2017-12-28 03:05:55 -08:00
Jae Kwon
93c05aa8c0 Add back on HexBytes 2017-12-27 13:52:32 -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
bf644b0984 Do not shadow assert 2017-12-26 00:36:58 -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
Jae Kwon
f2a8e95248 Add KI64Pair(s) 2017-12-25 11:40:05 -08:00
Ethan Buchman
218acc2224 Merge pull request #107 from tendermint/fix/cmn
Fix/cmn
2017-12-21 16:30:45 -05:00
Ethan Buchman
e2d7f1aa41 cmn: fix race 2017-12-21 14:21:15 -05: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
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
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
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
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
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
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
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
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
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
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
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
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
Jae Kwon
50a30aafc1 New canonical Iterator 2017-12-12 12:44:47 -08:00
Zach Ramsay
f39b575503 remove deprecated --root flag 2017-12-12 16:55:41 +00: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
Jae Kwon
a0b692c86d Add PushBytes to Heap 2017-12-10 14:23:27 -08:00
Jae Kwon
03dfb724c7 Change heap.Push to mean int priority 2017-12-10 10:18:35 -08: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
Jae Kwon
988e190ef7 Deprecated Panic* 2017-12-09 09:26:03 -08: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
ec4adf21e0 Cleanup from PR comments 2017-12-08 10:15:26 +01: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
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
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 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
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
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
Anton Kaliaev
27ab1f6bd9 Merge pull request #90 from tendermint/feature/throttle-timer
test timers
2017-12-05 14:17:41 -06: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
Jae Kwon
17dc8a7449 SetDeleter/Batch separation 2017-12-03 21:44:48 -08:00
Petabyte Storage
ebc543ebe3 fix warnings 2017-12-01 09:51:37 -08: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 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
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
d3bac7a6fe clist: reduce numTimes in test 2017-11-27 19:49:30 +00:00
Ethan Buchman
135a1a7cd7 db: sort keys for memdb iterator 2017-11-20 03:06:18 +00: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
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
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
Ethan Buchman
d9525c0fb6 Merge pull request #70 from tendermint/develop
Develop
2017-10-27 12:05:43 -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
42145a82bd version and changelog 2017-10-26 20:57:33 -04: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
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
Silas Davis
0eff425bc7 fix zeroed buffer getting flushed to the empty event 2017-10-23 18:52:31 +01: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
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
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
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
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
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
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
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
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
4e955434aa Merge pull request #48 from tendermint/log_tweak
Log tweak
2017-09-16 00:40:44 -04:00
Jae Kwon
3a36776d4a Reorder file for grokability 2017-09-10 18:45:20 -07: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
df250b6941 docs: go-events -> tmlibs/events 2017-04-21 16:25:23 -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
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
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
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
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 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
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
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
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
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
Ethan Frey
a816ff0bab Add test 2017-02-27 14:52:48 +01: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
339e135776 Add IsDirEmpty 2017-01-27 20:37:04 -08:00
Ethan Buchman
72f6dacd22 fix tests 2017-01-12 22:32:20 -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
2337086736 use mtx in OnStop 2017-01-12 14:32:48 -05: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
Ethan Buchman
a552e49b50 Reverts commit f40b1b to a6a67e 2016-12-12 23:08:31 -05: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
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
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
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
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
Jae Kwon
9dc4dc1960 Add BitArray.Update() 2016-09-05 18:26:43 -07:00
Ethan Buchman
3baa390bba reduce numTimes in test 2016-07-23 11:24:48 -04:00
Silas Davis
b0c0631468 Spelling 2016-07-13 18:50:06 +01: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
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
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
Ethan Buchman
dcfa46af13 BitArray.IsEmpty() 2016-03-18 02:30:15 -04:00
Jae Kwon
461c3b9785 Remove CRand* from go-common 2016-03-13 09:57:10 -07:00
Jae Kwon
84391b36d3 Conform to new go-config default config behavior 2016-03-06 12:31:22 -08:00
Jae Kwon
1559ae1ac9 Add BitArray.Bytes() 2016-02-21 00:14:08 -08:00
Ethan Buchman
4901b71ade SetLogLevel 2016-02-05 23:00:03 +00: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
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
a7878f1d0d Add basic test for level_db 2016-01-17 13:13:19 -08: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
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
ba01cfbb58 Remove spurious fmt.Print 2016-01-02 16:20:39 -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
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
acdbd88e88 Add BypassHandler and NewBypass to bypass main filter 2015-12-09 09:38:40 -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
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
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
c65e9e7d91 Added CList 2015-11-25 16:50:28 -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
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
440 changed files with 23185 additions and 6935 deletions

View File

@@ -31,8 +31,7 @@ jobs:
name: binaries
command: |
export PATH="$GOBIN:$PATH"
make install
cd abci && make install
make install install_abci
- persist_to_workspace:
root: /tmp/workspace
paths:

3
.github/CODEOWNERS vendored
View File

@@ -2,3 +2,6 @@
# Everything goes through Bucky, Anton, Alex. For now.
* @ebuchman @melekes @xla
# Precious documentation
/docs/ @zramsay @jolesbi

View File

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

4
.gitignore vendored
View File

@@ -14,10 +14,10 @@ test/p2p/data/
test/logs
coverage.txt
docs/_build
docs/tools
*.log
abci-cli
abci/types/types.pb.go
docs/node_modules/
scripts/wal2json/wal2json
scripts/cutWALUntil/cutWALUntil
@@ -27,5 +27,3 @@ scripts/cutWALUntil/cutWALUntil
libs/pubsub/query/fuzz_test/output
shunit2
.tendermint-lite
addrbook.json

View File

@@ -1,14 +1,94 @@
# Changelog
## TBD
## 0.22.3
IMPROVEMENTS
- Update dependencies
* pin all values in Gopkg.toml to version or commit
* update golang/protobuf to v1.1.0
## 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:
- [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
- [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
IMPROVEMENT
- [rpc/client] Supports https and wss now.
- [crypto] Make public key size into public constants
- [mempool] Log tx hash, not entire tx
- [abci] Merged in github.com/tendermint/abci
- [crypto] Merged in github.com/tendermint/go-crypto
- [libs] Merged in github.com/tendermint/tmlibs
- [docs] Move from .rst to .md
BUG FIXES:
- [rpc] limited number of HTTP/WebSocket connections
- [rpc] Limit maximum number of HTTP/WebSocket connections
(`rpc.max_open_connections`) and gRPC connections
(`rpc.grpc_max_open_connections`). Check out [Running In
Production](https://tendermint.readthedocs.io/en/master/running-in-production.html)
guide if you want to increase them.
(`rpc.grpc_max_open_connections`). Check out "Running In Production" guide if
you want to increase them.
- [rpc] Limit maximum request body size to 1MB (header is limited to 1MB).
- [consensus] Fix a halting bug where `create_empty_blocks=false`
- [p2p] Fix panic in seed mode
## 0.21.0
@@ -25,13 +105,6 @@ IMPROVEMENT
- [pubsub] Set default capacity to 0
- [docs] Various improvements
FEATURES
- [main] added metrics (served under `/metrics` using a Prometheus client;
disabled by default). See the new `instrumentation` section in the config and
[metrics](https://tendermint.readthedocs.io/projects/tools/en/v0.21.0/metrics.html)
guide.
BUG FIXES
- [consensus] Fix an issue where we don't make blocks after `fast_sync` when `create_empty_blocks=false`

View File

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

81
Gopkg.lock generated
View File

@@ -11,12 +11,14 @@
branch = "master"
name = "github.com/btcsuite/btcd"
packages = ["btcec"]
revision = "86fed781132ac890ee03e906e4ecd5d6fa180c64"
revision = "fdfc19097e7ac6b57035062056f5b7b4638b8898"
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcutil"
packages = ["base58"]
packages = [
"base58",
"bech32"
]
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
[[projects]]
@@ -26,16 +28,15 @@
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"
revision = "a5ef70473c97b71626b9abeda80ee92ba2a7de9e"
version = "v1.2.0"
[[projects]]
name = "github.com/fsnotify/fsnotify"
@@ -113,7 +114,6 @@
".",
"hcl/ast",
"hcl/parser",
"hcl/printer",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
@@ -183,8 +183,7 @@
"prometheus",
"prometheus/promhttp"
]
revision = "c5b7fccd204277076155f10851dad72b76a49317"
version = "v0.8.0"
revision = "ae27198cdd90bf12cd134ad79d1366a6cf49f632"
[[projects]]
branch = "master"
@@ -211,10 +210,9 @@
"nfs",
"xfs"
]
revision = "94663424ae5ae9856b40a9f170762b4197024661"
revision = "ae68e2d4c00fed4943b5f6698d504a5fe083da8a"
[[projects]]
branch = "master"
name = "github.com/rcrowley/go-metrics"
packages = ["."]
revision = "e2704e165165ec55d062f5919b4b29494e9fa790"
@@ -237,8 +235,8 @@
[[projects]]
name = "github.com/spf13/cobra"
packages = ["."]
revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385"
version = "v0.0.3"
revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b"
version = "v0.0.1"
[[projects]]
branch = "master"
@@ -255,8 +253,8 @@
[[projects]]
name = "github.com/spf13/viper"
packages = ["."]
revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736"
version = "v1.0.2"
revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7"
version = "v1.0.0"
[[projects]]
name = "github.com/stretchr/testify"
@@ -264,8 +262,8 @@
"assert",
"require"
]
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
version = "v1.2.1"
[[projects]]
branch = "master"
@@ -284,7 +282,7 @@
"leveldb/table",
"leveldb/util"
]
revision = "0d5a0ceb10cf9ab89fdd744cc8c50a83134f6697"
revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445"
[[projects]]
branch = "master"
@@ -302,33 +300,6 @@
revision = "2106ca61d91029c931fd54968c2bb02dc96b1412"
version = "0.10.1"
[[projects]]
name = "github.com/tendermint/iavl"
packages = [
".",
"sha256truncated"
]
revision = "866a229a90d86b07af23ffa156c3fa1396416574"
version = "v0.10.0-rc1"
[[projects]]
name = "github.com/tendermint/tmlibs"
packages = [
"autofile",
"cli",
"cli/flags",
"clist",
"common",
"db",
"flowrate",
"log",
"merkle",
"merkle/tmhash",
"test"
]
revision = "49596e0a1f48866603813df843c9409fc19805c6"
version = "v0.9.0"
[[projects]]
branch = "master"
name = "golang.org/x/crypto"
@@ -339,6 +310,7 @@
"curve25519",
"hkdf",
"internal/chacha20",
"internal/subtle",
"nacl/box",
"nacl/secretbox",
"openpgp/armor",
@@ -347,10 +319,9 @@
"ripemd160",
"salsa20/salsa"
]
revision = "8ac0e0d97ce45cd83d1d7243c060cb8461dda5e9"
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = [
"context",
@@ -362,7 +333,7 @@
"netutil",
"trace"
]
revision = "afe8f62b1d6bbd81f31868121a50b06d8188e1f9"
revision = "292b43bbf7cb8d35ddf40f8d5100ef3837cced3f"
[[projects]]
branch = "master"
@@ -371,7 +342,7 @@
"cpu",
"unix"
]
revision = "a9e25c09b96b8870693763211309e213c6ef299d"
revision = "1b2967e3c290b7c545b3db0deeda16e9be4f98a2"
[[projects]]
name = "golang.org/x/text"
@@ -404,9 +375,13 @@
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"codes",
"connectivity",
"credentials",
"encoding",
"encoding/proto",
"grpclb/grpc_lb_v1/messages",
"grpclog",
"internal",
@@ -415,13 +390,15 @@
"naming",
"peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap",
"transport"
]
revision = "5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e"
version = "v1.7.5"
revision = "d11072e7ca9811b1100b80ca0269ac831f06d024"
version = "v1.11.3"
[[projects]]
name = "gopkg.in/yaml.v2"
@@ -432,6 +409,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "ece6ed2d29c510b27b489c93a94e68e4aa5db840c16c6b8b7563d81fed4072fe"
inputs-digest = "b0718135d5ade0a75c6b8fe703f70eb9d8064ba871ec31abd9ace3c4ab944100"
solver-name = "gps-cdcl"
solver-version = 1

View File

@@ -23,81 +23,96 @@
# non-go = false
# go-tests = true
# unused-packages = true
#
###########################################################
# NOTE: All packages should be pinned to specific versions.
# Packages without releases must pin to a commit.
[[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"
version = "=0.6.0"
[[constraint]]
name = "github.com/gogo/protobuf"
version = "~1.0.0"
version = "=1.0.0"
[[constraint]]
name = "github.com/golang/protobuf"
version = "~1.0.0"
version = "=1.0.0"
[[constraint]]
name = "github.com/gorilla/websocket"
version = "~1.2.0"
version = "=1.2.0"
[[constraint]]
name = "github.com/pkg/errors"
version = "~0.8.0"
[[constraint]]
name = "github.com/rcrowley/go-metrics"
branch = "master"
version = "=0.8.0"
[[constraint]]
name = "github.com/spf13/cobra"
version = "~0.0.1"
version = "=0.0.1"
[[constraint]]
name = "github.com/spf13/viper"
version = "~1.0.0"
version = "=1.0.0"
[[constraint]]
name = "github.com/stretchr/testify"
version = "~1.2.1"
version = "=1.2.1"
[[constraint]]
name = "github.com/tendermint/go-amino"
version = "~0.10.1"
[[constraint]]
name = "github.com/tendermint/iavl"
version = "0.10.0-rc1"
[[override]]
name = "github.com/tendermint/tmlibs"
version = "~0.9.0"
version = "=0.10.1"
[[constraint]]
name = "google.golang.org/grpc"
version = "~1.7.3"
version = "=1.11.3"
# this got updated and broke, so locked to an old working commit ...
[[constraint]]
name = "github.com/fortytw2/leaktest"
version = "=1.2.0"
###################################
## Some repos dont have releases.
## Pin to revision
## We can remove this one by updating protobuf to v1.1.0
## but then the grpc tests break with
#--- FAIL: TestBroadcastTx (0.01s)
#panic: message/group field common.KVPair:bytes without pointer [recovered]
# panic: message/group field common.KVPair:bytes without pointer
#
# ...
#
# github.com/tendermint/tendermint/rpc/grpc_test.TestBroadcastTx(0xc420a5ab40)
# /go/src/github.com/tendermint/tendermint/rpc/grpc/grpc_test.go:29 +0x141
[[override]]
name = "google.golang.org/genproto"
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
[[constraint]]
name = "github.com/ebuchman/fail-test"
revision = "95f809107225be108efcf10a3509e4ea6ceef3c4"
# last revision used by go-crypto
[[constraint]]
name = "github.com/btcsuite/btcutil"
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
# Haven't made a release since 2016.
[[constraint]]
name = "github.com/prometheus/client_golang"
revision = "ae27198cdd90bf12cd134ad79d1366a6cf49f632"
[[constraint]]
name = "github.com/rcrowley/go-metrics"
revision = "e2704e165165ec55d062f5919b4b29494e9fa790"
[[constraint]]
name = "golang.org/x/net"
revision = "292b43bbf7cb8d35ddf40f8d5100ef3837cced3f"
[prune]
go-tests = true
unused-packages = true
[[constraint]]
name = "github.com/prometheus/client_golang"
version = "0.8.0"
[[constraint]]
branch = "master"
name = "golang.org/x/net"

View File

@@ -1,7 +1,12 @@
GOTOOLS = \
github.com/mitchellh/gox \
github.com/golang/dep/cmd/dep \
gopkg.in/alecthomas/gometalinter.v2
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
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD`"
@@ -11,7 +16,7 @@ check: check_tools ensure_deps
########################################
### Build
### Build Tendermint
build:
CGO_ENABLED=0 go build $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o build/tendermint ./cmd/tendermint/
@@ -22,10 +27,29 @@ build_race:
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'"
@@ -59,6 +83,17 @@ ensure_deps:
@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
@@ -70,6 +105,37 @@ get_deps_bin_size:
@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
@@ -87,6 +153,15 @@ test_apps:
# 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
@@ -105,17 +180,16 @@ test_p2p:
# requires 'tester' the image from above
bash test/p2p/test.sh tester
need_abci:
bash scripts/install_abci_apps.sh
test_integrations:
make build_docker_test_image
make get_tools
make get_vendor_deps
make install
make need_abci
make test_cover
make test_apps
make test_abci_apps
make test_abci_cli
make test_libs
make test_persistence
make test_p2p
@@ -132,11 +206,11 @@ vagrant_test:
### go tests
test:
@echo "--> Running go test"
@GOCACHE=off go test -p 1 $(PACKAGES)
@go test $(PACKAGES)
test_race:
@echo "--> Running go test --race"
@GOCACHE=off go test -p 1 -v -race $(PACKAGES)
@go test -v -race $(PACKAGES)
########################################
@@ -233,4 +307,4 @@ build-slate:
# 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 dist install check_tools get_tools update_tools get_vendor_deps draw_deps 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
.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

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

View File

@@ -1,174 +0,0 @@
GOTOOLS = \
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
GOTOOLS_CHECK = gox dep gometalinter.v2 protoc protoc-gen-gogo
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
all: check get_vendor_deps protoc build test install metalinter
check: check_tools
########################################
### Build
protoc:
## 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:. types/*.proto
@echo "--> adding nolint declarations to protobuf generated files"
@awk '/package types/ { print "//nolint: gas"; print; next }1' types/types.pb.go > types/types.pb.go.new
@mv types/types.pb.go.new types/types.pb.go
build:
@go build -i ./cmd/...
dist:
@bash scripts/dist.sh
@bash scripts/publish.sh
install:
@go install ./cmd/...
########################################
### Tools & dependencies
check_tools:
@# https://stackoverflow.com/a/25668869
@echo "Found tools: $(foreach tool,$(GOTOOLS_CHECK),\
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
get_tools:
@echo "--> Installing tools"
go get -u -v $(GOTOOLS)
@gometalinter.v2 --install
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
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
get_vendor_deps:
@rm -rf vendor/
@echo "--> Running dep ensure"
@dep ensure
########################################
### Testing
test:
@find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@echo "==> Running go test"
@go test $(PACKAGES)
test_race:
@find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@echo "==> Running go test --race"
@go test -v -race $(PACKAGES)
### three tests tested by Jenkins
test_cover:
@ bash tests/test_cover.sh
test_apps:
# test the counter using a go test script
@ bash tests/test_app/test.sh
test_cli:
# test the cli against the examples in the tutorial at:
# http://tendermint.readthedocs.io/projects/tools/en/master/abci-cli.html
#
# XXX: if this test fails, fix it and update the docs at:
# https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.rst
@ bash tests/test_cli/test.sh
########################################
### Formatting, linting, and vetting
fmt:
@go fmt ./...
metalinter:
@echo "==> Running linter"
gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=maligned \
--enable=deadcode \
--enable=goconst \
--enable=goimports \
--enable=gosimple \
--enable=ineffassign \
--enable=megacheck \
--enable=misspell \
--enable=staticcheck \
--enable=safesql \
--enable=structcheck \
--enable=unconvert \
--enable=unused \
--enable=varcheck \
--enable=vetshadow \
./...
#--enable=gas \
#--enable=dupl \
#--enable=errcheck \
#--enable=gocyclo \
#--enable=golint \ <== comments on anything exported
#--enable=gotype \
#--enable=interfacer \
#--enable=unparam \
#--enable=vet \
metalinter_all:
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
########################################
### Docker
DEVDOC_SAVE = docker commit `docker ps -a -n 1 -q` devdoc:local
docker_build:
docker build -t "tendermint/abci-dev" -f Dockerfile.develop .
docker_run:
docker run -it -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
docker_run_rm:
docker run -it --rm -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
devdoc_init:
docker run -it -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" tendermint/devdoc echo
# TODO make this safer
$(call DEVDOC_SAVE)
devdoc:
docker run -it -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" devdoc:local bash
devdoc_save:
# TODO make this safer
$(call DEVDOC_SAVE)
devdoc_clean:
docker rmi $$(docker images -f "dangling=true" -q)
# 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 protoc build dist install check_tools get_tools get_protoc update_tools get_vendor_deps test test_race fmt metalinter metalinter_all docker_build docker_run docker_run_rm devdoc_init devdoc devdoc_save devdoc_clean

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,8 +11,8 @@ import (
"github.com/spf13/cobra"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/example/code"
@@ -22,7 +22,6 @@ import (
servertest "github.com/tendermint/tendermint/abci/tests/server"
"github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/abci/version"
"github.com/tendermint/tendermint/crypto/merkle"
)
// client is a global variable so it can be reused by the console
@@ -101,7 +100,7 @@ type queryResponse struct {
Key []byte
Value []byte
Height int64
Proof *merkle.Proof
Proof []byte
}
func Execute() error {
@@ -741,7 +740,7 @@ func printResponse(cmd *cobra.Command, args []string, rsp response) {
fmt.Printf("-> value.hex: %X\n", rsp.Query.Value)
}
if rsp.Query.Proof != nil {
fmt.Printf("-> proof: %#v\n", rsp.Query.Proof)
fmt.Printf("-> proof: %X\n", rsp.Query.Proof)
}
}
}

View File

@@ -6,5 +6,4 @@ const (
CodeTypeEncodingError uint32 = 1
CodeTypeBadNonce uint32 = 2
CodeTypeUnauthorized uint32 = 3
CodeTypeUnknownError uint32 = 4
)

View File

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

View File

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

View File

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

View File

@@ -2,33 +2,31 @@ package kvstore
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"github.com/tendermint/iavl"
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/merkle"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
)
var (
stateKey = []byte("stateKey")
stateKey = []byte("stateKey")
kvPairPrefixKey = []byte("kvPairKey:")
)
type State struct {
db dbm.DB
tree *iavl.VersionedTree
db dbm.DB
Size int64 `json:"size"`
Height int64 `json:"height"`
AppHash []byte `json:"app_hash"`
}
func loadState(db dbm.DB) *State {
func loadState(db dbm.DB) State {
stateBytes := db.Get(stateKey)
var state = new(State)
var state State
if len(stateBytes) != 0 {
err := json.Unmarshal(stateBytes, &state)
if err != nil {
@@ -36,22 +34,10 @@ func loadState(db dbm.DB) *State {
}
}
state.db = db
state.tree = iavl.NewVersionedTree(db, 0)
state.tree.LoadVersion(state.Height)
return state
}
func saveState(state *State) {
hash, version, err := state.tree.SaveVersion()
if err != nil {
panic(err)
}
state.AppHash = hash
if state.Height+1 != version {
panic("should not happen, expected version to be 1+state.Height.")
}
state.Height = version
func saveState(state State) {
stateBytes, err := json.Marshal(state)
if err != nil {
panic(err)
@@ -59,6 +45,10 @@ func saveState(state *State) {
state.db.Set(stateKey, stateBytes)
}
func prefixKey(key []byte) []byte {
return append(kvPairPrefixKey, key...)
}
//---------------------------------------------------
var _ types.Application = (*KVStoreApplication)(nil)
@@ -66,7 +56,7 @@ var _ types.Application = (*KVStoreApplication)(nil)
type KVStoreApplication struct {
types.BaseApplication
state *State
state State
}
func NewKVStoreApplication() *KVStoreApplication {
@@ -87,11 +77,11 @@ func (app *KVStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
} else {
key, value = tx, tx
}
app.state.tree.Set(key, value)
app.state.db.Set(prefixKey(key), value)
app.state.Size += 1
tags := []cmn.KVPair{
{[]byte("app.creator"), []byte("Cosmoshi Netowoko")},
{[]byte("app.creator"), []byte("jae")},
{[]byte("app.key"), key},
}
return types.ResponseDeliverTx{Code: code.CodeTypeOK, Tags: tags}
@@ -102,48 +92,30 @@ func (app *KVStoreApplication) CheckTx(tx []byte) types.ResponseCheckTx {
}
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: app.state.AppHash}
return types.ResponseCommit{Data: appHash}
}
func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
key := reqQuery.Data
height := app.state.Height
if reqQuery.Height != 0 {
height = reqQuery.Height
}
if reqQuery.Prove {
value, proof, err := app.state.tree.GetVersionedWithProof(key, height)
if err != nil {
resQuery.Code = code.CodeTypeUnknownError
resQuery.Log = err.Error()
return
}
resQuery.Height = height
resQuery.Index = proof.LeftIndex() // TODO make Proof return index
resQuery.Key = key
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.Proof = &merkle.Proof{
// XXX key encoding
Ops: []merkle.ProofOp{iavl.NewIAVLValueOp(string(key), proof).ProofOp()},
}
resQuery.Log = "exists"
} else {
resQuery.Proof = &merkle.Proof{
// XXX key encoding
Ops: []merkle.ProofOp{iavl.NewIAVLAbsenceOp(string(key), proof).ProofOp()},
}
resQuery.Log = "does not exist"
}
return
} else {
index, value := app.state.tree.GetVersioned(key, height)
resQuery.Height = height
resQuery.Index = int64(index) // TODO GetVersioned64?
resQuery.Key = key
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Value = value
resQuery.Proof = nil
if value != nil {
resQuery.Log = "exists"
} else {

View File

@@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/example/code"
@@ -18,13 +18,11 @@ import (
)
func testKVStore(t *testing.T, app types.Application, tx []byte, key, value string) {
rdtx := app.DeliverTx(tx)
require.False(t, rdtx.IsErr(), rdtx)
ar := app.DeliverTx(tx)
require.False(t, ar.IsErr(), ar)
// repeating tx doesn't raise error
rdtx = app.DeliverTx(tx)
require.False(t, rdtx.IsErr(), rdtx)
rc := app.Commit()
require.NotNil(t, rc.Data)
ar = app.DeliverTx(tx)
require.False(t, ar.IsErr(), ar)
// make sure query is fine
resQuery := app.Query(types.RequestQuery{
@@ -254,7 +252,7 @@ func TestClientServer(t *testing.T) {
// set up socket app
kvstore := NewKVStoreApplication()
client, server, err := makeSocketClientServer(kvstore, "kvstore-socket")
require.Nil(t, err, "%+v", err)
require.Nil(t, err)
defer server.Stop()
defer client.Stop()
@@ -283,16 +281,13 @@ func runClientTests(t *testing.T, client abcicli.Client) {
}
func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string) {
rdtx, err := app.DeliverTxSync(tx)
ar, err := app.DeliverTxSync(tx)
require.NoError(t, err)
require.False(t, rdtx.IsErr(), rdtx)
require.False(t, ar.IsErr(), ar)
// repeating tx doesn't raise error
rdtx, err = app.DeliverTxSync(tx)
ar, err = app.DeliverTxSync(tx)
require.NoError(t, err)
require.False(t, rdtx.IsErr(), rdtx)
rc, err := app.CommitSync()
require.NoError(t, err)
require.NotNil(t, rc.Data)
require.False(t, ar.IsErr(), ar)
// make sure query is fine
resQuery, err := app.QuerySync(types.RequestQuery{

View File

@@ -9,9 +9,9 @@ import (
"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
)
const (
@@ -168,7 +168,7 @@ func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.Respon
}
// update
return app.updateValidator(types.Ed25519Validator(pubkey, power))
return app.updateValidator(types.Ed25519Validator(pubkey, int64(power)))
}
// add, update, or remove a validator

View File

@@ -1,12 +0,0 @@
FROM golang:1.9.2
RUN apt-get update && apt-get install -y --no-install-recommends \
zip \
&& rm -rf /var/lib/apt/lists/*
# We want to ensure that release builds never have any cgo dependencies so we
# switch that off at the highest level.
ENV CGO_ENABLED 0
RUN mkdir -p $GOPATH/src/github.com/tendermint/abci
WORKDIR $GOPATH/src/github.com/tendermint/abci

View File

@@ -1,52 +0,0 @@
#!/usr/bin/env bash
set -e
REPO_NAME="abci"
# Get the version from the environment, or try to figure it out.
if [ -z $VERSION ]; then
VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go)
fi
if [ -z "$VERSION" ]; then
echo "Please specify a version."
exit 1
fi
echo "==> Building version $VERSION..."
# Get the parent 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"
# Delete the old dir
echo "==> Removing old directory..."
rm -rf build/pkg
mkdir -p build/pkg
# Do a hermetic build inside a Docker container.
docker build -t tendermint/${REPO_NAME}-builder scripts/${REPO_NAME}-builder/
docker run --rm -e "BUILD_TAGS=$BUILD_TAGS" -v "$(pwd)":/go/src/github.com/tendermint/${REPO_NAME} tendermint/${REPO_NAME}-builder ./scripts/dist_build.sh
# Add $REPO_NAME and $VERSION prefix to package name.
rm -rf ./build/dist
mkdir -p ./build/dist
for FILENAME in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type f); do
FILENAME=$(basename "$FILENAME")
cp "./build/pkg/${FILENAME}" "./build/dist/${REPO_NAME}_${VERSION}_${FILENAME}"
done
# Make the checksums.
pushd ./build/dist
shasum -a256 ./* > "./${REPO_NAME}_${VERSION}_SHA256SUMS"
popd
# Done
echo
echo "==> Results:"
ls -hl ./build/dist
exit 0

View File

@@ -1,53 +0,0 @@
#!/usr/bin/env bash
set -e
# Get the parent 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"
# Get the git commit
GIT_COMMIT="$(git rev-parse --short HEAD)"
GIT_DESCRIBE="$(git describe --tags --always)"
GIT_IMPORT="github.com/tendermint/abci/version"
# Determine the arch/os combos we're building for
XC_ARCH=${XC_ARCH:-"386 amd64 arm"}
XC_OS=${XC_OS:-"solaris darwin freebsd linux windows"}
# Make sure build tools are available.
make get_tools
# Get VENDORED dependencies
make get_vendor_deps
BINARY="abci-cli"
# Build!
echo "==> Building..."
"$(which gox)" \
-os="${XC_OS}" \
-arch="${XC_ARCH}" \
-osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
-ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
-output "build/pkg/{{.OS}}_{{.Arch}}/$BINARY" \
-tags="${BUILD_TAGS}" \
github.com/tendermint/abci/cmd/$BINARY
# Zip all the files.
echo "==> Packaging..."
for PLATFORM in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type d); do
OSARCH=$(basename "${PLATFORM}")
echo "--> ${OSARCH}"
pushd "$PLATFORM" >/dev/null 2>&1
zip "../${OSARCH}.zip" ./*
popd >/dev/null 2>&1
done
exit 0

View File

@@ -1,7 +0,0 @@
#! /bin/bash
# Get the version from the environment, or try to figure it out.
if [ -z $VERSION ]; then
VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go)
fi
aws s3 cp --recursive build/dist s3://tendermint/binaries/abci/v${VERSION} --acl public-read

View File

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

View File

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

View File

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

View File

@@ -1,294 +0,0 @@
ABCI Specification
==================
NOTE: this file has moved to `specification.md <./specification.md>`__. It is left to prevent link breakages for the forseable future. It can safely be deleted in a few months.
Message Types
~~~~~~~~~~~~~
ABCI requests/responses are defined as simple Protobuf messages in `this
schema
file <https://github.com/tendermint/abci/blob/master/types/types.proto>`__.
TendermintCore sends the requests, and the ABCI application sends the
responses. Here, we provide an overview of the messages types and how they
are used by Tendermint. Then we describe each request-response pair as a
function with arguments and return values, and add some notes on usage.
Some messages (``Echo, Info, InitChain, BeginBlock, EndBlock, Commit``), don't
return errors because an error would indicate a critical failure in the
application and there's nothing Tendermint can do. The problem should be
addressed and both Tendermint and the application restarted. All other
messages (``SetOption, Query, CheckTx, DeliverTx``) return an
application-specific response ``Code uint32``, where only ``0`` is reserved for
``OK``.
Some messages (``SetOption, Query, CheckTx, DeliverTx``) return
non-deterministic data in the form of ``Info`` and ``Log``. The ``Log`` is
intended for the literal output from the application's logger, while the
``Info`` is any additional info that should be returned.
The first time a new blockchain is started, Tendermint calls ``InitChain``.
From then on, the Block Execution Sequence that causes the committed state to
be updated is as follows:
``BeginBlock, [DeliverTx], EndBlock, Commit``
where one ``DeliverTx`` is called for each transaction in the block.
Cryptographic commitments to the results of DeliverTx, EndBlock, and
Commit are included in the header of the next block.
Tendermint opens three connections to the application to handle the different message
types:
- ``Consensus Connection - InitChain, BeginBlock, DeliverTx, EndBlock, Commit``
- ``Mempool Connection - CheckTx``
- ``Info Connection - Info, SetOption, Query``
The ``Flush`` message is used on every connection, and the ``Echo`` message
is only used for debugging.
Note that messages may be sent concurrently across all connections -
a typical application will thus maintain a distinct state for each
connection. They may be referred to as the ``DeliverTx state``, the
``CheckTx state``, and the ``Commit state`` respectively.
See below for more details on the message types and how they are used.
Echo
^^^^
- **Arguments**:
- ``Message (string)``: A string to echo back
- **Returns**:
- ``Message (string)``: The input string
- **Usage**:
- Echo a string to test an abci client/server implementation
Flush
^^^^^
- **Usage**:
- Signals that messages queued on the client should be flushed to
the server. It is called periodically by the client implementation
to ensure asynchronous requests are actually sent, and is called
immediately to make a synchronous request, which returns when the
Flush response comes back.
Info
^^^^
- **Arguments**:
- ``Version (string)``: The Tendermint version
- **Returns**:
- ``Data (string)``: Some arbitrary information
- ``Version (Version)``: Version information
- ``LastBlockHeight (int64)``: Latest block for which the app has
called Commit
- ``LastBlockAppHash ([]byte)``: Latest result of Commit
- **Usage**:
- Return information about the application state.
- Used to sync Tendermint with the application during a handshake that
happens on startup.
- Tendermint expects ``LastBlockAppHash`` and ``LastBlockHeight`` to be
updated during ``Commit``, ensuring that ``Commit`` is never called twice
for the same block height.
SetOption
^^^^^^^^^
- **Arguments**:
- ``Key (string)``: Key to set
- ``Value (string)``: Value to set for key
- **Returns**:
- ``Code (uint32)``: Response code
- ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Info (string)``: Additional information. May be non-deterministic.
- **Usage**:
- Set non-consensus critical application specific options.
- e.g. Key="min-fee", Value="100fermion" could set the minimum fee required for CheckTx
(but not DeliverTx - that would be consensus critical).
InitChain
^^^^^^^^^
- **Arguments**:
- ``Validators ([]Validator)``: Initial genesis validators
- ``AppStateBytes ([]byte)``: Serialized initial application state
- **Usage**:
- Called once upon genesis.
Query
^^^^^
- **Arguments**:
- ``Data ([]byte)``: Raw query bytes. Can be used with or in lieu of
Path.
- ``Path (string)``: Path of request, like an HTTP GET path. Can be
used with or in liue of Data.
- Apps MUST interpret '/store' as a query by key on the underlying
store. The key SHOULD be specified in the Data field.
- Apps SHOULD allow queries over specific types like '/accounts/...'
or '/votes/...'
- ``Height (int64)``: The block height for which you want the query
(default=0 returns data for the latest committed block). Note that
this is the height of the block containing the application's
Merkle root hash, which represents the state as it was after
committing the block at Height-1
- ``Prove (bool)``: Return Merkle proof with response if possible
- **Returns**:
- ``Code (uint32)``: Response code.
- ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Info (string)``: Additional information. May be non-deterministic.
- ``Index (int64)``: The index of the key in the tree.
- ``Key ([]byte)``: The key of the matching data.
- ``Value ([]byte)``: The value of the matching data.
- ``Proof ([]byte)``: Proof for the data, if requested.
- ``Height (int64)``: The block height from which data was derived.
Note that this is the height of the block containing the
application's Merkle root hash, which represents the state as it
was after committing the block at Height-1
- **Usage**:
- Query for data from the application at current or past height.
- Optionally return Merkle proof.
BeginBlock
^^^^^^^^^^
- **Arguments**:
- ``Hash ([]byte)``: The block's hash. This can be derived from the
block header.
- ``Header (struct{})``: The block header
- ``AbsentValidators ([]int32)``: List of indices of validators not
included in the LastCommit
- ``ByzantineValidators ([]Evidence)``: List of evidence of
validators that acted maliciously
- **Usage**:
- Signals the beginning of a new block. Called prior to any DeliverTxs.
- The header is expected to at least contain the Height.
- The ``AbsentValidators`` and ``ByzantineValidators`` can be used to
determine rewards and punishments for the validators.
CheckTx
^^^^^^^
- **Arguments**:
- ``Tx ([]byte)``: The request transaction bytes
- **Returns**:
- ``Code (uint32)``: Response code
- ``Data ([]byte)``: Result bytes, if any.
- ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Info (string)``: Additional information. May be non-deterministic.
- ``GasWanted (int64)``: Amount of gas request for transaction.
- ``GasUsed (int64)``: Amount of gas consumed by transaction.
- ``Tags ([]cmn.KVPair)``: Key-Value tags for filtering and indexing transactions (eg. by account).
- ``Fee (cmn.KI64Pair)``: Fee paid for the transaction.
- **Usage**: Validate a mempool transaction, prior to broadcasting or
proposing. CheckTx should perform stateful but light-weight checks
of the validity of the transaction (like checking signatures and account balances),
but need not execute in full (like running a smart contract).
Tendermint runs CheckTx and DeliverTx concurrently with eachother,
though on distinct ABCI connections - the mempool connection and the consensus
connection, respectively.
The application should maintain a separate state to support CheckTx.
This state can be reset to the latest committed state during ``Commit``,
where Tendermint ensures the mempool is locked and not sending new ``CheckTx``.
After ``Commit``, the mempool will rerun CheckTx on all remaining
transactions, throwing out any that are no longer valid.
Keys and values in Tags must be UTF-8 encoded strings (e.g. "account.owner": "Bob", "balance": "100.0", "date": "2018-01-02")
DeliverTx
^^^^^^^^^
- **Arguments**:
- ``Tx ([]byte)``: The request transaction bytes.
- **Returns**:
- ``Code (uint32)``: Response code.
- ``Data ([]byte)``: Result bytes, if any.
- ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Info (string)``: Additional information. May be non-deterministic.
- ``GasWanted (int64)``: Amount of gas requested for transaction.
- ``GasUsed (int64)``: Amount of gas consumed by transaction.
- ``Tags ([]cmn.KVPair)``: Key-Value tags for filtering and indexing transactions (eg. by account).
- ``Fee (cmn.KI64Pair)``: Fee paid for the transaction.
- **Usage**:
- Deliver a transaction to be executed in full by the application. If the transaction is valid,
returns CodeType.OK.
- Keys and values in Tags must be UTF-8 encoded strings (e.g. "account.owner": "Bob", "balance": "100.0", "time": "2018-01-02T12:30:00Z")
EndBlock
^^^^^^^^
- **Arguments**:
- ``Height (int64)``: Height of the block just executed.
- **Returns**:
- ``ValidatorUpdates ([]Validator)``: Changes to validator set (set
voting power to 0 to remove).
- ``ConsensusParamUpdates (ConsensusParams)``: Changes to
consensus-critical time, size, and other parameters.
- **Usage**:
- Signals the end of a block.
- Called prior to each Commit, after all transactions.
- Validator set and consensus params are updated with the result.
- Validator pubkeys are expected to be go-wire encoded.
Commit
^^^^^^
- **Returns**:
- ``Data ([]byte)``: The Merkle root hash
- **Usage**:
- Persist the application state.
- Return a Merkle root hash of the application state.
- It's critical that all application instances return the same hash. If not,
they will not be able to agree on the next block, because the hash is
included in the next block!

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env bash
set -e
echo "" > coverage.txt
echo "==> Running unit tests"
for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done

View File

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

View File

@@ -50,8 +50,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import common "github.com/tendermint/tmlibs/common"
import merkle "github.com/tendermint/tendermint/crypto/merkle"
import common "github.com/tendermint/tendermint/libs/common"
import context "golang.org/x/net/context"
import grpc "google.golang.org/grpc"
@@ -1289,13 +1288,13 @@ func (m *ResponseInitChain) GetValidators() []Validator {
type ResponseQuery struct {
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
// bytes data = 2; // use "value" instead.
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
Proof *merkle.Proof `protobuf:"bytes,8,opt,name=proof" json:"proof,omitempty"`
Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"`
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
Proof []byte `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"`
Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"`
}
func (m *ResponseQuery) Reset() { *m = ResponseQuery{} }
@@ -1345,7 +1344,7 @@ func (m *ResponseQuery) GetValue() []byte {
return nil
}
func (m *ResponseQuery) GetProof() *merkle.Proof {
func (m *ResponseQuery) GetProof() []byte {
if m != nil {
return m.Proof
}
@@ -2336,123 +2335,121 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("types/types.proto", fileDescriptorTypes) }
var fileDescriptorTypes = []byte{
// 1874 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x4b, 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, 0x3f, 0xfa, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0x49, 0xc5, 0xab, 0xf9, 0x15,
0x00, 0x00,
// 1846 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x6e, 0x1b, 0xc9,
0x11, 0x16, 0xff, 0x39, 0xa5, 0x1f, 0xd2, 0x2d, 0xdb, 0xa2, 0xb9, 0x08, 0x6c, 0x0c, 0x02, 0xaf,
0x9c, 0xd5, 0x8a, 0x89, 0x76, 0x6d, 0xd8, 0xbb, 0xc9, 0x22, 0x92, 0xd6, 0x59, 0x0a, 0x9b, 0x1f,
0x65, 0xec, 0x75, 0x80, 0x5c, 0x88, 0x26, 0xa7, 0x45, 0x0e, 0x4c, 0xce, 0xcc, 0x4e, 0x37, 0xb5,
0x94, 0x6f, 0xb9, 0x2f, 0x72, 0xcd, 0x39, 0x2f, 0x90, 0x43, 0x80, 0xbc, 0x42, 0x90, 0x97, 0x88,
0x0f, 0x49, 0x4e, 0x79, 0x89, 0x04, 0x55, 0xdd, 0xf3, 0xab, 0xa1, 0xe1, 0x38, 0xc7, 0xbd, 0x48,
0x5d, 0x5d, 0x55, 0x3d, 0x5d, 0xc5, 0xaa, 0xaf, 0xaa, 0x1a, 0x6e, 0xa8, 0xab, 0x50, 0xc8, 0x01,
0xfd, 0x3d, 0x0c, 0xa3, 0x40, 0x05, 0xac, 0x41, 0x44, 0xff, 0xc3, 0xa9, 0xa7, 0x66, 0xcb, 0xf1,
0xe1, 0x24, 0x58, 0x0c, 0xa6, 0xc1, 0x34, 0x18, 0x10, 0x77, 0xbc, 0xbc, 0x20, 0x8a, 0x08, 0x5a,
0x69, 0xad, 0xfe, 0x20, 0x23, 0xae, 0x84, 0xef, 0x8a, 0x68, 0xe1, 0xf9, 0x6a, 0xa0, 0x16, 0x73,
0x6f, 0x2c, 0x07, 0x93, 0x60, 0x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0x8c, 0x97, 0xbf, 0x86, 0xf5, 0xd7,
0xcd, 0x52, 0xe3, 0x26, 0xbd, 0x98, 0x7e, 0xf4, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xf3,
0xb2, 0x34, 0xad, 0x15, 0x00, 0x00,
}

View File

@@ -5,7 +5,6 @@ package types;
// 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";
import "github.com/tendermint/tendermint/crypto/merkle/merkle.proto";
// This file is copied from http://github.com/tendermint/abci
// NOTE: When using custom types, mind the warnings.
@@ -144,7 +143,7 @@ message ResponseQuery {
int64 index = 5;
bytes key = 6;
bytes value = 7;
merkle.Proof proof = 8;
bytes proof = 8;
int64 height = 9;
}

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

@@ -5,12 +5,13 @@ import (
"reflect"
"time"
"github.com/tendermint/go-amino"
amino "github.com/tendermint/go-amino"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
)
const (
@@ -174,7 +175,7 @@ func (bcR *BlockchainReactor) respondToPeer(msg *bcBlockRequestMessage,
// 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)
msg, err := decodeMsg(msgBytes)
if err != nil {
bcR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
bcR.Switch.StopPeerForError(src, err)
@@ -342,17 +343,11 @@ func RegisterBlockchainMessages(cdc *amino.Codec) {
cdc.RegisterConcrete(&bcStatusRequestMessage{}, "tendermint/mempool/StatusRequest", nil)
}
// DecodeMessage decodes BlockchainMessage.
// TODO: ensure that bz is completely read.
func DecodeMessage(bz []byte) (msg BlockchainMessage, err error) {
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)
return msg, fmt.Errorf("Msg exceeds max size (%d > %d)", len(bz), maxMsgSize)
}
err = cdc.UnmarshalBinaryBare(bz, &msg)
if err != nil {
err = cmn.ErrorWrap(err, "DecodeMessage() had bytes left over")
}
return
}

View File

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

View File

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

View File

@@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/types"
)
@@ -49,7 +49,7 @@ func TestNewBlockStore(t *testing.T) {
return nil, nil
})
require.NotNil(t, panicErr, "#%d panicCauser: %q expected a panic", i, tt.data)
assert.Contains(t, fmt.Sprintf("%#v", panicErr), tt.wantErr, "#%d data: %q", i, tt.data)
assert.Contains(t, panicErr.Error(), tt.wantErr, "#%d data: %q", i, tt.data)
}
db.Set(blockStoreKey, nil)
@@ -153,14 +153,14 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
parts: validPartSet,
seenCommit: seenCommit1,
corruptCommitInDB: true, // Corrupt the DB's commit entry
wantPanic: "Error reading block commit",
wantPanic: "unmarshal to types.Commit failed",
},
{
block: newBlock(&header1, commitAtH10),
parts: validPartSet,
seenCommit: seenCommit1,
wantPanic: "Error reading block",
wantPanic: "unmarshal to types.BlockMeta failed",
corruptBlockInDB: true, // Corrupt the DB's block entry
},
@@ -179,7 +179,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
seenCommit: seenCommit1,
corruptSeenCommitInDB: true,
wantPanic: "Error reading block seen commit",
wantPanic: "unmarshal to types.Commit failed",
},
{
@@ -238,7 +238,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
if subStr := tuple.wantPanic; subStr != "" {
if panicErr == nil {
t.Errorf("#%d: want a non-nil panic", i)
} else if got := fmt.Sprintf("%#v", panicErr); !strings.Contains(got, subStr) {
} else if got := panicErr.Error(); !strings.Contains(got, subStr) {
t.Errorf("#%d:\n\tgotErr: %q\nwant substring: %q", i, got, subStr)
}
continue
@@ -287,7 +287,7 @@ func TestLoadBlockPart(t *testing.T) {
db.Set(calcBlockPartKey(height, index), []byte("Tendermint"))
res, _, panicErr = doFn(loadPart)
require.NotNil(t, panicErr, "expecting a non-nil panic")
require.Contains(t, fmt.Sprintf("%#v", panicErr), "Error reading block part")
require.Contains(t, panicErr.Error(), "unmarshal to types.Part failed")
// 3. A good block serialized and saved to the DB should be retrievable
db.Set(calcBlockPartKey(height, index), cdc.MustMarshalBinaryBare(part1))
@@ -316,7 +316,7 @@ func TestLoadBlockMeta(t *testing.T) {
db.Set(calcBlockMetaKey(height), []byte("Tendermint-Meta"))
res, _, panicErr = doFn(loadMeta)
require.NotNil(t, panicErr, "expecting a non-nil panic")
require.Contains(t, fmt.Sprintf("%#v", panicErr), "Error reading block meta")
require.Contains(t, panicErr.Error(), "unmarshal to types.BlockMeta")
// 3. A good blockMeta serialized and saved to the DB should be retrievable
meta := &types.BlockMeta{}

2
bump
View File

@@ -1,2 +0,0 @@
booop

View File

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

View File

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

View File

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

View File

@@ -6,9 +6,10 @@ import (
"github.com/spf13/cobra"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/lite/proxy"
rpcclient "github.com/tendermint/tendermint/rpc/client"
cmn "github.com/tendermint/tmlibs/common"
)
// LiteCmd represents the base command when called without any subcommands
@@ -65,21 +66,17 @@ func runProxy(cmd *cobra.Command, args []string) error {
}
// First, connect a client
logger.Info("Connecting to source HTTP client...")
node := rpcclient.NewHTTP(nodeAddr, "/websocket")
logger.Info("Constructing certifier...")
cert, err := proxy.NewCertifier(chainID, home, node, logger)
cert, err := proxy.GetCertifier(chainID, home, nodeAddr)
if err != nil {
return cmn.ErrorWrap(err, "constructing certifier")
return err
}
cert.SetLogger(logger)
sc := proxy.SecureClient(node, cert)
logger.Info("Starting proxy...")
err = proxy.StartProxy(sc, listenAddr, logger)
if err != nil {
return cmn.ErrorWrap(err, "starting proxy")
return err
}
cmn.TrapSignal(func() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,6 @@ import (
"io/ioutil"
"os"
"path"
"reflect"
"sort"
"sync"
"testing"
@@ -23,9 +22,9 @@ import (
"github.com/tendermint/tendermint/privval"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/abci/example/counter"
"github.com/tendermint/tendermint/abci/example/kvstore"
@@ -39,7 +38,7 @@ const (
// genesis, chain_id, priv_val
var config *cfg.Config // NOTE: must be reset for each _test.go file
var ensureTimeout = time.Second * 5 // must be in seconds because CreateEmptyBlocksInterval is
var ensureTimeout = time.Second * 1 // must be in seconds because CreateEmptyBlocksInterval is
func ensureDir(dir string, mode os.FileMode) {
if err := cmn.EnsureDir(dir, mode); err != nil {
@@ -326,30 +325,6 @@ func ensureNewStep(stepCh <-chan interface{}) {
}
}
func ensureVote(voteCh chan interface{}, height int64, round int, voteType byte) {
timer := time.NewTimer(ensureTimeout)
select {
case <-timer.C:
break
case v := <-voteCh:
edv, ok := v.(types.EventDataVote)
if !ok {
panic(fmt.Sprintf("expected a *types.Vote, got %v. wrong subscription channel?",
reflect.TypeOf(v)))
}
vote := edv.Vote
if vote.Height != height {
panic(fmt.Sprintf("expected height %v, got %v", height, vote.Height))
}
if vote.Round != round {
panic(fmt.Sprintf("expected round %v, got %v", round, vote.Round))
}
if vote.Type != voteType {
panic(fmt.Sprintf("expected type %v, got %v", voteType, vote.Type))
}
}
}
//-------------------------------------------------------------------------------
// consensus nets

View File

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

View File

@@ -9,11 +9,11 @@ import (
"github.com/pkg/errors"
amino "github.com/tendermint/go-amino"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cstypes "github.com/tendermint/tendermint/consensus/types"
cmn "github.com/tendermint/tendermint/libs/common"
tmevents "github.com/tendermint/tendermint/libs/events"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
@@ -183,7 +183,7 @@ func (conR *ConsensusReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
return
}
msg, err := DecodeMessage(msgBytes)
msg, err := decodeMsg(msgBytes)
if err != nil {
conR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
conR.Switch.StopPeerForError(src, err)
@@ -1306,11 +1306,9 @@ func RegisterConsensusMessages(cdc *amino.Codec) {
cdc.RegisterConcrete(&ProposalHeartbeatMessage{}, "tendermint/ProposalHeartbeat", nil)
}
// DecodeMessage decodes the given bytes into a ConsensusMessage.
func DecodeMessage(bz []byte) (msg ConsensusMessage, err error) {
func decodeMsg(bz []byte) (msg ConsensusMessage, err error) {
if len(bz) > maxMsgSize {
return msg, fmt.Errorf("Msg exceeds max size (%d > %d)",
len(bz), maxMsgSize)
return msg, fmt.Errorf("Msg exceeds max size (%d > %d)", len(bz), maxMsgSize)
}
err = cdc.UnmarshalBinaryBare(bz, &msg)
return

View File

@@ -11,8 +11,8 @@ import (
"time"
"github.com/tendermint/tendermint/abci/example/kvstore"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"
@@ -174,14 +174,14 @@ func TestReactorRecordsBlockParts(t *testing.T) {
require.Equal(t, 1, ps.BlockPartsSent(), "number of block parts sent should stay the same")
}
// Test we record votes from other peers.
// Test we record votes from other peers
func TestReactorRecordsVotes(t *testing.T) {
// Create dummy peer.
// create dummy peer
peer := p2pdummy.NewPeer()
ps := NewPeerState(peer).SetLogger(log.TestingLogger())
peer.Set(types.PeerStateKey, ps)
// Create reactor.
// create reactor
css := randConsensusNet(1, "consensus_reactor_records_votes_test", newMockTickerFunc(true), newPersistentKVStore)
reactor := NewConsensusReactor(css[0], false) // so we dont start the consensus states
reactor.SetEventBus(css[0].eventBus)
@@ -419,7 +419,7 @@ func waitForAndValidateBlock(t *testing.T, n int, activeVals map[string]struct{}
err := validateBlock(newBlock, activeVals)
assert.Nil(t, err)
for _, tx := range txs {
err := css[j].mempool.CheckTx(tx, nil)
css[j].mempool.CheckTx(tx, nil)
assert.Nil(t, err)
}
}, css)

View File

@@ -11,10 +11,10 @@ import (
"time"
abci "github.com/tendermint/tendermint/abci/types"
//auto "github.com/tendermint/tmlibs/autofile"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
//auto "github.com/tendermint/tendermint/libs/autofile"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state"
@@ -264,15 +264,15 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight
stateBlockHeight := state.LastBlockHeight
h.logger.Info("ABCI Replay Blocks", "appHeight", appBlockHeight, "storeHeight", storeBlockHeight, "stateHeight", stateBlockHeight)
// If appBlockHeight == 0 it means that we are at genesis and hence should send InitChain.
// If appBlockHeight == 0 it means that we are at genesis and hence should send InitChain
if appBlockHeight == 0 {
nextVals := types.TM2PB.Validators(state.NextValidators) // state.Validators would work too.
validators := types.TM2PB.Validators(state.Validators)
csParams := types.TM2PB.ConsensusParams(h.genDoc.ConsensusParams)
req := abci.RequestInitChain{
Time: h.genDoc.GenesisTime.Unix(), // TODO
ChainId: h.genDoc.ChainID,
ConsensusParams: csParams,
Validators: nextVals,
Validators: validators,
AppStateBytes: h.genDoc.AppStateJSON,
}
res, err := proxyApp.Consensus().InitChainSync(req)
@@ -280,7 +280,9 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight
return nil, err
}
// If the app returned validators or consensus params, update the state.
// if the app returned validators
// or consensus params, update the state
// with the them
if len(res.Validators) > 0 {
vals, err := types.PB2TM.Validators(res.Validators)
if err != nil {
@@ -294,7 +296,7 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight
sm.SaveState(h.stateDB, state)
}
// First handle edge cases and constraints on the storeBlockHeight.
// First handle edge cases and constraints on the storeBlockHeight
if storeBlockHeight == 0 {
return appHash, checkAppHash(state, appHash)

View File

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

View File

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

View File

@@ -10,8 +10,8 @@ import (
"time"
fail "github.com/ebuchman/fail-test"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
cfg "github.com/tendermint/tendermint/config"
cstypes "github.com/tendermint/tendermint/consensus/types"
@@ -74,6 +74,7 @@ type ConsensusState struct {
privValidator types.PrivValidator // for signing votes
// services for creating and executing blocks
// TODO: encapsulate all of this in one "BlockManager"
blockExec *sm.BlockExecutor
blockStore sm.BlockStore
mempool sm.Mempool
@@ -196,15 +197,6 @@ func (cs *ConsensusState) GetState() sm.State {
return cs.state.Copy()
}
// GetLastHeight returns the last height committed.
// If there were no blocks, returns 0.
func (cs *ConsensusState) GetLastHeight() int64 {
cs.mtx.Lock()
defer cs.mtx.Unlock()
return cs.RoundState.Height - 1
}
// GetRoundState returns a shallow copy of the internal consensus state.
func (cs *ConsensusState) GetRoundState() *cstypes.RoundState {
cs.mtx.Lock()
@@ -322,16 +314,8 @@ func (cs *ConsensusState) startRoutines(maxSteps int) {
// OnStop implements cmn.Service. It stops all routines and waits for the WAL to finish.
func (cs *ConsensusState) OnStop() {
cs.BaseService.OnStop()
cs.evsw.Stop()
cs.timeoutTicker.Stop()
// Make BaseService.Wait() wait until cs.wal.Wait()
if cs.IsRunning() {
cs.wal.Wait()
}
}
// Wait waits for the the main routine to return.
@@ -611,6 +595,7 @@ func (cs *ConsensusState) receiveRoutine(maxSteps int) {
// close wal now that we're done writing to it
cs.wal.Stop()
cs.wal.Wait()
close(cs.done)
return
@@ -632,7 +617,7 @@ func (cs *ConsensusState) handleMsg(mi msgInfo) {
err = cs.setProposal(msg.Proposal)
case *BlockPartMessage:
// if the proposal is complete, we'll enterPrevote or tryFinalizeCommit
_, err = cs.addProposalBlockPart(msg.Height, msg.Part)
_, err = cs.addProposalBlockPart(msg, peerID)
if err != nil && msg.Round != cs.Round {
cs.Logger.Debug("Received block part from wrong round", "height", cs.Height, "csRound", cs.Round, "blockRound", msg.Round)
err = nil
@@ -940,7 +925,7 @@ func (cs *ConsensusState) createProposalBlock() (block *types.Block, blockParts
}
// Mempool validated transactions
txs := cs.mempool.Reap(cs.config.MaxBlockSizeTxs)
txs := cs.mempool.Reap(cs.state.ConsensusParams.BlockSize.MaxTxs)
block, parts := cs.state.MakeBlock(cs.Height, txs, commit)
evidence := cs.evpool.PendingEvidence()
block.AddEvidence(evidence)
@@ -1021,11 +1006,9 @@ func (cs *ConsensusState) enterPrevoteWait(height int64, round int) {
logger.Debug(cmn.Fmt("enterPrevoteWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
return
}
/*
if !cs.Votes.Prevotes(round).HasTwoThirdsAny() {
cmn.PanicSanity(cmn.Fmt("enterPrevoteWait(%v/%v), but Prevotes does not have any +2/3 votes", height, round))
}
*/
if !cs.Votes.Prevotes(round).HasTwoThirdsAny() {
cmn.PanicSanity(cmn.Fmt("enterPrevoteWait(%v/%v), but Prevotes does not have any +2/3 votes", height, round))
}
logger.Info(cmn.Fmt("enterPrevoteWait(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
defer func() {
@@ -1409,17 +1392,22 @@ func (cs *ConsensusState) defaultSetProposal(proposal *types.Proposal) error {
// NOTE: block is not necessarily valid.
// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block.
func (cs *ConsensusState) addProposalBlockPart(height int64, part *types.Part) (added bool, err error) {
func (cs *ConsensusState) addProposalBlockPart(msg *BlockPartMessage, peerID p2p.ID) (added bool, err error) {
height, round, part := msg.Height, msg.Round, msg.Part
// Blocks might be reused, so round mismatch is OK
if cs.Height != height {
cs.Logger.Debug("Received block part from wrong height", "height", height)
cs.Logger.Debug("Received block part from wrong height", "height", height, "round", round)
return false, nil
}
// We're not expecting a block part.
if cs.ProposalBlockParts == nil {
cs.Logger.Info("Received a block part when we're not expecting any", "height", height)
return false, nil // TODO: bad peer? Return error?
// NOTE: this can happen when we've gone to a higher round and
// then receive parts from the previous round - not necessarily a bad peer.
cs.Logger.Info("Received a block part when we're not expecting any",
"height", height, "round", round, "index", part.Index, "peer", peerID)
return false, nil
}
added, err = cs.ProposalBlockParts.AddPart(part)
@@ -1453,7 +1441,7 @@ func (cs *ConsensusState) addProposalBlockPart(height int64, part *types.Part) (
// procedure at this point.
}
if cs.Step == cstypes.RoundStepPropose && cs.isProposalComplete() {
if cs.Step <= cstypes.RoundStepPropose && cs.isProposalComplete() {
// Move onto the next step
cs.enterPrevote(height, cs.Round)
} else if cs.Step == cstypes.RoundStepCommit {
@@ -1589,7 +1577,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
if prevotes.HasTwoThirdsMajority() {
cs.enterPrecommit(height, vote.Round)
} else {
cs.enterPropose(height, vote.Round) // we can't prevote until we wait for the proposal.
cs.enterPrevote(height, vote.Round) // if the vote is ahead of us
cs.enterPrevoteWait(height, vote.Round)
}
} else if cs.Proposal != nil && 0 <= cs.Proposal.POLRound && cs.Proposal.POLRound == vote.Round {
@@ -1605,9 +1593,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
blockID, ok := precommits.TwoThirdsMajority()
if ok {
if len(blockID.Hash) == 0 {
cs.enterNewRound(height, vote.Round)
cs.enterPrecommit(height, vote.Round)
cs.enterPrecommitWait(height, vote.Round)
cs.enterNewRound(height, vote.Round+1)
} else {
cs.enterNewRound(height, vote.Round)
cs.enterPrecommit(height, vote.Round)
@@ -1623,8 +1609,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
}
} else if cs.Round <= vote.Round && precommits.HasTwoThirdsAny() {
cs.enterNewRound(height, vote.Round)
cs.enterPropose(height, vote.Round)
cs.enterPrevoteWait(height, vote.Round)
cs.enterPrecommit(height, vote.Round)
cs.enterPrecommitWait(height, vote.Round)
}
default:

View File

@@ -10,8 +10,8 @@ import (
cstypes "github.com/tendermint/tendermint/consensus/types"
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
"github.com/tendermint/tendermint/types"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
)
func init() {
@@ -64,22 +64,22 @@ func TestStateProposerSelection0(t *testing.T) {
startTestRound(cs1, height, round)
// Wait for new round so proposer is set.
// wait for new round so proposer is set
<-newRoundCh
// Commit a block and ensure proposer for the next height is correct.
// lets commit a block and ensure proposer for the next height is correct
prop := cs1.GetRoundState().Validators.GetProposer()
if !bytes.Equal(prop.Address, cs1.privValidator.GetAddress()) {
t.Fatalf("expected proposer to be validator %d. Got %X", 0, prop.Address)
}
// Wait for complete proposal.
// wait for complete proposal
<-proposalCh
rs := cs1.GetRoundState()
signAddVotes(cs1, types.VoteTypePrecommit, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), vss[1:]...)
// Wait for new round so next validator is set.
// wait for new round so next validator is set
<-newRoundCh
prop = cs1.GetRoundState().Validators.GetProposer()
@@ -718,8 +718,6 @@ func TestStateLockPOLUnlock(t *testing.T) {
func TestStateLockPOLSafety1(t *testing.T) {
cs1, vss := randConsensusState(4)
vs2, vs3, vs4 := vss[1], vss[2], vss[3]
h := cs1.GetRoundState().Height
r := cs1.GetRoundState().Round
partSize := cs1.state.ConsensusParams.BlockPartSizeBytes
@@ -736,7 +734,7 @@ func TestStateLockPOLSafety1(t *testing.T) {
rs := re.(types.EventDataRoundState).RoundState.(*cstypes.RoundState)
propBlock := rs.ProposalBlock
ensureVote(voteCh, h, r, types.VoteTypePrevote)
<-voteCh // prevote
validatePrevote(t, cs1, 0, vss[0], propBlock.Hash())
@@ -757,11 +755,6 @@ func TestStateLockPOLSafety1(t *testing.T) {
// we do see them precommit nil
signAddVotes(cs1, types.VoteTypePrecommit, nil, types.PartSetHeader{}, vs2, vs3, vs4)
ensureVote(voteCh, h, r, types.VoteTypePrecommit)
<-newRoundCh
t.Log("### ONTO ROUND 1")
prop, propBlock := decideProposal(cs1, vs2, vs2.Height, vs2.Round+1)
propBlockHash := propBlock.Hash()
propBlockParts := propBlock.MakePartSet(partSize)
@@ -772,6 +765,9 @@ func TestStateLockPOLSafety1(t *testing.T) {
if err := cs1.SetProposalAndBlock(prop, propBlock, propBlockParts, "some peer"); err != nil {
t.Fatal(err)
}
<-newRoundCh
t.Log("### ONTO ROUND 1")
/*Round2
// we timeout and prevote our lock
// a polka happened but we didn't see it!
@@ -792,13 +788,13 @@ func TestStateLockPOLSafety1(t *testing.T) {
}
t.Logf("new prop hash %v", fmt.Sprintf("%X", propBlockHash))
// go to prevote, prevote for proposal block
ensureVote(voteCh, h, r+1, types.VoteTypePrevote)
<-voteCh
validatePrevote(t, cs1, 1, vss[0], propBlockHash)
// now we see the others prevote for it, so we should lock on it
signAddVotes(cs1, types.VoteTypePrevote, propBlockHash, propBlockParts.Header(), vs2, vs3, vs4)
ensureVote(voteCh, h, r+1, types.VoteTypePrecommit)
<-voteCh // precommit
// we should have precommitted
validatePrecommit(t, cs1, 1, 1, vss[0], propBlockHash, propBlockHash)
@@ -820,7 +816,7 @@ func TestStateLockPOLSafety1(t *testing.T) {
<-timeoutProposeCh
// finish prevote
ensureVote(voteCh, h, r+2, types.VoteTypePrevote)
<-voteCh
// we should prevote what we're locked on
validatePrevote(t, cs1, 2, vss[0], propBlockHash)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

137
crypto/Gopkg.lock generated
View File

@@ -1,137 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcd"
packages = ["btcec"]
revision = "86fed781132ac890ee03e906e4ecd5d6fa180c64"
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcutil"
packages = ["base58"]
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
[[projects]]
name = "github.com/davecgh/go-spew"
packages = ["spew"]
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
name = "github.com/go-kit/kit"
packages = [
"log",
"log/level",
"log/term"
]
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",
"proto",
"protoc-gen-gogo/descriptor"
]
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
version = "v1.0.0"
[[projects]]
branch = "master"
name = "github.com/kr/logfmt"
packages = ["."]
revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0"
[[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]]
name = "github.com/stretchr/testify"
packages = [
"assert",
"require"
]
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
[[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]]
name = "github.com/tendermint/tmlibs"
packages = [
"common",
"log",
"test"
]
revision = "692f1d86a6e2c0efa698fd1e4541b68c74ffaf38"
version = "v0.8.4"
[[projects]]
branch = "master"
name = "golang.org/x/crypto"
packages = [
"bcrypt",
"blowfish",
"chacha20poly1305",
"hkdf",
"internal/chacha20",
"internal/subtle",
"nacl/secretbox",
"openpgp/armor",
"openpgp/errors",
"poly1305",
"ripemd160",
"salsa20/salsa"
]
revision = "7f39a6fea4fe9364fb61e1def6a268a51b4f3a06"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["cpu"]
revision = "ad87a3a340fa7f3bed189293fbfa7a9b7e021ae1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "027b22b86396a971d5d5c1d298947f531f39743975d65a22e98601140aa1b1a1"
solver-name = "gps-cdcl"
solver-version = 1

View File

@@ -1,49 +0,0 @@
# 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/btcsuite/btcutil"
branch = "master"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.1"
[[constraint]]
name = "github.com/tendermint/ed25519"
branch = "master"
[[constraint]]
name = "github.com/tendermint/go-amino"
version = "0.10.0-rc2"
[[constraint]]
name = "github.com/tendermint/tmlibs"
version = "0.8.1"
[prune]
go-tests = true
unused-packages = true

View File

@@ -1,99 +0,0 @@
GOTOOLS = \
github.com/golang/dep/cmd/dep \
# gopkg.in/alecthomas/gometalinter.v2 \
GOTOOLS_CHECK = dep #gometalinter.v2
all: check get_vendor_deps build test install
check: check_tools
########################################
### Build
# Command to generate the workd list (kept here for documentation purposes only):
wordlist:
# To re-generate wordlist.go run:
# go-bindata -ignore ".*\.go" -o keys/words/bip39/wordlist.go -pkg "wordlist" keys/bip39/wordlist/...
build: wordlist
# Nothing else to build!
install:
# Nothing to install!
########################################
### Tools & dependencies
check_tools:
@# https://stackoverflow.com/a/25668869
@echo "Found tools: $(foreach tool,$(GOTOOLS_CHECK),\
$(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)
get_vendor_deps:
@rm -rf vendor/
@echo "--> Running dep ensure"
@dep ensure
########################################
### Testing
test:
CGO_ENABLED=0 go test -p 1 $(shell go list ./... | grep -v vendor)
########################################
### Formatting, linting, and vetting
fmt:
@go fmt ./...
metalinter:
@echo "==> Running linter"
gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=maligned \
--enable=deadcode \
--enable=goconst \
--enable=goimports \
--enable=gosimple \
--enable=ineffassign \
--enable=megacheck \
--enable=misspell \
--enable=staticcheck \
--enable=safesql \
--enable=structcheck \
--enable=unconvert \
--enable=unused \
--enable=varcheck \
--enable=vetshadow \
./...
#--enable=gas \
#--enable=dupl \
#--enable=errcheck \
#--enable=gocyclo \
#--enable=golint \ <== comments on anything exported
#--enable=gotype \
#--enable=interfacer \
#--enable=unparam \
#--enable=vet \
metalinter_all:
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
# 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
.PHONEY: check build install check_tools get_tools update_tools get_vendor_deps test fmt metalinter metalinter_all

View File

@@ -1,6 +0,0 @@
#! /bin/bash
protoc --gogo_out=. -I $GOPATH/src/ -I . -I $GOPATH/src/github.com/gogo/protobuf/protobuf merkle.proto
echo "--> adding nolint declarations to protobuf generated files"
awk '/package merkle/ { print "//nolint: gas"; print; next }1' merkle.pb.go > merkle.pb.go.new
mv merkle.pb.go.new merkle.pb.go

View File

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

View File

@@ -1,100 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: merkle.proto
/*
Package merkle is a generated protocol buffer package.
It is generated from these files:
merkle.proto
It has these top-level messages:
ProofOp
Proof
*/
package merkle
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type ProofOp struct {
Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *ProofOp) Reset() { *m = ProofOp{} }
func (m *ProofOp) String() string { return proto.CompactTextString(m) }
func (*ProofOp) ProtoMessage() {}
func (*ProofOp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *ProofOp) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *ProofOp) GetKey() []byte {
if m != nil {
return m.Key
}
return nil
}
func (m *ProofOp) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}
type Proof struct {
Ops []*ProofOp `protobuf:"bytes,1,rep,name=ops" json:"ops,omitempty"`
}
func (m *Proof) Reset() { *m = Proof{} }
func (m *Proof) String() string { return proto.CompactTextString(m) }
func (*Proof) ProtoMessage() {}
func (*Proof) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *Proof) GetOps() []*ProofOp {
if m != nil {
return m.Ops
}
return nil
}
func init() {
proto.RegisterType((*ProofOp)(nil), "merkle.ProofOp")
proto.RegisterType((*Proof)(nil), "merkle.Proof")
}
func init() { proto.RegisterFile("merkle.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 168 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xc9, 0x4d, 0x2d, 0xca,
0xce, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0xa4, 0x74, 0xd3, 0x33,
0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0xd2,
0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x39, 0x73, 0xb1, 0x07, 0x14,
0xe5, 0xe7, 0xa7, 0xf9, 0x17, 0x08, 0x09, 0x71, 0xb1, 0x94, 0x54, 0x16, 0xa4, 0x4a, 0x30, 0x2a,
0x30, 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0x02, 0x5c, 0xcc, 0xd9, 0xa9, 0x95, 0x12, 0x4c, 0x0a,
0x8c, 0x1a, 0x3c, 0x41, 0x20, 0x26, 0x48, 0x55, 0x4a, 0x62, 0x49, 0xa2, 0x04, 0x33, 0x58, 0x08,
0xcc, 0x56, 0x32, 0xe0, 0x62, 0x05, 0x1b, 0x22, 0xa4, 0xce, 0xc5, 0x9c, 0x5f, 0x50, 0x2c, 0xc1,
0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0xc4, 0xaf, 0x07, 0x75, 0x20, 0xd4, 0x02, 0x27, 0x96, 0x13, 0xf7,
0xe4, 0x19, 0x82, 0x40, 0x2a, 0x92, 0xd8, 0xc0, 0xb6, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff,
0xe0, 0x7d, 0x7c, 0x4e, 0xc4, 0x00, 0x00, 0x00,
}

View File

@@ -1,19 +0,0 @@
syntax = "proto3";
package merkle;
// For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
//----------------------------------------
// Message types
message ProofOp {
string type = 1;
bytes key = 2;
bytes data = 3;
}
message Proof {
repeated ProofOp ops = 1 [(gogoproto.nullable)=false];
}

View File

@@ -1,124 +0,0 @@
package merkle
import (
"bytes"
cmn "github.com/tendermint/tmlibs/common"
)
//----------------------------------------
// ProofOp gets converted to an instance of ProofOperator:
type ProofOperator interface {
Run([][]byte) ([][]byte, error)
GetKey() []byte
ProofOp() ProofOp
}
//----------------------------------------
// Operations on a list of ProofOperators
type ProofOperators []ProofOperator
func (poz ProofOperators) VerifyValue(root []byte, keypath string, value []byte) (err error) {
return poz.Verify(root, keypath, [][]byte{value})
}
func (poz ProofOperators) Verify(root []byte, keypath string, args [][]byte) (err error) {
keys, err := KeyPathToKeys(keypath)
if err != nil {
return
}
for i, op := range poz {
key := op.GetKey()
if len(key) != 0 {
if !bytes.Equal(keys[0], key) {
return cmn.NewError("Key mismatch on operation #%d: expected %+v but %+v", i, []byte(keys[0]), []byte(key))
}
keys = keys[1:]
}
args, err = op.Run(args)
if err != nil {
return
}
}
if !bytes.Equal(root, args[0]) {
return cmn.NewError("Calculated root hash is invalid: expected %+v but %+v", root, args[0])
}
if len(keys) != 0 {
return cmn.NewError("Keypath not consumed all")
}
return nil
}
//----------------------------------------
// ProofRuntime - main entrypoint
type OpDecoder func(ProofOp) (ProofOperator, error)
type ProofRuntime struct {
decoders map[string]OpDecoder
}
func NewProofRuntime() *ProofRuntime {
return &ProofRuntime{
decoders: make(map[string]OpDecoder),
}
}
func (prt *ProofRuntime) RegisterOpDecoder(typ string, dec OpDecoder) {
_, ok := prt.decoders[typ]
if ok {
panic("already registered for type " + typ)
}
prt.decoders[typ] = dec
}
func (prt *ProofRuntime) Decode(pop ProofOp) (ProofOperator, error) {
decoder := prt.decoders[pop.Type]
if decoder == nil {
return nil, cmn.NewError("unrecognized proof type %v", pop.Type)
}
return decoder(pop)
}
func (prt *ProofRuntime) DecodeProof(proof *Proof) (poz ProofOperators, err error) {
poz = ProofOperators(nil)
for _, pop := range proof.Ops {
operator, err := prt.Decode(*pop)
if err != nil {
return nil, cmn.ErrorWrap(err, "decoding a proof operator")
}
poz = append(poz, operator)
}
return
}
func (prt *ProofRuntime) VerifyValue(proof *Proof, root []byte, keypath string, value []byte) (err error) {
return prt.Verify(proof, root, keypath, [][]byte{value})
}
// TODO In the long run we'll need a method of classifcation of ops,
// whether existence or absence or perhaps a third?
func (prt *ProofRuntime) VerifyAbsence(proof *Proof, keypath string, root []byte) (err error) {
return prt.Verify(proof, root, keypath, nil)
}
func (prt *ProofRuntime) Verify(proof *Proof, root []byte, keypath string, args [][]byte) (err error) {
poz, err := prt.DecodeProof(proof)
if err != nil {
return cmn.ErrorWrap(err, "decoding proof")
}
return poz.Verify(root, keypath, args)
}
// DefaultProofRuntime only knows about Simple value
// proofs.
// To use e.g. IAVL proofs, register op-decoders as
// defined in the IAVL package.
func DefaultProofRuntime() (prt *ProofRuntime) {
prt = NewProofRuntime()
prt.RegisterOpDecoder(ProofOpSimpleValue, SimpleValueOpDecoder)
return
}

View File

@@ -1,107 +0,0 @@
package merkle
import (
"encoding/hex"
"fmt"
"net/url"
"strings"
cmn "github.com/tendermint/tmlibs/common"
)
/*
For generalized Merkle proofs, each layer of the proof may require an
optional key. The key may be encoded either by URL-encoding or
(upper-case) hex-encoding.
TODO: In the future, more encodings may be supported, like base32 (e.g.
/32:)
For example, for a Cosmos-SDK application where the first two proof layers
are SimpleValueOps, and the third proof layer is an IAVLValueOp, the keys
might look like:
0: []byte("App")
1: []byte("IBC")
2: []byte{0x01, 0x02, 0x03}
Assuming that we know that the first two layers are always ASCII texts, we
probably want to use URLEncoding for those, whereas the third layer will
require HEX encoding for efficient representation.
kp := new(KeyPath)
kp.AppendKey([]byte("App"), KeyEncodingURL)
kp.AppendKey([]byte("IBC"), KeyEncodingURL)
kp.AppendKey([]byte{0x01, 0x02, 0x03}, KeyEncodingURL)
kp.String() // Should return "/App/IBC/x:010203"
NOTE: All encodings *MUST* work compatibly, such that you can choose to use
whatever encoding, and the decoded keys will always be the same. In other
words, it's just as good to encode all three keys using URL encoding or HEX
encoding... it just wouldn't be optimal in terms of readability or space
efficiency.
NOTE: Punycode will never be supported here, because not all values can be
decoded. For example, no string decodes to the string "xn--blah" in
Punycode.
*/
type keyEncoding int
const (
KeyEncodingURL keyEncoding = iota
KeyEncodingHex
KeyEncodingMax
)
type Key struct {
name []byte
enc keyEncoding
}
type KeyPath []Key
func (pth KeyPath) AppendKey(key []byte, enc keyEncoding) KeyPath {
return append(pth, Key{key, enc})
}
func (pth KeyPath) String() string {
res := ""
for _, key := range pth {
switch key.enc {
case KeyEncodingURL:
res += "/" + url.PathEscape(string(key.name))
case KeyEncodingHex:
res += "/x:" + fmt.Sprintf("%X", key.name)
default:
panic("unexpected key encoding type")
}
}
return res
}
func KeyPathToKeys(path string) (keys [][]byte, err error) {
if path == "" || path[0] != '/' {
return nil, cmn.NewError("key path string must start with a forward slash '/'")
}
parts := strings.Split(path[1:], "/")
keys = make([][]byte, len(parts))
for i, part := range parts {
if strings.HasPrefix(part, "x:") {
hexPart := part[2:]
key, err := hex.DecodeString(hexPart)
if err != nil {
return nil, cmn.ErrorWrap(err, "decoding hex-encoded part #%d: /%s", i, part)
}
keys[i] = key
} else {
key, err := url.PathUnescape(part)
if err != nil {
return nil, cmn.ErrorWrap(err, "decoding url-encoded part #%d: /%s", i, part)
}
keys[i] = []byte(key) // TODO Test this with random bytes, I'm not sure that it works for arbitrary bytes...
}
}
return keys, nil
}

View File

@@ -1,41 +0,0 @@
package merkle
import (
"math/rand"
"testing"
"github.com/stretchr/testify/require"
)
func TestKeyPath(t *testing.T) {
var path KeyPath
keys := make([][]byte, 10)
alphanum := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
for d := 0; d < 1e4; d++ {
path = nil
for i := range keys {
enc := keyEncoding(rand.Intn(int(KeyEncodingMax)))
keys[i] = make([]byte, rand.Uint32()%20)
switch enc {
case KeyEncodingURL:
for j := range keys[i] {
keys[i][j] = alphanum[rand.Intn(len(alphanum))]
}
case KeyEncodingHex:
rand.Read(keys[i])
default:
panic("Unexpected encoding")
}
path = path.AppendKey(keys[i], enc)
}
res, err := KeyPathToKeys(path.String())
require.Nil(t, err)
for i, key := range keys {
require.Equal(t, key, res[i])
}
}
}

View File

@@ -1,91 +0,0 @@
package merkle
import (
"bytes"
"fmt"
"github.com/tendermint/tendermint/crypto/tmhash"
cmn "github.com/tendermint/tmlibs/common"
)
const ProofOpSimpleValue = "simple:v"
// SimpleValueOp takes a key and a single value as argument and
// produces the root hash. The corresponding tree structure is
// the SimpleMap tree. SimpleMap takes a Hasher, and currently
// Tendermint uses aminoHasher. SimpleValueOp should support
// the hash function as used in aminoHasher. TODO support
// additional hash functions here as options/args to this
// operator.
//
// If the produced root hash matches the expected hash, the
// proof is good.
type SimpleValueOp struct {
// Encoded in ProofOp.Key.
key []byte
// To encode in ProofOp.Data
Proof *SimpleProof `json:"simple-proof"`
}
var _ ProofOperator = SimpleValueOp{}
func NewSimpleValueOp(key []byte, proof *SimpleProof) SimpleValueOp {
return SimpleValueOp{
key: key,
Proof: proof,
}
}
func SimpleValueOpDecoder(pop ProofOp) (ProofOperator, error) {
if pop.Type != ProofOpSimpleValue {
return nil, cmn.NewError("unexpected ProofOp.Type; got %v, want %v", pop.Type, ProofOpSimpleValue)
}
var op SimpleValueOp // a bit strange as we'll discard this, but it works.
err := cdc.UnmarshalBinary(pop.Data, &op)
if err != nil {
return nil, cmn.ErrorWrap(err, "decoding ProofOp.Data into SimpleValueOp")
}
return NewSimpleValueOp(pop.Key, op.Proof), nil
}
func (op SimpleValueOp) ProofOp() ProofOp {
bz := cdc.MustMarshalBinary(op)
return ProofOp{
Type: ProofOpSimpleValue,
Key: op.key,
Data: bz,
}
}
func (op SimpleValueOp) String() string {
return fmt.Sprintf("SimpleValueOp{%v}", op.GetKey())
}
func (op SimpleValueOp) Run(args [][]byte) ([][]byte, error) {
if len(args) != 1 {
return nil, cmn.NewError("expected 1 arg, got %v", len(args))
}
value := args[0]
hasher := tmhash.New()
hasher.Write(value) // does not error
vhash := hasher.Sum(nil)
// Wrap <op.Key, vhash> to hash the KVPair.
hasher = tmhash.New()
encodeByteSlice(hasher, []byte(op.key)) // does not error
encodeByteSlice(hasher, []byte(vhash)) // does not error
kvhash := hasher.Sum(nil)
if !bytes.Equal(kvhash, op.Proof.LeafHash) {
return nil, cmn.NewError("leaf hash mismatch: want %X got %X", op.Proof.LeafHash, kvhash)
}
return [][]byte{
op.Proof.ComputeRootHash(),
}, nil
}
func (op SimpleValueOp) GetKey() []byte {
return op.key
}

View File

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

View File

@@ -3,22 +3,11 @@ package merkle
import (
"bytes"
"fmt"
cmn "github.com/tendermint/tmlibs/common"
)
// SimpleProof represents a simple Merkle proof.
// NOTE: The convention for proofs is to include leaf hashes but to
// exclude the root hash.
// This convention is implemented across IAVL range proofs as well.
// Keep this consistent unless there's a very good reason to change
// everything. This also affects the generalized proof system as
// well.
// SimpleProof represents a simple merkle proof.
type SimpleProof struct {
Total int `json:"total"` // Total number of items.
Index int `json:"index"` // Index of item to prove.
LeafHash []byte `json:"leaf_hash"` // Hash of item value.
Aunts [][]byte `json:"aunts"` // Hashes from leaf's sibling to a root's child.
Aunts [][]byte `json:"aunts"` // Hashes from leaf's sibling to a root's child.
}
// SimpleProofsFromHashers computes inclusion proof for given items.
@@ -29,10 +18,7 @@ func SimpleProofsFromHashers(items []Hasher) (rootHash []byte, proofs []*SimpleP
proofs = make([]*SimpleProof, len(items))
for i, trail := range trails {
proofs[i] = &SimpleProof{
Total: len(items),
Index: i,
LeafHash: trail.Hash,
Aunts: trail.FlattenAunts(),
Aunts: trail.FlattenAunts(),
}
}
return
@@ -63,32 +49,11 @@ func SimpleProofsFromMap(m map[string]Hasher) (rootHash []byte, proofs map[strin
return
}
// Verify that the SimpleProof proves the root hash.
func (sp *SimpleProof) Verify(rootHash []byte, index int, total int, leafHash []byte) error {
if sp.Index != index {
return cmn.NewError("invalid index: wanted %v got %v", index, sp.Index)
}
if sp.Total != total {
return cmn.NewError("invalid total: wanted %v got %v", total, sp.Total)
}
if !bytes.Equal(sp.LeafHash, leafHash) {
return cmn.NewError("invalid leaf hash: wanted %X got %X", leafHash, sp.LeafHash)
}
computedHash := sp.ComputeRootHash()
if !bytes.Equal(computedHash, rootHash) {
return cmn.NewError("invalid root hash: wanted %X got %X", rootHash, computedHash)
}
return nil
}
// Compute the root hash given a leaf hash. Does not verify the result.
func (sp *SimpleProof) ComputeRootHash() []byte {
return computeHashFromAunts(
sp.Index,
sp.Total,
sp.LeafHash,
sp.Aunts,
)
// Verify that leafHash is a leaf hash of the simple-merkle-tree
// which hashes to rootHash.
func (sp *SimpleProof) Verify(index int, total int, leafHash []byte, rootHash []byte) bool {
computedHash := computeHashFromAunts(index, total, leafHash, sp.Aunts)
return computedHash != nil && bytes.Equal(computedHash, rootHash)
}
// String implements the stringer interface for SimpleProof.

View File

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

View File

@@ -3,8 +3,8 @@ package merkle
import (
"bytes"
cmn "github.com/tendermint/tmlibs/common"
. "github.com/tendermint/tmlibs/test"
cmn "github.com/tendermint/tendermint/libs/common"
. "github.com/tendermint/tendermint/libs/test"
"github.com/tendermint/tendermint/crypto/tmhash"
"testing"
@@ -39,16 +39,16 @@ func TestSimpleProof(t *testing.T) {
proof := proofs[i]
// Verify success
err := proof.Verify(rootHash, i, total, itemHash)
if err != nil {
t.Errorf("Verification failed: %v.", err)
ok := proof.Verify(i, total, itemHash, rootHash)
if !ok {
t.Errorf("Verification failed for index %v.", i)
}
// Wrong item index should make it fail
{
err = proof.Verify(rootHash, (i+1)%total, total, itemHash)
if err == nil {
t.Errorf("Expected verification to fail for wrong index %v", i)
ok = proof.Verify((i+1)%total, total, itemHash, rootHash)
if ok {
t.Errorf("Expected verification to fail for wrong index %v.", i)
}
}
@@ -56,9 +56,9 @@ func TestSimpleProof(t *testing.T) {
origAunts := proof.Aunts
proof.Aunts = append(proof.Aunts, cmn.RandBytes(32))
{
err = proof.Verify(rootHash, i, total, itemHash)
if err == nil {
t.Errorf("Expected verification to fail for wrong trail length")
ok = proof.Verify(i, total, itemHash, rootHash)
if ok {
t.Errorf("Expected verification to fail for wrong trail length.")
}
}
proof.Aunts = origAunts
@@ -66,22 +66,22 @@ func TestSimpleProof(t *testing.T) {
// Trail too short should make it fail
proof.Aunts = proof.Aunts[0 : len(proof.Aunts)-1]
{
err = proof.Verify(rootHash, i, total, itemHash)
if err == nil {
t.Errorf("Expected verification to fail for wrong trail length")
ok = proof.Verify(i, total, itemHash, rootHash)
if ok {
t.Errorf("Expected verification to fail for wrong trail length.")
}
}
proof.Aunts = origAunts
// Mutating the itemHash should make it fail.
err = proof.Verify(rootHash, i, total, MutateByteSlice(itemHash))
if err == nil {
ok = proof.Verify(i, total, MutateByteSlice(itemHash), rootHash)
if ok {
t.Errorf("Expected verification to fail for mutated leaf hash")
}
// Mutating the rootHash should make it fail.
err = proof.Verify(MutateByteSlice(rootHash), i, total, itemHash)
if err == nil {
ok = proof.Verify(i, total, itemHash, MutateByteSlice(rootHash))
if ok {
t.Errorf("Expected verification to fail for mutated root hash")
}
}

View File

@@ -1,16 +0,0 @@
package merkle
import (
"github.com/tendermint/go-amino"
)
var cdc *amino.Codec
func init() {
cdc = amino.NewCodec()
RegisterWire(cdc)
}
func RegisterWire(cdc *amino.Codec) {
// Nothing to do.
}

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