forest
forest copied to clipboard
Allow drand beacons to support multiple endpoints
Task summary
Currently we are only referencing one endpoint in https://github.com/ChainSafe/forest/blob/3eed3ac2a774853ae2fae5371696627fc4e3a81b/blockchain/beacon/src/drand.rs#L35
But there are multiple nodes available (Lotus has all the endpoints listed here https://github.com/filecoin-project/lotus/blob/master/build/drand.go)
It would be best if DrandBeacons can be initialized with multiple server endpoints, so that there isn't a reliance on one specific one. Implementation of how requests are done is a bit opinionated, but I would think there wouldn't be much overhead with sending requests to all endpoints and just awaiting as a race between them for the response. This way lag or an outage doesn't slow down the request.
Other motivation is that there is a single endpoint we use, which if it goes down, our node will stop validating.
Specification reference
Other information and links
Another option for this is to use Drand over libp2p and have the HTTP endpoints as a fallback
Another option for this is to use Drand over libp2p and have the HTTP endpoints as a fallback
Do other implementations support this now? I thought that was just an idea. Either way good point to add to this discussion, it's worth looking into
Yup, I'm pretty sure they have it in the Lotus code. You get new Drand blocks over gossipsub over the /drand/pubsub/v0.0.0/<DRAND HASH> topic.
Forest supports multiple drand endpoints now.
https://github.com/ChainSafe/forest/blob/fed8ec22426efa66f3468748126187261a4c4b9a/src/beacon/drand.rs#L50-L58