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

Upgrade to v0.9.43 #130

Merged
merged 10 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
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
5,744 changes: 3,649 additions & 2,095 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 24 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,30 @@ members = [

'modified-construct-runtime',
]

[workspace.package]
version = "1.5.0"
edition = "2021"

license = "GPL-3.0"
authors = ["InvArch Association <https://github.com/InvArch>"]
repository = "https://github.com/InvArch/InvArch-Node/"
homepage = "https://invarch.network"

[profile.release]
panic = 'unwind'

[patch.'https://github.com/paritytech/polkadot']
xcm = { git = "https://github.com/paritytech//polkadot", branch = "release-v0.9.36" }
xcm-executor = { git = "https://github.com/paritytech//polkadot", branch = "release-v0.9.36" }
[patch.'https://github.com/arrudagates/open-runtime-module-library']
orml-traits2 = { package = "orml-traits", git = "https://github.com/arrudagates//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-tokens2 = { package = "orml-tokens", git = "https://github.com/arrudagates//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }

[patch.'https://github.com/open-web3-stack/open-runtime-module-library']
orml-traits = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-xcm = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-vesting = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-asset-registry = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-xtokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-xcm-support = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-unknown-tokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-currencies = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
orml-tokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae" }
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ zombienet-run-tinkernet+basilisk: | $(polkadot_target) $(basilisk_target)
zombienet-run-tinkernet+tinkernet: | $(polkadot_target)
zombienet spawn zombienet/rococo-and-tinkernet+tinkernet.toml

zombienet-run-kusama+tinkernet:
zombienet spawn zombienet/kusama-and-tinkernet.toml

.PHONY: setup-testing purge-testing download-relay generate-relay-raw-chainspec build generate-both copy-collator-to-testing

generate-genesis-wasm:
Expand Down Expand Up @@ -164,9 +167,9 @@ setup-testing: | purge-testing download-relay generate-relay-raw-chainspec build
$(info Terminal 3: make run-parachain-collator)

run-solo-alice:
./target/release/invarch-collator --chain solo-dev --alice --tmp --rpc-cors=all
./target/release/invarch-collator --chain solo-dev --alice --tmp --listen-addr /ip4/0.0.0.0/tcp/53102/ws --rpc-cors=all --discover-local --collator --node-key c12b6d18942f5ee8528c8e2baf4e147b5c5c18710926ea492d09cbd9f6c9f82a

run-solo-bob:
./target/release/invarch-collator --chain solo-dev --bob --tmp --port 30334 --rpc-cors=all
./target/release/invarch-collator --chain solo-dev --bob --tmp --listen-addr /ip4/0.0.0.0/tcp/54102/ws --rpc-cors=all --discover-local --collator --bootnodes /ip4/127.0.0.1/tcp/53102/ws/p2p/12D3KooWBmAwcd4PJNJvfV89HwE48nwkRmAgo8Vy3uQEyNNHBox2

run-solo: ; printf "run-solo-alice\nrun-solo-bob" | parallel -u make
14 changes: 10 additions & 4 deletions modified-construct-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ targets = ["x86_64-unknown-linux-gnu"]
proc-macro = true

[dependencies]
derive-syn-parse = "0.1.5"
Inflector = "0.11.4"
cfg-expr = "0.10.3"
cfg-expr = "0.15.1"
itertools = "0.10.3"
proc-macro2 = "1.0.37"
quote = "1.0.10"
syn = { version = "1.0.98", features = ["full"] }
proc-macro2 = "1.0.56"
quote = "1.0.26"
syn = { version = "2.0.16", features = ["full"] }
frame-support-procedural-tools = { version = "4.0.0-dev", path = "./tools" }
proc-macro-warning = { version = "0.3.0", default-features = false }

[features]
default = ["std"]
std = []
no-metadata-docs = []
# Generate impl-trait for tuples with the given number of tuples. Will be needed as the number of
# pallets in a runtime grows. Does increase the compile time!
tuples-96 = []
tuples-128 = []
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of Substrate.

// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of Substrate.

// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of Substrate.

// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// This file is part of Substrate.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License

use crate::construct_runtime::{parse::PalletPath, Pallet};
use proc_macro2::{Ident, TokenStream};
use quote::quote;

pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream {
let mut conversion_fns = Vec::new();
let mut freeze_reason_variants = Vec::new();
for decl in pallet_decls {
if let Some(_) = decl.find_part("FreezeReason") {
let variant_name = &decl.name;
let path = &decl.path;
let index = decl.index;

conversion_fns.push(expand_conversion_fn(path, variant_name));

freeze_reason_variants.push(expand_variant(index, path, variant_name));
}
}

quote! {
/// A reason for placing a freeze on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
)]
pub enum RuntimeFreezeReason {
#( #freeze_reason_variants )*
}

#( #conversion_fns )*
}
}

