Metadata v14 (companion to #3336) (#564)

* Remove event pallet::metadata attributes

* Add scale-info deps, TypeInfo derives, update call variants

* Update metadata runtime APIs

* Add missing scale_info dependency, update rococo runtime API

* Add missing scale_info dependency

* Remove pushed diener patches

* Cargo.lock

* Add missing scale-info dependencies

* Fixes

* Statemint runtime fixes

* Call struct variant empty matches

* Add missing scale-info dependency

* Fixes

* scale-info 1.0

* cargo update -p xcm

* update lock

* Update Cargo.lock

* update to latest polkadot

* remove rpc_http_threads

https://github.com/paritytech/substrate/pull/9737

* replace task executor with tokio handler

https://github.com/paritytech/substrate/pull/9737

* fix test compilation?

* Update Cargo.lock

* cargo update

* remove unused

* Update substrate and polkadot

* Update test/client/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Andrew Jones
2021-09-16 11:11:05 +01:00
committed by GitHub
parent b39bad58f1
commit e3eb3a0a12
36 changed files with 576 additions and 409 deletions
+352 -248
View File
File diff suppressed because it is too large Load Diff
+17 -13
View File
@@ -20,16 +20,15 @@
use sc_cli; use sc_cli;
use sc_service::{ use sc_service::{
BasePath, config::{PrometheusConfig, TelemetryEndpoints},
config::{TelemetryEndpoints, PrometheusConfig}, BasePath, TransactionPoolOptions,
TransactionPoolOptions,
}; };
use std::{ use std::{
fs, fs,
io::{self, Write}, io::{self, Write},
net::SocketAddr,
}; };
use structopt::StructOpt; use structopt::StructOpt;
use std::net::SocketAddr;
/// The `purge-chain` command used to remove the whole chain: the parachain and the relaychain. /// The `purge-chain` command used to remove the whole chain: the parachain and the relaychain.
#[derive(Debug, StructOpt)] #[derive(Debug, StructOpt)]
@@ -66,10 +65,12 @@ impl PurgeChainCmd {
let db_paths = databases let db_paths = databases
.iter() .iter()
.map(|(chain_label, database)| { .map(|(chain_label, database)| {
database.path().ok_or_else(|| sc_cli::Error::Input(format!( database.path().ok_or_else(|| {
"Cannot purge custom database implementation of: {}", sc_cli::Error::Input(format!(
chain_label, "Cannot purge custom database implementation of: {}",
))) chain_label,
))
})
}) })
.collect::<sc_cli::Result<Vec<_>>>()?; .collect::<sc_cli::Result<Vec<_>>>()?;
@@ -152,11 +153,11 @@ impl RunCmd {
pub fn normalize(&self) -> NormalizedRunCmd { pub fn normalize(&self) -> NormalizedRunCmd {
let mut new_base = self.base.clone(); let mut new_base = self.base.clone();
new_base.validator = self.base.validator || self.collator; new_base.validator = self.base.validator || self.collator;
NormalizedRunCmd { NormalizedRunCmd {
base: new_base, base: new_base,
parachain_id: self.parachain_id, parachain_id: self.parachain_id,
} }
} }
} }
@@ -205,7 +206,10 @@ impl sc_cli::CliConfiguration for NormalizedRunCmd {
self.base.force_authoring() self.base.force_authoring()
} }
fn prometheus_config(&self, default_listen_port: u16) -> sc_cli::Result<Option<PrometheusConfig>> { fn prometheus_config(
&self,
default_listen_port: u16,
) -> sc_cli::Result<Option<PrometheusConfig>> {
self.base.prometheus_config(default_listen_port) self.base.prometheus_config(default_listen_port)
} }
+2
View File
@@ -18,6 +18,7 @@ sp-application-crypto = { git = "https://github.com/paritytech/substrate", defau
# Other Dependencies # Other Dependencies
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"]} codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"]}
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
[dev-dependencies] [dev-dependencies]
@@ -27,6 +28,7 @@ cumulus-pallet-parachain-system = { path = "../parachain-system" }
default = [ "std" ] default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"frame-support/std", "frame-support/std",
"sp-runtime/std", "sp-runtime/std",
@@ -15,6 +15,7 @@ targets = ['x86_64-unknown-linux-gnu']
[dependencies] [dependencies]
log = { version = "0.4.0", default-features = false } log = { version = "0.4.0", default-features = false }
codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = '2.0.0' } codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = '2.0.0' }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.119", default-features = false } serde = { version = "1.0.119", default-features = false }
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" } sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" } sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
@@ -46,6 +47,7 @@ runtime-benchmarks = [
std = [ std = [
'codec/std', 'codec/std',
'log/std', 'log/std',
'scale-info/std',
'sp-runtime/std', 'sp-runtime/std',
'sp-staking/std', 'sp-staking/std',
'sp-std/std', 'sp-std/std',
@@ -162,7 +162,7 @@ pub mod pallet {
} }
/// Basic information about a collation candidate. /// Basic information about a collation candidate.
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)]
pub struct CandidateInfo<AccountId, Balance> { pub struct CandidateInfo<AccountId, Balance> {
/// Account identifier. /// Account identifier.
pub who: AccountId, pub who: AccountId,
@@ -247,7 +247,6 @@ pub mod pallet {
} }
#[pallet::event] #[pallet::event]
#[pallet::metadata(T::AccountId = "AccountId", BalanceOf<T> = "Balance")]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> { pub enum Event<T: Config> {
NewInvulnerables(Vec<T::AccountId>), NewInvulnerables(Vec<T::AccountId>),
+2
View File
@@ -7,6 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
# Other dependencies # Other dependencies
codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ], default-features = false } codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ], default-features = false }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
# Substrate Dependencies # Substrate Dependencies
@@ -32,6 +33,7 @@ default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"log/std", "log/std",
"scale-info/std",
"sp-std/std", "sp-std/std",
"sp-io/std", "sp-io/std",
"sp-runtime/std", "sp-runtime/std",
+7 -4
View File
@@ -21,6 +21,7 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
use scale_info::TypeInfo;
use sp_std::{prelude::*, convert::TryFrom}; use sp_std::{prelude::*, convert::TryFrom};
use cumulus_primitives_core::relay_chain::BlockNumber as RelayBlockNumber; use cumulus_primitives_core::relay_chain::BlockNumber as RelayBlockNumber;
use cumulus_primitives_core::DmpMessageHandler; use cumulus_primitives_core::DmpMessageHandler;
@@ -30,7 +31,7 @@ use xcm::{VersionedXcm, latest::prelude::*};
use frame_support::{traits::EnsureOrigin, dispatch::Weight, weights::constants::WEIGHT_PER_MILLIS}; use frame_support::{traits::EnsureOrigin, dispatch::Weight, weights::constants::WEIGHT_PER_MILLIS};
pub use pallet::*; pub use pallet::*;
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)] #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct ConfigData { pub struct ConfigData {
/// The maximum amount of weight any individual message may consume. Messages above this weight /// The maximum amount of weight any individual message may consume. Messages above this weight
/// go into the overweight queue and may only be serviced explicitly by the /// go into the overweight queue and may only be serviced explicitly by the
@@ -47,7 +48,7 @@ impl Default for ConfigData {
} }
/// Information concerning our message pages. /// Information concerning our message pages.
#[derive(Copy, Clone, Eq, PartialEq, Default, Encode, Decode, RuntimeDebug)] #[derive(Copy, Clone, Eq, PartialEq, Default, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct PageIndexData { pub struct PageIndexData {
/// The lowest used page index. /// The lowest used page index.
begin_used: PageCounter, begin_used: PageCounter,
@@ -166,7 +167,6 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::metadata(T::BlockNumber = "BlockNumber")]
pub enum Event<T: Config> { pub enum Event<T: Config> {
/// Downward message is invalid XCM. /// Downward message is invalid XCM.
/// \[ id \] /// \[ id \]
@@ -755,7 +755,10 @@ mod tests {
assert_noop!(DmpQueue::service_overweight(Origin::root(), 0, 9999), Error::<Test>::OverLimit); assert_noop!(DmpQueue::service_overweight(Origin::root(), 0, 9999), Error::<Test>::OverLimit);
assert_eq!(take_trace(), vec![ msg_limit_reached(10000) ]); assert_eq!(take_trace(), vec![ msg_limit_reached(10000) ]);
let base_weight = super::Call::<Test>::service_overweight(0, 0).get_dispatch_info().weight; let base_weight = super::Call::<Test>::service_overweight {
index: 0,
weight_limit: 0,
}.get_dispatch_info().weight;
use frame_support::weights::GetDispatchInfo; use frame_support::weights::GetDispatchInfo;
let info = DmpQueue::service_overweight(Origin::root(), 0, 20000).unwrap(); let info = DmpQueue::service_overweight(Origin::root(), 0, 20000).unwrap();
let actual_weight = info.actual_weight.unwrap(); let actual_weight = info.actual_weight.unwrap();
@@ -31,6 +31,7 @@ sp-externalities = { git = "https://github.com/paritytech/substrate", default-fe
# Other Dependencies # Other Dependencies
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"]} codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"]}
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
environmental = { version = "1.1.2", default-features = false } environmental = { version = "1.1.2", default-features = false }
@@ -55,6 +56,7 @@ default = [ "std" ]
std = [ std = [
"serde", "serde",
"codec/std", "codec/std",
"scale-info/std",
"frame-support/std", "frame-support/std",
"pallet-balances/std", "pallet-balances/std",
"sp-core/std", "sp-core/std",
+14 -12
View File
@@ -30,8 +30,8 @@
use cumulus_primitives_core::{ use cumulus_primitives_core::{
relay_chain, AbridgedHostConfiguration, ChannelStatus, CollationInfo, DmpMessageHandler, relay_chain, AbridgedHostConfiguration, ChannelStatus, CollationInfo, DmpMessageHandler,
GetChannelInfo, InboundDownwardMessage, InboundHrmpMessage, MessageSendError, OnValidationData, GetChannelInfo, InboundDownwardMessage, InboundHrmpMessage, MessageSendError, OnValidationData,
OutboundHrmpMessage, ParaId, UpwardMessage, UpwardMessageSender, XcmpMessageHandler, OutboundHrmpMessage, ParaId, PersistedValidationData, UpwardMessage, UpwardMessageSender,
XcmpMessageSource, PersistedValidationData, XcmpMessageHandler, XcmpMessageSource,
}; };
use cumulus_primitives_parachain_inherent::ParachainInherentData; use cumulus_primitives_parachain_inherent::ParachainInherentData;
use frame_support::{ use frame_support::{
@@ -46,7 +46,7 @@ use frame_system::{ensure_none, ensure_root};
use polkadot_parachain::primitives::RelayChainBlockNumber; use polkadot_parachain::primitives::RelayChainBlockNumber;
use relay_state_snapshot::MessagingStateSnapshot; use relay_state_snapshot::MessagingStateSnapshot;
use sp_runtime::{ use sp_runtime::{
traits::{BlakeTwo256, Block as BlockT, Hash, BlockNumberProvider}, traits::{BlakeTwo256, Block as BlockT, BlockNumberProvider, Hash},
transaction_validity::{ transaction_validity::{
InvalidTransaction, TransactionLongevity, TransactionSource, TransactionValidity, InvalidTransaction, TransactionLongevity, TransactionSource, TransactionValidity,
ValidTransaction, ValidTransaction,
@@ -393,7 +393,10 @@ pub mod pallet {
} }
#[pallet::weight(1_000_000)] #[pallet::weight(1_000_000)]
pub fn enact_authorized_upgrade(_: OriginFor<T>, code: Vec<u8>) -> DispatchResultWithPostInfo { pub fn enact_authorized_upgrade(
_: OriginFor<T>,
code: Vec<u8>,
) -> DispatchResultWithPostInfo {
Self::validate_authorized_upgrade(&code[..])?; Self::validate_authorized_upgrade(&code[..])?;
Self::set_code_impl(code)?; Self::set_code_impl(code)?;
AuthorizedUpgrade::<T>::kill(); AuthorizedUpgrade::<T>::kill();
@@ -403,7 +406,6 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::metadata(T::Hash = "Hash")]
pub enum Event<T: Config> { pub enum Event<T: Config> {
/// The validation function has been scheduled to apply as of the contained relay chain /// The validation function has been scheduled to apply as of the contained relay chain
/// block number. /// block number.
@@ -576,11 +578,11 @@ pub mod pallet {
.flatten() .flatten()
.expect("validation function params are always injected into inherent data; qed"); .expect("validation function params are always injected into inherent data; qed");
Some(Call::set_validation_data(data)) Some(Call::set_validation_data { data })
} }
fn is_inherent(call: &Self::Call) -> bool { fn is_inherent(call: &Self::Call) -> bool {
matches!(call, Call::set_validation_data(_)) matches!(call, Call::set_validation_data { .. })
} }
} }
@@ -599,9 +601,9 @@ pub mod pallet {
#[pallet::validate_unsigned] #[pallet::validate_unsigned]
impl<T: Config> sp_runtime::traits::ValidateUnsigned for Pallet<T> { impl<T: Config> sp_runtime::traits::ValidateUnsigned for Pallet<T> {
type Call = Call<T>; type Call = Call<T>;
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
if let Call::enact_authorized_upgrade(ref code) = call { if let Call::enact_authorized_upgrade { ref code } = call {
if let Ok(hash) = Self::validate_authorized_upgrade(code) { if let Ok(hash) = Self::validate_authorized_upgrade(code) {
return Ok(ValidTransaction { return Ok(ValidTransaction {
priority: 100, priority: 100,
@@ -612,7 +614,7 @@ pub mod pallet {
}); });
} }
} }
if let Call::set_validation_data(..) = call { if let Call::set_validation_data { .. } = call {
return Ok(Default::default()); return Ok(Default::default());
} }
Err(InvalidTransaction::Call.into()) Err(InvalidTransaction::Call.into())
@@ -942,7 +944,7 @@ impl<T: Config> Pallet<T> {
pub struct ParachainSetCode<T>(sp_std::marker::PhantomData<T>); pub struct ParachainSetCode<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> frame_system::SetCode for ParachainSetCode<T> { impl<T: Config> frame_system::SetCode<T> for ParachainSetCode<T> {
fn set_code(code: Vec<u8>) -> DispatchResult { fn set_code(code: Vec<u8>) -> DispatchResult {
Pallet::<T>::set_code_impl(code) Pallet::<T>::set_code_impl(code)
} }
@@ -956,7 +958,7 @@ impl<T: Config> frame_system::SetCode for ParachainSetCode<T> {
/// A head for an empty chain is agreed to be a zero hash. /// A head for an empty chain is agreed to be a zero hash.
/// ///
/// [hash chain]: https://en.wikipedia.org/wiki/Hash_chain /// [hash chain]: https://en.wikipedia.org/wiki/Hash_chain
#[derive(Default, Clone, codec::Encode, codec::Decode)] #[derive(Default, Clone, codec::Encode, codec::Decode, scale_info::TypeInfo)]
struct MessageQueueChain(relay_chain::Hash); struct MessageQueueChain(relay_chain::Hash);
impl MessageQueueChain { impl MessageQueueChain {
@@ -18,6 +18,7 @@ use codec::{Decode, Encode};
use cumulus_primitives_core::{ use cumulus_primitives_core::{
relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId, relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId,
}; };
use scale_info::TypeInfo;
use sp_trie::{MemoryDB, HashDBT, EMPTY_PREFIX}; use sp_trie::{MemoryDB, HashDBT, EMPTY_PREFIX};
use sp_runtime::traits::HashFor; use sp_runtime::traits::HashFor;
use sp_state_machine::{Backend, TrieBackend}; use sp_state_machine::{Backend, TrieBackend};
@@ -29,7 +30,7 @@ use sp_trie::StorageProof;
/// This data is essential for making sure that the parachain is aware of current resource use on /// This data is essential for making sure that the parachain is aware of current resource use on
/// the relay chain and that the candidates produced for this parachain do not exceed any of these /// the relay chain and that the candidates produced for this parachain do not exceed any of these
/// limits. /// limits.
#[derive(Clone, Encode, Decode)] #[derive(Clone, Encode, Decode, TypeInfo)]
pub struct MessagingStateSnapshot { pub struct MessagingStateSnapshot {
/// The current message queue chain head for downward message queue. /// The current message queue chain head for downward message queue.
/// ///
@@ -128,7 +128,7 @@ where
.iter() .iter()
.filter_map(|e| e.call().is_sub_type()) .filter_map(|e| e.call().is_sub_type())
.find_map(|c| match c { .find_map(|c| match c {
crate::Call::set_validation_data(validation_data) => Some(validation_data.clone()), crate::Call::set_validation_data { data: validation_data } => Some(validation_data.clone()),
_ => None, _ => None,
}) })
.expect("Could not find `set_validation_data` inherent"); .expect("Could not find `set_validation_data` inherent");
+2
View File
@@ -6,6 +6,7 @@ version = "0.1.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -22,6 +23,7 @@ cumulus-primitives-core = { path = "../../primitives/core", default-features = f
default = ["std"] default = ["std"]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"sp-std/std", "sp-std/std",
+2 -2
View File
@@ -24,6 +24,7 @@ use sp_std::{prelude::*, convert::TryFrom};
use cumulus_primitives_core::{ParaId, DmpMessageHandler}; use cumulus_primitives_core::{ParaId, DmpMessageHandler};
use cumulus_primitives_core::relay_chain::BlockNumber as RelayBlockNumber; use cumulus_primitives_core::relay_chain::BlockNumber as RelayBlockNumber;
use codec::{Encode, Decode}; use codec::{Encode, Decode};
use scale_info::TypeInfo;
use sp_runtime::traits::BadOrigin; use sp_runtime::traits::BadOrigin;
use xcm::{VersionedXcm, latest::{Xcm, Outcome, Parent, ExecuteXcm}}; use xcm::{VersionedXcm, latest::{Xcm, Outcome, Parent, ExecuteXcm}};
use frame_support::dispatch::Weight; use frame_support::dispatch::Weight;
@@ -60,7 +61,6 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::metadata(T::BlockNumber = "BlockNumber")]
pub enum Event<T: Config> { pub enum Event<T: Config> {
/// Downward message is invalid XCM. /// Downward message is invalid XCM.
/// \[ id \] /// \[ id \]
@@ -74,7 +74,7 @@ pub mod pallet {
} }
/// Origin for the parachains module. /// Origin for the parachains module.
#[derive(PartialEq, Eq, Clone, Encode, Decode)] #[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "std", derive(Debug))] #[cfg_attr(feature = "std", derive(Debug))]
#[pallet::origin] #[pallet::origin]
pub enum Origin { pub enum Origin {
+2
View File
@@ -7,6 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
# Other dependencies # Other dependencies
codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ], default-features = false } codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ], default-features = false }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
rand_chacha = { version = "0.3.0", default-features = false } rand_chacha = { version = "0.3.0", default-features = false }
@@ -35,6 +36,7 @@ default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"log/std", "log/std",
"scale-info/std",
"sp-std/std", "sp-std/std",
"sp-runtime/std", "sp-runtime/std",
"frame-support/std", "frame-support/std",
+6 -6
View File
@@ -41,6 +41,7 @@ use rand_chacha::{
rand_core::{RngCore, SeedableRng}, rand_core::{RngCore, SeedableRng},
ChaChaRng, ChaChaRng,
}; };
use scale_info::TypeInfo;
use sp_runtime::{traits::Hash, RuntimeDebug}; use sp_runtime::{traits::Hash, RuntimeDebug};
use sp_std::{prelude::*, convert::TryFrom}; use sp_std::{prelude::*, convert::TryFrom};
use xcm::{latest::prelude::*, WrapVersion, VersionedXcm}; use xcm::{latest::prelude::*, WrapVersion, VersionedXcm};
@@ -96,7 +97,6 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::metadata(Option<T::Hash> = "Option<Hash>")]
pub enum Event<T: Config> { pub enum Event<T: Config> {
/// Some XCM was executed ok. /// Some XCM was executed ok.
Success(Option<T::Hash>), Success(Option<T::Hash>),
@@ -172,19 +172,19 @@ pub mod pallet {
pub(super) type QueueConfig<T: Config> = StorageValue<_, QueueConfigData, ValueQuery>; pub(super) type QueueConfig<T: Config> = StorageValue<_, QueueConfigData, ValueQuery>;
} }
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, TypeInfo)]
pub enum InboundStatus { pub enum InboundStatus {
Ok, Ok,
Suspended, Suspended,
} }
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)] #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
pub enum OutboundStatus { pub enum OutboundStatus {
Ok, Ok,
Suspended, Suspended,
} }
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)] #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct QueueConfigData { pub struct QueueConfigData {
/// The number of pages of messages which must be in the queue for the other side to be told to /// The number of pages of messages which must be in the queue for the other side to be told to
/// suspend their sending. /// suspend their sending.
@@ -195,14 +195,14 @@ pub struct QueueConfigData {
/// The number of pages of messages which the queue must be reduced to before it signals that /// The number of pages of messages which the queue must be reduced to before it signals that
/// message sending may recommence after it has been suspended. /// message sending may recommence after it has been suspended.
resume_threshold: u32, resume_threshold: u32,
// The amount of remaining weight under which we stop processing messages. /// The amount of remaining weight under which we stop processing messages.
threshold_weight: Weight, threshold_weight: Weight,
/// The speed to which the available weight approaches the maximum weight. A lower number /// The speed to which the available weight approaches the maximum weight. A lower number
/// results in a faster progression. A value of 1 makes the entire weight available initially. /// results in a faster progression. A value of 1 makes the entire weight available initially.
weight_restrict_decay: Weight, weight_restrict_decay: Weight,
} }
#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode)] #[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, TypeInfo)]
pub enum ChannelSignal { pub enum ChannelSignal {
Suspend, Suspend,
Resume, Resume,
@@ -6,6 +6,7 @@ version = "0.1.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -17,6 +18,7 @@ cumulus-primitives-core = { path = "../../../primitives/core", default-features
default = ["std"] default = ["std"]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"frame-support/std", "frame-support/std",
@@ -6,6 +6,7 @@ version = "0.1.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -22,6 +23,7 @@ cumulus-pallet-xcm = { path = "../../../pallets/xcm", default-features = false }
default = ["std"] default = ["std"]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"sp-std/std", "sp-std/std",
@@ -79,7 +79,6 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::metadata(T::BlockNumber = "BlockNumber")]
pub enum Event<T: Config> { pub enum Event<T: Config> {
PingSent(ParaId, u32, Vec<u8>), PingSent(ParaId, u32, Vec<u8>),
Pinged(ParaId, u32, Vec<u8>), Pinged(ParaId, u32, Vec<u8>),
@@ -105,7 +104,7 @@ pub mod pallet {
Xcm(vec![Transact { Xcm(vec![Transact {
origin_type: OriginKind::Native, origin_type: OriginKind::Native,
require_weight_at_most: 1_000, require_weight_at_most: 1_000,
call: <T as Config>::Call::from(Call::<T>::ping(seq, payload.clone())).encode().into(), call: <T as Config>::Call::from(Call::<T>::ping { seq, payload: payload.clone() }).encode().into(),
}]), }]),
) { ) {
Ok(()) => { Ok(()) => {
@@ -167,7 +166,7 @@ pub mod pallet {
Xcm(vec![Transact { Xcm(vec![Transact {
origin_type: OriginKind::Native, origin_type: OriginKind::Native,
require_weight_at_most: 1_000, require_weight_at_most: 1_000,
call: <T as Config>::Call::from(Call::<T>::pong(seq, payload.clone())).encode().into(), call: <T as Config>::Call::from(Call::<T>::pong { seq, payload: payload.clone() } ).encode().into(),
}]), }]),
) { ) {
Ok(()) => Self::deposit_event(Event::PongSent(para, seq, payload)), Ok(()) => Self::deposit_event(Event::PongSent(para, seq, payload)),
@@ -11,6 +11,7 @@ targets = ['x86_64-unknown-linux-gnu']
[dependencies] [dependencies]
# External dependencies # External dependencies
codec = { package = 'parity-scale-codec', version = '2.0.0', features = ['derive'], default-features = false } codec = { package = 'parity-scale-codec', version = '2.0.0', features = ['derive'], default-features = false }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
# Substrate dependencies # Substrate dependencies
sp-consensus-aura = { git = 'https://github.com/paritytech/substrate', branch = "master", default-features = false } sp-consensus-aura = { git = 'https://github.com/paritytech/substrate', branch = "master", default-features = false }
@@ -42,6 +43,7 @@ substrate-wasm-builder = { git = 'https://github.com/paritytech/substrate', bran
default = ["std"] default = ["std"]
std = [ std = [
'codec/std', 'codec/std',
'scale-info/std',
'sp-consensus-aura/std', 'sp-consensus-aura/std',
'sp-std/std', 'sp-std/std',
'sp-io/std', 'sp-io/std',
@@ -7,6 +7,7 @@ description = "Simple runtime used by the rococo parachain(s)"
[dependencies] [dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false } parachain-info = { path = "../pallets/parachain-info", default-features = false }
@@ -63,6 +64,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran
default = [ "std" ] default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"log/std", "log/std",
"sp-api/std", "sp-api/std",
@@ -538,7 +538,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
@@ -7,6 +7,7 @@ edition = '2018'
[dependencies] [dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false } parachain-info = { path = "../pallets/parachain-info", default-features = false }
@@ -44,6 +45,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran
default = [ "std" ] default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"log/std", "log/std",
"sp-api/std", "sp-api/std",
+4 -2
View File
@@ -22,6 +22,8 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata; use sp_core::OpaqueMetadata;
use sp_runtime::{ use sp_runtime::{
@@ -241,7 +243,7 @@ construct_runtime! {
} }
/// Simple implementation which fails any transaction which is signed. /// Simple implementation which fails any transaction which is signed.
#[derive(Eq, PartialEq, Clone, Default, sp_core::RuntimeDebug, codec::Encode, codec::Decode)] #[derive(Eq, PartialEq, Clone, Default, sp_core::RuntimeDebug, Encode, Decode, TypeInfo)]
pub struct DisallowSigned; pub struct DisallowSigned;
impl sp_runtime::traits::SignedExtension for DisallowSigned { impl sp_runtime::traits::SignedExtension for DisallowSigned {
const IDENTIFIER: &'static str = "DisallowSigned"; const IDENTIFIER: &'static str = "DisallowSigned";
@@ -319,7 +321,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
@@ -8,6 +8,7 @@ description = "Kusama variant of Statemint parachain runtime"
[dependencies] [dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive", "max-encoded-len"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false } parachain-info = { path = "../pallets/parachain-info", default-features = false }
smallvec = "1.6.1" smallvec = "1.6.1"
@@ -101,6 +102,7 @@ runtime-benchmarks = [
] ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"log/std", "log/std",
"sp-api/std", "sp-api/std",
@@ -321,6 +321,7 @@ parameter_types! {
/// The type used to represent the kinds of proxying allowed. /// The type used to represent the kinds of proxying allowed.
#[derive( #[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen,
scale_info::TypeInfo,
)] )]
pub enum ProxyType { pub enum ProxyType {
/// Fully permissioned proxy. Can execute any call on behalf of _proxied_. /// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
@@ -348,58 +349,61 @@ impl InstanceFilter<Call> for ProxyType {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => { ProxyType::NonTransfer => {
!matches!(c, Call::Balances(..) | Call::Assets(..) | Call::Uniques(..)) !matches!(c, Call::Balances { .. } | Call::Assets { .. } | Call::Uniques { .. })
} }
ProxyType::CancelProxy => matches!( ProxyType::CancelProxy => matches!(
c, c,
Call::Proxy(pallet_proxy::Call::reject_announcement(..)) Call::Proxy(pallet_proxy::Call::reject_announcement { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::Assets => { ProxyType::Assets => {
matches!( matches!(
c, c,
Call::Assets(..) | Call::Utility(..) | Call::Multisig(..) | Call::Uniques(..) Call::Assets { .. }
| Call::Utility { .. }
| Call::Multisig { .. }
| Call::Uniques { .. }
) )
} }
ProxyType::AssetOwner => matches!( ProxyType::AssetOwner => matches!(
c, c,
Call::Assets(pallet_assets::Call::create(..)) Call::Assets(pallet_assets::Call::create { .. })
| Call::Assets(pallet_assets::Call::destroy(..)) | Call::Assets(pallet_assets::Call::destroy { .. })
| Call::Assets(pallet_assets::Call::transfer_ownership(..)) | Call::Assets(pallet_assets::Call::transfer_ownership { .. })
| Call::Assets(pallet_assets::Call::set_team(..)) | Call::Assets(pallet_assets::Call::set_team { .. })
| Call::Assets(pallet_assets::Call::set_metadata(..)) | Call::Assets(pallet_assets::Call::set_metadata { .. })
| Call::Assets(pallet_assets::Call::clear_metadata(..)) | Call::Assets(pallet_assets::Call::clear_metadata { .. })
| Call::Uniques(pallet_uniques::Call::create(..)) | Call::Uniques(pallet_uniques::Call::create { .. })
| Call::Uniques(pallet_uniques::Call::destroy(..)) | Call::Uniques(pallet_uniques::Call::destroy { .. })
| Call::Uniques(pallet_uniques::Call::transfer_ownership(..)) | Call::Uniques(pallet_uniques::Call::transfer_ownership { .. })
| Call::Uniques(pallet_uniques::Call::set_team(..)) | Call::Uniques(pallet_uniques::Call::set_team { .. })
| Call::Uniques(pallet_uniques::Call::set_metadata(..)) | Call::Uniques(pallet_uniques::Call::set_metadata { .. })
| Call::Uniques(pallet_uniques::Call::set_attribute(..)) | Call::Uniques(pallet_uniques::Call::set_attribute { .. })
| Call::Uniques(pallet_uniques::Call::set_class_metadata(..)) | Call::Uniques(pallet_uniques::Call::set_class_metadata { .. })
| Call::Uniques(pallet_uniques::Call::clear_metadata(..)) | Call::Uniques(pallet_uniques::Call::clear_metadata { .. })
| Call::Uniques(pallet_uniques::Call::clear_attribute(..)) | Call::Uniques(pallet_uniques::Call::clear_attribute { .. })
| Call::Uniques(pallet_uniques::Call::clear_class_metadata(..)) | Call::Uniques(pallet_uniques::Call::clear_class_metadata { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::AssetManager => matches!( ProxyType::AssetManager => matches!(
c, c,
Call::Assets(pallet_assets::Call::mint(..)) Call::Assets(pallet_assets::Call::mint { .. })
| Call::Assets(pallet_assets::Call::burn(..)) | Call::Assets(pallet_assets::Call::burn { .. })
| Call::Assets(pallet_assets::Call::freeze(..)) | Call::Assets(pallet_assets::Call::freeze { .. })
| Call::Assets(pallet_assets::Call::thaw(..)) | Call::Assets(pallet_assets::Call::thaw { .. })
| Call::Assets(pallet_assets::Call::freeze_asset(..)) | Call::Assets(pallet_assets::Call::freeze_asset { .. })
| Call::Assets(pallet_assets::Call::thaw_asset(..)) | Call::Assets(pallet_assets::Call::thaw_asset { .. })
| Call::Uniques(pallet_uniques::Call::mint(..)) | Call::Uniques(pallet_uniques::Call::mint { .. })
| Call::Uniques(pallet_uniques::Call::burn(..)) | Call::Uniques(pallet_uniques::Call::burn { .. })
| Call::Uniques(pallet_uniques::Call::freeze(..)) | Call::Uniques(pallet_uniques::Call::freeze { .. })
| Call::Uniques(pallet_uniques::Call::thaw(..)) | Call::Uniques(pallet_uniques::Call::thaw { .. })
| Call::Uniques(pallet_uniques::Call::freeze_class(..)) | Call::Uniques(pallet_uniques::Call::freeze_class { .. })
| Call::Uniques(pallet_uniques::Call::thaw_class(..)) | Call::Uniques(pallet_uniques::Call::thaw_class { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::Collator => matches!( ProxyType::Collator => matches!(
c, c,
Call::CollatorSelection(..) | Call::Utility(..) | Call::Multisig(..) Call::CollatorSelection { .. } | Call::Utility { .. } | Call::Multisig { .. }
), ),
} }
} }
@@ -771,7 +775,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
@@ -8,6 +8,7 @@ description = "Statemint parachain runtime"
[dependencies] [dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive", "max-encoded-len"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false } parachain-info = { path = "../pallets/parachain-info", default-features = false }
smallvec = "1.6.1" smallvec = "1.6.1"
@@ -101,6 +102,7 @@ runtime-benchmarks = [
] ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"log/std", "log/std",
"sp-api/std", "sp-api/std",
@@ -288,6 +288,7 @@ parameter_types! {
/// The type used to represent the kinds of proxying allowed. /// The type used to represent the kinds of proxying allowed.
#[derive( #[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen,
scale_info::TypeInfo,
)] )]
pub enum ProxyType { pub enum ProxyType {
/// Fully permissioned proxy. Can execute any call on behalf of _proxied_. /// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
@@ -315,58 +316,61 @@ impl InstanceFilter<Call> for ProxyType {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => { ProxyType::NonTransfer => {
!matches!(c, Call::Balances(..) | Call::Assets(..) | Call::Uniques(..)) !matches!(c, Call::Balances { .. } | Call::Assets { .. } | Call::Uniques { .. })
} }
ProxyType::CancelProxy => matches!( ProxyType::CancelProxy => matches!(
c, c,
Call::Proxy(pallet_proxy::Call::reject_announcement(..)) Call::Proxy(pallet_proxy::Call::reject_announcement { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::Assets => { ProxyType::Assets => {
matches!( matches!(
c, c,
Call::Assets(..) | Call::Utility(..) | Call::Multisig(..) | Call::Uniques(..) Call::Assets { .. }
| Call::Utility { .. }
| Call::Multisig { .. }
| Call::Uniques { .. }
) )
} }
ProxyType::AssetOwner => matches!( ProxyType::AssetOwner => matches!(
c, c,
Call::Assets(pallet_assets::Call::create(..)) Call::Assets(pallet_assets::Call::create { .. })
| Call::Assets(pallet_assets::Call::destroy(..)) | Call::Assets(pallet_assets::Call::destroy { .. })
| Call::Assets(pallet_assets::Call::transfer_ownership(..)) | Call::Assets(pallet_assets::Call::transfer_ownership { .. })
| Call::Assets(pallet_assets::Call::set_team(..)) | Call::Assets(pallet_assets::Call::set_team { .. })
| Call::Assets(pallet_assets::Call::set_metadata(..)) | Call::Assets(pallet_assets::Call::set_metadata { .. })
| Call::Assets(pallet_assets::Call::clear_metadata(..)) | Call::Assets(pallet_assets::Call::clear_metadata { .. })
| Call::Uniques(pallet_uniques::Call::create(..)) | Call::Uniques(pallet_uniques::Call::create { .. })
| Call::Uniques(pallet_uniques::Call::destroy(..)) | Call::Uniques(pallet_uniques::Call::destroy { .. })
| Call::Uniques(pallet_uniques::Call::transfer_ownership(..)) | Call::Uniques(pallet_uniques::Call::transfer_ownership { .. })
| Call::Uniques(pallet_uniques::Call::set_team(..)) | Call::Uniques(pallet_uniques::Call::set_team { .. })
| Call::Uniques(pallet_uniques::Call::set_metadata(..)) | Call::Uniques(pallet_uniques::Call::set_metadata { .. })
| Call::Uniques(pallet_uniques::Call::set_attribute(..)) | Call::Uniques(pallet_uniques::Call::set_attribute { .. })
| Call::Uniques(pallet_uniques::Call::set_class_metadata(..)) | Call::Uniques(pallet_uniques::Call::set_class_metadata { .. })
| Call::Uniques(pallet_uniques::Call::clear_metadata(..)) | Call::Uniques(pallet_uniques::Call::clear_metadata { .. })
| Call::Uniques(pallet_uniques::Call::clear_attribute(..)) | Call::Uniques(pallet_uniques::Call::clear_attribute { .. })
| Call::Uniques(pallet_uniques::Call::clear_class_metadata(..)) | Call::Uniques(pallet_uniques::Call::clear_class_metadata { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::AssetManager => matches!( ProxyType::AssetManager => matches!(
c, c,
Call::Assets(pallet_assets::Call::mint(..)) Call::Assets(pallet_assets::Call::mint { .. })
| Call::Assets(pallet_assets::Call::burn(..)) | Call::Assets(pallet_assets::Call::burn { .. })
| Call::Assets(pallet_assets::Call::freeze(..)) | Call::Assets(pallet_assets::Call::freeze { .. })
| Call::Assets(pallet_assets::Call::thaw(..)) | Call::Assets(pallet_assets::Call::thaw { .. })
| Call::Assets(pallet_assets::Call::freeze_asset(..)) | Call::Assets(pallet_assets::Call::freeze_asset { .. })
| Call::Assets(pallet_assets::Call::thaw_asset(..)) | Call::Assets(pallet_assets::Call::thaw_asset { .. })
| Call::Uniques(pallet_uniques::Call::mint(..)) | Call::Uniques(pallet_uniques::Call::mint { .. })
| Call::Uniques(pallet_uniques::Call::burn(..)) | Call::Uniques(pallet_uniques::Call::burn { .. })
| Call::Uniques(pallet_uniques::Call::freeze(..)) | Call::Uniques(pallet_uniques::Call::freeze { .. })
| Call::Uniques(pallet_uniques::Call::thaw(..)) | Call::Uniques(pallet_uniques::Call::thaw { .. })
| Call::Uniques(pallet_uniques::Call::freeze_class(..)) | Call::Uniques(pallet_uniques::Call::freeze_class { .. })
| Call::Uniques(pallet_uniques::Call::thaw_class(..)) | Call::Uniques(pallet_uniques::Call::thaw_class { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::Collator => matches!( ProxyType::Collator => matches!(
c, c,
Call::CollatorSelection(..) | Call::Utility(..) | Call::Multisig(..) Call::CollatorSelection { .. } | Call::Utility { .. } | Call::Multisig { .. }
), ),
} }
} }
@@ -753,7 +757,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
@@ -8,6 +8,7 @@ description = "Westend variant of Statemint parachain runtime"
[dependencies] [dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive", "max-encoded-len"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
parachain-info = { path = "../pallets/parachain-info", default-features = false } parachain-info = { path = "../pallets/parachain-info", default-features = false }
smallvec = "1.6.1" smallvec = "1.6.1"
@@ -101,6 +102,7 @@ runtime-benchmarks = [
] ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"serde", "serde",
"log/std", "log/std",
"sp-api/std", "sp-api/std",
+40 -36
View File
@@ -287,6 +287,7 @@ parameter_types! {
/// The type used to represent the kinds of proxying allowed. /// The type used to represent the kinds of proxying allowed.
#[derive( #[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen,
scale_info::TypeInfo,
)] )]
pub enum ProxyType { pub enum ProxyType {
/// Fully permissioned proxy. Can execute any call on behalf of _proxied_. /// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
@@ -314,58 +315,61 @@ impl InstanceFilter<Call> for ProxyType {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => { ProxyType::NonTransfer => {
!matches!(c, Call::Balances(..) | Call::Assets(..) | Call::Uniques(..)) !matches!(c, Call::Balances { .. } | Call::Assets { .. } | Call::Uniques { .. })
} }
ProxyType::CancelProxy => matches!( ProxyType::CancelProxy => matches!(
c, c,
Call::Proxy(pallet_proxy::Call::reject_announcement(..)) Call::Proxy(pallet_proxy::Call::reject_announcement { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::Assets => { ProxyType::Assets => {
matches!( matches!(
c, c,
Call::Assets(..) | Call::Utility(..) | Call::Multisig(..) | Call::Uniques(..) Call::Assets { .. }
| Call::Utility { .. }
| Call::Multisig { .. }
| Call::Uniques { .. }
) )
} }
ProxyType::AssetOwner => matches!( ProxyType::AssetOwner => matches!(
c, c,
Call::Assets(pallet_assets::Call::create(..)) Call::Assets(pallet_assets::Call::create { .. })
| Call::Assets(pallet_assets::Call::destroy(..)) | Call::Assets(pallet_assets::Call::destroy { .. })
| Call::Assets(pallet_assets::Call::transfer_ownership(..)) | Call::Assets(pallet_assets::Call::transfer_ownership { .. })
| Call::Assets(pallet_assets::Call::set_team(..)) | Call::Assets(pallet_assets::Call::set_team { .. })
| Call::Assets(pallet_assets::Call::set_metadata(..)) | Call::Assets(pallet_assets::Call::set_metadata { .. })
| Call::Assets(pallet_assets::Call::clear_metadata(..)) | Call::Assets(pallet_assets::Call::clear_metadata { .. })
| Call::Uniques(pallet_uniques::Call::create(..)) | Call::Uniques(pallet_uniques::Call::create { .. })
| Call::Uniques(pallet_uniques::Call::destroy(..)) | Call::Uniques(pallet_uniques::Call::destroy { .. })
| Call::Uniques(pallet_uniques::Call::transfer_ownership(..)) | Call::Uniques(pallet_uniques::Call::transfer_ownership { .. })
| Call::Uniques(pallet_uniques::Call::set_team(..)) | Call::Uniques(pallet_uniques::Call::set_team { .. })
| Call::Uniques(pallet_uniques::Call::set_metadata(..)) | Call::Uniques(pallet_uniques::Call::set_metadata { .. })
| Call::Uniques(pallet_uniques::Call::set_attribute(..)) | Call::Uniques(pallet_uniques::Call::set_attribute { .. })
| Call::Uniques(pallet_uniques::Call::set_class_metadata(..)) | Call::Uniques(pallet_uniques::Call::set_class_metadata { .. })
| Call::Uniques(pallet_uniques::Call::clear_metadata(..)) | Call::Uniques(pallet_uniques::Call::clear_metadata { .. })
| Call::Uniques(pallet_uniques::Call::clear_attribute(..)) | Call::Uniques(pallet_uniques::Call::clear_attribute { .. })
| Call::Uniques(pallet_uniques::Call::clear_class_metadata(..)) | Call::Uniques(pallet_uniques::Call::clear_class_metadata { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::AssetManager => matches!( ProxyType::AssetManager => matches!(
c, c,
Call::Assets(pallet_assets::Call::mint(..)) Call::Assets(pallet_assets::Call::mint { .. })
| Call::Assets(pallet_assets::Call::burn(..)) | Call::Assets(pallet_assets::Call::burn { .. })
| Call::Assets(pallet_assets::Call::freeze(..)) | Call::Assets(pallet_assets::Call::freeze { .. })
| Call::Assets(pallet_assets::Call::thaw(..)) | Call::Assets(pallet_assets::Call::thaw { .. })
| Call::Assets(pallet_assets::Call::freeze_asset(..)) | Call::Assets(pallet_assets::Call::freeze_asset { .. })
| Call::Assets(pallet_assets::Call::thaw_asset(..)) | Call::Assets(pallet_assets::Call::thaw_asset { .. })
| Call::Uniques(pallet_uniques::Call::mint(..)) | Call::Uniques(pallet_uniques::Call::mint { .. })
| Call::Uniques(pallet_uniques::Call::burn(..)) | Call::Uniques(pallet_uniques::Call::burn { .. })
| Call::Uniques(pallet_uniques::Call::freeze(..)) | Call::Uniques(pallet_uniques::Call::freeze { .. })
| Call::Uniques(pallet_uniques::Call::thaw(..)) | Call::Uniques(pallet_uniques::Call::thaw { .. })
| Call::Uniques(pallet_uniques::Call::freeze_class(..)) | Call::Uniques(pallet_uniques::Call::freeze_class { .. })
| Call::Uniques(pallet_uniques::Call::thaw_class(..)) | Call::Uniques(pallet_uniques::Call::thaw_class { .. })
| Call::Utility(..) | Call::Multisig(..) | Call::Utility { .. } | Call::Multisig { .. }
), ),
ProxyType::Collator => matches!( ProxyType::Collator => matches!(
c, c,
Call::CollatorSelection(..) | Call::Utility(..) | Call::Multisig(..) Call::CollatorSelection { .. } | Call::Utility { .. } | Call::Multisig { .. }
), ),
} }
} }
@@ -756,7 +760,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
@@ -24,6 +24,7 @@ cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder",
# Other dependencies # Other dependencies
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive" ] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
tracing = { version = "0.1.22", optional = true } tracing = { version = "0.1.22", optional = true }
async-trait = { version = "0.1.42", optional = true } async-trait = { version = "0.1.42", optional = true }
@@ -32,6 +33,7 @@ default = [ "std" ]
std = [ std = [
"async-trait", "async-trait",
"codec/std", "codec/std",
"scale-info/std",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"sp-inherents/std", "sp-inherents/std",
"sp-core/std", "sp-core/std",
@@ -31,6 +31,7 @@ use cumulus_primitives_core::{
InboundDownwardMessage, InboundHrmpMessage, ParaId, PersistedValidationData, InboundDownwardMessage, InboundHrmpMessage, ParaId, PersistedValidationData,
}; };
use scale_info::TypeInfo;
use sp_inherents::InherentIdentifier; use sp_inherents::InherentIdentifier;
use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; use sp_std::{collections::btree_map::BTreeMap, vec::Vec};
@@ -47,7 +48,7 @@ pub use mock::MockValidationDataInherentDataProvider;
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"sysi1337"; pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"sysi1337";
/// The inherent data that is passed by the collator to the parachain runtime. /// The inherent data that is passed by the collator to the parachain runtime.
#[derive(codec::Encode, codec::Decode, sp_core::RuntimeDebug, Clone, PartialEq)] #[derive(codec::Encode, codec::Decode, sp_core::RuntimeDebug, Clone, PartialEq, TypeInfo)]
pub struct ParachainInherentData { pub struct ParachainInherentData {
pub validation_data: PersistedValidationData, pub validation_data: PersistedValidationData,
/// A storage proof of a predefined set of keys from the relay-chain. /// A storage proof of a predefined set of keys from the relay-chain.
+4 -1
View File
@@ -170,7 +170,10 @@ pub fn transfer(
dest: sp_keyring::AccountKeyring, dest: sp_keyring::AccountKeyring,
value: Balance, value: Balance,
) -> UncheckedExtrinsic { ) -> UncheckedExtrinsic {
let function = Call::Balances(pallet_balances::Call::transfer(dest.public().into(), value)); let function = Call::Balances(pallet_balances::Call::transfer {
dest: dest.public().into(),
value,
});
generate_extrinsic(client, origin, function) generate_extrinsic(client, origin, function)
} }
+2
View File
@@ -6,6 +6,7 @@ edition = "2018"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
# Substrate dependencies # Substrate dependencies
@@ -41,6 +42,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran
default = [ "std", "upgrade" ] default = [ "std", "upgrade" ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"cumulus-pallet-parachain-system/std", "cumulus-pallet-parachain-system/std",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"cumulus-primitives-timestamp/std", "cumulus-primitives-timestamp/std",
+2
View File
@@ -6,6 +6,7 @@ edition = "2018"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
# Substrate dependencies # Substrate dependencies
@@ -41,6 +42,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran
default = [ "std" ] default = [ "std" ]
std = [ std = [
"codec/std", "codec/std",
"scale-info/std",
"cumulus-pallet-parachain-system/std", "cumulus-pallet-parachain-system/std",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
"cumulus-primitives-timestamp/std", "cumulus-primitives-timestamp/std",
+1 -1
View File
@@ -347,7 +347,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
+6 -3
View File
@@ -391,7 +391,7 @@ impl TestNodeBuilder {
/// Create a new instance of `Self`. /// Create a new instance of `Self`.
/// ///
/// `para_id` - The parachain id this node is running for. /// `para_id` - The parachain id this node is running for.
/// `task_executor` - The task executor to use. /// `tokio_handle` - The tokio handler to use.
/// `key` - The key that will be used to generate the name and that will be passed as `dev_seed`. /// `key` - The key that will be used to generate the name and that will be passed as `dev_seed`.
pub fn new(para_id: ParaId, tokio_handle: tokio::runtime::Handle, key: Sr25519Keyring) -> Self { pub fn new(para_id: ParaId, tokio_handle: tokio::runtime::Handle, key: Sr25519Keyring) -> Self {
TestNodeBuilder { TestNodeBuilder {
@@ -682,10 +682,13 @@ impl TestNode {
/// Register a parachain at this relay chain. /// Register a parachain at this relay chain.
pub async fn schedule_upgrade(&self, validation: Vec<u8>) -> Result<(), RpcTransactionError> { pub async fn schedule_upgrade(&self, validation: Vec<u8>) -> Result<(), RpcTransactionError> {
let call = frame_system::Call::set_code(validation); let call = frame_system::Call::set_code { code: validation };
self.send_extrinsic( self.send_extrinsic(
runtime::SudoCall::sudo_unchecked_weight(Box::new(call.into()), 1_000), runtime::SudoCall::sudo_unchecked_weight {
call: Box::new(call.into()),
weight: 1_000,
},
Sr25519Keyring::Alice, Sr25519Keyring::Alice,
) )
.await .await