Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snowbridge]: Ensure source always from AH for exported message #6838

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

yrong
Copy link
Contributor

@yrong yrong commented Dec 11, 2024

@yrong yrong marked this pull request as ready for review December 11, 2024 05:35
@paritytech-review-bot paritytech-review-bot bot requested a review from a team December 11, 2024 05:36
Copy link
Contributor

@acatangiu acatangiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's wrong to enforce this rule at the router level:

  • maybe some other chain wants to use this router primitive with another bridge (unlikely)
  • maybe we change the router in the AH runtime and the new one doesn't validate this bridge-specific rule (likely)
  • XCM goes to bridge on Bridge Hub through another path than this router and this rule is not enforced (potentially dangerous)

This rule should definitely be enforced by the bridge itself on Bridge Hub. We can have the router also enforce it in order to fail early, fail at AH instead of failing on the next hop on BH. If this is the case, then the impl details comments below apply.

bridges/snowbridge/primitives/router/src/outbound/mod.rs Outdated Show resolved Hide resolved
bridges/snowbridge/primitives/router/src/outbound/mod.rs Outdated Show resolved Hide resolved
bridges/snowbridge/primitives/router/src/outbound/mod.rs Outdated Show resolved Hide resolved
@@ -20,6 +20,8 @@ use sp_std::{iter::Peekable, marker::PhantomData, prelude::*};
use xcm::prelude::*;
use xcm_executor::traits::{ConvertLocation, ExportXcm};

pub const ASSET_HUB_PARA_ID:u32 = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an anti-pattern to hardcode para-id constants in these types of primitives that could be in theory reused in other scenarios.

In practice this is fine, but the used pattern is to make this a generic parameter so it can be customized by the runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Yeah, just a workaround before getting some feedback.

Fixed in 277d51b

@paritytech-review-bot paritytech-review-bot bot requested a review from a team December 13, 2024 01:03
@yrong
Copy link
Contributor Author

yrong commented Dec 13, 2024

We can have the router also enforce it to fail early at AH instead of failing on the next hop on BH.

IIUC EthereumBlobExporter is the only entry point where users can send arbitrary messages to OutboundQueue. Meanwhile, since we've already patched with polkadot-fellows/runtimes#506 to disable the agent/channel, I'd assume it's safe for now, so maybe we can improve that in a separate PR?

@acatangiu acatangiu added the T15-bridges This PR/Issue is related to bridges. label Dec 18, 2024
>
where
UniversalLocation: Get<InteriorLocation>,
EthereumNetwork: Get<NetworkId>,
OutboundQueue: SendMessage<Balance = u128>,
AgentHashedDescription: ConvertLocation<H256>,
ConvertAssetId: MaybeEquivalence<TokenId, Location>,
AssetHubParaId: Get<ParaId>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AssetHubParaId: Get<ParaId>,
WhitelistedParaId: Get<ParaId>,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T15-bridges This PR/Issue is related to bridges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants