-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Change on-the-wire protocol names to include genesis hash & fork id #11938
Conversation
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.
Looks good to me, thanks!
Would be nice if you could add at least one of block-announces
, sync
, sync/warp
, state
, and light
protocols to this PR to see how it'll be used. Although, come to think about it we already have GRANDPA
and BEEFY
as showcases.
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.
I don't really see the need for these standard_protocol_name
and legacy_protocol_name
functions. You're saving literally two lines of code.
Plus, it is in no way guaranteed that every protocol name follows the same pattern. The fact that they do should be seen as a happy coincidence.
Furthermore, moving this code to a separate function IMO decreases readability. If you want to figure out which protocol name GrandPa has, there is now even one more additional step.
I think it's a mistake to see multiple pieces of code that look the same and immediately jump to the conclusion "we should merge these pieces into one because DRY". Applying DRY has a lot of cons.
But since I'm not maintaining this code, I'm not going to be opposed to it.
@acatangiu Added @tomaka We will have the similar pattern of |
To rephrase my point: what's the advantage of standardizing the protocol name in one place? None that I can see. We might specifically need in the future to change the pattern of one protocol name without touching the 7 others. For example, we might want to upgrade to
Decision isn't mine here |
Protocols changed: - sync - state - light - sync/warp
…EEFY and GRANDPA" This reverts commit 29aa556.
I've updated @acatangiu and @tomaka , could you please re-review? |
@tomaka Should we also update polkadot protocol names, e.g. |
To clarify, you're suggesting this as a follow-up PR to the companion PR to replace "/polkadot/etc" with "/{genesis_hash}/etc" and with fallback to the current names ("/polkadot/etc")? Sounds reasonable to me. |
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.
Looks good, thanks!
This PR has 2 approving reviews, and the companion PR is approved. Why Check reviews CI stage is failing? |
It is off-topic why, but my reviews don't technically count |
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.
An approval on behalf of @tomaka.
bot merge |
Seems like this assertion is now wrong? substrate/client/network/src/protocol.rs Line 1580 in 6527f0c
|
…aritytech#11938) * Rename transactions protocol to include genesis hash * Add protocol name generation to sc_network::utils * Use utils functions for transactions protocol name generation * Extract protocol name generation into public module * Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA * minor: add missing newline at EOF * Change block-announces protocol name to include genesis_hash & fork_id * Change protocol names to include genesis hash and fork id Protocols changed: - sync - state - light - sync/warp * Revert "Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA" This reverts commit 29aa556. * Get rid of `protocol_name` module
…aritytech#11938) * Rename transactions protocol to include genesis hash * Add protocol name generation to sc_network::utils * Use utils functions for transactions protocol name generation * Extract protocol name generation into public module * Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA * minor: add missing newline at EOF * Change block-announces protocol name to include genesis_hash & fork_id * Change protocol names to include genesis hash and fork id Protocols changed: - sync - state - light - sync/warp * Revert "Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA" This reverts commit 29aa556. * Get rid of `protocol_name` module
This PR implements #7746 for
transactions
,block-announces
,sync
,sync/warp
,state
, andlight
protocols.polkadot companion: paritytech/polkadot#5849