feat(mainnet): include xcm benchmarks#479
Conversation
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## al3mart/feat-mainnet-all-benchmarks #479 +/- ##
=======================================================================
- Coverage 68.43% 65.43% -3.00%
=======================================================================
Files 113 120 +7
Lines 21344 22424 +1080
Branches 21344 22424 +1080
=======================================================================
+ Hits 14606 14673 +67
- Misses 6472 7485 +1013
Partials 266 266
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
ec2ffde to
1c65204
Compare
a9e6d11 to
9b39ef8
Compare
| // Magic number 2 has to do with the fact that we could have up to 2 times | ||
| // MaxAssetsIntoHolding in the worst-case scenario. |
There was a problem hiding this comment.
Reason for this is:
// worst-case, holding.len becomes 2 * holding_limit.
// this guarantees that if holding.len() == holding_limit and you have more than
//holding_limititems (which has a best case outcome of holding.len() == holding_limit),
// then the operation is guaranteed to succeed.
Also, even though I've found this comment: paritytech/cumulus#2102 (comment)
The reason why this only is applied for NonFungible is not that apparent to me. It seems that it would apply to both cases.
There was a problem hiding this comment.
Worth pinging a Cisco or someone about?
| let _ = <Balances as frame_support::traits::Currency<_>>::make_free_balance_be( | ||
| &ah_on_pop, balance, | ||
| ); |
There was a problem hiding this comment.
Funding AH sovereign account on pop because the benchmark tries to withdraw from destination as a way to verify the benchmark.
I believe that makes sense for reserve transfers happening within the reserve itself. Not quite that for our case.
There was a problem hiding this comment.
Curious why all the above is necessary for us and not asset hub: https://github.com/polkadot-fellows/runtimes/blob/80ee7dce11ed68a68abf89512bd9886ffcabe192/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs#L1155
peterwht
left a comment
There was a problem hiding this comment.
Very clean PR, almost ready to approve.
| // 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) |
There was a problem hiding this comment.
For future reviewers: this value is so large because we don't support teleporting.
There was a problem hiding this comment.
Thanks!
Indeed, max weight is applied for unsupported actions.
| // Magic number 2 has to do with the fact that we could have up to 2 times | ||
| // MaxAssetsIntoHolding in the worst-case scenario. |
There was a problem hiding this comment.
Worth pinging a Cisco or someone about?
| // Measured: `111` | ||
| // Estimated: `1596` | ||
| // Minimum execution time: 291_401_000 picoseconds. | ||
| Weight::from_parts(291_401_000, 0) |
There was a problem hiding this comment.
A little expensive compared to westend: https://github.com/paritytech/polkadot-sdk/blob/3dc3a11cd68762c2e5feb0beba0b61f448c4fc92/polkadot/runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs#L72
Likely just hardware, but double checking regardless.
There was a problem hiding this comment.
Should be, I've did these benchmarks in my laptop :)
Recreating weights in our collators will give us a better point to compare.
|
|
||
| impl pallet_xcm::benchmarking::Config for Runtime { | ||
| type DeliveryHelper = ( | ||
| polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< |
There was a problem hiding this comment.
should this also have a ToParentDelivery?
| AssetHubParaId::get(), | ||
| )); | ||
| // Pop can only reserve transfer DOT. | ||
| // This test needs to be adapted as the features grow. |
There was a problem hiding this comment.
could you please add a comment on one of the XCM config unit tests?
Basically that way we have this flow:
- we change XCM to support other asset transfers
- We now have a failing unit test
- We fix unit test and see comment that says: "update set_up_complex_asset_transfer ..."
There was a problem hiding this comment.
The worst_case_holding is also one that must be included in this cycle? Perhaps we should create a doc that we can circle back to? Just an idea not saying it as a requirement
|
do we need cumulus_pallet_weight_reclaim : https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs#L1486? |
Daanvdplas
left a comment
There was a problem hiding this comment.
Nice job!!!
I must say that I didn't expect this complex review and have to finish it tomorrow. Will need some more reference material to give a proper review. Already left some comments you can take a look at.
Once we move from using Here the PR where it was introduced. Have created an issue to track this: #480 |
| let _ = <Balances as frame_support::traits::Currency<_>>::make_free_balance_be( | ||
| &ah_on_pop, balance, | ||
| ); |
There was a problem hiding this comment.
Curious why all the above is necessary for us and not asset hub: https://github.com/polkadot-fellows/runtimes/blob/80ee7dce11ed68a68abf89512bd9886ffcabe192/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs#L1155
|
Don't forget to rebase before next review :) |
…eric::unsubscribe_version
7a74982 to
95d1187
Compare
visibility
95d1187 to
f6f8af0
Compare
| ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(ParaId::from( | ||
| AssetHubParaId::get(), |
There was a problem hiding this comment.
| ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(ParaId::from( | |
| AssetHubParaId::get(), | |
| ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests( | |
| AssetHubParaId::get(), |
peterwht
left a comment
There was a problem hiding this comment.
Approving again.
- The code to generate the benchmarks are solid
- The outputted weight files discrepancies make sense to me as well due to hardware, number of steps, and different XCM configs. So, until we run on production collators this will be sufficient.
Daanvdplas
left a comment
There was a problem hiding this comment.
Well done on this PR, very big and complex undertaking and you helped me understand everything very well!
* feat(benchmark): add pallet_xcm extrinsic benchmarks * refactor(benchmkars): amend xcm transfer_assets benchmark fmt * style(benchmarks): pretty comments. * refactor(benchmarks): fund SA of AH on pop in reserve_transfer benchmark * feat(mainnet): add generic & fungible xcm benchmarks * refactor(benchmarks): don't define CheckAccount for pallet_xcm_benchmarks::fungible * refactor(benchmarks): amend benchmarks for pallet_xcm_benchmarks::generic::unsubscribe_version * feat(mainnet): configure xcm Weigher as WeightInfoBounds * docs(xcm): missing doc * refactor(weights): MAX_ASSETS is MaxAssetsIntoHolding * refactor(mainnet): remove default weights from queue pallets * docs(xcm): credit source for WeighAssets impl * docs(xcm): reminders for updating benchmarks * refactor(mainnet): DeliveryHelper considers delivery to parent * docs(benchmarks): clarify xcm NonFungible AllOf weight comments * refactor(api): reorg imports * style(benchmark): refactor import syntax * docs(bencmark): better docs for XcmBalances * refactor(benchmark): define locations via xcm config definitions * test(xcm): ensure xcm encoding size * refactor(benchmark): improve worst_case_response * chore(benchmark): update results for query_response bench * style(benchmarks): remove RelayAsset * docs(benchmarks): explain ExistentialDepositAsset * docs(xcm): note worst_case_holding needs updating * style(benchmark): better naming * chore(benchmarks): update xcm benchmarks visibility * test(xcm): amend router_uses_ump_for_relay_and_xcmp_for_para * test(xcm): amend router_uses_ump_for_relay_and_xcmp_for_para * refactor(benchmarks): unnecessary ParaId::from * refactor(xcm): unnecessary u64 cast * test(xcm): msg_length factor is > 1 in price_for_parent_delivery~
* refactor(benchmakrs): benchmarks mod in its own file (#477) refactor(benchmark): reorg files * feat(benchmarks): add every pallet benchmark to mainnet without XCM * refactor(benchmarks): rename Assets to TrustBackedAssets * fix(motion): map to Weightless Error one origin check failure * fix(monetary): Treausyr BenchmarkHelper to use correct ExistentialDeposit * refactor(mainnet): remove default weights for assets * refactor(mainnet): remove default weights for pallet_session * refactor(mainnet): remove default weights from governance modules * refactor(mainnet): remove default weights from monetary module * refactor(mainnet): remove default weights from proxy * refactor(mainnet): remove default weights from revive * refactor(mainnet): remove default weights from system modules * refactor(mainnet): remove default weights from utiliy * feat(mainnet): introduce benchmarks-ci.sh * refactor(mainnet): remove default weights for pallet_collator_selection * style(collation): more correct comment. * refactor(collation): amend candidates_disabled test * docs(governance): provide docs for CouncilCollective * docs(benchmakrs): allow missing docs * chore(benchmarks): update weights results * refactor(benchmark): rename TrustBackedAssets to Assets * feat(mainnet): include xcm benchmarks (#479) * feat(benchmark): add pallet_xcm extrinsic benchmarks * refactor(benchmkars): amend xcm transfer_assets benchmark fmt * style(benchmarks): pretty comments. * refactor(benchmarks): fund SA of AH on pop in reserve_transfer benchmark * feat(mainnet): add generic & fungible xcm benchmarks * refactor(benchmarks): don't define CheckAccount for pallet_xcm_benchmarks::fungible * refactor(benchmarks): amend benchmarks for pallet_xcm_benchmarks::generic::unsubscribe_version * feat(mainnet): configure xcm Weigher as WeightInfoBounds * docs(xcm): missing doc * refactor(weights): MAX_ASSETS is MaxAssetsIntoHolding * refactor(mainnet): remove default weights from queue pallets * docs(xcm): credit source for WeighAssets impl * docs(xcm): reminders for updating benchmarks * refactor(mainnet): DeliveryHelper considers delivery to parent * docs(benchmarks): clarify xcm NonFungible AllOf weight comments * refactor(api): reorg imports * style(benchmark): refactor import syntax * docs(bencmark): better docs for XcmBalances * refactor(benchmark): define locations via xcm config definitions * test(xcm): ensure xcm encoding size * refactor(benchmark): improve worst_case_response * chore(benchmark): update results for query_response bench * style(benchmarks): remove RelayAsset * docs(benchmarks): explain ExistentialDepositAsset * docs(xcm): note worst_case_holding needs updating * style(benchmark): better naming * chore(benchmarks): update xcm benchmarks visibility * test(xcm): amend router_uses_ump_for_relay_and_xcmp_for_para * test(xcm): amend router_uses_ump_for_relay_and_xcmp_for_para * refactor(benchmarks): unnecessary ParaId::from * refactor(xcm): unnecessary u64 cast * test(xcm): msg_length factor is > 1 in price_for_parent_delivery~ * refactor(motion): improve pallet_motion benchmarking * test(governance): amend simple_majority_is_never_origin * refactor(weights): move weights into pop_runtime_common * syle: fmt * chore(benchmark): improve benchmarking script * fix(ci): add and properly propagate pop-runtime-common try-runtime feat
Needed for: #478
Adds benchmarks related to XCM in mainnet runtime.
pallet_xcmextrinsics benchmarkpallet_xcm_benchmarks::genericbenchmarkpallet_xcm_benchmarks::fungiblebenchmarkWeigherusingWeightInfoBoundspallet_xcmand use benchmarks results.Note that the benchmarks have been run locally, and they need to be re-run in the collator machines. A script will be provided in #478 such that we can do that easily.