Zebra/zebra-network/src
Janito Vaqueiro Ferreira Filho 20eeddcaab
Parse `MSG_WTX` inventory type (part of ZIP-239) (#2446)
* Rename constant to `MIN_INVENTORY_HASH_SIZE`

Because the size is not constant anymore, since the `MSG_WTX` inventory
type is larger.

* Add `InventoryHash::smallest_types_strategy`

A method for a proptest strategy that generates the `InventoryHash`
variants that have the smallest serialized size.

* Update proptest to use only smallest inventories

In order to properly test the maximum allocation.

* Add intra-doc links in some method documentation

Make it easier to navigate from the documentation of the proptest
strategies to the variants they generate.

* Parse `MSG_WTX` inventory type

Avoid returning an error if a received `GetData` or `Inv` message
contains a `MSG_WTX` inventory type. This prevents Zebra from
disconnecting from peers that announce V5 transactions.

* Fix inventory hash size proptest

The serialized size now depends on what type of `InventoryHash` is being
tested.

* Implement serialization of `InventoryHash::Wtx`

For now it just copies the stored bytes, in order to allow the tests to
run correctly.

* Test if `MSG_WTX` inventory is parsed correctly

Create some mock input bytes representing a serialized `MSG_WTX`
inventory item, and check that it can be deserialized successfully.

* Generate arbitrary `InventoryHash::Wtx` for tests

Create a strategy that only generates `InventoryHash::Wtx` instances,
and also update the `Arbitrary` implementation for `InventoryHash` to
also generate `Wtx` variants.

* Test `InventoryHash` serialization roundtrip

Given an arbitrary `InventoryHash`, check that it does not change after
being serialized and deserialized.

Currently, `InventoryHash::Wtx` can't be serialized, so this test will
is expected to panic for now, but it will fail once the serialization
code is implemented, and then the `should_panic` should be removed.

* Test deserialize `InventoryHash` from random bytes

Create an random input vector of bytes, and try to deserialize an
`InventoryHash` from it. This should either succeed or fail in an
expected way.

* Remove redundant attribute

The attribute is redundant because the `arbitrary` module already has
that attribute.

* Implement `Message::inv_strategy()`

A method to return a proptest strategy that creates `Message::Inv`
instances.

* Implement `Message::get_data_strategy()`

A method that returns a proptest strategy that creates
`Message::GetData` instances.

* Test encode/decode roundtrip of some `Message`s

Create a `Message` instance, encode it and then decode it using a
`Codec` instance and check that the result is the same as the initial
`Message`.

For now, this only tests `Message::Inv` and `Message::GetData`, because
these are the variants that are related to the scope of the current set
of changes to support parsing the `MSG_WTX` inventory type.

Even so, the test relies on being able to serialize an
`InventoryHash::Wtx`, which is currently not implemented. Therefore the
test was marked as `should_panic` until the serialization code is
implemented.
2021-07-07 11:06:11 +10:00
..
address_book Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
config Use the default port for configured listen addresses with no port (#2043) 2021-04-21 23:14:29 +00:00
meta_addr Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
peer Support a minimum protocol version during initial block download (#2395) 2021-06-29 10:49:03 +10:00
peer_set Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
protocol Parse `MSG_WTX` inventory type (part of ZIP-239) (#2446) 2021-07-07 11:06:11 +10:00
address_book.rs Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
config.rs README: update known issues and add inbound network ports (#2373) 2021-06-23 08:10:21 -03:00
constants.rs Update versions for Zebra v1.0.0 alpha.12 release (#2415) 2021-07-01 08:59:32 +01:00
isolated.rs Security: stop gossiping temporary inbound remote addresses to peers 2021-05-14 23:45:42 +10:00
lib.rs Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
meta_addr.rs Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
peer.rs Security: stop gossiping temporary inbound remote addresses to peers 2021-05-14 23:45:42 +10:00
peer_set.rs Security: Limit reconnection rate to individual peers (#2275) 2021-06-18 09:30:44 -03:00
policies.rs Fix sync algorithm. (#887) 2020-08-12 16:48:01 -07:00
protocol.rs Refactor protocol into internal, external modules. 2019-11-27 05:06:01 -05:00
timestamp_collector.rs Gossip dynamic local listener ports to peers (#2277) 2021-06-23 07:59:06 +10:00