Commit Graph

4627 Commits

Author SHA1 Message Date
Henry de Valence 715ed52617 Deserialize Bitcoin-encoded IP addresses. 2019-09-18 17:32:06 -04:00
Henry de Valence 3c32beb8f0 Add a &'static str error message to ParseError. 2019-09-18 17:32:06 -04:00
Henry de Valence d847dc1356 Start implementing serialization for Version. 2019-09-18 17:32:06 -04:00
Henry de Valence b98e1c7853 Add ZcashSerialization impls for some std types. 2019-09-18 17:32:06 -04:00
Henry de Valence 1f280b7bb8 Make MetaAddr fields public. 2019-09-18 17:32:06 -04:00
Henry de Valence 8a3cabc686 Define Magic newtype as `[u8; 4]`, not `u32`.
The magic value isn't a u32, it's a byte string, so specifying it as
such avoids ambiguity about endianness.
2019-09-18 17:32:06 -04:00
Henry de Valence 00cc1284ae Add a stub ZcashSerialization trait.
There are a few unresolved questions marked in the doc comment for the trait;
we can resolve them later and rework the trait as we map everything out.
2019-09-18 17:32:06 -04:00
Henry de Valence 73cd06b4dc Add derived impls to newtypes 2019-09-18 17:32:06 -04:00
Henry de Valence c3b7dcdfbe Add Read/WriteZcashExt extension traits.
Currently these just have write_compactsize and read_compactsize methods which
allow reading and writing u64s to any `Read` or `Write` implementation using
the Bitcoin "CompactSize" variable integer encoding.

These methods read and write u64s rather than defining a new `CompactSize`
type, because the `CompactSize` is just an encoding detail, not a different
type with any distinct meaning.
2019-09-18 17:32:06 -04:00
Henry de Valence 50f749a817 Try writing message headers. 2019-09-18 17:32:06 -04:00
Henry de Valence cf63f00171 Add a Magic type for network magics. 2019-09-18 17:32:06 -04:00
Henry de Valence 42cb9c1ff9 Add a `Sha256dChecksum` type for truncated double SHA256. 2019-09-18 17:32:06 -04:00
Henry de Valence b9af047a09 Introduce a `MetaAddr` type replacing `NetworkAddress`.
The `NetworkAddress` type was a `(Services, SocketAddr)` pair as used in the
`version` handshake message, described as the `net_addr` struct in the Bitcoin
wiki protocol documentation.  However, all of the other uses of the `net_addr`
struct are a `(Timestamp, Services, SocketAddr)` pair (where the timestamp is
the last-seen time of the peer), and the timestamp is omitted only during the
`version` messages, which are used only during the handshake, so it seems
better to include the timestamp field and omit it during serialization of
`version` packets.
2019-09-18 17:32:06 -04:00
Henry de Valence 1d0517fe56 Split parts of message.rs into constants.rs, types.rs 2019-09-18 17:32:06 -04:00
Henry de Valence eeb0ab7c43 fixup! Add InventoryType, InventoryVector, and Message::{Inventory, GetData, NotFound} 2019-09-18 17:32:06 -04:00
Deirdre Connolly a2e50833be Add InventoryType, InventoryVector, and Message::{Inventory, GetData, NotFound} 2019-09-18 17:32:06 -04:00
Henry de Valence 7fb71a7a9e Replace Timestamp with chrono::DateTime<Utc> 2019-09-18 17:32:06 -04:00
Deirdre Connolly fa8b5290b5 Add Reject message type and RejectReason enum 2019-09-18 17:32:06 -04:00
Deirdre Connolly a4a21138d0 Update user_agent docstring
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
2019-09-18 17:32:06 -04:00
Deirdre Connolly c39d2c7510 Doc comments for various structures and fields
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
2019-09-18 17:32:06 -04:00
Deirdre Connolly ac0d9732a0 WIP: Version message and various sub structures
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
2019-09-18 17:32:06 -04:00
Henry de Valence 8c2b066885 Add more message variants. 2019-09-18 17:32:06 -04:00
Deirdre Connolly 42412ec2a8 Some line breaks for readability 2019-09-18 17:32:06 -04:00
Henry de Valence 80308f85e1 Add a skeleton enum for network messages. 2019-09-18 17:32:06 -04:00
Deirdre Connolly 162b37fe8d Tracing endpoint (#3)
* Add a TracingConfig and some components

Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>

* Restructure, use dependency injection, initialize tracing

* Start a placeholder loop in start command

* Add hyper alpha.1, bump tokio to alpha.4

* Hello world endpoint using async/await from hyper 0.13 alpha

Also cleaned up some linter messages.

Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>

* Update to tracing_subscriber 0.1

* fmt

* add rust-toolchain

* Remove hyper::Version import

* wip: start filter_handler impl

* Add .rustfmt.toml

* rustfmt

* Tidy up .rustfmt.toml

* Add filter reloading handling.

* bump toolchain

* Remove generated hello world acceptance tests.

These test the behaviour of the autogenerated binary and work as examples of
how to test the behaviour of abscissa binaries.  Since we don't print "Hello
World" any more, they fail, but we don't yet have replacement behaviour to add
tests for, so they're removed for now.

* Clean up config file handling with Option::and_then.
2019-09-09 13:05:42 -07:00
Deirdre Connolly 8fe3403de0
Continuous integration (#2)
* Add CI workflow similar to other zebra

* Bump cache TTL to 24hours

* Expand image name to include full repo owner/repo-name/branch-name

* Force to lowercase because google container registry demands it

This may not be universally shell compatible

* Use bash as gcloud action container entrypoint
2019-09-05 13:08:48 -04:00
Henry de Valence ec363d2d41 Create workspace skeleton based on design.md 2019-08-29 14:46:54 -07:00