Commit Graph

2143 Commits

Author SHA1 Message Date
Antioch Peverell f3baceb51b bump version for 2.1.0 dev (still on master) (#3050) 2019-09-19 15:03:44 +01:00
Antioch Peverell bc6108cf12 Kernels v2 (variable size) (#3034)
* wip

* exhaustive match

* write with fixed v1 strategy when writing for hashing

* local protocol version is 2

* cleanup "size" tests that exercise v1 vs v2 vs default protocol versions

* add proto version to Connected! log msg

* cleanup docs

* negotiate protocol version min(local, peer) when doing hand/shake
2019-09-19 14:31:46 +01:00
Quentin Le Sceller b209244d17 Add sync_status in status Node API (#2966)
* Add sync_status in status Node API
2019-09-17 11:12:42 -04:00
Antioch Peverell 28d5ee8242 Peer is_known robustness (#3040)
* add some test coverage around peers map (peer_addr hashing impl)

* make is_known a bit more robust

* fix typos
2019-09-12 21:04:09 +01:00
Yeastplume 95004a4b96 BasicAuthMiddleware: Add option to ignore authentication for a particular URI (#3037)
* api::BasicAuthMiddleware: Add option to ignore authentication for a particular URI

* rustfmt
2019-09-12 11:35:18 +01:00
Antioch Peverell 32286ccd7a add some test coverage around peers map (peer_addr hashing impl) (#3039) 2019-09-12 10:37:29 +01:00
Nikolay Volf 108b640c22 Update mmr.md (#3024) 2019-09-10 16:50:10 +01:00
hashmap d90b1c2723 Optimize POW read (#3035)
* Optimize POW read

This functionality is used to deserialize header (from network or from
DB), it was taking up to 40% cpu time during initial header sync. This
PR brings it down to 3-4%. Function read_number would look better as
closure, unfortunately the compliler doesn't inline it in this case, so
it would be 2x slower.

* Remove unused code
2019-09-10 15:14:33 +02:00
hashmap 80a8f76c4c Optimize Option to Error conversion (#3036)
To convert option to error we generate an error message. In some places
it contains header or block hash code or other data which is costly to
produce. So during the initial header sync we spend 12% of all time on
generating those messages (in 99% cases we don't use it). This PR
introduces a lazy generation of error messages which completely
eliminates CPU load during the header sync.
2019-09-10 14:38:36 +02:00
Gary Yu 4faac470d4 fix: the cpuload 100% in case the tcpstream WouldBlock (#3029)
* fix: the cpuload 100% in case the tcpstream WouldBlock

* extending the sleep on WouldBlock to all read/write

* rustfmt
2019-09-10 07:55:57 +08:00
Gary Yu 7a07541c26 Clean the unused build_index (#3026) 2019-09-10 07:55:24 +08:00
Gary Yu fa0fed9de5 fix: find common header between the header chain and the current body chain (#3033)
* fix: find common header between the header chain and the current body chain

* add some code comments
2019-09-10 07:54:42 +08:00
Antioch Peverell 383985292c Split header MMR (and sync MMR) out from txhashset (#3004)
* wip

* sync sort of works now

* get rid of the deadlock during compaction
there is *always* a deadlock in there when we make changes like this...

* cleanup how we rebuild the sync MMR on init

* cleanup rewind logic

* roll the "fix invalid root" changes into this PR

* move rebuild_height_pos_index into txhashset
and pass in header_pmmr for header lookups

* cleanup and remember to setup sync head on init

* cleanup unnecessary ref muts

* rebuild_height_pos_index when writing txhashset
2019-09-07 07:28:26 +08:00
Gary Yu d55ebe8a2b fix: the race condition in compact (#3015) 2019-09-04 19:51:28 +01:00
Tengfei Niu 7aa27652b7 refactor code (#2990)
refactor: refactor code.
2019-09-04 09:53:05 -04:00
Antioch Peverell b291467b96 use head (not header_head) when rewinding full blocks (#3017)
* use head (not header_head) when rewinding to find fork point for full blocks

* get rid of shortcut when nothing to rewind - always something to rewind
2019-09-04 08:02:45 +08:00
jaspervdm 0e62b7e43e Optionally add rangeproofs to block api (#2999) 2019-09-03 15:52:33 +01:00
Gary Yu 928279a676 schnorr signature batch verification (#2961)
* schnorr signature batch verification

* Split the fee and lock_height verification out from the batch signature verification

* Remove the new added fee_height_verify to comply with #2859

* fix: the last n could not be leaf?
2019-09-03 15:44:10 +01:00
jackiszhp 2cebdc5868 it was miscounted (#3013) 2019-09-02 10:13:46 +01:00
jaspervdm 30156cdcf9 Kernel lookup api method (#3000)
* Kernel lookup api

* Min and max height parameters, scan backwards

* Return null instead of 404 if kernel not found

* Return TxKernel instead of TxKernelPrintable

* Update description of KernelHandler
2019-08-30 10:03:12 +01:00
Gary Yu d36a0b29ef store both mmr index and block height into database for output (#2903)
* store both mmr index and block height into database for output

* rustfmt

* fix: mmr position is 1-based instead of 0-based

* (Hash, u64, u64) deserves a type
2019-08-29 17:14:39 +01:00
Antioch Peverell 97f961fc67 verify the ignored fee is still 0 (#3007)
* verify the ignored bytes are indeed 0

* check for !=0 (rather than >0)
2019-08-29 12:56:21 +01:00
Antioch Peverell 357bc11746 Fix invalid root (#3005)
* use the correct (header) head for the header extension

* add test coverage for header first fork scenario
2019-08-29 10:15:41 +01:00
Antioch Peverell dcd405e263 cleanup deprecation warnings about missing dyn with trait objects (#2997) 2019-08-26 21:17:47 +01:00
Antioch Peverell d06b56cf6d simplify broadcast - send to all connected peers (#2996) 2019-08-22 16:35:31 +01:00
Antioch Peverell 5bf813ee93 improve checking for p2p connection limits (revised) (#2993)
* Add check for p2p connection limits

* Simplify undesirable connection shutdown

* Make inbound and outbound connections more explicit

* Cleanup inbound and outbound connections

* Cleanup an outbound peers check

* Rename healthy_peers_mix to enough_outbound_peers

* be a lot less restrictive when picking some candidate peers to connect to
keep the peer address queue drained but actually attempt a healthy number of connections
as most of these attempts are going to fail due to majority of nodes not being publicly accessible
2019-08-21 19:58:43 +01:00
antiochp 17dddeeb0d Revert "Improve checking for p2p connection limits (#2985)"
This reverts commit 24f0a52437.
2019-08-21 15:02:10 +01:00
j01tz 24f0a52437 Improve checking for p2p connection limits (#2985)
* Add check for p2p connection limits

* Simplify undesirable connection shutdown

* Make inbound and outbound connections more explicit

* Cleanup inbound and outbound connections

* Cleanup an outbound peers check

* Rename healthy_peers_mix to enough_outbound_peers
2019-08-21 12:43:09 +01:00
Mattia Rossi ea023387bf Fix doc grin <subcommand> help syntax. (#2991) 2019-08-20 18:05:26 +01:00
Antioch Peverell 6036b671e8 fee and lock_height maintained in kernel features variants (#2859)
* fee and lock_height now maintained in kernel features enum variants

* sum fees via explicit enum variants

* cleanup semantics around with_fee and with_lock_height for tx builders

* document the kernel feature variants

* serialize kernel features correctly for api json

* cleanup

* commit

* bump to unstick azure
2019-08-19 14:28:02 +01:00
j01tz d220410571 Improve error handling when computing PMMR roots (#2988)
* Improve error handling for invalid PMMR roots

* Update tests that rely on pmmr root

* Fix pmmr store tests
2019-08-09 15:10:54 +01:00
j01tz ea1d14ddb0 Improve validation when processing orphan blocks (#2981) 2019-08-03 09:07:01 +01:00
Yeastplume 705fcbb1a6 Updates to support XORed wallet keys/Tokens (#2982)
* updates to support xored tokens in wallet

* rustfmt
2019-08-02 11:30:26 +01:00
Quentin Le Sceller f79d05ba53 TxHashSet Download Improvement (#2984)
* Ban on cannot get block header in txhashset_write

* Rusfmt

* Fix typo

* Missing error handling

* Rustfmt

* Only accept txhashset from corresponding peer

* Switch to AtomicBool instead of RwLock<bool>

* Rustfmt
2019-08-01 17:46:06 +01:00
Antioch Peverell 4bd3aa109d cleanup and simplify how we generate the genesis block in user_testing (and automated_testing) modes (#2986) 2019-08-01 17:22:12 +01:00
Antioch Peverell aa5c428eb1 Prune list robustness (#2976)
* make prune list deserialization more robust (1-index vs 0 values)

* cleanup
2019-07-29 12:42:12 +01:00
eupn d918c5fe84 extkey_bip32.rs: fix misleading comment on HMAC (#2979) 2019-07-27 17:44:44 +01:00
NaN-git 0d4d98db0d fix wording in comment (#2913) 2019-07-26 08:43:18 +01:00
Antioch Peverell 515fa54614 Rewind head and header_head consistently. (#2918)
* maintain header_head as distinctly separate from head

* cleanup corrupted storage log msg

* simplify process_header and check_header_known

* remember to commit the batch when successfully processing a header...

* rework sync_block_headers for consistency with process_block_header

* cleanup unrelated code

* fix pool tests

* cleanup chain tests

* cleanup chain tests (reuse helpers more)

* cleanup - head not header on an extension
shortcircuit "rewind and apply fork" for headers if next header
2019-07-26 08:36:24 +01:00
pharazen 45cf1d96df Adds command to remove chain_data (#2954) 2019-07-25 10:13:56 +01:00
Joseph Goulden 2ae76d39bb fix: move checks for automated test mode into global.rs (#2956)
* fix: move checks for test/production mode into one place - global.rs

* chore: rustfmt
2019-07-25 10:08:24 +01:00
Joseph Goulden ecd16d114f fix: move sync state check from server into test_miner (#2958)
* fix: move sync state check from server into test_miner

* fix: compile error from SyncState moving to grin_chain
2019-07-25 10:07:56 +01:00
antiochp 441e846af6 Merge remote-tracking branch 'upstream/milestone/2.x.x' 2019-07-24 16:18:49 +01:00
antiochp 16af57706a Merge branch master into milestone/2.x.x 2019-07-24 15:33:26 +01:00
antiochp c6cea4744c Merge branch 'master' into milestone/2.x.x 2019-07-24 15:10:26 +01:00
Chengcheng Zhang 9040b5b774 Update intro_ZH-CN.md (#2965) 2019-07-24 13:18:10 +02:00
Ramin Soltanzadeh eff24723d0 Update Swedish intro.md (#2968)
* Update Swedish intro.md

Significant improvements, including a less excessive translation of the English terminology.
2019-07-24 12:02:10 +01:00
Quentin Le Sceller 38ddc32cf3 Move SyncStatus and SyncState to chain crate (#2964)
* Moved SyncState and SyncStatus to chain

* Rustfmt

* Fix typo in SyncError
2019-07-23 16:47:59 +02:00
Quentin Le Sceller 298e3caae2 [2.x.x] CI Improvements (#2963) 2019-07-23 16:25:25 +02:00
Antioch Peverell fb33d3af1f make sure user_testing uses a sensible txhashset interval (#2962) 2019-07-23 13:25:34 +01:00