Commit Graph

54 Commits

Author SHA1 Message Date
Ignotus Peverell e4ebb7c7cb Cleanup HTTP APIs, update ports to avoid gap, rustfmt
Moved the HTTP APIs away from the REST endpoint abstraction and
to simpler Hyper handlers. Re-established all routes as v1.
Changed wallet receiver port to 13415 to avoid a gap in port
numbers.

Finally, rustfmt seems to have ignored specific files arguments,
running on everything.
2017-10-31 19:42:56 -04:00
Ignotus Peverell efe414bf07 No send back for blocks and transactions (#212)
* Do not send txs and blocks to senders. Keeps a ring buffer of transaction and blocks hashes that a peer has received. Do not send what we've already received.
* Test fix and fmt
2017-10-26 17:48:51 +00:00
Ignotus Peverell e2e24bc38e Transaction broadcast (#209)
* Add transaction broadcast to all known peers once they have been
accepted by our own transaction pool.
* Some debug log

Fixes #200
2017-10-25 21:06:24 +00:00
Yeastplume 9c0411ac5e Bind to services to all interfaces rather than loopback (#197)
* changing default ip
2017-10-23 16:34:43 +00:00
Ignotus Peverell 361e39c87c Log connection errors 2017-10-12 19:26:10 +00:00
Yeastplume 8e382a7593 slog-rs logging (#171)
* added global slog instance, changed all logging macro formats to include logger instance
* adding configuration to logging, allowing for multiple log outputs
* updates to test, changes to build docs
* rustfmt
* moving logging functions into util crate
2017-10-12 16:56:44 +00:00
Seamus Finnigan 2e819c72aa Fix deprecated futures items (#148)
* Update futures deprecated send item
* Update futures deprecated iter item
* Fix cargo req for futures
2017-10-01 21:34:14 +00:00
Ignotus Peverell 8504efb796 Cargo fmt all the things 2017-09-29 18:44:25 +00:00
AntiochP 3b4a48b2fd Cleanup build warnings (#87)
* minor cleanup - unused imports
* cleanup build warnings - unused vars
* make structs pub to get rid of the private_in_public lint warning
* missing docs on RangeProof
* add missing docs to store delete function
* cleaned up deprecation warning -
tokio_core -> tokio_io
complete() -> send()
2017-08-10 00:54:10 +00:00
Jacob Payne 60705eff76 Use io::Read/Write interface instead of AsyncRead/AsyncWrite + Finish Tests (#74) 2017-07-05 18:42:55 +00:00
Ignotus Peverell 15ea8da34a New Chain struct acting as facade for all chain operations
Introduce a new Chain struct that maintains the current head,
acts as facade to the store and the block processing pipeline
and handles all appropriate locking.

All higher level components, like the overall server, REST APIs
and miner have been update to only depend on Chain. Cleaned up
some duplication and tests now that there's a single entry point
to all blockchain operations.
2017-07-04 09:17:11 -07:00
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
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 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 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 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