celestia-node icon indicating copy to clipboard operation
celestia-node copied to clipboard

[EPIC] HeaderEx protocol extensions and hardening

Open Wondertan opened this issue 4 years ago • 4 comments

Mainly we should remove hard dependency on trusted peers, so any node is able to sync headers from any immediate peers and not only trusted and/or bootstrappers. The trusted peers would still remain for automatic subjective initialization. Also, there are multiple networking optimization can be applied to speed up significantly speedup synchronization time.

TODO

  • [x] #635
    • Fixes potential vulnerability
  • [ ] #636
  • [x] #906
    • ErrNotFound on the wire should be implemented, so client header ex once requested could go further and ask other peers for headers. This is needed to avoid the general request retrying logic and simply go further to another peer.
  • [x] https://github.com/celestiaorg/celestia-node/issues/191
    • Currently, we only limit the requestor, but an attacker can currently request millions of headers in a range and OOM the responder
    • An error code response saying the request can't be processed as it's bigger than the limit
  • [x] #1019
    • Request trusted header from all and compared, choosing the one that the majority chooses
  • [ ] #1020
    • Measure response latency and prefer peers with the shortest
  • [ ] Fallback to peer discovery for peers serving headers in case all our immediate(connected) peers don't have the requested header(s)
    • The simplest working approach would be searching for more peers in header-sub HeaderSub topic(or custom header discovery topic as they are pros and cons of a unified topic that needs to be justified) with transient connections and asking them for a header until we find the required one.
    • exchange.Head should only rely on trustedPeer as subjective initialization
  • [ ] #1078
  • [x] https://github.com/celestiaorg/celestia-node/issues/197
  • [x] https://github.com/celestiaorg/celestia-node/issues/366
  • [x] #980
  • [x] https://github.com/celestiaorg/celestia-node/issues/1140
  • [ ] #1162
  • [ ] #1163
  • [ ] https://github.com/celestiaorg/celestia-node/issues/1201

Nice-to-haves:

  • [ ] #905
    • Optimization to get heads as early as possible without requested msgs
    • Allows analyzing rcvd heads and choosing the best as the sync target
      • Helps with automatic subjective initialization(if the local head is expired) by choosing the most trustworthy head i.e. came from trusted peers or the majority of peers with high scores(served headers before) shared the same head. High scores here may help from an eclipse attack.
    • Needs more input
  • [ ] #1018

Wondertan avatar Mar 06 '22 14:03 Wondertan

Request size configuration for clients and servers. Servers should tell the number of headers they can serve with the hello msg.

I think this should be an optimisation for much later as I'm sure this will be useful for light nodes. I think for now, we can set a comfortable default for all node types that serve headers and then introduce this customisation later. It will be annoying to update the Hello packet in that case though.

We should think about what the Hello packet should contain. We could probably even include MaxHeadersPerRequest (or whatever we wanna call it) field and just set it to a default for now so we don't have to update the packet later

renaynay avatar Mar 06 '22 19:03 renaynay

@renaynay, agree with you. Also, note that there won't be any single hello message and each subprotocol may have its own hello msg. Adding more fields to hello msg shouldn't be problematic in this case together with versioning for subprotocol/wire messages

Wondertan avatar Mar 16 '22 13:03 Wondertan

We still need to turn all TODOs in the comment into issues to make this a tracking issue

renaynay avatar Apr 15 '22 08:04 renaynay

  • [x] https://github.com/celestiaorg/celestia-node/pull/1038
  • [x] https://github.com/celestiaorg/celestia-node/pull/1046
  • [x] https://github.com/celestiaorg/celestia-node/pull/1135
  • [x] https://github.com/celestiaorg/celestia-node/pull/1153

vgonkivs avatar Aug 25 '22 12:08 vgonkivs

  • [x] https://github.com/celestiaorg/celestia-node/pull/1318
  • [x] https://github.com/celestiaorg/celestia-node/pull/1305
  • [x] https://github.com/celestiaorg/celestia-node/pull/1298
  • [x] https://github.com/celestiaorg/celestia-node/pull/1206
  • [x] https://github.com/celestiaorg/celestia-node/pull/1319
  • [x] https://github.com/celestiaorg/celestia-node/pull/1477

vgonkivs avatar Nov 03 '22 14:11 vgonkivs