mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
Pokladot sdk backport to staging (#2746)
* Bump to `polkadot-sdk` master `ebe2aad6f0ae576a0e176f38a084fe7579f936dd` * align with others * Backport xcm version stuff from `polkadot-sdk` * Backport Slava's commit from `polkadot-sdk` * Workspace clippy as `polkadot-sdk` does * Make submodules use workspace lints * Add Bridges clippy addons to workspace lints * Looks like we dont need extra clippy addons anymore?
This commit is contained in:
committed by
Bastian Köcher
parent
23440ceab0
commit
8b1e14658e
@@ -7,6 +7,9 @@ edition.workspace = true
|
||||
repository.workspace = true
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
|
||||
hash-db = { version = "0.16.0", default-features = false }
|
||||
@@ -59,8 +62,8 @@ std = [
|
||||
"bp-polkadot-core/std",
|
||||
"bp-relayers/std",
|
||||
"bp-runtime/std",
|
||||
"bp-xcm-bridge-hub/std",
|
||||
"bp-xcm-bridge-hub-router/std",
|
||||
"bp-xcm-bridge-hub/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
|
||||
@@ -309,6 +309,28 @@ impl<H: XcmBlobHauler> LocalXcmQueueManager<H> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Adapter for the implementation of `GetVersion`, which attempts to find the minimal
|
||||
/// configured XCM version between the destination `dest` and the bridge hub location provided as
|
||||
/// `Get<Location>`.
|
||||
pub struct XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>(
|
||||
sp_std::marker::PhantomData<(Version, RemoteBridge)>,
|
||||
);
|
||||
impl<Version: GetVersion, RemoteBridge: Get<MultiLocation>> GetVersion
|
||||
for XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>
|
||||
{
|
||||
fn get_version_for(dest: &MultiLocation) -> Option<XcmVersion> {
|
||||
let dest_version = Version::get_version_for(dest);
|
||||
let bridge_hub_version = Version::get_version_for(&RemoteBridge::get());
|
||||
|
||||
match (dest_version, bridge_hub_version) {
|
||||
(Some(dv), Some(bhv)) => Some(sp_std::cmp::min(dv, bhv)),
|
||||
(Some(dv), None) => Some(dv),
|
||||
(None, Some(bhv)) => Some(bhv),
|
||||
(None, None) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user