mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
WIP: Update Substrate & Polkadot (#496)
* WIP: Update Substrate * Update Substrate & Polkadot * fixes * more fixes * few missing origins * use spawn_essential_handle * bump polkadot dep * remove newlines * fix test Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -123,14 +123,14 @@ pub mod pallet {
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::weight(0)]
|
||||
fn start(origin: OriginFor<T>, para: ParaId, payload: Vec<u8>) -> DispatchResult {
|
||||
pub fn start(origin: OriginFor<T>, para: ParaId, payload: Vec<u8>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Targets::<T>::mutate(|t| t.push((para, payload)));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
fn start_many(origin: OriginFor<T>, para: ParaId, count: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
pub fn start_many(origin: OriginFor<T>, para: ParaId, count: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
for _ in 0..count {
|
||||
Targets::<T>::mutate(|t| t.push((para, payload.clone())));
|
||||
@@ -139,14 +139,14 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
fn stop(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
|
||||
pub fn stop(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Targets::<T>::mutate(|t| if let Some(p) = t.iter().position(|(p, _)| p == ¶) { t.swap_remove(p); });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
fn stop_all(origin: OriginFor<T>, maybe_para: Option<ParaId>) -> DispatchResult {
|
||||
pub fn stop_all(origin: OriginFor<T>, maybe_para: Option<ParaId>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
if let Some(para) = maybe_para {
|
||||
Targets::<T>::mutate(|t| t.retain(|&(x, _)| x != para));
|
||||
@@ -157,7 +157,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
fn ping(origin: OriginFor<T>, seq: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
pub fn ping(origin: OriginFor<T>, seq: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
// Only accept pings from other chains.
|
||||
let para = ensure_sibling_para(<T as Config>::Origin::from(origin))?;
|
||||
|
||||
@@ -177,7 +177,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
fn pong(origin: OriginFor<T>, seq: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
pub fn pong(origin: OriginFor<T>, seq: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
// Only accept pings from other chains.
|
||||
let para = ensure_sibling_para(<T as Config>::Origin::from(origin))?;
|
||||
|
||||
|
||||
@@ -222,6 +222,8 @@ impl pallet_balances::Config for Runtime {
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
}
|
||||
|
||||
impl pallet_randomness_collective_flip::Config for Runtime {}
|
||||
|
||||
impl pallet_transaction_payment::Config for Runtime {
|
||||
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
@@ -436,10 +438,10 @@ construct_runtime! {
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
||||
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
|
||||
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
|
||||
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>} = 20,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
|
||||
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
|
||||
|
||||
@@ -226,7 +226,7 @@ construct_runtime! {
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned},
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>},
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config},
|
||||
|
||||
// DMP handler.
|
||||
|
||||
@@ -163,7 +163,7 @@ where
|
||||
config.transaction_pool.clone(),
|
||||
config.role.is_authority().into(),
|
||||
config.prometheus_registry(),
|
||||
task_manager.spawn_handle(),
|
||||
task_manager.spawn_essential_handle(),
|
||||
client.clone(),
|
||||
);
|
||||
|
||||
|
||||
@@ -466,6 +466,8 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type ReservedXcmpWeight = ReservedXcmpWeight;
|
||||
}
|
||||
|
||||
impl pallet_randomness_collective_flip::Config for Runtime {}
|
||||
|
||||
impl parachain_info::Config for Runtime {}
|
||||
|
||||
impl cumulus_pallet_aura_ext::Config for Runtime {}
|
||||
@@ -669,7 +671,7 @@ construct_runtime!(
|
||||
// System support stuff.
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>} = 1,
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage} = 2,
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 2,
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
|
||||
|
||||
|
||||
@@ -53,4 +53,9 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn transfer_all() -> Weight {
|
||||
(84_170_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
use frame_support::traits::FindAuthor;
|
||||
use frame_support::{parameter_types, weights::DispatchClass, PalletId};
|
||||
use frame_support::{parameter_types, PalletId};
|
||||
use frame_system::{limits, EnsureRoot};
|
||||
use polkadot_primitives::v1::AccountId;
|
||||
use sp_core::H256;
|
||||
@@ -92,14 +92,6 @@ mod tests {
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub BlockWeights: limits::BlockWeights = limits::BlockWeights::builder()
|
||||
.for_class(DispatchClass::all(), |weight| {
|
||||
weight.base_extrinsic = 100;
|
||||
})
|
||||
.for_class(DispatchClass::non_mandatory(), |weight| {
|
||||
weight.max_total = Some(1024);
|
||||
})
|
||||
.build_or_panic();
|
||||
pub BlockLength: limits::BlockLength = limits::BlockLength::max(2 * 1024);
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
pub const MaxReserves: u32 = 50;
|
||||
@@ -119,7 +111,7 @@ mod tests {
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type BlockLength = BlockLength;
|
||||
type BlockWeights = BlockWeights;
|
||||
type BlockWeights = ();
|
||||
type DbWeight = ();
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
|
||||
@@ -226,6 +226,8 @@ impl pallet_transaction_payment::Config for Runtime {
|
||||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
|
||||
}
|
||||
|
||||
impl pallet_randomness_collective_flip::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
pub const AssetDeposit: Balance = 100 * DOLLARS; // 100 DOLLARS deposit to create asset
|
||||
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
@@ -610,7 +612,7 @@ construct_runtime!(
|
||||
// System support stuff.
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>} = 1,
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage} = 2,
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 2,
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
|
||||
|
||||
|
||||
@@ -53,4 +53,9 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn transfer_all() -> Weight {
|
||||
(84_170_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,6 +227,8 @@ impl pallet_transaction_payment::Config for Runtime {
|
||||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
|
||||
}
|
||||
|
||||
impl pallet_randomness_collective_flip::Config for Runtime {}
|
||||
|
||||
impl pallet_sudo::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
@@ -600,7 +602,7 @@ construct_runtime!(
|
||||
// System support stuff;
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config},
|
||||
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
|
||||
@@ -53,4 +53,9 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn transfer_all() -> Weight {
|
||||
(84_170_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user