Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
baf1be9
Here's a template for you.
kianenigma Jul 30, 2021
3f357a0
All tests compile
kianenigma Jul 30, 2021
ac40480
finish the skeleton
kianenigma Jul 30, 2021
a43758a
More baby steps
kianenigma Jul 31, 2021
1dc11da
Build is broken
kianenigma Jul 31, 2021
e4792b7
Merge branch 'master' of github.com:paritytech/polkadot into kiz-xcm-…
kianenigma Jul 31, 2021
cb91ac6
make westend work again
kianenigma Jul 31, 2021
5b33749
mock weight generation
shawntabrizi Jul 31, 2021
ed9149f
Merge branch 'kiz-xcm-bench-pallet' of https://github.com/paritytech/…
shawntabrizi Jul 31, 2021
d99d4f9
just some boilerpalate
kianenigma Jul 31, 2021
5483da8
Merge branch 'kiz-xcm-bench-pallet' of github.com:paritytech/polkadot…
kianenigma Jul 31, 2021
e9081ea
Everythign works again in a new format
kianenigma Aug 1, 2021
d976204
add the new files
kianenigma Aug 1, 2021
44c212d
more weight info
shawntabrizi Aug 2, 2021
1f70c4c
new format again
kianenigma Aug 2, 2021
324be3d
Merge branch 'kiz-xcm-bench-pallet' of github.com:paritytech/polkadot…
kianenigma Aug 2, 2021
d61c255
remove files
kianenigma Aug 2, 2021
139e1aa
Update traits.rs
shawntabrizi Aug 2, 2021
145f522
stuff
shawntabrizi Aug 2, 2021
feb6bac
push for shawn
kianenigma Aug 3, 2021
3915752
Everything now builds
kianenigma Aug 3, 2021
649b422
pallet-xcm-benchmarks fully compiles again with benchmarks added
kianenigma Aug 3, 2021
b7750a0
push midway
kianenigma Aug 3, 2021
78c4c3e
make build
shawntabrizi Aug 3, 2021
2049112
fix benchmark compile
shawntabrizi Aug 3, 2021
45dedc9
benchmark fix
shawntabrizi Aug 3, 2021
893d572
fix benchmark
shawntabrizi Aug 3, 2021
2038bbd
new bm
shawntabrizi Aug 4, 2021
3b056c7
more benches
shawntabrizi Aug 4, 2021
46a3af0
fix bench
shawntabrizi Aug 4, 2021
e400bc1
finish fungible?
shawntabrizi Aug 4, 2021
6621af3
fix westend build
shawntabrizi Aug 4, 2021
f20ae75
benchmark barrier
shawntabrizi Aug 4, 2021
e4b8a4c
use `ValidDestination`
shawntabrizi Aug 4, 2021
8479329
working on westend
shawntabrizi Aug 4, 2021
d5fd2f8
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Aug 7, 2021
c8819da
fix xcm v1
shawntabrizi Aug 7, 2021
b56df81
fix xcm-executor
shawntabrizi Aug 7, 2021
9c33a40
fix xcm-builder
shawntabrizi Aug 7, 2021
4fddeae
make benchmarks compile
shawntabrizi Aug 7, 2021
6f29de0
make tests work
shawntabrizi Aug 7, 2021
768a92a
fix westend benchmarks build
shawntabrizi Aug 7, 2021
3c578e4
use generated weight in westend
shawntabrizi Aug 7, 2021
be9cbb6
start fixing xcm_generic
shawntabrizi Aug 7, 2021
b782a31
most of xcm generic
shawntabrizi Aug 7, 2021
3a26395
clean up
shawntabrizi Aug 8, 2021
a950330
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Aug 8, 2021
3915381
Update Cargo.lock
shawntabrizi Aug 8, 2021
fc00dc1
fix merge
shawntabrizi Aug 8, 2021
c7c0f2b
more cleanup
shawntabrizi Aug 8, 2021
62bb8ee
fix warnings
shawntabrizi Aug 8, 2021
de3247b
more cleanup
shawntabrizi Aug 8, 2021
65a9df8
point to separate modules
shawntabrizi Aug 8, 2021
d62420e
temp fix, use zero weight
shawntabrizi Aug 8, 2021
be98ce1
Merge remote-tracking branch 'origin/master' into kiz-xcm-bench-palle…
shawntabrizi Aug 10, 2021
3c08461
fix pallet-xcm-benchmarks
shawntabrizi Aug 10, 2021
0be427c
fix westend benchmarks
shawntabrizi Aug 10, 2021
ac6445c
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Aug 12, 2021
c352a6e
Delete mock2.rs
shawntabrizi Aug 12, 2021
71cedbf
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Aug 19, 2021
8c0191a
fix merge
shawntabrizi Aug 19, 2021
edacc76
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Sep 2, 2021
91b2c13
update trait for v2
shawntabrizi Sep 5, 2021
d1fbaef
basic final weight (maybe wrong)
shawntabrizi Sep 5, 2021
45b5dd4
fix barrier
shawntabrizi Sep 5, 2021
e720007
start to clean up benchmarks
shawntabrizi Sep 5, 2021
12bfc2b
more fixes
shawntabrizi Sep 5, 2021
9ed8a4c
fix more
shawntabrizi Sep 5, 2021
8078c35
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Sep 5, 2021
ec16d44
update xcm_weight
shawntabrizi Sep 6, 2021
fe27083
executor error and pub
shawntabrizi Sep 6, 2021
f99e086
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Sep 6, 2021
1d0f6f6
more benchmarks
shawntabrizi Sep 6, 2021
894cd69
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Sep 6, 2021
b18a7e9
Update Cargo.lock
shawntabrizi Sep 7, 2021
402282c
more
shawntabrizi Sep 7, 2021
e091c29
more
shawntabrizi Sep 7, 2021
40c613d
Merge branch 'master' into kiz-xcm-bench-pallet-extended
shawntabrizi Sep 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make tests work
  • Loading branch information
