Commit Graph

33 Commits

Author SHA1 Message Date
Zahary Karadjov bddec91d05 minor fixes 2018-12-19 12:25:35 +02:00
Ștefan Talpalaru be476feeec
better error handling
- changed the logging level of some messages that should not appear by
  default in a debug build
- most errors in persistWorkItem() are gracefully recovered from
- fixed the handling of out of order blocks
- dropped work items with fewer blocks than what we requested
- getBestBlockNumber(): log and allow exceptions from getBlockHeaders()
- obtainBlocksFromPeer(): moved here the check for block numbers being
  in sequence (from nimbus/p2p/chain.nim)
- sendMsg(): log and catch exceptions in callers
2018-12-17 23:35:45 +01:00
kdeme 8cad437112 Fix, improve and enable tshh_connect + other improvements:
- minePow fix
- random padding
- random IV (phew!)
- other small changes + comments
2018-12-06 14:30:55 +02:00
kdeme 420298dca0 Address PR #52 review comments 2018-11-28 20:16:21 +02:00
Zahary Karadjov ccea6dc7b6 Whisper post-review changes (PR #52) 2018-11-28 02:23:03 +02:00
deme 1e5eeec6bb Untie filter code from EthereumNode + add unit tests 2018-11-27 13:56:25 +02:00
deme bc9db02411 Add more unit tests, change unnecessary vars to let and some general cleanup 2018-11-27 13:56:25 +02:00
deme 3d2abbdfdd Add access to set/get the message padding + tests 2018-11-27 13:56:25 +02:00
deme 4f53236233 Filter queue and other improvements:
- Add filter queue and getFilterMessages
- Improve some procs that can return failures
- Add + improve tests
2018-11-27 13:56:25 +02:00
deme 8c273b2a2d Improvements and some cleanup
- Added sendP2PMessage + test
- Timeout on waiting for status message
2018-11-27 13:56:25 +02:00
deme 70fc6874be Add Whisper implementation 2018-11-27 13:56:25 +02:00
Zahary Karadjov eca93509b4 Support for creating JSON dumps of all P2P network traffic
Enable by compiling with -d:p2pdump. A chronicles log file named
p2p_messages.json will be created in the working directory. This
file will be consumed by the upcoming Chronicles Tail GUI (more
details will be provided on the wiki of this repo).

Other changes:

* Removes the use of package_visible_types (only partially so far)
* Simplifies the new Snappy code a little bit
2018-11-10 02:18:00 +02:00
Zahary Karadjov 8b4bbd29af Adopt to the latest version of RLPx 2018-10-21 01:40:00 +03:00
Jacek Sieka 7342c46fd9 whisper: updates
* add some logging
* add some error and bounds checking
* move tests where they belong
* add symmetric encryption
* add signature public key recovery
2018-10-21 01:35:35 +03:00
Zahary Karadjov 3c97296ef8 Working definition of an SHH RLPX protocol 2018-10-21 01:35:35 +03:00
Jacek Sieka 7fdd574a37 whisper: add primitives (WIP)
Work-in-progress dump of initial whisper support

* payload encoding / decoding (missing 256-bit GCM mode)
* missing tests
* missing p2p integration
2018-10-21 01:35:35 +03:00
Zahary Karadjov 7828ef0481 Initial implementation of the LES protocol and its flow control.
This also restores the old module structure of having separate
`peer_pool` and `rlpx` modules. This is made possible by the
new Nim package `package_visible_types` (please refer to its
README for an explanation).

Also introduces more error handling in the low-level RLPx routines.
All detected errors will result in immediate disconnection of the
corresponding peer, which may be detected in the protocols though
the `onPeerDisconnected` event handler.
2018-10-16 02:52:11 +03:00
Zahary Karadjov b38804f873 This commit only moves files around (no need for review)
In the next commit, I'm going to squash all the changes in the LES.
This commit just sets the directory tree to its final state, so the
diffs in the follow up commits are easier to review.

Please note that eth.nim was renamed to eth_protocol.nim, because
it's not advisable to have a module name that shares the name of
a protocol identifier (this creates hard to figure out ambiguity
errors)
2018-10-15 16:49:49 +03:00
Yuriy Glukhov e64ab468ae Blocks ordering 2018-10-02 14:40:08 +03:00
Yuriy Glukhov 7f14c435d6 Proper sync part 1 2018-10-01 14:33:59 +03:00
Yuriy Glukhov f815c73963 Reply empty nodeData 2018-09-10 19:22:31 +03:00
Yuriy Glukhov b5c898dc1e Fixed requested block range, more reliable block downloader 2018-09-07 13:37:11 +03:00
Yuriy Glukhov 0eda6bc91a Download block bodies 2018-08-29 23:34:21 +03:00
Zahary Karadjov 20033b499b Use chronicles instead of 'echo'; Cosmetic renames 2018-08-14 16:45:08 +03:00
Yuriy Glukhov 253bea9c8e More fixes. Block headers download works! 2018-08-14 16:45:08 +03:00
Zahary Karadjov 11fbe60ba4 add some reference links 2018-07-24 00:41:40 +03:00
Zahary Karadjov be7ca479b3 more fleshed out implementation of the blockchain sync procedure 2018-07-24 00:39:41 +03:00
Zahary Karadjov 6351fc38b9 type in eth_common has been renamed to avoid a naming collission in nimbus's gas_costs module 2018-07-23 13:44:56 +03:00
Zahary Karadjov 41e92ca8df The ETH and LES protocols now compile as part of nimbus 2018-07-23 00:32:45 +03:00
Zahary Karadjov 96cf717778 WIP outline of the Blockchain sync procedure using the ETH wire protocol 2018-07-09 01:26:14 +03:00
Zahary Karadjov 72016046fb Merge peer_pool and server into rlpx
This was done because a cycle was formed between the structures
of the three modules:

- A Peer holds a reference to its Network
- The Network holds a reference to its PeerPool
- The PeerPool keeps a table of connected Peers

I could have resolved the issue by introducing a new types module,
but it would have required all of the currently private fields to
become public (due to lack of package-level visibility in Nim).

Instead I decided to merge the modules because they were relatively
small anyway. Please note that the former `P2PServer` type is now
called `NetworkConnection`. There are slight changes in the APIs
that will be carried out in Nimbus when merging this.
2018-07-06 15:25:21 +03:00
Zahary Karadjov fac8bbd917 WIP refactor the rlpxProtocol macro
* Make all handlers async

* Added a new `requestResponse` construct that allows you to wait
  for the results of a particular request

* Introduced an optional `NetworkState` type for the protocol

* The semantics of `nextMsg` has changed. See the notes in the README
2018-07-06 13:24:01 +03:00
Zahary Karadjov 812c6284c0 rename package to eth_p2p to make it consistent with our naming scheme 2018-06-16 21:58:41 +03:00