Skip to content

Commit

Permalink
Fix compile
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Lau <xavier@inv.cafe>
  • Loading branch information
aurexav committed Oct 24, 2023
1 parent 80cce01 commit f6b7930
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 40 deletions.
2 changes: 1 addition & 1 deletion pallets/moonbeam-orbiters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub mod pallet {

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(_: T::BlockNumber) -> Weight {
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
// Prune old OrbiterPerRound entries
if let Some(round_to_prune) =
CurrentRound::<T>::get().checked_sub(&T::MaxRoundArchive::get())
Expand Down
2 changes: 1 addition & 1 deletion pallets/moonbeam-xcm-benchmarks/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl xcm_executor::traits::OnResponse for DevNull {
}

pub struct AccountIdConverter;
impl xcm_executor::traits::Convert<MultiLocation, u64> for AccountIdConverter {
impl xcm_executor::traits::ConvertLocation<MultiLocation, u64> for AccountIdConverter {
fn convert(ml: MultiLocation) -> Result<u64, MultiLocation> {
match ml {
MultiLocation {
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn parachain_staking_on_finalize<T: Config>(author: T::AccountId) {
/// Run to end block and author
fn roll_to_and_author<T: Config>(round_delay: u32, author: T::AccountId) {
let total_rounds = round_delay + 1u32;
let round_length: T::BlockNumber = Pallet::<T>::round().length.into();
let round_length: BlockNumberFor<T> = Pallet::<T>::round().length.into();
let mut now = <frame_system::Pallet<T>>::block_number() + 1u32.into();
let end = Pallet::<T>::round().first + (round_length * total_rounds.into());
while now < end {
Expand Down
18 changes: 9 additions & 9 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pub mod pallet {
pub enum Event<T: Config> {
/// Started new round.
NewRound {
starting_block: T::BlockNumber,
starting_block: BlockNumberFor<T>,
round: RoundIndex,
selected_collators_number: u32,
total_balance: BalanceOf<T>,
Expand Down Expand Up @@ -410,7 +410,7 @@ pub mod pallet {
/// Set blocks per round
BlocksPerRoundSet {
current_round: RoundIndex,
first_block: T::BlockNumber,
first_block: BlockNumberFor<T>,
old: u32,
new: u32,
new_per_round_inflation_min: Perbill,
Expand All @@ -433,7 +433,7 @@ pub mod pallet {

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(n: T::BlockNumber) -> Weight {
fn on_initialize(n: BlockNumberFor<T>) -> Weight {
let mut weight = T::WeightInfo::base_on_initialize();

let mut round = <Round<T>>::get();
Expand Down Expand Up @@ -470,7 +470,7 @@ pub mod pallet {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(3, 2));
weight
}
fn on_finalize(_n: T::BlockNumber) {
fn on_finalize(_n: BlockNumberFor<T>) {
Self::award_points_to_block_author();
}
}
Expand All @@ -494,7 +494,7 @@ pub mod pallet {
#[pallet::storage]
#[pallet::getter(fn round)]
/// Current round index and next round scheduled transition
pub(crate) type Round<T: Config> = StorageValue<_, RoundInfo<T::BlockNumber>, ValueQuery>;
pub(crate) type Round<T: Config> = StorageValue<_, RoundInfo<BlockNumberFor<T>>, ValueQuery>;

#[pallet::storage]
#[pallet::getter(fn delegator_state)]
Expand Down Expand Up @@ -777,13 +777,13 @@ pub mod pallet {
// Choose top TotalSelected collator candidates
let (_, v_count, _, total_staked) = <Pallet<T>>::select_top_candidates(1u32);
// Start Round 1 at Block 0
let round: RoundInfo<T::BlockNumber> =
let round: RoundInfo<BlockNumberFor<T>> =
RoundInfo::new(1u32, 0u32.into(), self.blocks_per_round);
<Round<T>>::put(round);
// Snapshot total stake
<Staked<T>>::insert(1u32, <Total<T>>::get());
<Pallet<T>>::deposit_event(Event::NewRound {
starting_block: T::BlockNumber::zero(),
starting_block: BlockNumberFor<T>::zero(),
round: 1u32,
selected_collators_number: v_count,
total_balance: total_staked,
Expand Down Expand Up @@ -1546,8 +1546,8 @@ pub mod pallet {
let return_stake = |bond: Bond<T::AccountId, BalanceOf<T>>| {
// remove delegation from delegator state
let mut delegator = DelegatorState::<T>::get(&bond.owner).expect(
"Collator state and delegator state are consistent.
Collator state has a record of this delegation. Therefore,
"Collator state and delegator state are consistent.
Collator state has a record of this delegation. Therefore,
Delegator state also has a record. qed.",
);

Expand Down
2 changes: 1 addition & 1 deletion pallets/proxy-genesis-companion/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub mod pallet {
T::AccountId,
T::AccountId,
<T as Config>::ProxyType,
T::BlockNumber,
BlockNumberFor<T>,
)>,
}

Expand Down
2 changes: 1 addition & 1 deletion precompiles/xcm-utils/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use xcm_builder::AllowUnpaidExecutionFrom;
use xcm_builder::FixedWeightBounds;
use xcm_builder::IsConcrete;
use xcm_builder::SovereignSignedViaLocation;
use xcm_executor::traits::Convert;
use xcm_executor::traits::ConvertLocation;
use xcm_executor::{
traits::{TransactAsset, WeightTrader},
Assets,
Expand Down
3 changes: 2 additions & 1 deletion primitives/xcm/src/asset_id_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ use xcm::latest::MultiLocation;
pub struct AsAssetType<AssetId, AssetType, AssetIdInfoGetter>(
PhantomData<(AssetId, AssetType, AssetIdInfoGetter)>,
);
impl<AssetId, AssetType, AssetIdInfoGetter> xcm_executor::traits::Convert<MultiLocation, AssetId>
impl<AssetId, AssetType, AssetIdInfoGetter>
xcm_executor::traits::ConvertLocation<MultiLocation, AssetId>
for AsAssetType<AssetId, AssetType, AssetIdInfoGetter>
where
AssetId: Clone,
Expand Down
2 changes: 1 addition & 1 deletion primitives/xcm/src/origin_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct SignedToAccountId20<Origin, AccountId, Network>(
sp_std::marker::PhantomData<(Origin, AccountId, Network)>,
);
impl<Origin: OriginTrait + Clone, AccountId: Into<[u8; 20]>, Network: Get<NetworkId>>
xcm_executor::traits::Convert<Origin, MultiLocation>
xcm_executor::traits::ConvertLocation<Origin, MultiLocation>
for SignedToAccountId20<Origin, AccountId, Network>
where
Origin::PalletsOrigin: From<frame_system::RawOrigin<AccountId>>
Expand Down
8 changes: 4 additions & 4 deletions runtime/moonbase/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ pub type LocationToAccountId = (

/// Wrapper type around `LocationToAccountId` to convert an `AccountId` to type `H160`.
pub struct LocationToH160;
impl xcm_executor::traits::Convert<MultiLocation, H160> for LocationToH160 {
impl xcm_executor::traits::ConvertLocation<MultiLocation, H160> for LocationToH160 {
fn convert(location: MultiLocation) -> Result<H160, MultiLocation> {
<LocationToAccountId as xcm_executor::traits::Convert<MultiLocation, AccountId>>::convert(
<LocationToAccountId as xcm_executor::traits::ConvertLocation<MultiLocation, AccountId>>::convert(
location,
)
.map(Into::into)
Expand Down Expand Up @@ -503,7 +503,7 @@ pub struct CurrencyIdtoMultiLocation<AssetXConverter>(sp_std::marker::PhantomDat
impl<AssetXConverter> sp_runtime::traits::Convert<CurrencyId, Option<MultiLocation>>
for CurrencyIdtoMultiLocation<AssetXConverter>
where
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, AssetId>,
AssetXConverter: xcm_executor::traits::ConvertLocation<MultiLocation, AssetId>,
{
fn convert(currency: CurrencyId) -> Option<MultiLocation> {
match currency {
Expand Down Expand Up @@ -679,7 +679,7 @@ mod testing {
/// AssetManager::set_asset_type_asset_id() and should NOT be used in any production code.
impl From<MultiLocation> for CurrencyId {
fn from(location: MultiLocation) -> CurrencyId {
use xcm_executor::traits::Convert as XConvert;
use xcm_executor::traits::ConvertLocation as XConvert;
use xcm_primitives::AssetTypeGetter;

// If it does not exist, for benchmarking purposes, we create the association
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbase/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use polkadot_parachain::primitives::Sibling;
use precompile_utils::testing::MockHandle;
use std::str::from_utf8;
use xcm_builder::{ParentIsPreset, SiblingParachainConvertsVia};
use xcm_executor::traits::Convert as XcmConvert;
use xcm_executor::traits::ConvertLocation as XcmConvert;

use moonbeam_xcm_benchmarks::weights::XcmWeight;
use nimbus_primitives::NimbusId;
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbase/tests/xcm_mock/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ pub struct CurrencyIdtoMultiLocation<AssetXConverter>(sp_std::marker::PhantomDat
impl<AssetXConverter> sp_runtime::traits::Convert<CurrencyId, Option<MultiLocation>>
for CurrencyIdtoMultiLocation<AssetXConverter>
where
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, AssetId>,
AssetXConverter: xcm_executor::traits::ConvertLocation<MultiLocation, AssetId>,
{
fn convert(currency: CurrencyId) -> Option<MultiLocation> {
match currency {
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbase/tests/xcm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use sp_std::boxed::Box;
use xcm::latest::prelude::*;
use xcm::{VersionedMultiLocation, WrapVersion};
use xcm_builder::HashedDescriptionDescribeFamilyAllTerminal;
use xcm_executor::traits::Convert;
use xcm_executor::traits::ConvertLocation;
use xcm_mock::*;
use xcm_primitives::{UtilityEncodeCall, DEFAULT_PROOF_SIZE};
use xcm_simulator::TestExt;
Expand Down
8 changes: 4 additions & 4 deletions runtime/moonbeam/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ pub type LocationToAccountId = (

/// Wrapper type around `LocationToAccountId` to convert an `AccountId` to type `H160`.
pub struct LocationToH160;
impl xcm_executor::traits::Convert<MultiLocation, H160> for LocationToH160 {
impl xcm_executor::traits::ConvertLocation<MultiLocation, H160> for LocationToH160 {
fn convert(location: MultiLocation) -> Result<H160, MultiLocation> {
<LocationToAccountId as xcm_executor::traits::Convert<MultiLocation, AccountId>>::convert(
<LocationToAccountId as xcm_executor::traits::ConvertLocation<MultiLocation, AccountId>>::convert(
location,
)
.map(Into::into)
Expand Down Expand Up @@ -492,7 +492,7 @@ pub struct CurrencyIdtoMultiLocation<AssetXConverter>(sp_std::marker::PhantomDat
impl<AssetXConverter> sp_runtime::traits::Convert<CurrencyId, Option<MultiLocation>>
for CurrencyIdtoMultiLocation<AssetXConverter>
where
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, AssetId>,
AssetXConverter: xcm_executor::traits::ConvertLocation<MultiLocation, AssetId>,
{
fn convert(currency: CurrencyId) -> Option<MultiLocation> {
match currency {
Expand Down Expand Up @@ -669,7 +669,7 @@ mod testing {
/// AssetManager::set_asset_type_asset_id() and should NOT be used in any production code.
impl From<MultiLocation> for CurrencyId {
fn from(location: MultiLocation) -> CurrencyId {
use xcm_executor::traits::Convert as XConvert;
use xcm_executor::traits::ConvertLocation as XConvert;
use xcm_primitives::AssetTypeGetter;

// If it does not exist, for benchmarking purposes, we create the association
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use std::str::from_utf8;
use xcm::latest::prelude::*;
use xcm::{VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation};
use xcm_builder::{ParentIsPreset, SiblingParachainConvertsVia};
use xcm_executor::traits::Convert as XcmConvert;
use xcm_executor::traits::ConvertLocation as XcmConvert;

type BatchPCall = pallet_evm_precompile_batch::BatchPrecompileCall<Runtime>;
type CrowdloanRewardsPCall =
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/tests/xcm_mock/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ pub struct CurrencyIdtoMultiLocation<AssetXConverter>(sp_std::marker::PhantomDat
impl<AssetXConverter> sp_runtime::traits::Convert<CurrencyId, Option<MultiLocation>>
for CurrencyIdtoMultiLocation<AssetXConverter>
where
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, AssetId>,
AssetXConverter: xcm_executor::traits::ConvertLocation<MultiLocation, AssetId>,
{
fn convert(currency: CurrencyId) -> Option<MultiLocation> {
match currency {
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/tests/xcm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use sp_core::ConstU32;
use xcm::latest::prelude::*;
use xcm::{VersionedMultiLocation, WrapVersion};
use xcm_builder::HashedDescriptionDescribeFamilyAllTerminal;
use xcm_executor::traits::Convert;
use xcm_executor::traits::ConvertLocation;
use xcm_mock::parachain;
use xcm_mock::relay_chain;
use xcm_mock::*;
Expand Down
8 changes: 4 additions & 4 deletions runtime/moonriver/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ pub type LocationToAccountId = (

/// Wrapper type around `LocationToAccountId` to convert an `AccountId` to type `H160`.
pub struct LocationToH160;
impl xcm_executor::traits::Convert<MultiLocation, H160> for LocationToH160 {
impl xcm_executor::traits::ConvertLocation<MultiLocation, H160> for LocationToH160 {
fn convert(location: MultiLocation) -> Result<H160, MultiLocation> {
<LocationToAccountId as xcm_executor::traits::Convert<MultiLocation, AccountId>>::convert(
<LocationToAccountId as xcm_executor::traits::ConvertLocation<MultiLocation, AccountId>>::convert(
location,
)
.map(Into::into)
Expand Down Expand Up @@ -501,7 +501,7 @@ pub struct CurrencyIdtoMultiLocation<AssetXConverter>(sp_std::marker::PhantomDat
impl<AssetXConverter> sp_runtime::traits::Convert<CurrencyId, Option<MultiLocation>>
for CurrencyIdtoMultiLocation<AssetXConverter>
where
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, AssetId>,
AssetXConverter: xcm_executor::traits::ConvertLocation<MultiLocation, AssetId>,
{
fn convert(currency: CurrencyId) -> Option<MultiLocation> {
match currency {
Expand Down Expand Up @@ -681,7 +681,7 @@ mod testing {
/// AssetManager::set_asset_type_asset_id() and should NOT be used in any production code.
impl From<MultiLocation> for CurrencyId {
fn from(location: MultiLocation) -> CurrencyId {
use xcm_executor::traits::Convert as XConvert;
use xcm_executor::traits::ConvertLocation as XConvert;
use xcm_primitives::AssetTypeGetter;

// If it does not exist, for benchmarking purposes, we create the association
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use std::str::from_utf8;
use xcm::latest::prelude::*;
use xcm::{VersionedMultiAssets, VersionedMultiLocation};
use xcm_builder::{ParentIsPreset, SiblingParachainConvertsVia};
use xcm_executor::traits::Convert as XcmConvert;
use xcm_executor::traits::ConvertLocation as XcmConvert;

type BatchPCall = pallet_evm_precompile_batch::BatchPrecompileCall<Runtime>;
type CrowdloanRewardsPCall =
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/tests/xcm_mock/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ pub struct CurrencyIdtoMultiLocation<AssetXConverter>(sp_std::marker::PhantomDat
impl<AssetXConverter> sp_runtime::traits::Convert<CurrencyId, Option<MultiLocation>>
for CurrencyIdtoMultiLocation<AssetXConverter>
where
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, AssetId>,
AssetXConverter: xcm_executor::traits::ConvertLocation<MultiLocation, AssetId>,
{
fn convert(currency: CurrencyId) -> Option<MultiLocation> {
match currency {
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/tests/xcm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use sp_core::ConstU32;
use xcm::latest::prelude::*;
use xcm::{VersionedMultiLocation, WrapVersion};
use xcm_builder::HashedDescriptionDescribeFamilyAllTerminal;
use xcm_executor::traits::Convert;
use xcm_executor::traits::ConvertLocation;
use xcm_mock::parachain;
use xcm_mock::relay_chain;
use xcm_mock::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ declare module "@polkadot/api-base/types/storage" {
* light-clients to leverage the changes trie storage tracking mechanism and in case of
* changes fetch the list of events of interest.
*
* The value has the type `(T::BlockNumber, EventIndex)` because if we used only just the
* The value has the type `(BlockNumberFor<T>, EventIndex)` because if we used only just the
* `EventIndex` then in case if the topic has the same contents on the next block no
* notification will be triggered thus the event might be lost.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ declare module "@polkadot/api-base/types/storage" {
* light-clients to leverage the changes trie storage tracking mechanism and in case of
* changes fetch the list of events of interest.
*
* The value has the type `(T::BlockNumber, EventIndex)` because if we used only just the
* The value has the type `(BlockNumberFor<T>, EventIndex)` because if we used only just the
* `EventIndex` then in case if the topic has the same contents on the next block no
* notification will be triggered thus the event might be lost.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ declare module "@polkadot/api-base/types/storage" {
* light-clients to leverage the changes trie storage tracking mechanism and in case of
* changes fetch the list of events of interest.
*
* The value has the type `(T::BlockNumber, EventIndex)` because if we used only just the
* The value has the type `(BlockNumberFor<T>, EventIndex)` because if we used only just the
* `EventIndex` then in case if the topic has the same contents on the next block no
* notification will be triggered thus the event might be lost.
*/
Expand Down

0 comments on commit f6b7930

Please sign in to comment.