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

Use new bridge config #33

Merged
merged 2 commits into from
Jun 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ pub mod bridging {
pub storage AssetHubPolkadotMaxFee: Option<MultiAsset> = Some((MultiLocation::parent(), 1_000_000).into());
pub DotLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(PolkadotNetwork::get())));

pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 15 };
pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get()))); // TODO: Maybe registry address belongs here

// Setup bridges configuration
// (hard-coded version - on-chain configuration will come later as separate feature)
pub Bridges: BridgesConfig = BridgesConfigBuilder::default()
Expand All @@ -555,6 +558,23 @@ pub mod bridging {
))
)
)
.add_or_panic(
EthereumNetwork::get(),
BridgeConfig.new(
MaybePaidLocation {
location: BridgeHubKusama::get(),
maybe_fee: None,
}
).add_target_location(
MaybePaidLocation {
location: EthereumLocation::get(),
maybe_fee: None, // No fees supported for ethereum
},
Some(AssetFilter::ByMultiLocation({
MultiLocationFilter::default()
.add_starts_with(EthereumLocation::get())
})),
))
.build();

// Setup trusted bridged reserve locations
Expand All @@ -567,13 +587,21 @@ pub mod bridging {
// allow receive DOT
.add_equals(DotLocation::get())
)
),
(
EthereumLocation::get(),
AssetFilter::ByMultiLocation(
MultiLocationFilter::default()
.add_starts_with(EthereumLocation::get())
) // TODO: Change to registry contract address. For now accept any ethereum address.
Copy link
Author

Choose a reason for hiding this comment

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

Is it safe for us to trust any multilocation that is from Ethereum as a reserve location? I think so because only contracts that have SUBMIT_ROLE permission will be able to enqueue messages. However, another contract with SUBMIT_ROLE privilege could send through a Mint message and this predicate would not guard against that.

)
];

/// Universal aliases
pub BridgedUniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
(BridgeHubKusama::get(), GlobalConsensus(PolkadotNetwork::get()))
(BridgeHubKusama::get(), GlobalConsensus(PolkadotNetwork::get())),
(BridgeHubKusama::get(), GlobalConsensus(EthereumNetwork::get())),
]
);
}
Expand Down