shawntabrizi committed Aug 7, 2021
commit 6f29de0e37a0a899d58c71e0870a54c33579f1bb
19 changes: 4 additions & 15 deletions xcm/pallet-xcm-benchmarks/src/fungible/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
use xcm::latest::{Junction, MultiAsset, MultiLocation, NetworkId};
use xcm::latest::{AssetId::*, Fungibility::*, Junction, MultiAsset, MultiLocation, NetworkId};
use xcm_builder::{
AllowBenchmarks, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom,
IsChildSystemParachain, TakeWeightCredit,
Expand Down Expand Up @@ -107,7 +107,7 @@ impl xcm_executor::traits::MatchesFungible<u64> for MatchAnyFungible {
fn matches_fungible(m: &MultiAsset) -> Option<u64> {
use sp_runtime::traits::SaturatedConversion;
match m {
MultiAsset::ConcreteFungible { amount, .. } => Some((*amount).saturated_into::<u64>()),
MultiAsset { fun: Fungible(amount), .. } => Some((*amount).saturated_into::<u64>()),
_ => None,
}
}
Expand All @@ -122,17 +122,6 @@ pub type AssetTransactor = xcm_builder::CurrencyAdapter<
CheckedAccount,
>;

/// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = (
// Weight that is paid for may be consumed.
TakeWeightCredit,
// If the message is one that immediately attemps to pay for execution, then allow it.
AllowTopLevelPaidExecutionFrom<All<MultiLocation>>,
// Messages coming from system parachains need not pay for execution.
AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
AllowBenchmarks,
);

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type Call = Call;
Expand All @@ -142,7 +131,7 @@ impl xcm_executor::Config for XcmConfig {
type IsReserve = ();
type IsTeleporter = ();
type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
type Barrier = Barrier;
type Barrier = YesItShould;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, Call>;
type Trader = xcm_builder::FixedRateOfConcreteFungible<WeightPrice, ()>;
type ResponseHandler = DevNull;
Expand All @@ -169,7 +158,7 @@ impl xcm_balances_benchmark::Config for Test {
fn get_multi_asset() -> MultiAsset {
let amount =
<Balances as frame_support::traits::fungible::Inspect<u64>>::minimum_balance() as u128;
MultiAsset::ConcreteFungible { id: MultiLocation::Null, amount }
MultiAsset { id: Concrete(MultiLocation::Here), fun: Fungible(amount) }
}
}

Expand Down
26 changes: 14 additions & 12 deletions xcm/pallet-xcm-benchmarks/src/fungibles/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ use sp_runtime::{
};
use xcm::{
latest::Junction,
opaque::latest::{MultiAsset, MultiLocation},
opaque::latest::{AssetId, MultiAsset, MultiLocation},
};

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;

type AccountId = u64;

// For testing the pallet, we construct a mock runtime.
frame_support::construct_runtime!(
pub enum Test where
Expand Down Expand Up @@ -66,7 +68,7 @@ impl frame_system::Config for Test {
type Hash = H256;
type Call = Call;
type Hashing = BlakeTwo256;
type AccountId = u64;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
Expand Down Expand Up @@ -105,10 +107,12 @@ parameter_types! {
pub const MetadataDepositPerByte: u64 = 1 * ExistentialDeposit::get();
}

type AssetsAssetId = u32;

impl pallet_assets::Config for Test {
type Event = Event;
type Balance = u64;
type AssetId = u32;
type AssetId = AssetsAssetId;
type Currency = Balances;
type ForceOrigin = frame_system::EnsureRoot<u64>;
type AssetDeposit = AssetDeposit;
Expand All @@ -131,13 +135,11 @@ impl Contains<u32> for CheckAsset {
pub struct MatchAnyFungibles;
impl xcm_executor::traits::MatchesFungibles<u32, u64> for MatchAnyFungibles {
fn matches_fungibles(m: &MultiAsset) -> Result<(u32, u64), xcm_executor::traits::Error> {
// ^^ TODO: this error is too out of scope.
// ^^ TODO: this error is too out of scope.
use sp_runtime::traits::SaturatedConversion;
match m {
MultiAsset::ConcreteFungible {
amount,
id: MultiLocation::X1(Junction::GeneralIndex { id }),
} => Ok(((*id).saturated_into(), (*amount).saturated_into::<u64>())),
MultiAsset { id: Concrete(X1(GeneralIndex { id })), fun: Fungible(amount) } =>
Ok(((*id).saturated_into::<u32>(), (*amount).saturated_into::<u64>())),
_ => Err(xcm_executor::traits::Error::AssetNotFound),
}
}
Expand All @@ -151,7 +153,7 @@ pub type AssetTransactor = xcm_builder::FungiblesAdapter<
Assets,
MatchAnyFungibles,
AccountIdConverter,
u64,
AccountId,
CheckAsset,
CheckedAccount,
>;
Expand Down Expand Up @@ -189,9 +191,9 @@ impl xcm_assets_benchmarks::Config for Test {
}

let amount = <Assets as Inspect<u64>>::minimum_balance(id) as u128;
MultiAsset::ConcreteFungible {
id: MultiLocation::X1(Junction::GeneralIndex { id: id.into() }),
amount,
MultiAsset {
id: Concrete(X1(Junction::GeneralIndex { id: id.into() })),
fun: Fungible(amount),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion xcm/pallet-xcm-benchmarks/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ impl xcm_executor::traits::Convert<MultiLocation, u64> for AccountIdConverter {
parameter_types! {
pub Ancestry: MultiLocation = MultiLocation::X1(Junction::Parachain(101));
pub UnitWeightCost: Weight = 10;
pub WeightPrice: (MultiLocation, u128) = (MultiLocation::Null, 1_000_000_000_000);
pub WeightPrice: (MultiLocation, u128) = (MultiLocation::Here, 1_000_000_000_000);
}