You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The metrics need to build constructed when the Gossipsub struct is instantiated but this particular metrics requires bounds for the score. In the current design the scoring system can be activated at some future time rather than during the creation of the Gossipsub struct so we cannot properly initialise this metric.
There are a few traits we need to deal with for the Gossipsub struct, which makes this slightly more complicated than the example. However I'm hoping a builder pattern will be a nicer way of handling the variable configurations for creating a Gossipsub struct.
Creating a
Gossipsub
struct is somewhat awkward in the current design.We have a bunch of
new_with_X
functions, see for example here: https://github.com/sigp/rust-libp2p/blob/master/protocols/gossipsub/src/behaviour.rs#L342Apart from being somewhat non-ergonomic, we have recently introduced some metrics into the protocol. One metric requires building a histogram of the score distribution: https://github.com/sigp/rust-libp2p/blob/master/protocols/gossipsub/src/metrics.rs#L227
The metrics need to build constructed when the
Gossipsub
struct is instantiated but this particular metrics requires bounds for the score. In the current design the scoring system can be activated at some future time rather than during the creation of theGossipsub
struct so we cannot properly initialise this metric.One way we could resolve this is to use a
builder
pattern to create theGossipsub
struct and force the user to choose scoring on creation. An example of the builder pattern is with the config: https://github.com/sigp/rust-libp2p/blob/master/protocols/gossipsub/src/config.rs#L389There are a few traits we need to deal with for the
Gossipsub
struct, which makes this slightly more complicated than the example. However I'm hoping a builder pattern will be a nicer way of handling the variable configurations for creating aGossipsub
struct.I had started work on this at some time ages ago and have found an old file lying around which starts this modification. I've put it in this branch: https://github.com/sigp/rust-libp2p/tree/gossipsub-builder
Feel free to use anything in there (I think its just a single file at the moment) or to write from scratch :).
The text was updated successfully, but these errors were encountered: