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

Measured XCM weights and benchmarking for collectives-polkadot #547

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

bkontur
Copy link
Contributor

@bkontur bkontur commented Jan 16, 2025

Closes: paritytech/polkadot-sdk#2904
Closes: #446
Continuation: paritytech/polkadot-sdk#6820

The collectives-polkadot uses FixedWeightBounds. This PR introduces a properly measured XCM benchmarking setup and updates the weights with fresh data.

TODO

  • check if we use somewhere some hard-coded weights for Transact that goes to the collectives-polkadot

@bkontur
Copy link
Contributor Author

bkontur commented Jan 16, 2025

* [ ]  check if we use somewhere some hard-coded weights for `Transact` that goes to the `collectives-polkadot`

@seadanda @muharem any idea?

@bkontur bkontur mentioned this pull request Jan 16, 2025
6 tasks
@bkontur
Copy link
Contributor Author

bkontur commented Jan 17, 2025

/cmd fmt

1 similar comment
@bkontur
Copy link
Contributor Author

bkontur commented Jan 17, 2025

/cmd fmt

Copy link

Command "fmt" has started 🚀 See logs here

Copy link

Command "fmt" has finished ✅ See logs here

@seadanda
Copy link
Contributor

* [ ]  check if we use somewhere some hard-coded weights for `Transact` that goes to the `collectives-polkadot`

@seadanda @muharem any idea?

There is nothing talking to collectives in this way AFAIK. We have only used that pattern for the People Chain migration and coretime interface so far.

CHANGELOG.md Outdated Show resolved Hide resolved
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
Weight::from_parts(18_446_744_073_709_551_000, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quite big, but seems not only for this runtime

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is basically Weight::MAX and used for unsupported instructions - in this particular case ReserveAssetDeposited is disabled on collectives because it doesn't support any reserve assets, it only supports DOT through teleports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is basically Weight::MAX and used for unsupported instructions - in this particular case ReserveAssetDeposited is disabled on collectives because it doesn't support any reserve assets, it only supports DOT through teleports

👆

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a DQ: why not just use Weight::Max?

let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);
add_benchmarks!(params, batches);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not needed anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed from all Polkadot-SDK and Polkadot-Fellows runtimes, so why keep it here?

#446

I'm not entirely sure about the purpose of this IF, but I can imagine it might have caused issues for scripting/bots. For example, when regenerating a specific pallet_xyz for a set of runtimes, if one of those runtimes doesn’t include pallet_xyz, the process might abort instead of simply skipping the runtime without that pallet.

However, I believe that for scripting/bots, we now use benchmark pallet --list, so this shouldn't be an issue anymore.

@muharem
Copy link
Contributor

muharem commented Jan 19, 2025

* [ ]  check if we use somewhere some hard-coded weights for `Transact` that goes to the `collectives-polkadot`

@seadanda @muharem any idea?

I do not remember any. But I tried to cover all important cases with integration tests. I would check them, if anything should be updated or added and it should be good to go

Co-authored-by: Muharem <ismailov.m.h@gmail.com>
@bkontur bkontur requested a review from muharem January 20, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants