-
Notifications
You must be signed in to change notification settings - Fork 11
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
kad: Provide partial results to speedup GetRecord
queries
#315
Conversation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
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.
Nice!
src/protocol/libp2p/kademlia/mod.rs
Outdated
// Send partial response to the user. | ||
if let Some(QueryAction::GetRecordPartialResult { query_id, record }) = | ||
self.engine.register_response( | ||
query_id, | ||
peer, | ||
KademliaMessage::GetRecord { key, record, peers }, | ||
) | ||
{ | ||
let _ = self | ||
.event_tx | ||
.send(KademliaEvent::GetRecordPartialResult { query_id, record }) | ||
.await; | ||
} |
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.
nit: to keep the structure of event handling, I would let the engine
pass QueryAction::GetRecordPartialResult
to on_query_action()
and published the outbound event there. The latency won't be noticeable, but the code structure will be more streamlined.
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.
Thanks, that makes sense! 🙏 Let me know if the latest changes are oki with you, planning to do a release later today
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
## [0.9.0] - 2025-01-14 This release provides partial results to speed up `GetRecord` queries in the Kademlia protocol. ### Changed - kad: Provide partial results to speedup `GetRecord` queries ([#315](#315)) cc @paritytech/networking --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This PR provides the partial results of the
GetRecord
kademlia query.GetRecordPartialResult
event is introduced for kademliaGetRecordSuccess
is modified to include only the query IDGetRecord
implementation no longer stores network records internally and forwards valid (unexpired) ones back to the userThe change is needed to speedup authority discovery for substrate based chains.
More context can be found at: paritytech/polkadot-sdk#7077 (comment)
Next Steps