Skip to content

Commit

Permalink
add pallet-assets to mock test runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
acatangiu committed Sep 27, 2023
1 parent c2015ca commit ed59413
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions polkadot/xcm/pallet-xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ xcm = { package = "staging-xcm", path = "..", default-features = false }
xcm-executor = { package = "staging-xcm-executor", path = "../xcm-executor", default-features = false }

[dev-dependencies]
pallet-assets = { path = "../../../substrate/frame/assets" }
pallet-balances = { path = "../../../substrate/frame/balances" }
polkadot-runtime-parachains = { path = "../../runtime/parachains" }
polkadot-parachain-primitives = { path = "../../parachain" }
Expand All @@ -51,6 +52,7 @@ runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
Expand All @@ -61,6 +63,7 @@ runtime-benchmarks = [
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-assets/try-runtime",
"pallet-balances/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"sp-runtime/try-runtime",
Expand Down
26 changes: 25 additions & 1 deletion polkadot/xcm/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use codec::Encode;
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, Everything, Nothing},
traits::{AsEnsureOriginWithArg, ConstU128, ConstU32, Everything, Nothing},
weights::Weight,
};
use frame_system::EnsureRoot;
Expand Down Expand Up @@ -135,6 +135,7 @@ construct_runtime!(
{
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Assets: pallet_assets::{Pallet, Call, Storage, Config<T>, Event<T>},
ParasOrigin: origin::{Pallet, Origin},
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>},
TestNotifier: pallet_test_notifier::{Pallet, Call, Event<T>},
Expand Down Expand Up @@ -245,6 +246,29 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ConstU32<0>;
}

impl pallet_assets::Config for Test {
type RuntimeEvent = RuntimeEvent;
type Balance = u64;
type AssetId = u32;
type AssetIdParameter = u32;
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<frame_system::EnsureSigned<AccountId>>;
type ForceOrigin = EnsureRoot<AccountId>;
type AssetDeposit = ConstU128<1>;
type AssetAccountDeposit = ConstU128<10>;
type MetadataDepositBase = ConstU128<1>;
type MetadataDepositPerByte = ConstU128<1>;
type ApprovalDeposit = ConstU128<1>;
type StringLimit = ConstU32<50>;
type Freezer = ();
type WeightInfo = ();
type CallbackHandle = ();
type Extra = ();
type RemoveItemsLimit = ConstU32<5>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}

parameter_types! {
pub const RelayLocation: MultiLocation = Here.into_location();
pub const AnyNetwork: Option<NetworkId> = None;
Expand Down
4 changes: 2 additions & 2 deletions polkadot/xcm/pallet-xcm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn report_outcome_notify_works() {
let querier: MultiLocation = Here.into();
let status = QueryStatus::Pending {
responder: MultiLocation::from(Parachain(PARA_ID)).into(),
maybe_notify: Some((4, 2)),
maybe_notify: Some((5, 2)),
timeout: 100,
maybe_match_querier: Some(querier.into()),
};
Expand Down Expand Up @@ -105,7 +105,7 @@ fn report_outcome_notify_works() {
)),
RuntimeEvent::XcmPallet(crate::Event::Notified {
query_id: 0,
pallet_index: 4,
pallet_index: 5,
call_index: 2
}),
]
Expand Down

0 comments on commit ed59413

Please sign in to comment.