paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.com/
1.89k stars 695 forks source link

`AllowKnownQueryResponses` broken with new xcm router wrapper `WithUniqueTopic` #4868

Closed JuaniRios closed 4 months ago

JuaniRios commented 4 months ago

Is there an existing issue?

Experiencing problems? Have you tried our Stack Exchange first?

Description of bug

The new WithUniqueTopic wrapper on the XCM Router appends a SetTopic at the end of any xcm message sent.

The AllowKnownQueryResponses allows messages that only have 1 instruction, QueryResponse.

This means that if you submit a query through XCM, and the destination uses the WithUniqueTopic router, your barrier will reject all responses.

Proposed fix:

I can submit a fix soon

Steps to reproduce

JuaniRios commented 4 months ago

@franciscoaguirre

bkontur commented 4 months ago

@JuaniRios you need to wrap your barriers with TrailingSetTopicAsId, which is counter-part to WithUniqueTopic, you can try it e.g.:

TrailingSetTopicAsId<AllowKnownQueryResponses<..>>

There is also a test for TrailingSetTopicAsId.

We wrap all our barriers with TrailingSetTopicAsId, e.g. https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs#L266

JuaniRios commented 4 months ago

@bkontur That's what I was looking for, thanks!