Skip to content

[xcm-builder] Replaced deprecated CurrencyAdapter with FungibleAdapter#3287

Merged
franciscoaguirre merged 9 commits intomasterfrom
bko-replaced-deprecated-currency-adapter
Feb 13, 2024
Merged

[xcm-builder] Replaced deprecated CurrencyAdapter with FungibleAdapter#3287
franciscoaguirre merged 9 commits intomasterfrom
bko-replaced-deprecated-currency-adapter

Conversation

@bkontur
Copy link
Copy Markdown
Contributor

@bkontur bkontur commented Feb 12, 2024

I found out during the cleanup of this deprecation message in the polkadot-fellows repository that we deprecated CurrencyAdapter without making the recommended changes.

TODO

@bkontur bkontur added R0-no-crate-publish-required The change does not require any crates to be re-published. T6-XCM This PR/Issue is related to XCM. labels Feb 12, 2024
@bkontur bkontur requested review from a team and athei as code owners February 12, 2024 09:22
@bkontur
Copy link
Copy Markdown
Contributor Author

bkontur commented Feb 12, 2024

@franciscoaguirre I see that tests/benchmarks fails, also I am checking your PR: #2684

and I'll change it to the new FungibleAdapter in a following PR.
The two stages are separated so as to not bloat this PR with some name fixes in tests.

What about that following PR? :)

also I changed CurencyAdapter to FungibleAdapter for fellows and tests started to fail: https://github.com/polkadot-fellows/runtimes/actions/runs/7869327889/job/21468225062?pr=159

@franciscoaguirre
Copy link
Copy Markdown
Contributor

Pallet balances' fungible implementation emits different events than its Currency implementation. I had to change them in the tests to make them pass

@franciscoaguirre
Copy link
Copy Markdown
Contributor

Need to change all the other runtimes

@paritytech-cicd-pr
Copy link
Copy Markdown

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

@franciscoaguirre
Copy link
Copy Markdown
Contributor

Seems there's a problem with benchmarks... Looking into it

…chmark

The `CurrencyAdapter` allowed transferring even when it would destroy the account,
because of having less than the ED.
The new `FungibleAdapter` always tries to preserve the sending account.
This benchmark was leaving an account with zero after transferring, which is why
it was working before but not after the change of adapter.
let channel_id: ChannelId = origin.into();

let nonce = snowbridge_pallet_outbound_queue::Nonce::<Runtime>::try_get(channel_id);
dbg!(&nonce);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should probably remove this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

executor.bench_process(xcm)?;
} verify {
assert!(T::TransactAsset::balance(&sender_account).is_zero());
assert!(T::TransactAsset::balance(&sender_account) < sender_account_balance_before);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this a tight enough bound on this test? It's just checking that it decreases by any amount, whereas do we not expect it to change by some predictable amount?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree it should be tighter. Will look into it on another PR 😄

@franciscoaguirre franciscoaguirre added this pull request to the merge queue Feb 13, 2024
Merged via the queue into master with commit e0c902e Feb 13, 2024
@franciscoaguirre franciscoaguirre deleted the bko-replaced-deprecated-currency-adapter branch February 13, 2024 19:52
github-merge-queue bot pushed a commit that referenced this pull request Feb 14, 2024
bkontur added a commit that referenced this pull request Feb 21, 2024
#3287)

I found out during the cleanup of this deprecation message in the
`polkadot-fellows` repository that we deprecated `CurrencyAdapter`
without making the recommended changes.


## TODO
- [ ] fix `polkadot-fellows` bump to 1.6.0
polkadot-fellows/runtimes#159

---------

Co-authored-by: Francisco Aguirre <[email protected]>
acatangiu pushed a commit that referenced this pull request Feb 21, 2024
…apter (#3417)

We replaced deprecated `CurrencyAdapter`
[here](#3287) and we also
did the same for fellows
[here](polkadot-fellows/runtimes@2d6d3ac),
but this change requires this patch for xcm benchmarks.

Expected patch for  `pallet-xcm-benchmarks` as `8.0.1`

Co-authored-by: Francisco Aguirre <[email protected]>
bkchr pushed a commit to polkadot-fellows/runtimes that referenced this pull request Feb 27, 2024
Based on bump to
[`[email protected]`](#137).

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

_Note: Encointer was not upgraded (because its pallet references
`[email protected]` release)._

## ~~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
`[email protected]` update please check:
bkontur/runtimes@bko-bump-to-1.5...bkontur:runtimes:bko-bump-to-1.6.~~


## TODO

- [x] fix compilation
- [x] fix integration tests
- [x] fix benchmarks (also try them) - `collectives-polkadot` `payout`
- [ ] ~~Does not require a CHANGELOG entry~~
- [x] `warning: use of deprecated struct
`staging_xcm_builder::CurrencyAdapter`: Use `FungibleAdapter` instead`
- [ ] search for `TODO:(PR#159) change to FungibleAdapter` and/or wait
for paritytech/polkadot-sdk#3287
- [x] patch for `pallet-nomination-pools` migration fix
paritytech/polkadot-sdk#3093
- will be fixed here
#188 (comment)
- [x] patch for `xcm-executor` fix (for 1.6.0) e.g.
paritytech/polkadot-sdk#3174
- [x] check/fix coretime stuff for Kusama/Polkadot - search for `//
TODO:(PR#159)(PR#1694)` - see
[comment](#159 (comment))
- fixed by bkontur#3
- [x] check the
`MaxControllersInDeprecationBatch`https://github.com/polkadot-fellows/runtimes/pull/159/files#r1492361038
- [x] check `pallet_identity::Config` for Kusama and Polkadot
https://github.com/polkadot-fellows/runtimes/pull/159/files#r1492363866

---------

Signed-off-by: Adrian Catangiu <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Francisco Aguirre <[email protected]>
Co-authored-by: Ross Bulat <[email protected]>
Co-authored-by: Alain Brenzikofer <[email protected]>
Co-authored-by: eskimor <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
paritytech#3287)

I found out during the cleanup of this deprecation message in the
`polkadot-fellows` repository that we deprecated `CurrencyAdapter`
without making the recommended changes.


## TODO
- [ ] fix `polkadot-fellows` bump to 1.6.0
polkadot-fellows/runtimes#159

---------

Co-authored-by: Francisco Aguirre <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R0-no-crate-publish-required The change does not require any crates to be re-published. T6-XCM This PR/Issue is related to XCM.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants