-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into aleks-fix-data-preservers-benchmarking
- Loading branch information
Showing
43 changed files
with
2,503 additions
and
647 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
name = "tp-xcm-commons" | ||
edition = "2021" | ||
version = "0.1.0" | ||
[package.authors] | ||
workspace = true | ||
[package.repository] | ||
workspace = true | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
frame-support = { workspace = true } | ||
log = { workspace = true } | ||
staging-xcm = { workspace = true } | ||
|
||
[features] | ||
default = [ | ||
"std", | ||
] | ||
std = [ | ||
"frame-support/std", | ||
"log/std", | ||
"staging-xcm/std", | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (C) Moondance Labs Ltd. | ||
// This file is part of Tanssi. | ||
|
||
// Tanssi is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Tanssi is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Tanssi. If not, see <http://www.gnu.org/licenses/> | ||
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
use staging_xcm::latest::prelude::*; | ||
trait Parse { | ||
/// Returns the "chain" location part. It could be parent, sibling | ||
/// parachain, or child parachain. | ||
fn chain_part(&self) -> Option<Location>; | ||
} | ||
|
||
impl Parse for Location { | ||
fn chain_part(&self) -> Option<Location> { | ||
match (self.parents, self.first_interior()) { | ||
// sibling parachain | ||
(1, Some(Parachain(id))) => Some(Location::new(1, [Parachain(*id)])), | ||
// parent | ||
(1, _) => Some(Location::parent()), | ||
// children parachain | ||
(0, Some(Parachain(id))) => Some(Location::new(0, [Parachain(*id)])), | ||
_ => None, | ||
} | ||
} | ||
} | ||
|
||
pub struct NativeAssetReserve; | ||
impl frame_support::traits::ContainsPair<Asset, Location> for NativeAssetReserve { | ||
fn contains(asset: &Asset, origin: &Location) -> bool { | ||
log::trace!(target: "xcm::contains", "NativeAssetReserve asset: {:?}, origin: {:?}", asset, origin); | ||
let reserve = if asset.id.0.parents == 0 | ||
&& !matches!(asset.id.0.first_interior(), Some(Parachain(_))) | ||
{ | ||
Some(Location::here()) | ||
} else { | ||
asset.id.0.chain_part() | ||
}; | ||
|
||
if let Some(ref reserve) = reserve { | ||
if reserve == origin { | ||
return true; | ||
} | ||
} | ||
false | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
103 changes: 0 additions & 103 deletions
103
runtime/dancebox/src/tests/common/xcm/expected_event_checker.rs
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.