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

[pallet-xcm] Adjust benchmarks (teleport_assets/reserve_transfer_assets) not relying on ED (patch for 1.7.0) #3465

Merged

Conversation

bkontur
Copy link
Contributor

@bkontur bkontur commented Feb 23, 2024

For description, please see: #3464

Expected patches for (1.7.0):

  • cumulus-pallet-parachain-system 0.8.1
  • cumulus-primitives-utility 0.8.1
  • polkadot-runtime-common 8.0.1
  • pallet-xcm-benchmarks 8.0.2
  • pallet-xcm 8.0.1
  • staging-xcm-builder 8.0.1

@bkontur bkontur added the R0-silent Changes should not be mentioned in any release notes label Feb 23, 2024
@bkontur bkontur requested a review from a team as a code owner February 23, 2024 16:38
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5332038

bkontur and others added 4 commits February 23, 2024 22:15
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
@bkontur bkontur added the T6-XCM This PR/Issue is related to XCM. label Feb 23, 2024
@acatangiu acatangiu merged commit c762cf7 into release-crates-io-v1.7.0 Feb 26, 2024
125 of 128 checks passed
@acatangiu acatangiu deleted the bko-adjust-benchmarks-pallet-xcm-1.7 branch February 26, 2024 08:12
github-merge-queue bot pushed a commit that referenced this pull request Feb 26, 2024
…ts) not relying on ED (#3464)

## Problem
During the bumping of the `polkadot-fellows` repository to
`polkadot-sdk@1.6.0`, I encountered a situation where the benchmarks
`teleport_assets` and `reserve_transfer_assets` in AssetHubKusama
started to fail. This issue arose due to a decreased ED balance for
AssetHubs introduced
[here](https://github.com/polkadot-fellows/runtimes/pull/158/files#diff-80668ff8e793b64f36a9a3ec512df5cbca4ad448c157a5d81abda1b15f35f1daR213),
and also because of a [missing CI
pipeline](polkadot-fellows/runtimes#197) to
check the benchmarks, which went unnoticed.

These benchmarks expect the `caller` to have enough:
1. balance to transfer (BTT)
2. balance for paying delivery (BFPD).
 
So the initial balance was calculated as `ED * 100`, which seems
reasonable:
```
const ED_MULTIPLIER: u32 = 100;
let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into());`
```
The problem arises when the price for delivery is 100 times higher than
the existential deposit. In other words, when `ED * 100` does not cover
`BTT` + `BFPD`.

I check AHR/AHW/AHK/AHP and this problem has only AssetHubKusama
```
ED: 3333333
calculated price to parent delivery:  1031666634  (from xcm logs from the benchmark)
---

3333333 * 100 - BTT(3333333) - BFPD(1031666634) = −701666667
```
which results in the error;
```
2024-02-23 09:19:42 Unable to charge fee with error Module(ModuleError { index: 31, error: [17, 0, 0, 0], message: Some("FeesNotMet") })
Error: Input("Benchmark pallet_xcm::reserve_transfer_assets failed: FeesNotMet")
     
```

## Solution

The benchmarks `teleport_assets` and `reserve_transfer_assets` were
fixed by removing `ED * 100` and replacing it with `DeliveryHelper`
logic, which calculates the (almost real) price for delivery and sets it
along with the existential deposit as the initial balance for the
account used in the benchmark.


## TODO

- [ ] patch for 1.6 -
#3466
- [ ] patch for 1.7 -
#3465
- [ ] patch for 1.8 - TODO: PR

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
bkontur added a commit to bkontur/runtimes that referenced this pull request Feb 28, 2024
fellowship-merge-bot bot pushed a commit to polkadot-fellows/runtimes that referenced this pull request Mar 5, 2024
Based on bump to
[`polkadot-sdk@1.6.0`](#159).

Attached result of `cargo upgrade -v --pinned --incompatible`
[cargo-upgrade-version-bump.log](https://github.com/polkadot-fellows/runtimes/files/14281072/cargo-upgrade-version-bump.log)

~~## For reviewers~~

~~This PR is against `polkadot-fellows`'s main to bring it to the
fellows repo, but if you want to see a real diff relevant to the
`polkadot-sdk@1.7.0` update please check:
bkontur/runtimes@bko-bump-to-1.6...bkontur:runtimes:bko-bump-to-1.7.~~


## TODO

- [x] fix compilation
- [x] apply patch for AssetHub tests:
paritytech/polkadot-sdk#3404
- [x] apply patch for `coretime`
paritytech/polkadot-sdk#3497 see
[comment](#187 (comment))
- [x] fix integration tests - fix after
#185
- [x] fix benchmarks (also try them)
- [x] apply patch for `pallet-xcm` benchmarks
paritytech/polkadot-sdk#3465
- [x] check ranked collectives:
- [x] `ExchangeOrigin` see
[comment](#187 (comment))
- [x] `MemberSwappedHandler` / `BenchmarkSetup` see
[comment](#187 (comment))

---------

Signed-off-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Ross Bulat <ross@parity.io>
Co-authored-by: Alain Brenzikofer <alain@integritee.network>
Co-authored-by: eskimor <eskimor@no-such-url.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: brenzi <brenzi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants