Commit graph

447 commits

Author SHA1 Message Date
Jacob Payne
6a15100c96 [WIP] Rate Limiting (#57)
* Setup tests for rate limiting
* Add send and receive rate configs to P2P Config
* Setup ThrottledConnection and ThrottledWrite
* Add Tokio io
* Fix ThrottledReader + Add Bytes
* Attach Rate Limiting to Connection
2017-06-18 01:15:46 +02:00
Ignotus Peverell
3d5411b6ad
Deprecated. 2017-06-06 12:27:39 -07:00
Ignotus Peverell
40d23db6c1
Revert "[WIP] Partial Transition from Writeable/Readable to Codecs (#51)"
This reverts commit de4ebdde71.
2017-05-31 15:47:52 -07:00
Ignotus Peverell
f79fb8ef95
Sending end of the wallet
Most of the logic to build a transaction that sends coin to
another party. Still requires more debugging and clean up.
Main changes and additions are:

* Update to serde 1.0
* API endpoint to retrieve an Output
* Output is now Serialize and Deserialize
* Wallet configuration
* Command line for the send operation
* Wallet data checker to update created outputs into confirmed
* Wallet-specific configuration
2017-05-28 20:21:29 -07:00
Jacob Payne
de4ebdde71 [WIP] Partial Transition from Writeable/Readable to Codecs (#51)
* Sample Signatures for put_enc and get_dec
* Implement put_enc and get_dec
* Implement ChainCodec in grin_chain
* Truncate src only on complete Blocks
* Truncate src only on complete Tip + Check Len
* Move BlockHeader Encoding to BlockHeaderCodec
* Define put_enc for store::Batch
* Replace BlockCodec and BlockHeaderCodec with generic BlockCodec<T>
* Implement Default for BlockCodec Manually
* Replace get_ser/put_ser with get_enc/get_dec for chain::ChainKVStore
* Remove Writeable/Readable for chain::Tip
* Add Tokio-io and Bytes to grin_p2p
* Additional Setup for Message enum + Msg{Encode,Decode} traits
* base msg ping pong encoding and test
* fill out msg-codec tests
* Implement Hand Encoding/Decoding
* msg-encode shake
* msg-encode getpeeraddr
* codec peer-addrs message, SockAddr struct wierdness
* header message codec
* msg encoding finished prelim
* Implement PeerCodec Encoding/Decoding
* Set PeerStore to use PeerCodec for Encoding/Decoding
* Add a DecIterator
* Prune PeerStore
* Replace Decoding and Encoding in handle_payload
* Prune Writeable/Readable methods in store::Store
* Remove Incomplete Frame Testing ( Not Nessesary right now )
* separate block and tx codec tests
* Refactor {Tx,Block}Codec Tests
2017-05-22 19:16:13 +02:00
Ignotus Peverell
1b78a73328
Variety of small p2p fixes to block sync
Adds a couple utility function to p2p server to check whether
we're already connected to a peer before trying again. Other
very minor fixes and logging improvements.
2017-04-27 22:05:12 -07:00
Ignotus Peverell
3fe28b0f03
Server types cleanup and serde for configuration types
Moved error and configuration types from server.rs to types.rs
where they should have been from the start. Configuration types
for the server and p2p modules now derive serde Serialize and
Deserialize so we can have a simple JSON configuration file.
2017-04-24 18:49:57 -07:00
Ignotus Peverell
a37e2b99fb
Trivial formatting fixes 2017-04-24 18:47:36 -07:00
Merope Riddle
39ddeb0a2a core: various cleanups, improvements, code comments (#38)
* core: cleanup slicing impls for Hash
* core: clean up Readable trait, implement Readable/Writeable for various integers
* core: change Hash debug output to hex
* core: correct warnings in all modules
2017-04-09 23:17:23 -07:00
Jacob Payne
9e82fb1774 Replace AsFixedBytes with Sized + AsRef<[u8]> (#35)
* Replace AsFixedBytes with Sized + AsRef<[u8]>
* Add AsRef<u8> to impl_array_newtype!
* Include AsFixedBytes as marker trait
* Related fixes
* Remove Deref
2017-04-06 22:54:54 -07:00
Ignotus Peverell
382754e54c
Add workspace support for all crates 2017-04-05 23:41:49 -07:00
Ignotus Peverell
38d5d67e79
Add features bitmask to Block, Output, Kernel; coinbase validation
Block, Output and Kernel now have bitmasks to hold supported
features and eventually versioning. Will make adding features and
updates easier and open the possibility of soft forks.

First added feature for Output and Kernel is the marking of coinbase
related ones. Allows the validation of the coinbase part of a block.
2017-03-23 17:06:00 -07:00
Ignotus Peverell
f64d20749f
Framework to define services as RESTful HTTP API services. Serde implementations for some core types. 2017-03-07 17:00:34 -08:00
Ignotus Peverell
d900f0b934
P2P server cleanup of disconnected peers. Mark those that don't respect the protocol as banned. 2017-02-27 14:17:53 -08:00
Ignotus Peverell
7c72ccec7c
Cleaned up error handling in p2p module. Setting peer status on disconnect. 2017-02-26 20:08:40 -08:00
Ignotus Peverell
c0e635071c
Fixed p2p tests. 2017-02-18 18:56:07 -08:00
Ignotus Peverell
eb024e91d2
Discovery and seeding of other peers. Relies either on a gist with IP addresses or a static list. Connects to a first list, sending peer request messages to discover more. Monitor the server to make sure there's always enough peer connections. 2017-02-18 18:42:34 -08:00
Ignotus Peverell
786da24653
A db store for peer data. 2017-02-09 20:16:34 -08:00
Ignotus Peverell
85edf57366
Iterator for Readable impls stored in DB. 2017-02-09 20:15:22 -08:00
Ignotus Peverell
4af049a887
Added full node sync mode. Follows closely the bitcoin header-first sync. Related p2p messages and protocol. 2017-02-07 13:52:17 -08:00
Ignotus Peverell
2d81abc16c
Added height as part of handshake to inform syncing. 2017-02-02 15:51:48 -08:00
Ignotus Peverell
7f029cb4c0
Added a Connection wrapper to handle timeouts when we want information from a peer in a request/response style. 2017-02-01 19:05:17 -08:00
Ignotus Peverell
572c1951e1
Introduced a higher-level connection abstraction, allowing the protocol to stay relatively simple. Deals with the lower level details of sending, receiving data, timeouts and dealing with futures. 2017-01-29 22:43:20 -08:00
Ignotus Peverell
dc33ebcf39
Network block broadcasting. 2016-12-20 17:33:20 -08:00
Ignotus Peverell
e688ff99e6
Started putting in place the adapter between the chain and p2p modules to forward blocks and transactions. Cleaned up chain store references. 2016-12-18 15:51:54 -08:00
Ignotus Peverell
bc61c5dae7
Read block and transaction messages and forward to the adapter. 2016-12-15 14:57:04 -08:00
Ignotus Peverell
d395b3d128
Added another server implementation for when the client needs to stay in control of the event loop (i.e. multiple servers for tests). Test to spin up 5 servers and connect them all together. 2016-12-14 16:10:39 -08:00
Ignotus Peverell
19a700b81e
Minor fixes, testing server peer count. 2016-12-13 16:05:24 -08:00
Ignotus Peverell
7bea7341ab
Various cleanup and reorganization. 2016-12-11 13:04:52 -08:00
Ignotus Peverell
4b5c010b05
Rewrote most of p2p code to use futures-rs instead of mioco. Need some cleanup and support for a few more message types. 2016-12-10 19:11:49 -08:00
Ignotus Peverell
309cb497f8
Configurable host and port for p2p server. Utility for client connection. 2016-11-29 18:49:03 -08:00
Ignotus Peverell
632e3af8ee
Test for sending tx from one peer to another. Common tests module. 2016-11-07 14:02:45 -08:00
Ignotus Peverell
ea425dc614
Protocol cleanup. Tests cleanup. Additional test for transaction broadcast. 2016-11-05 16:31:45 -07:00
Ignotus Peverell
28f007240e
Usefuly read and write implementations to limit and count bytes. 2016-11-04 08:59:49 -07:00
Ignotus Peverell
098d17ee42
Added limited and counting readers for protocol to maintain its stats. Added primitive error count. Cleaned up protocol. 2016-11-02 14:19:40 -07:00
Ignotus Peverell
edc6c62577
Fixed message serialization following changes in core. Sending of block and transaction. 2016-11-01 10:42:33 -07:00
Merope Riddle
565374bac7 p2p: fix for changes in core serialization API 2016-11-01 02:16:57 +00:00
Ignotus Peverell
3ffc2f5d8c
Tests improvement. Protocol also measures bytes received (at least for pings). 2016-10-31 12:30:48 -07:00
Garrick Ollivander
d7dcd6d3ae
nicer processing of message types 2016-10-31 13:08:48 +01:00
Ignotus Peverell
ee6fcab8db
Proper server and protocol event loop. Channels for shutdown and ping/pong trivial roundtrip. Working test. 2016-10-30 18:24:19 -07:00
Ignotus Peverell
a23308dd9d
Added clean stop logic on server and peers. Broken unit test. 2016-10-30 08:24:19 -07:00
Ignotus Peverell
42769c373c
Re-implemented the whole interaction between server, peer and protocol to be more Rust-ish. Server maintains peer references and protocol is internally mutable. 2016-10-29 12:36:45 -07:00
Ignotus Peverell
fdaf2ba6af
First working test with related fixes demonstrating a full peer handshake. 2016-10-27 14:28:02 -07:00
Ignotus Peverell
a9dc8a05ac
Preliminary impl of p2p package compiles now. Next step: basic handshake integration test. 2016-10-26 11:21:45 -07:00
Ignotus Peverell
b1762cb5f4
p2p module getting close to first integration test allowing 2 peers to connect. Fleshed out handshake and protocol use. Fixed most errors, just need to make the borrow checker happy. 2016-10-25 22:06:13 -07:00
Ignotus Peverell
4657b09c4e
WIP: more p2p code, mostly interaction between peer, protocol and server as well as ser/deser for first message types. 2016-10-24 21:35:10 -07:00
Ignotus Peverell
c8aa8d7c18
Getting started on the p2p networking code. 2016-10-23 17:02:02 -04:00