-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Idea: Replace protocolId with the genesis hash #7746
Comments
Depends on #6605 |
Some remark: using just the genesis hash would make it impossible to do a hard fork. Adding an extra field also makes it flexible enough to not run into an issue if a chain transitions from standalone to parachain. |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Issue still relevant and important. |
I am writing some guides on parachain configuration, and especially in that context, having unique network protocol IDs seems more important, and as you mention, accounting for the possibility of hard forks and changes in paraID and such. We have seen solo-chains run into improper discovery & attempted peering because of this, and my hunch at least is in a common-relay chain context, this will be exacerbated. |
At the network level, when looking at scale wouldn't it be expensive to string match against such a long protocol id? Would |
There's no need to truncate. We don't care about the performance of comparing strings of 50 bytes. |
Done in #10463 |
This was done for Grandpa/Beefy, but not for the syncing and transactions protocols. |
One last thing to do is change the Kademlia protocol name: substrate/client/network/src/discovery.rs Line 202 in c76c40a
Unfortunately, this is maybe more complicated, because libp2p doesn't allow setting backwards compatible names for this protocol. |
@dmitry-markin could you check with upstream if adding support for backwards compatible names would be accepted? If yes, could you please do this. |
Done in libp2p/rust-libp2p#2846. |
Nice! So we will be able to close this with the next libp2p update. |
For the protocol: libp2p/rust-libp2p#2869 |
@dmitry-markin please keep track on this and when it is released, please update libp2p. :) |
At the moment, most networking protocols contain what is called the
protocolId
, defined in the chain specs.For example, the syncing protocol of Polkadot is named
/dot/sync/2
, because Polkadot hasprotocolId: "dot"
in its chain specs.Instead of using a user-chosen
protocolId
, we could name the protocol using the hash of the genesis block.The sync protocol could for example become
/91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3/sync/2
.The advantage of doing so is that things become "automatic". No need to define your own
protocolId
anymore, and no need to verify whether the genesis hash is the same between two nodes during the blocks announce handshake.The drawback is obviously that this is longer than just
dot
, so more bytes are transmitted on the network. Themultistream-select
protocol requires protocol names to be string.To mitigate this, we could use an encoding other than hex encoding of the hash. Using a different encoding might however make things confusing.
This also depends on how we tackle #7458. After #7458, the definition of "genesis block" might become a bit blurry.
The text was updated successfully, but these errors were encountered: