Skip to content
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

Implement RFC 8: store parachain bootnodes in the relay chain DHT #1825

Open
2 tasks
tomaka opened this issue Oct 9, 2023 · 3 comments
Open
2 tasks

Implement RFC 8: store parachain bootnodes in the relay chain DHT #1825

tomaka opened this issue Oct 9, 2023 · 3 comments
Assignees
Labels
I5-enhancement An additional feature request. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@tomaka
Copy link
Contributor

tomaka commented Oct 9, 2023

This PR is about implementing polkadot-fellows/RFCs#8
(note: I'm opening this issue before the RFC is accepted because I assume it will be unanimously accepted, will close if it's not the case)

There are two different but related aspects to this RFC that need to be implemented:

  • Parachain nodes should register themselves in the DHT.
  • Parachain nodes should discover other nodes from the DHT.

The DHT registration described in the RFC should use Kademlia::start_providing.
Looking for other nodes should use get_providers.

As I mention in the RFC text, I believe that rust-libp2p already hashes the key.
The RFC says that the key is sha256(concat(scale_compact(para_id), randomness)), but since rust-libp2p already hashes it, what you need to pass as parameter is instead just concat(scale_compact(para_id), randomness).

Since the authority discovery system is already using Kademlia, I would expect the wiring between the parachain node and the relay chain Kademlia to not encounter any major obstacle. The authority discovery system is not using Kademlia's providers system but straight-up Kademlia records, so you probably need to add a few functions that are similar to the existing one but not exactly the same.

The way I would expect the registration to be implemented is to start a background task that in a loop: queries Babe_current_epoch & Babe_next_epoch, updates the providers registration if necessary, then sleeps for a few minutes.
Implementing it this way means that for each node the registration would take a different amount of time (up to a few minutes) between the moment when the Babe epoch changes and the moment when the registration updates, which as mentioned in the RFC is a good thing in order to avoid a spike of traffic to the nodes handling the DHT records.

Are you willing to help with this request?

Only by answering questions regarding the RFC.

@Polkadot-Forum
Copy link

This issue has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/smoldot-updates-threads/4471/4

@Polkadot-Forum
Copy link

This issue has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/smoldot-updates-threads/4471/8

@tomaka
Copy link
Contributor Author

tomaka commented Dec 18, 2023

cc polkadot-fellows/RFCs#59

If someone is implementing this any time soon, they might want to keep in mind that polkadot-fellows/RFCs#59 aims to make the mechanism slightly more generic than what is described in RFC 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
Status: Backlog 🗒
Status: backlog
Development

No branches or pull requests

3 participants