Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xcm benchmark tests #1333

Merged
merged 63 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6225a29
update to v1.6.0
ferrell-code Jan 30, 2024
f3994e6
update primitives
ferrell-code Jan 31, 2024
dba5130
bump a few pallets
ferrell-code Jan 31, 2024
403605e
compile more pallets
ferrell-code Jan 31, 2024
a7adb80
[no-ci] finish compiling pallets
ferrell-code Jan 31, 2024
bbe7334
[no ci] update calamari
ferrell-code Jan 31, 2024
a7ef2e0
calamari xcmp module configuration
ferrell-code Feb 2, 2024
86c9230
[no ci] compile calamari runtime
ferrell-code Feb 2, 2024
c8b68b2
[no ci] get lottery test to compile
ferrell-code Feb 2, 2024
e141110
[no ci] manta runtime update
ferrell-code Feb 2, 2024
5ca69b4
[no ci] update client
ferrell-code Feb 2, 2024
81917bd
[no ci] some client fixes and add rust toolchain info
ferrell-code Feb 3, 2024
e148335
[no ci] compile node, a bit broken still
ferrell-code Feb 13, 2024
2d0206c
[no ci] wip integration test fix
ferrell-code Feb 13, 2024
561fbb9
[no ci] fix integration test
ferrell-code Feb 15, 2024
f95946a
[no ci] update mocks to correctly process xcm
ferrell-code Feb 15, 2024
e370a57
[no ci] compile calamari integration test
ferrell-code Feb 16, 2024
49cee80
[no ci] runtime benchmarks fix
ferrell-code Feb 16, 2024
e0dd42d
[no ci] runtime benchmarks now compiles
ferrell-code Feb 16, 2024
0f3bc42
[no ci] Fix some warnings
ferrell-code Feb 16, 2024
5afd98d
fix some failed integration tests
ferrell-code Feb 18, 2024
9929ead
[no ci] fix more integration test
ferrell-code Feb 18, 2024
644e3f3
[no ci] fix tx pause unit tests
ferrell-code Feb 18, 2024
50acb9e
[no ci] fix tx pause tests
ferrell-code Feb 18, 2024
0f41be4
[no ci] fix some client issue
ferrell-code Feb 21, 2024
34b8cd9
[no ci] clean up chain specs
ferrell-code Feb 21, 2024
1479a3d
[no ci] try-runtime to work
ferrell-code Feb 21, 2024
de31046
[no ci] use nimbus consensus... uses deprecated function for now
ferrell-code Feb 22, 2024
7a30fff
[no ci] add concrete weight values
ferrell-code Mar 4, 2024
18b1c5a
update ci
ferrell-code Mar 4, 2024
9380318
[no ci]Add comments for async backing
Dengjianping Mar 15, 2024
214b92b
merge in manta
ferrell-code Apr 1, 2024
9d92e45
[no ci] compile with moonkit
ferrell-code Apr 2, 2024
d4b97ab
[no ci] fix block import issue, now panics on execution
ferrell-code Apr 5, 2024
ecbf318
Use forked moonkit
Dengjianping Apr 8, 2024
0f245cd
[no ci] dont implement vrf, cleanup client code
ferrell-code Apr 8, 2024
5de032a
[no ci] remove compilation warnings
ferrell-code Apr 8, 2024
63d95c7
[no ci] update runtimes
ferrell-code Apr 8, 2024
0a73df3
add logic to disallow blocks on consecutive relay slots
ferrell-code Apr 9, 2024
ee01e3e
use clippy
ferrell-code Apr 9, 2024
a1e007f
get tests to compile
ferrell-code Apr 9, 2024
2fd5d43
[no ci] bump workflows
ferrell-code Apr 9, 2024
b6a357c
fix all clippy lints and fix failing tests
ferrell-code Apr 9, 2024
6c03b13
Fix benchmarking for frame-system
Dengjianping Apr 14, 2024
c912ced
fix compilation
ferrell-code Apr 14, 2024
847a8ed
fix runtime-bench compilation
ferrell-code Apr 14, 2024
52cbf8e
remove sudo migration and update vesting pallet Cargo.toml
ferrell-code Apr 15, 2024
dda1d90
Fix benchmarking for vesting
Dengjianping Apr 16, 2024
64e17d3
add dev mode
ferrell-code Apr 16, 2024
e87bd91
fix manta integration tests
ferrell-code Apr 16, 2024
258c84e
Fix aura block importing
Dengjianping Apr 18, 2024
05f0876
fix block import to use delayed best block
ferrell-code Apr 18, 2024
cf2559d
fix benchmarking
ferrell-code Apr 18, 2024
d6effc3
fix benchmark
ferrell-code Apr 19, 2024
f16625d
update treasury in manta to spend via root
ferrell-code Apr 19, 2024
8baf332
Fix xcm benchmarking
Dengjianping May 9, 2024
4ecb9c0
Merge manta branch
Dengjianping May 9, 2024
6d5d83b
Fix clippy
Dengjianping May 13, 2024
82f8674
Fix tests
Dengjianping May 13, 2024
087ce65
Fix fmt
Dengjianping May 13, 2024
fabb21a
Fix xcm benchmarking
Dengjianping May 15, 2024
2151491
Fix tests
Dengjianping May 15, 2024
1ca8072
Fix benchmarkng
Dengjianping May 17, 2024
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
13 changes: 7 additions & 6 deletions pallets/asset-manager/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use manta_primitives::{
types::Balance,
};
use scale_info::prelude::*;
use sp_runtime::traits::One;
use sp_std::vec;
use xcm::latest::prelude::*;

Expand All @@ -39,6 +40,9 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
}

pub fn register_asset_helper<T: Config>(location: MultiLocation, i: u32) {
if crate::LocationAssetId::<T>::contains_key(T::Location::from(location)) {
return;
}
let metadata = AssetRegistryMetadata::<Balance> {
metadata: AssetStorageMetadata {
name: format!("{}-name", i).into(),
Expand All @@ -51,12 +55,9 @@ pub fn register_asset_helper<T: Config>(location: MultiLocation, i: u32) {
};
Pallet::<T>::register_asset(RawOrigin::Root.into(), location.into(), metadata)
.expect("Filed to register asset");
Pallet::<T>::set_units_per_second(
RawOrigin::Root.into(),
<T as Config>::AssetId::from(i),
i.into(),
)
.expect("Filed to set ups");
let current_asset_id = crate::NextAssetId::<T>::get() - One::one();
Pallet::<T>::set_units_per_second(RawOrigin::Root.into(), current_asset_id, i.into())
.expect("Filed to set ups");
}

benchmarks! {
Expand Down
52 changes: 34 additions & 18 deletions runtime/calamari/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1162,9 +1162,8 @@ mod benches {
// always get this error(Unimplemented) while benchmarking pallet_xcm_benchmarks::fungible::initiate_teleport
// so this time we will use statemint's fungible weights
// and actually we don't support teleport now
// [pallet_xcm_benchmarks::generic, XcmGeneric]
// [pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::<Runtime>]
// [pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::<Runtime>]
[pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::<Runtime>]
// Nimbus pallets
// [pallet_author_inherent, AuthorInherent]
);
Expand Down Expand Up @@ -1519,9 +1518,6 @@ impl_runtime_apis! {
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
use frame_system_benchmarking::Pallet as SystemBench;

//type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
//type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;

let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);

Expand Down Expand Up @@ -1551,7 +1547,6 @@ impl_runtime_apis! {
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
impl cumulus_pallet_session_benchmarking::Config for Runtime {}

use pallet_xcm_benchmarks::asset_instance_from;
use xcm_config::{LocationToAccountId, XcmExecutorConfig};

parameter_types! {
Expand Down Expand Up @@ -1580,7 +1575,22 @@ impl_runtime_apis! {
>;

fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
Ok(KsmLocation::get())
let assets = vec![
MultiAsset {
id: Concrete(KsmLocation::get()),
fun: Fungible(1_000_000 * KMA),
}
];

for (i, asset) in assets.iter().enumerate() {
if let MultiAsset {
id: Concrete(location),
fun: Fungible(_)
} = asset {
pallet_asset_manager::benchmarking::register_asset_helper::<Runtime>(*location, i as u32);
}
}
Ok(KsmLocation::get())
}

fn worst_case_holding(depositable_count: u32) -> MultiAssets {
Expand All @@ -1596,16 +1606,25 @@ impl_runtime_apis! {
}
})
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
id: Concrete(GeneralIndex(i as u128).into()),
fun: NonFungible(asset_instance_from(i)),
}))
.collect::<Vec<_>>();

assets.push(MultiAsset {
id: Concrete(KmaLocation::get()),
fun: Fungible(1_000_000 * KMA),
});
assets.push(MultiAsset {
id: Concrete(KsmLocation::get()),
fun: Fungible(1_000_000 * KMA),
});
assets.push(MultiAsset {
id: Concrete(KmaLocation::get()),
fun: Fungible(1_000_000 * KMA),
});

for (i, asset) in assets.iter().enumerate() {
if let MultiAsset {
id: Concrete(location),
fun: Fungible(_)
} = asset {
pallet_asset_manager::benchmarking::register_asset_helper::<Runtime>(*location, i as u32);
}
}
assets.into()
}
}
Expand Down Expand Up @@ -1670,9 +1689,6 @@ impl_runtime_apis! {
}
}

//type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
//type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;

let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
Expand Down
42 changes: 32 additions & 10 deletions runtime/manta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ mod benches {
// always get this error(Unimplemented) while benchmarking pallet_xcm_benchmarks::fungible::initiate_teleport
// so this time we will use statemint's fungible weights
// [pallet_xcm_benchmarks::fungible, XcmBalances]
// [pallet_xcm_benchmarks::generic, XcmGeneric]
[pallet_xcm_benchmarks::generic, XcmGeneric]
[pallet_session, SessionBench::<Runtime>]
// Manta pallets
[pallet_tx_pause, TransactionPause]
Expand Down Expand Up @@ -1448,8 +1448,7 @@ impl_runtime_apis! {
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
use frame_system_benchmarking::Pallet as SystemBench;

//type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
//type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;

let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);
Expand Down Expand Up @@ -1479,7 +1478,6 @@ impl_runtime_apis! {
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
impl cumulus_pallet_session_benchmarking::Config for Runtime {}

use pallet_xcm_benchmarks::asset_instance_from;
use xcm_config::{LocationToAccountId, XcmExecutorConfig};

parameter_types! {
Expand Down Expand Up @@ -1512,6 +1510,21 @@ impl_runtime_apis! {
>;

fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
let assets = vec![
MultiAsset {
id: Concrete(DotLocation::get()),
fun: Fungible(1_000_000 * MANTA),
}
];

for (i, asset) in assets.iter().enumerate() {
if let MultiAsset {
id: Concrete(location),
fun: Fungible(_)
} = asset {
pallet_asset_manager::benchmarking::register_asset_helper::<Runtime>(*location, i as u32);
}
}
Ok(DotLocation::get())
}

Expand All @@ -1528,16 +1541,26 @@ impl_runtime_apis! {
}
})
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
.chain((0..holding_non_fungibles).map(|i| MultiAsset {
id: Concrete(GeneralIndex(i as u128).into()),
fun: NonFungible(asset_instance_from(i)),
}))
.collect::<Vec<_>>();

assets.push(MultiAsset {
id: Concrete(DotLocation::get()),
fun: Fungible(1_000_000 * MANTA),
});
assets.push(MultiAsset {
id: Concrete(MantaLocation::get()),
fun: Fungible(1_000_000 * MANTA),
});

for (i, asset) in assets.iter().enumerate() {
if let MultiAsset {
id: Concrete(location),
fun: Fungible(_)
} = asset {
pallet_asset_manager::benchmarking::register_asset_helper::<Runtime>(*location, i as u32);
}
}

assets.into()
}
}
Expand Down Expand Up @@ -1601,8 +1624,7 @@ impl_runtime_apis! {
}
}

//type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
//type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;

let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number
Expand Down
1 change: 0 additions & 1 deletion scripts/benchmarking/run_all_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ MANTA=./target/production/manta
# Will fix it in next release
# currently, both pallets have problems on benchmarking
EXCLUDED_PALLETS=(
"frame_system"
"zenlink_protocol"
)

Expand Down
2 changes: 1 addition & 1 deletion tests/check_parachain_lease_expiration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function createPromiseApi(nodeAddress: string) {

describe('Check Parachain_Lease_Expiration', () => {
it('Check Manta Parachain Lease', async () => {
const polkadotNode = 'wss://1rpc.io/dot';
const polkadotNode = 'wss://polkadot.api.onfinality.io/public-ws';
const polkadotApi = await createPromiseApi(polkadotNode);
const mantaParaId = 2104;
const oneDay = 3600 * 24;
Expand Down
Loading