Skip to content

Commit

Permalink
Update to polkadot-sdk v1.12.0 (#409)
Browse files Browse the repository at this point in the history
* change(cargo): initiate updating dependencies

* change(cargo): format files / update dependencies / patch broken dependencies

* change(pallet-communities): explicitly define ItemConfig

* change(pallet-communities-manager): use pallet-communities' ItemConfig for managing memberships

* change(cargo): apply frame-contrib#14

* change(runtime-common): update definitions to XCMv4

* change(kusama-runtime-constants): update definitions to XCMv4

* wip(virto-common): use XCMv3 as the version for structuring locations over `MultiLocationAssetId`s

* change(pallets): update pallets to use new features present in PSDK v1.12

* change(pallets): prune unused pallets

* change(cargo): remove crate patch / update dependencies

* wip(kreivo-runtime): adjust parameters for runtime

* change(kreivo-runtime): adjust xcm to use latest

* change: update deps / lint

* fix: lint

* fix(kreivo-runtime): output WASM in builds

* change(node): adjustments in cli settings

* change(kreivo-runtime): update version

* change(justfile): adjust to new TOML format

* change(virto-node): update to latest template

* change(kreivo-runtime): include missing impls for aura

* fix(kreivo-runtime): missing feature propagation / invalid visiblity for RuntimeApi

* fix(virto-node): misaligned version for json_rpsee dependency

* fix(virto-node): format

* change(zombienet): adjust configs

* fix(kreivo-runtime): use specific CreateOrigin for runtime benchmarks

* fix: lint

* [ci] calculate weights (#414)

Co-authored-by: pandres95 <[email protected]>

* change: version bump

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
pandres95 and github-actions[bot] authored Jun 26, 2024
1 parent f9718c2 commit 3d0bcdd
Show file tree
Hide file tree
Showing 69 changed files with 4,224 additions and 5,927 deletions.
4,165 changes: 2,300 additions & 1,865 deletions Cargo.lock

Large diffs are not rendered by default.

303 changes: 151 additions & 152 deletions Cargo.toml

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
[package]
name = "virto-common"
version = "0.1.0"
edition = "2021"
name = "virto-common"
version = "0.1.0"
edition = "2021"

[dependencies]
bs58 = { version = "0.5.0", default-features = false }
wasm-bindgen = { version = "0.2.87", optional = true }
bs58 = { version = "0.5.0", default-features = false }
wasm-bindgen = { version = "0.2.87", optional = true }

cumulus-primitives-core = { workspace = true, optional = true }
frame-support = { workspace = true, optional = true }
pallet-payments = { workspace = true, optional = true }
parity-scale-codec = { workspace = true, optional = true }
scale-info = { workspace = true, optional = true }
serde = { workspace = true, optional = true, default-features = false }
sp-runtime = { workspace = true, optional = true }
xcm = { workspace = true, optional = true }
cumulus-primitives-core = { workspace = true, optional = true }
frame-support = { workspace = true, optional = true }
pallet-payments = { workspace = true, optional = true }
parity-scale-codec = { workspace = true, optional = true }
scale-info = { workspace = true, optional = true }
serde = { workspace = true, optional = true, default-features = false }
sp-runtime = { workspace = true, optional = true }
xcm = { workspace = true, optional = true }

[dev-dependencies]
frame-support = { workspace = true, features = ["std"] }
frame-support = { workspace = true, features = ["std"] }

[features]
default = ["std"]
std = [
"bs58/std",
"cumulus-primitives-core?/std",
"frame-support?/std",
"pallet-payments?/std",
"parity-scale-codec?/std",
"scale-info?/std",
"serde?/std",
"sp-runtime?/std",
"xcm?/std",
]
alloc = []
js = ["alloc", "wasm-bindgen"]
nightly = []
runtime = [
"dep:cumulus-primitives-core",
"dep:frame-support",
"dep:pallet-payments",
"dep:parity-scale-codec",
"dep:serde",
"dep:scale-info",
"dep:sp-runtime",
"dep:xcm",
]
default = ["std"]
std = [
"bs58/std",
"cumulus-primitives-core?/std",
"frame-support?/std",
"pallet-payments?/std",
"parity-scale-codec?/std",
"scale-info?/std",
"serde?/std",
"sp-runtime?/std",
"xcm?/std",
]
alloc = []
js = ["alloc", "wasm-bindgen"]
nightly = []
runtime = [
"dep:cumulus-primitives-core",
"dep:frame-support",
"dep:pallet-payments",
"dep:parity-scale-codec",
"dep:serde",
"dep:scale-info",
"dep:sp-runtime",
"dep:xcm",
]
98 changes: 44 additions & 54 deletions common/src/multilocation_asset_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ impl From<u32> for FungibleAssetLocation {
#[cfg(feature = "runtime")]
pub mod runtime {
use super::{FungibleAssetLocation, Para};
use cumulus_primitives_core::MultiLocation;
use sp_runtime::traits::MaybeEquivalence;
use xcm::v3::{
use xcm::latest::{
Junction::{GeneralIndex, GlobalConsensus, PalletInstance, Parachain},
Junctions, NetworkId,
Location, NetworkId,
};

impl TryFrom<NetworkId> for super::NetworkId {
Expand All @@ -83,72 +82,63 @@ pub mod runtime {
}

pub struct AsFungibleAssetLocation;
impl MaybeEquivalence<MultiLocation, FungibleAssetLocation> for AsFungibleAssetLocation {
fn convert(value: &MultiLocation) -> Option<FungibleAssetLocation> {
match *value {
MultiLocation {
parents: 2,
interior: Junctions::X1(GlobalConsensus(network)),
} => Some(FungibleAssetLocation::External {
network: network.try_into().ok()?,
impl MaybeEquivalence<Location, FungibleAssetLocation> for AsFungibleAssetLocation {
fn convert(value: &Location) -> Option<FungibleAssetLocation> {
match value.unpack() {
(2, [GlobalConsensus(network)]) => Some(FungibleAssetLocation::External {
network: (*network).try_into().ok()?,
child: None,
}),
MultiLocation {
parents: 2,
interior:
Junctions::X4(GlobalConsensus(network), Parachain(id), PalletInstance(pallet), GeneralIndex(index)),
} => Some(FungibleAssetLocation::External {
network: network.try_into().ok()?,
child: Some(Para {
id: id.try_into().ok()?,
pallet,
index: index.try_into().ok()?,
}),
}),
MultiLocation {
parents: 1,
interior: Junctions::X3(Parachain(id), PalletInstance(pallet), GeneralIndex(index)),
} => Some(FungibleAssetLocation::Sibling(Para {
id: id.try_into().ok()?,
pallet,
index: index.try_into().ok()?,
})),
MultiLocation {
parents: 0,
interior: Junctions::X2(PalletInstance(13), GeneralIndex(index)),
} => Some(FungibleAssetLocation::Here(
index.try_into().expect("as it is here, we the types will match; qed"),
(2, [GlobalConsensus(network), Parachain(id), PalletInstance(pallet), GeneralIndex(index)]) => {
Some(FungibleAssetLocation::External {
network: (*network).try_into().ok()?,
child: Some(Para {
id: (*id).try_into().ok()?,
pallet: *pallet,
index: (*index).try_into().ok()?,
}),
})
}
(1, [Parachain(id), PalletInstance(pallet), GeneralIndex(index)]) => {
Some(FungibleAssetLocation::Sibling(Para {
id: (*id).try_into().ok()?,
pallet: *pallet,
index: (*index).try_into().ok()?,
}))
}
(0, [PalletInstance(13), GeneralIndex(index)]) => Some(FungibleAssetLocation::Here(
(*index)
.try_into()
.expect("as it is here, we the types will match; qed"),
)),
_ => None,
}
}

fn convert_back(value: &FungibleAssetLocation) -> Option<MultiLocation> {
fn convert_back(value: &FungibleAssetLocation) -> Option<Location> {
match *value {
FungibleAssetLocation::Here(index) => Some(MultiLocation {
parents: 0,
interior: Junctions::X2(PalletInstance(13), GeneralIndex(index.into())),
}),
FungibleAssetLocation::Sibling(Para { id, pallet, index }) => Some(MultiLocation {
parents: 1,
interior: Junctions::X3(Parachain(id.into()), PalletInstance(pallet), GeneralIndex(index.into())),
}),
FungibleAssetLocation::External { network, child: None } => Some(MultiLocation {
parents: 2,
interior: Junctions::X1(GlobalConsensus(network.into())),
}),
FungibleAssetLocation::Here(index) => {
Some(Location::new(0, [PalletInstance(13), GeneralIndex(index.into())]))
}
FungibleAssetLocation::Sibling(Para { id, pallet, index }) => Some(Location::new(
1,
[Parachain(id.into()), PalletInstance(pallet), GeneralIndex(index.into())],
)),
FungibleAssetLocation::External { network, child: None } => {
Some(Location::new(2, [GlobalConsensus(network.into())]))
}
FungibleAssetLocation::External {
network,
child: Some(Para { id, pallet, index }),
} => Some(MultiLocation {
parents: 2,
interior: Junctions::X4(
} => Some(Location::new(
2,
[
GlobalConsensus(network.into()),
Parachain(id.into()),
PalletInstance(pallet),
GeneralIndex(index.into()),
),
}),
],
)),
}
}
}
Expand Down
Loading

0 comments on commit 3d0bcdd

Please sign in to comment.