0xProject / 0x-mesh

A peer-to-peer network for sharing 0x orders
https://0x-org.gitbook.io/mesh/
Other
259 stars 112 forks source link

Improve ordersync protocol #822

Open albrow opened 4 years ago

albrow commented 4 years ago

The current implementation of the ordersync protocol is naive and could be improved. Some changes to consider are:

  1. Request orders from multiple peers in parallel.
  2. Drop providers that are slow, apparently malicious, or just don't have the orders that we're looking for.
  3. Implement new subprotocols which are more efficient (e.g. using a cuckoo filter to avoid receiving orders we already know about).
  4. Partitioning the space of possible order hashes and asking each peer for different partitions. E.g., ask peer A for orders with hashes between 0x00 and 0x80 and ask peer B for orders with hashes between 0x81 and 0xff.

Related to https://github.com/0xProject/0x-mesh/issues/803.

albrow commented 4 years ago

https://github.com/0xProject/0x-mesh/issues/824 could also help with this.

albrow commented 4 years ago

https://github.com/0xProject/0x-mesh/pull/848 implements option (1) from above. It requests orders from multiple peers in parallel, meaning slower peers have reduced impact.