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.6) #3466

Closed

Conversation

bkontur
Copy link
Contributor

@bkontur bkontur commented Feb 23, 2024

For description, please see: #3464

Expected patches for (1.6.0):

  • cumulus-pallet-parachain-system 0.7.1
  • cumulus-primitives-utility 0.6.3
  • polkadot-runtime-common 7.0.1
  • pallet-xcm-benchmarks 7.0.5
  • pallet-xcm 7.0.1
  • staging-xcm-builder 7.0.4

bkontur and others added 4 commits February 23, 2024 22:27
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
@bkontur bkontur added the R0-silent Changes should not be mentioned in any release notes label Feb 23, 2024
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 1/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5335155

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
Copy link
Contributor Author

bkontur commented Feb 26, 2024

rejected

@bkontur bkontur closed this Feb 26, 2024
@bkontur bkontur deleted the bko-adjust-benchmarks-pallet-xcm-1.6 branch February 26, 2024 09:05
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants