celestia-node
celestia-node copied to clipboard
feat(share/getters): Implement a peer routing solution based on request
Problem
#3188 introduces a complexity into the design of shrex getter where it now has to take an additional archival peer manager and perform a check in shrex.go
on each request whether the timestamp of the header is historic or not, and route accordingly.
This is ugly and does not scale with other types of routing that could be required in the future with the introduction of partial nodes, for example, where requests could be routed to peers serving historic data for a specific namespace.
Ideas for solution
A PeerGetter
function / component that can be mounted on the shrex getter that will fetch the best peer (or best few peers) that would be able to respond to the request.
This can be generalised to handle the following:
- whether request is recent or historic
- based on whether it's a request for ND and if the node is running a disc + peerMan for that namespace, among other potential use cases that we haven't yet defined