Companion for Substrate 12740 (#1898)

* add helper config trait

* benchmarkhelper

* update config

* update tests

* into

* update lockfile for {"substrate", "polkadot"}

* include benchmarks in tomls

Co-authored-by: parity-processbot <>
This commit is contained in:
joe petrowski
2022-11-28 21:31:09 +01:00
committed by GitHub
parent aad3912924
commit 021e1463bd
11 changed files with 301 additions and 277 deletions
@@ -262,6 +262,7 @@ impl pallet_assets::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type AssetId = AssetId;
type AssetIdParameter = codec::Compact<AssetId>;
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type ForceOrigin = AssetsForceOrigin;
@@ -275,6 +276,8 @@ impl pallet_assets::Config for Runtime {
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type AssetAccountDeposit = AssetAccountDeposit;
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
parameter_types! {
@@ -32,7 +32,7 @@ fn test_asset_xcm_trader() {
let local_asset_id = 1;
assert_ok!(Assets::force_create(
RuntimeHelper::<Runtime>::root_origin(),
local_asset_id,
local_asset_id.into(),
AccountId::from(ALICE).into(),
true,
minimum_asset_balance
@@ -41,7 +41,7 @@ fn test_asset_xcm_trader() {
// We first mint enough asset for the account to exist for assets
assert_ok!(Assets::mint(
RuntimeHelper::<Runtime>::origin_of(AccountId::from(ALICE)),
local_asset_id,
local_asset_id.into(),
AccountId::from(ALICE).into(),
minimum_asset_balance
));
@@ -121,7 +121,7 @@ fn test_asset_xcm_trader_with_refund() {
// We set existential deposit to be identical to the one for Balances first
assert_ok!(Assets::force_create(
RuntimeHelper::<Runtime>::root_origin(),
1,
1.into(),
AccountId::from(ALICE).into(),
true,
ExistentialDeposit::get()
@@ -130,7 +130,7 @@ fn test_asset_xcm_trader_with_refund() {
// We first mint enough asset for the account to exist for assets
assert_ok!(Assets::mint(
RuntimeHelper::<Runtime>::origin_of(AccountId::from(ALICE)),
1,
1.into(),
AccountId::from(ALICE).into(),
ExistentialDeposit::get()
));
@@ -211,7 +211,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() {
// We set existential deposit to be identical to the one for Balances first
assert_ok!(Assets::force_create(
RuntimeHelper::<Runtime>::root_origin(),
1,
1.into(),
AccountId::from(ALICE).into(),
true,
ExistentialDeposit::get()
@@ -274,7 +274,7 @@ fn test_that_buying_ed_refund_does_not_refund() {
// We set existential deposit to be identical to the one for Balances first
assert_ok!(Assets::force_create(
RuntimeHelper::<Runtime>::root_origin(),
1,
1.into(),
AccountId::from(ALICE).into(),
true,
ExistentialDeposit::get()
@@ -347,7 +347,7 @@ fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() {
let minimum_asset_balance = 1_000_000_u128;
assert_ok!(Assets::force_create(
RuntimeHelper::<Runtime>::root_origin(),
1,
1.into(),
AccountId::from(ALICE).into(),
false,
minimum_asset_balance
@@ -356,7 +356,7 @@ fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() {
// We first mint enough asset for the account to exist for assets
assert_ok!(Assets::mint(
RuntimeHelper::<Runtime>::origin_of(AccountId::from(ALICE)),
1,
1.into(),
AccountId::from(ALICE).into(),
minimum_asset_balance
));