Polkadot-Kusama Bridge support#1029
Merged
Merged
Conversation
karolk91
marked this pull request as ready for review
June 25, 2026 11:08
xlc
approved these changes
Jun 26, 2026
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.
Adds bridge-message relaying between two forked bridge hubs, so XCM-over-bridge scenarios (e.g. Polkadot↔Kusama) can be tested end-to-end in chopsticks.
Usage
Library:
CLI:
Both spin up two independent chopsticks instances and wire delivery in both directions (one relayer account, funded on both hubs).
How it works
connectBridgeHubsnever builds blocks — it reads state, builds storage proofs, writes the destination'spallet_bridge_parachainsstate, and pushes extrinsics to pools, then reacts to the heads produced by whatever builds blocks (Instant/Batchauto-build, or a host drivingdev_newBlockunderManual). So it behaves identically across build modes.Two reactive loops:
receive_messages_prooffor[last_delivered+1 .. latest_generated](chunked to ≤4096) to the destination pool, withParasInfo/ImportedParaHeads/ImportedParaHasheswritten from the proof's recomputed root. Starting at the livelast_delivered+1gives the pallet'sis_obsoletecheck its contiguity, so nothing is re-delivered; an in-flight chunk blocks the next push until a destination head shows it landed.InboundLanes, deriveUnrewardedRelayersStateas the pallet'sFrom<&InboundLaneData>does, and pushreceive_messages_delivery_proofto the source pool, advancinglatest_received_nonceso the destination prunes its relayer queue.ImportedParaHeadsis written directly (finality isn't forged), so only the messages-pallet calls run through pallet logic. Pallet names and para ids are auto-detected from runtime metadata (override via config for runtimes with multiple instances).signermust hold a balance on both hubs; one signer covers both directions since every submission goes through the pool.New RPC methods
state_getReadProof— spec-shaped{ at, proof }. Composed from an upstream base plus local overrides via the executor'screateProof(chopsticks has no trie of its own).dev_getReadProof—{ at, proof, stateRoot }: the same proof plus its recomputed root, which diverges fromchain_getHeader(at).state_rootonce overrides are applied. Verifiers check against this root; kept separate sostate_getReadProofstays spec-compliant.References
state_getReadProof)Testing
packages/e2e/src/state.test.ts—state_getReadProof: proof reflects local overrides, rejects child-storage keys, rejects empty key list.packages/e2e/src/bridge.test.ts— against live Polkadot/Kusama bridge-hub forks: continuous delivery, back-to-back source blocks, a multi-nonce range in one block, delivery under each build mode (Manual / Instant / Batch), idempotent confirmation relay across rounds, and state-root-binding proofs. All assert the destination's inboundlast_delivered_nonce.packages/e2e/src/bridge-detect.test.ts— pallet/para-id auto-detection guards, including ambiguity on every side and override-bypass (no live forks).packages/chopsticks/src/bridge.test.ts— unit tests for theUnrewardedRelayersStatederivation across multi-entry / multi-message relayer queues (the count>1 cases the single live confirmation can't reach), checked against the pallet'sFrom<&InboundLaneData>