Fix testnet warp sync and protocol isolation#2551
Open
prop-opentensor wants to merge 4 commits intodevnet-readyfrom
Open
Fix testnet warp sync and protocol isolation#2551prop-opentensor wants to merge 4 commits intodevnet-readyfrom
prop-opentensor wants to merge 4 commits intodevnet-readyfrom
Conversation
f2a87d7 to
34ad959
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
protocolIdtobittensor-testnetso testnet nodes stop sharing a peer set with mainnetProblem
Fresh testnet warp sync is currently broken for two separate reasons.
First, the raw testnet spec still uses the mainnet
protocolId, so testnet nodes can connect to the wrong peer set and receive cross-chain traffic.Second, testnet has historical GRANDPA authority-set transitions that cannot be handled correctly by the current generic testnet warp configuration alone. In particular, the canonical pre-fragment states around blocks
4589660,4589686, and5534451need explicit handling, and the5534451transition must be verified against pre-changeset_id = 3, not2.Without those testnet-specific corrections, a fresh node can accept the wrong peer set, reject the relevant warp proof fragments, or stall partway through warp sync.
There is also a generic serving-side issue in the SDK for delayed GRANDPA changes. That is tracked separately in the companion SDK PR: opentensor/polkadot-sdk#22
Fix
This PR keeps the change surface testnet-specific.
raw_spec_testfinney.jsongets a distinct protocol ID so testnet discovery and gossip are isolated from mainnet.service.rsadds a testnet-only warp provider keyed offprotocolId == bittensor-testnet.authority_set_changes()history.For all later normal scheduled GRANDPA changes, the provider still falls back to the backend’s live authority-set history.
Why This Is Safe
protocolId = bittensor-testnetprotocolIdstringCompanion SDK Change
This Subtensor PR fixes the testnet-specific consumer/history side.
Official peers also need the generic SDK serving-side fix from opentensor/polkadot-sdk#22 so they can encode delayed GRANDPA change fragments correctly during warp sync.
Because that SDK change extends the warp-proof encoding, production deployment also needs Subtensor to pick up that SDK revision when it is merged. The two PRs are complementary:
Notes
This patch is narrow by design. It should continue to work for future normal authority-set changes. Another code change should only be needed if testnet introduces another abnormal/manual historical GRANDPA transition that cannot be reconstructed from the normal aux history.