-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable message id function #248
Conversation
2f0a6fa
to
7981f9b
Compare
Edit: force pushed over previous commit, for some reason Go decided I wanted the old multi addr dependency version in here. Removed that from the diff. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo a small nit regarding the naming of ChangeMsgIdFn
.
We have a small issue with the ordering of options regarding the message id function, as seen by the tracer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
May want to make a release for @protolambda and @prestonvanloon to be able to test this change against rust. |
Yeah, release forthcoming. |
Is it the case that Go gossip implementation lacks client validation functionality? |
See #247: this PR is fully backwards compatible, no public API changes, except for the addition of:
ChangeMsgIdFn
SetMsgIdFn
toMessageCache
. The cache doesn't really need a single message id function from the start, so changing it with a method seems fine. And this way it doesn't break any existing code. Note that users of caches like this can update it once they get hold of the exact msg id function to use. E.g. gossipsub updates it when PubSub attaches the router. So it also avoids a painful early design choice of PubSub getting all options, and gossipsub not being able to adapt based on these Options, before initializing PubSub.MsgIdFunction
, which has the same signature as the previous privatemsgID
helper, but now it's configurable! The oldmsgID
is nowDefaultMsgIdFn
.Option
created withWithMessageIdFn
to apply your own message ID function to PubSub :)PS: I thought this was an easy and important issue to just fix it myself, and although I have some previous experience hacking on this repo (I looked deep into its concurrency and simulation for eth2 tooling for aggregation modeling), I can definitely appreciate a review since I don't normally contribute code upstream here.
Closes #247
cc @AgeManning