Commit Graph

480 Commits

Author SHA1 Message Date
Simon B 8b81a2f806 Seed debug outputs cleanup (#460)
* DRY up

* iterate 66% less

* clarify debug! outputs

* less verbose peer queuing

Rationale: debug outputs that happen _a lot_ is nice if they're short and distinct, making them easier to pattern match / willfully ignore while reading through logs

* update comment to mention last weeks' added usecases

* .push() less
2017-12-11 09:38:46 -05:00
Yeastplume 18fc1384de updating secp256k tag to include aggsig library 2017-12-11 14:23:55 +00:00
Michalis Kargakis e13f622395 Add docs about cross-compiling ARM binaries (#457) 2017-12-10 18:42:39 +00:00
Ignotus Peverell 8c718443ef Explicit error when a forked block can't be retrieved 2017-12-09 21:43:42 +00:00
Ignotus Peverell 6ba22e71c8 Fix for buffer-pruned positions in MMR store
The MMR storage has a buffer for all changes so they can either
be discarded without side effects or committed to disk. Pruning
can also happen in the buffer if an input directly spends an
output in a block (not likely), or a fork has an input spending
a previous output within it.

When the buffer gets flushed to storage, the pruned element was
just skipped, causing an offset within the underlying storage and
a shorter file than expected. This fix writes zeroes instead, so
the size is consistent. Note that the zeroes will be removed with
all other pruned elements on next compaction.

Fixes #444
2017-12-09 18:53:24 +00:00
AntiochP 001fd3789c specify serde_json as "=1.0.7" to pin the version (#451) 2017-12-09 11:59:54 -05:00
AntiochP 0a87c0ced1 body_sync every 5s, but request 10*most_work_peers blocks at a time (#448)
header_sync every 10s
2017-12-08 17:12:10 +00:00
AntiochP a4e0b5c56a base threshold for sync on difficulty of past 5 blocks (#433)
* base threshold for sync on difficulty of past 5 blocks

* cleanup threshold calc filter_map + fold
2017-12-07 21:11:44 -05:00
AntiochP 10030a224a more aggressive peering (#445) (#446)
* [WIP] aggressive peer connections (and logging)

* get peer list from each connected peer when low on peers

* cleanup the try_read() calls and log consistent warning messages
(will clean these up later)

* cleanup error logging (log at debug level)
2017-12-07 20:24:03 -05:00
Maxime fa91e4dc15 homogenize MimbleWimble writing (#438) 2017-12-07 16:13:36 -05:00
Ignotus Peverell 68bb49dd61 Comment out unused for now 2017-12-07 19:12:27 +00:00
Ignotus Peverell f001006fc9 Re-introduce wallet config as part of global grin.toml
Wallet configuration was disabled presumably as wallet is its
own separate process. However people seem to still want to use
a single config for everything, which may be a sign that the
lifecycle of the wallet and the server should be the same by
default (with appropriate options to only start one).

Note that this does *not* mean that the wallet and the server
should share the same process. The wallet process can easily be
forked. But sharing the same config file may provide a lot of
future convenience.
2017-12-07 19:08:02 +00:00
Johnny Gannon 1ac8aa9978 Revert BlockHeaderInfo struct to contain only the fields needed for wallet reconstruction. Create a new struct for use in the /blocks api. (#442) 2017-12-07 09:27:55 +00:00
AntiochP 0b9ca727d3 add logging in monitor_peers for healthy/banned/defunct counts (#436) 2017-12-06 09:28:11 -05:00
Yeastplume f7866d9f32 fix to header info for wallet restore (#435) 2017-12-06 12:54:33 +00:00
Ignotus Peverell 173344471f Fix in detectin a duplicate after rewound position
When rewinding, it's possible to have a commitment (or kernel)
identical to the one we're adding both in the index and in the
data file (because it's not truncated by rewind, by design). To
detect this, we just need to make sure we don't look for anything
past the size of the rewound MMR.
2017-12-06 00:14:01 +00:00
Johnny Gannon 72fdceb0d6 API endpoints to browse blocks (#416)
* Implement /block api endpoint displaying basic information
* Add block inputs and kernels to the api output.
* Add fields to BlockHeaderInfo and TxKernelPrintable
* Add features debug string to TxKernelPrintable.
* Return 400 and 404 statuses from the blocks api endpoint.
* For the blocks api, return a 404 if a block is not found at the requested height
* Add back hash to BlockHeader api output.
2017-12-05 18:55:32 +00:00
AntiochP f5d24c5a9c Dry up how we check if a header is on the current chain (#431)
Uses the header_by_height index
2017-12-05 18:32:57 +00:00
AntiochP 179f74462a simplify sync process further - one thread for both body and header sync (#427) (#428)
* simplify sync process further - one thread, try_read on peer for robustness
* add most_work_peers() for convenience, add most_work_peers count to "monitoring peers" log msg
2017-12-05 11:42:25 -05:00
Ignotus Peverell 7b9351864a Banning of misbehaving peer, applied to bad blocks
Added support for peer banning on the p2p server. The peer status
is changed and the peer is disconnected. A banned peer won't be
able to reconnect as well.

Tracking of chain errors due to a block that's intrinsically bad
and banning of the peer that sent it. If we're syncing, resetting
the header chain to the same as the main chain to force
backtracking.
2017-12-05 02:14:55 +00:00
Jeremy Bokobza 19da9ad1e0 Small documentation improvements (#418) 2017-12-05 00:57:03 +00:00
Ignotus Peverell db0cce9fa0 Correct mmr buffer index on remove, fixes #423 2017-12-05 00:37:37 +00:00
AntiochP d3e5acccf9 initial docs and images to describe receiving a block and simple sync. (#405)
* intial docs and images to describe receiving a block and simple sync.

* add some more description text

* svg -> png

* updated simple_sync diagram to include sync_head

* rename "block head" -> "body head"

* wip - sync_on_form diagram (kill me now)

* tidy up diagram for "sync on fork"

* consolidate the chain docs
2017-12-04 15:35:18 -05:00
AntiochP cc9ec53390 sync_head port from testnet1 (#425)
* port simple_sync across from testnet1, sync head & improved fork handling
* introduce new sync_head for tracking header chain during sync
* add debug logging in body_sync for state of various heads
* update header_head during sync if header is now the one with most work, pass in sync and head contexts to pipe
* port across sync_head changes from master, put the 1s sleep back in...
* let sync run even if the full 512 headers are all known, give sync a chance to sync against a fork that forked a long time ago
* handle height jumping during a reorg
block validaton should not check for height+1 based on head
no assumptions should be made about height indices
* quick(er) check for previous block in process_block (we cannot check height against ctx head)
* make body_sync a _lot_ faster by finding the forked block more efficiently...
* fix monitoring peers log msg
* fix chain tests
* fix grin tests - we were using the wrong genesis hash (wrong chain type)
* apparently needs setting in both places...
* body -> header -> sync (#414)
* port over body -> header -> sync changes from testnet1
2017-12-04 19:16:57 +00:00
Gareth Hayes 364c8cb797 Grammar and typo fix (#415) 2017-12-04 12:51:46 -05:00
AntiochP 442ef3b255 port across "simple_sync" changes from testnet1 branch (#409)
* port across "simple_sync" changes from testnet1 branch
Cleanup direct refs to peer map or peer store
P2P server acts as a facade, handling the list of connected peers
and the storage of their information. Everything else goes through
the p2p server instead of having a peer map reference or going
straight to the store.
Fix p2p tests

* fix "monitoring peers" log msg (use connected_peers)
2017-11-30 10:27:50 -05:00
Simon B 90a1187bf7 doc/wallet: replace all [tbd] with some minimal text, partly from grin help wallet ... (#391) 2017-11-28 21:22:46 -05:00
bit 29b4a6df40 Doc fix: wallet receive -> wallet listen (#357) 2017-11-28 21:22:04 -05:00
Ignotus Peverell 2c6c8ed688 Fix rm log not getting written to disk
Only the temporary remove log for the last block was written to
disk, and then overwritten for every block. The fix writes the
temp remove log (just last block) to the permanent remove log,
and saves that to disk.
2017-11-25 23:26:36 -05:00
Simon B 0fb15641fe Add doc/usage that explains status and functionality grin at Testnet1 (#392) 2017-11-25 12:59:17 -05:00
Simon B b21da1cbb6 FAQ: corrections (#390)
* FAQ: fix capitalization
* FAQ: friendlier answers. Move Q: crash/hangs under the Troubleshooting section
* FAQ: add missing A for block size/target mean time
* FAQ: Add link to grintest.net (see also #325)
* FAQ corrections
- link to Scripting discussion
- Quantum unsafe, says A.P.
2017-11-25 12:44:05 -05:00
Yeastplume 77eac16702 Locator fix master (#381)
* fix chain_header_by_height error

* cherry-pick and clean up
2017-11-23 11:11:35 +00:00
AntiochP 25969424ff notify syncer on every block received (including orphans) (#379)
prefer random peers with more difficulty than us
do not keep asking for headers over and over
2017-11-23 00:16:36 -05:00
AntiochP c6b94dd2c4 generate locator heights all the way down to 0 by powers of 2 (#378) 2017-11-22 22:59:33 -05:00
AntiochP 348038f0ed Add some randomness to most_work_peer (#364) 2017-11-22 16:07:21 -05:00
Ignotus Peverell 861c54c13b More explicit panic when syn can't get a peer 2017-11-22 15:54:50 -05:00
Ignotus Peverell 31f8f2ad3e Better comments for PMMR size check 2017-11-22 15:50:59 -05:00
Ignotus Peverell 5807a6b270 Fix sumtree checks ignoring total size
Duplicate commitment and ducplicate kernel errors, as well as
`is_unspent` did not check the total PMMR size, leading to
wrong detection of duplicates or unspent.
2017-11-22 15:14:42 -05:00
AntiochP 7573f6a556 use read lock over write lock where possible (#363)
fix issue with sync starting twice
2017-11-21 22:28:31 -05:00
Ignotus Peverell c325c99b87 Error handling fixes sync
And error in the sync run loop would just exit it silently. Abort
with a panic instead.

Peer errors (like disconnect) on locator request was bubling up in
the loop. Just logging instead.
2017-11-21 15:19:17 -05:00
AntiochP 6352dfbac9 add total_diff to ping/pong msgs (#350)
* add total_diff to ping/pong msgs
debug log for total_diff on each ping/pong

* expose peer addr to the handle_payload fn
so we know where it came from

* fix p2p tests for ping

* default to 0 if we cannot read total_difficulty

* updating a connected peer in place

* actually update peer info diff

* fixup p2p tests
2017-11-21 09:24:29 -05:00
Simon B ce82c82b0d Add doc/table_of_contents.md (#311)
* add doc/table_of_contents, initial attempt, based on https://lists.launchpad.net/mimblewimble/msg00024.html
And explain and link to build.md about creating folders server and wallet manually.
* add Files in this folder (doc)
* rename headlines
* docs: extract code and directory structure to code_structure.md
2017-11-20 19:06:51 -05:00
Yeastplume c019cc2fd0 miner timing resolution (#351) 2017-11-20 22:57:36 +00:00
AntiochP 2f09d2e630 rollback the change output in the wallet on tx failure (#345) 2017-11-20 14:12:52 -05:00
AntiochP 00d82f2c04 compare genesis during peering handshake (#327)
* wip - send genesis in handshake
* error if genesis mismatch on handshake
* fix the tests
* preserve order of existing fields in hand/shake
2017-11-20 12:35:52 -05:00
Michalis Kargakis 1f0808fc24 Markdown fixes + gitignore addition (#334)
* Markdown fixes in doc/build.md

Signed-off-by: Michalis Kargakis <mkargaki@redhat.com>

* Ignore grin.log and wallet.seed
2017-11-20 14:33:35 +00:00
Yeastplume 6ad403fbf8 Wallet recovery return unspent only (#340)
* beginning to add wallet restore... api endpoints and basic restore

* basic restore working, still missing features

* rustfmt

* large speed up to output search, should be more or less working

* properly mark coinbase status

* ensure only unspent utxos are returned from sumtree
2017-11-20 10:38:49 +00:00
Simon B e20975136e less chatty Testnet1 outputs (#316)
Fixes #281 by doing:

- "Starting validation pipeline for " -> "Processing "
- stdout logging default = Warning
- ERR -> INFO for "Transaction rejected: Already in pool" -- only for netadapter transaction_received, which (hopefully!) only gets tx from peers, and lots of those will be duplicates, that's good and not an error.

* Downgrade ERR even down to DEBUG.

Also let Transaction rejected show tx hash,
 so users can check if such a rejection is for the
 payment they expected, or just any random peer
 sending in some old and already known tx.
2017-11-19 20:45:32 -05:00
Ignotus Peverell 8ce494536e Regularly ping all peers to check liveness
Ping all our peers every 20 sec. If no pong occurs within a
reasonable time (5 sec), disconnects.
2017-11-19 20:40:49 -05:00
Ignotus Peverell c1be4e2113 Debug log for block broadcast 2017-11-19 20:40:36 -05:00