fn expand_conversion_fn(path: &PalletPath, variant_name: &Ident) -> TokenStream {
quote! {
impl From<#path::FreezeReason> for RuntimeFreezeReason {
fn from(hr: #path::FreezeReason) -> Self {
RuntimeFreezeReason::#variant_name(hr)
}
}
}
}

fn expand_variant(index: u8, path: &PalletPath, variant_name: &Ident) -> TokenStream {
quote! {
#[codec(index = #index)]
#variant_name(#path::FreezeReason),
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// This file is part of Substrate.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License

use crate::construct_runtime::{parse::PalletPath, Pallet};
use proc_macro2::{Ident, TokenStream};
use quote::quote;

pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream {
let mut conversion_fns = Vec::new();
let mut hold_reason_variants = Vec::new();
for decl in pallet_decls {
if let Some(_) = decl.find_part("HoldReason") {
let variant_name = &decl.name;
let path = &decl.path;
let index = decl.index;

conversion_fns.push(expand_conversion_fn(path, variant_name));

hold_reason_variants.push(expand_variant(index, path, variant_name));
}
}

quote! {
/// A reason for placing a hold on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
)]
pub enum RuntimeHoldReason {
#( #hold_reason_variants )*
}

#( #conversion_fns )*
}
}

fn expand_conversion_fn(path: &PalletPath, variant_name: &Ident) -> TokenStream {
quote! {
impl From<#path::HoldReason> for RuntimeHoldReason {
fn from(hr: #path::HoldReason) -> Self {
RuntimeHoldReason::#variant_name(hr)
}
}
}
}

fn expand_variant(index: u8, path: &PalletPath, variant_name: &Ident) -> TokenStream {
quote! {
#[codec(index = #index)]
#variant_name(#path::HoldReason),
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of Substrate.

// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
68 changes: 68 additions & 0 deletions modified-construct-runtime/src/construct_runtime/expand/lock_id.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// This file is part of Substrate.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License

use crate::construct_runtime::{parse::PalletPath, Pallet};
use proc_macro2::{Ident, TokenStream};
use quote::quote;

pub fn expand_outer_lock_id(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream {
let mut conversion_fns = Vec::new();
let mut lock_id_variants = Vec::new();
for decl in pallet_decls {
if let Some(_) = decl.find_part("LockId") {
let variant_name = &decl.name;
let path = &decl.path;
let index = decl.index;

conversion_fns.push(expand_conversion_fn(path, variant_name));

lock_id_variants.push(expand_variant(index, path, variant_name));
}
}

quote! {
/// An identifier for each lock placed on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
)]
pub enum RuntimeLockId {
#( #lock_id_variants )*
}

#( #conversion_fns )*
}
}

fn expand_conversion_fn(path: &PalletPath, variant_name: &Ident) -> TokenStream {
quote! {
impl From<#path::LockId> for RuntimeLockId {
fn from(hr: #path::LockId) -> Self {
RuntimeLockId::#variant_name(hr)
}
}
}
}

fn expand_variant(index: u8, path: &PalletPath, variant_name: &Ident) -> TokenStream {
quote! {
#[codec(index = #index)]
#variant_name(#path::LockId),
}
}
Loading
Loading