-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat(mainnet): include xcm benchmarks #479
feat(mainnet): include xcm benchmarks #479
Conversation
Codecov ReportAttention: 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
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_limit
items (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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth pinging a Cisco or someone about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified in: 0a50386
let _ = <Balances as frame_support::traits::Currency<_>>::make_free_balance_be( | ||
&ah_on_pop, balance, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reviewers: this value is so large because we don't support teleporting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be, I've did these benchmarks in my laptop :)
Recreating weights in our collators will give us a better point to compare.
runtime/mainnet/src/benchmarks.rs
Outdated
|
||
impl pallet_xcm::benchmarking::Config for Runtime { | ||
type DeliveryHelper = ( | ||
polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this also have a ToParentDelivery
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be better with it 👍 375e9d1
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job. Approving!
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few last comments
runtime/mainnet/src/benchmarks.rs
Outdated
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(ParaId::from( | ||
AssetHubParaId::get(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(ParaId::from( | |
AssetHubParaId::get(), | |
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests( | |
AssetHubParaId::get(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done on this PR, very big and complex undertaking and you helped me understand everything very well!
Needed for: #478
Adds benchmarks related to XCM in mainnet runtime.
pallet_xcm
extrinsics benchmarkpallet_xcm_benchmarks::generic
benchmarkpallet_xcm_benchmarks::fungible
benchmarkWeigher
usingWeightInfoBounds
pallet_xcm
and 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.