[AHM / ah-migrator]: Implement RC->AH account translation mocked migration across all involved pallets#807
Conversation
mocked account translation migration across all involved palletsmocked account translation migration across all involved pallets
|
@ggwpez PTAL 🙏 |
re-gius
left a comment
There was a problem hiding this comment.
Reviewed half of the files - completing review in a couple of hours
| let translated_node = alias::Node { | ||
| id: Self::translate_account_rc_to_ah(node.id), | ||
| prev: node.prev.map(|account| Self::translate_account_rc_to_ah(account)), | ||
| next: node.next.map(|account| Self::translate_account_rc_to_ah(account)), |
There was a problem hiding this comment.
Hm I think this will break the pallet. These bags list are sorted. We will probably need to re-create the bags.
Can you please revert this file and create an issue for it? thanks
There was a problem hiding this comment.
Maybe it could be a good next task for you, since its also staking related :)
There was a problem hiding this comment.
sure, let's see if I can squeeze the fix directly in this PR or I will create an issue. Do we have a specific project for this migration?
There was a problem hiding this comment.
I think there is no project. Just put AHM into the title please.
There was a problem hiding this comment.
Done here. Thanks for catching the issue 🙇
There was a problem hiding this comment.
Ok I am reverting the change where I was recreating the bags lists. See here. Reason being that bags are sorted but FIFO insertion is used within a bag. So we want to preserve the order per score and we want to preserve the prev / next relationship within a bag, and that's lost if we recreate from scratch
There was a problem hiding this comment.
There was a problem hiding this comment.
There should also be an integrity check for the bags-list pallet that we currently dont call. Probably worth to call that, this one
https://github.com/paritytech/polkadot-sdk/blob/6824a6782354e274cf308be314f142551c5457ab/substrate/frame/bags-list/src/lib.rs#L405 (try_state).
You probably have to call it directly, as the function is feature gated <Self as SortedListProvider<T::AccountId>>::try_state().
But if it does not work then we need to just revert and do later. As I want to get this merged soon.
There was a problem hiding this comment.
Added in an ad-hoc commit so we can easily revert if the integration test fails 🤞
There was a problem hiding this comment.
CI's usual ahm-test-polkadot is happy with that, so we should be good
|
🙈 did not read the discussion before reviewing, yes. |
re-gius
left a comment
There was a problem hiding this comment.
Great effort! Just a few doubts about treating AccountIds and Option<AccountId>s interchangeably
0a00a8f to
583244c
Compare
|
Review required! Latest push from author must always be reviewed |
670b8e8 to
338ff3f
Compare
|
@ggwpez , @re-gius , @muharem I've addressed the two remaining critical issues:
The test via Can you please review and let me know what we are missing to be able to merge 🙏 ? |
muharem
left a comment
There was a problem hiding this comment.
Lets do not merge this until we do not have the list of the derivation pattern that we need to map. I think currently the mapping for location is wrong, and not needed if we consider only parachains sov accounts. Additionally we might not need the translation for cases like bounties curators. I do not like the idea of blindly applying the translation everywhere.
I am fine with not merging now but to be fair, in this PR the translation is no-op, it just attaching the infrastructure to convert accounts and should be safe in that perspective (especially now that I have reverted the change about re-creationg of bags lists). |
This reverts commit a8834c9.
Add comprehensive XCM location translation to handle AccountId32 junctions in treasury spend beneficiary locations during RC→AH migration. - Apply translation at pallet level before type conversion - Support XCM versions V3, V4, V5 with proper junction handling - Translate AccountId32 IDs while preserving other junction types - Add graceful error handling with fallback to original location - Follow established pattern from other migration modules Resolves treasury spend account translation requirement per Option 1.
Extract XCM location translation functions from treasury.rs into a dedicated xcm_translation.rs module for better code organization. - Move all XCM version handling (V3, V4, V5) to xcm_translation.rs - Keep treasury.rs focused on treasury-specific migration logic - Add xcm_translation module to lib.rs - Maintain same functionality with improved separation of concerns No functional changes, purely organizational refactoring.
- Replace mock translate_account_rc_to_ah with production implementation - Add sovereign account detection and translation (para -> sibl prefix) - Follow try_translate_rc_sovereign_to_ah pattern - Update comprehensive documentation with translation rules and format details - Preserve backward compatibility for all non-sovereign account types TODO: - Add more UTs - Remove try_translate_rc_sovereign_to_ah from rc_migrator and update integration test to use ah-migrator translator - Add event handling once requirements are clarified
…ah-migrator" This reverts commit 830da13.
1cd24a3 to
c744022
Compare
| }, | ||
| ReferendumInfo::Cancelled(block, submission_deposit, decision_deposit) => { | ||
| let translated_submission = submission_deposit.map(|mut deposit| { | ||
| deposit.who = Self::translate_account_rc_to_ah(deposit.who.clone()); |
|
|
||
| // Run bags-list pallet integrity check | ||
| #[cfg(feature = "try-runtime")] | ||
| <pallet_bags_list::Pallet<T, pallet_bags_list::Instance1> as frame_election_provider_support::SortedListProvider< |
There was a problem hiding this comment.
Note to self: Remove the feature gate in the SDK so that we can use it here as well.
6b603ca
into
polkadot-fellows:dev-asset-hub-migration
A high-level look of the migration is this: <img width="1204" height="745" alt="Screenshot 2025-09-17 at 18 23 57" src="https://github.com/user-attachments/assets/1fb39ef8-5efa-4db2-81db-6dd775af3a39" /> You can see the main components being the `pallet_rc_migrator` and `pallet_ah_migrator`. The RC migrator pallet takes data out of the RC storage and enqueues it for AH through XCM::Transact calls to the AH migrator pallet. Each pallet on the RC side has a migrator module that handles the removal of the old data and creation of the messages for AH. AH then processes these messages through the MQ pallet and acknowledges back to RC that they were processed (not shown in the graphic). There is rate-limiting code in place to prevent it from overloading the DMP queue or Asset Hub. ## For Reviewers The review comments are being addressed in #915. We need eyes on the Core part that is described below. ## Core STM The main stage transitions look like this. The only manual part is the scheduling call by the fellowship that kicks off the procedure: * `Pending` wait for Fellowship to call `schedule_migration(when)` -> Scheduled * `Scheduled` waiting for scheduled block -> `WaitingForAH` * `WaitingForAH` AH replies that it is ready -> `WarmUp` * `WarmUp` waiting for warm-up end -> `Starting` * `Starting` doing some startup initialization -> `DataMigration` * `DataMigration` MAIN PART **all pallet migrations finish** -> `CoolOff` * `CoolOff` waiting for cool-off to end -> `SignalMigrationFinish` * `SignalMigrationFinish` send signal to AH that we are done -> `MigrationDone` * `MigrationDone` finished, unlock all Pallets. ### State Machine The core State Machine lives in the `RcMigrator` pallet in its `on_initialize`: https://github.com/polkadot-fellows/runtimes/blob/8ef1cc739d756b109dc93eaf3b9da00e3dcf1383/pallets/rc-migrator/src/lib.rs#L1338-L1342 On each block the Rc Migrator checks the current state and possibly progresses to the next one. It will only do a single state transition per block to reduce complexity of the code. Generally, there are three states per pallet (called [*stages*](https://github.com/polkadot-fellows/runtimes/blob/8ef1cc739d756b109dc93eaf3b9da00e3dcf1383/pallets/rc-migrator/src/lib.rs#L190-L389) in the code). Some pallets have more then three, but it is generally still a multiple of three and always follows the pattern of `PalletInit`, `PalletOngoing { cursor }`, `PalletDone`: https://github.com/polkadot-fellows/runtimes/blob/8ef1cc739d756b109dc93eaf3b9da00e3dcf1383/pallets/rc-migrator/src/lib.rs#L239-L244 Each pallet then has one migrator struct (eg. `MultisigMigrator<T>`) that migrates the storage items from the Relay side. It lives in the module of its name `rc-migrator/src/multisig.rs` respectively. Taking Multisigs as an example; you can find two functions in the migrator struct: `migrate_many` and `migrate_single`. The former one is from the [`PalletMigration` trait](https://github.com/polkadot-fellows/runtimes/blob/715dbb4455a127066d0118ce7a096c72200e1126/pallets/rc-migrator/src/types.rs#L209-L221). The `migrate_single` function is done by convention to keep the code readable. The `migrate_many` does the following: - Weight accounting for the RC side: Normal weight tracking to not have overtime RC blocks - Weight accounting for the AH side: Ensuring to not send messages that would take up too much weight on AH processing - Ensure that DMP messages are sensibly sized by using the `XcmBatchAndMeter` - Taking the data out from the Relay chain (deleting it) - Including the data into a DMP message and sending it towards AH ### AH Side The main logic on Asset Hub lives in the `AhMigrator` pallet. It contains at least one extrinsic per pallet to receive the incoming data from the RC. We are using extrinsics since RC is wrapping the data into XCM::Transacts: https://github.com/polkadot-fellows/runtimes/blob/9a20b12e22b019c1c0b15b9af897567a559e424c/pallets/ah-migrator/src/lib.rs#L650-L653 This calls into the [`multisig` module](https://github.com/polkadot-fellows/runtimes/blob/6b603ca47e5c49b3a898be3f8f6b078c424f42a0/pallets/ah-migrator/src/multisig.rs#L37) to integrate the data into the storage. Per convention we are emitting events for each item and the whole batch. The main task of the AH side is to integrate the data. In the example of the multisig it is special since we do not migrate the multisig, but only the reserved account which will be unreserved on AH. ## Messaging Logic The messaging is ACK based. The Relay sends message to Asset Hub up to a specified limit (50). The limit can be adjusted on the fly through a dedicated dispatchable call, restricted to Admin and Manager roles. The limit may be overstepped by the configured batch-size (10), so in total there should never be more than 60 DMPs queued. Each DMP is set to at most [50KB](https://github.com/polkadot-fellows/runtimes/blob/8ef1cc739d756b109dc93eaf3b9da00e3dcf1383/pallets/rc-migrator/src/lib.rs#L131). The Relay Chain migrator creates a query for each XCM data message using the XCM query–response primitives and attaches a response status request from Asset Hub to the message. The XCM executor on Asset Hub then sends back the response status for every message with such a request. The Relay migrator stores each data message sent to Asset Hub until it receives confirmation of successful processing. It also provides a dispatchable call, available only to Admin and Manager roles, to resend any unconfirmed messages. A bug that prevented certain messages from being accounted for during a particulat pallet migration caused the Westend AHM stall. The system was queuing too many DMPs, which forced WAH to author an overweight block while attempting to process them all at once. ## Call Filtering Pallet calls are filtered during the migration for three reasons: - prevent malicious users from spamming the chain with cheap TX and slowing down the migration - prevent users from sending many UMPs out of AH to clog up the UMP queue - prevent interference with pallets that are being migrated to avoid messing up their storage invariants Both RC and AH provide call filters for `Before`, `During` and `After` the migration. As you can see, most things are disabled during the migration on both chains. After the migration, Relay chain keeps pretty much everything disabled since it was now enabled on AH: - Before: RC everything enabled, AH all new pallets disabled (staking, gov etc) - During: RC mostly everything disabled, AH mostly everything disabled - After: RC mostly everything disabled (staking, gov etc), AH everything enabled (staking, gov etc) This is implemented by returning three bools, one for each phase: https://github.com/polkadot-fellows/runtimes/blob/88f4aaf62236fbee9cfb9183e44333bac45b1371/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/call_filter.rs#L81-L83 ## Testing and Dry-Runs https://github.com/paritytech/ahm-dryrun is the repository for testing infrastructure for AHM. As of now, the following is being tested there (as a part of "[AHM Flow (all steps)](https://github.com/paritytech/ahm-dryrun/actions/workflows/zombie-bite.yml)" nightly action): * Dry-running a migration on a fork of Kusama * Re-running the rust unit tests introduced in this branch * Re-running a subset of the same tests, re-written in TS * Re-running PET tests. Each action produces a table with the summary of the test results: <img width="682" height="357" alt="Screenshot 2025-09-19 at 09 03 20" src="https://github.com/user-attachments/assets/69c1e37d-6f8f-4b57-b97f-75781a1e1a3a" /> And 4 snapshot files (2 real databases, 2 try-runtime snapshots) which can be used to re-run any of the tests, or run the pre/post migration chain, locally. <img width="1347" height="476" alt="Screenshot 2025-09-19 at 09 03 40" src="https://github.com/user-attachments/assets/127cbf76-b2fb-467f-8fef-3e93a9a709f6" /> <details><summary>Full Changelog</summary> <p> - **[AHM] OpenGov for Kusama AH (#877)** - **Relay Chain Accounts to Asset Hub Migration (#515)** - **Test Relay<->AH migration through DMP messages (#528)** - **[AHM] Improve account migration (#532)** - **[AHM] Add multisig migration (#534)** - **[AHM] Proxy migration (#542)** - **[AHM] Cleanup and add Preimage doc (#543)** - **[AHM] Improve accounts migration (#550)** - **[AHM] Preimage migration (#545)** - **[AHM] Add Polkadot call filtering (#559)** - **[AHM] Nomination pools (#562)** - **[AHM] referenda pallet (#558)** - **[AHM] Cleanup (#565)** - **[AHM] Scheduler Pallet (#569)** - **[AHM] Fast unstake and Bags list (#563)** - **[AHM] Pallet claims (#570)** - **[AHM] Conviction Voting Pallet (#578)** - **[AHM] Pallet Indices (#577)** - **[AHM] pause scheduler during migration (#580)** - **[AHM] Asset rate pallet migration (#581)** - **[AHM] Bounties data migration (#585)** - **[AHM] Vesting (#575)** - **[AHM] fix the rc-migrator call filter (#598)** - **[AHM] Sovereign Account Translation (#594)** - **[AHM] Crowdloans (#592)** - **[AHM] Set up AH migration testing framework for single pallets (#597)** - **[AHM] Stage management (#584)** - **[AHM] Do not pause inherents 🙈 (#609)** - **[AHM] Relay Chain accounts' reserves (#602)** - **[AHM] Benchmarks (#589)** - **[AHM] Pallet testing framework (#612)** - **[AHM] fix xcm weight at most (#617)** - **[AHM] Improve weight accounting for accounts migration (#618)** - **[AHM] AH acks messages from RC (#620)** - **[AHM] Pure Proxy Investigation (#621)** - **[AHM] Remove migrated items for pallet preimage and improve testing (#619)** - **[AHM] Referenda metadata (#633)** - **[AHM] Fix accounts migration failures (#628)** - **[AHM] refactor events and enable scheduled migration start (#634)** - **[AHM] Migrating DOT total issuance tracking from RC to AH (#607)** - **[AHM] Comment faulty checks out (#640)** - **Account migrator refactor (#639)** - **[AHM] Rebase (#641)** - **[AHM] Run AHM test in CI (#642)** - **[AHM] Vesting test (#615)** - **[AHM] bags_list and conviction_voting tests (#632)** - **[AHM] Treasury pallet migration (#624)** - **[AHM] Fix tests for pallet preimage (#643)** - **[AHM] Test Coverage Report (#650)** - **[AHM] deactivate/reactivate total issuance & weights (#648)** - **[AHM] add sudo behind feature flag (#657)** - **[AHM] fast_unstake tests (#658)** - **[AHM] asset_rate test (#660)** - **[AHM] Pallet treasury tests (#664)** - **[AHM] Improve account balances integration tests (#655)** - **[AHM] Integrate AH migrator weights to RC (#665)** - **Testing for bounties migration (#669)** - **[AHM] Westend port adapters (#652)** - **[AHM] fix checking account and total issuance migration (#636)** - **[AHM] Bump polkadot relay and AH versions (#667)** - **[AHM] Fix tests for pallet treasury (#671)** - **[AHM] Claims and Crowdloan tests (#622)** - **[AHM] Benchmarks (#663)** - **[AHM] Add Asset Hub CallFilter (#670)** - **[AHM] Westend staking migration (#689)** - **[AHM] Referenda migration storage checks (#672)** - **[AHM] AH benchmarks cleanup (#690)** - **[AHM] Westend Async Staking Migration (#691)** - **[AHM] Relay Chain migrator benchmarks (#692)** - **[AHM] Asset Hub ops pallet benchmarks (#693)** - **[AHM] Xcm send weights and Batch helper types (#694)** - **Finish staking Westend (#695)** - **[AHM] Account provider/consumer references (#702)** - **[AHM] Fix westend builds (#704)** - **[AHM] Generate weights (#706)** - **[AHM] Proxy fixes and more tests (#707)** - **[AHM] Docs and simpler events (#699)** - **[AHM] Test call decoding (#710)** - **[AHM] Emulated test for migration with async backing (#717)** - **[AHM] Increase test coverage (#720)** - **[AHM] Add referenda checks to Westend migration (#713)** - **[AHM] Nom_pools test (#677)** - **[AHM] Scheduler storage item checks (#680)** - **[AHM] Update Polkadot Snapshot (#725)** - **[AHM] Pallet multisig tests (#666)** - **[AHM] Adapt XCM configuration to account for changes before and after migration (#722)** - **[AHM] document checking account migration (#716)** - **[AHM] Dependency fixes for integration tests and the Polkadot runtime (#751)** - **[AHM] Remove empty conviction voting filter (#750)** - **[AHM] Missing TODOs and `AccountState` type update (#742)** - **[AHM] DMP prioritization on AH (#772)** - **[AHM] Disable #[pallet::hooks] for migrating pallets during migration (#784)** - **[AHM] AH messages prioritization on RC (#787)** - **[AHM] Cache test snapshots and include more tests into CI job (#788)** - **[AHM] Cleanup Westend feature (#789)** - **[AHM] Introducing the Cool-Off stage (#786)** - **[AHM] Flow Control System (#780)** - **[AHM] Migrate pallet delegated-staking to AH (#791)** - **[AHM] Merge master into dev branch (#793)** - **[AHM] Disable indirect XCMs from RC to AH and vice versa during migration (#774)** - **Rebase** - **bring back RelayTreasuryLocation to make old tests compiole** - **[AHM] Missing `RootLocation` for WaivedLocation for AHP (#798)** - **[AHM] Missing `SecretaryEntities` for AHP (#797)** - **[AHM] Migration idempotency (#808)** - **[AHM] Block number providers for migrating pallets (#809)** - **[AHM] Copy latest ah-ops pallet from the SDK (#810)** - **[AHM / ah-migrator]: Implement RC->AH account translation `mocked` migration across all involved pallets (#807)** - **[AHM] Complete account balances tests (#674)** - **[AHM] Address TODOs (#815)** - **[AHM] Async staking config (#812)** - **[AHM] Optional migration manager account id (#818)** - **[AHM] Type safe Hold and Freeze-Reason translation (#819)** - **[AHM] Create new response query on resend and tests (#816)** - **PolkadotAssetHub: Enable Async Backing (#763)** - **Ensure no era planned when migration starts (#728)** - **[AHM] with async backing (#822)** - **[AHM] Staking migration (#821)** - **identify with only validator account** - **[AHM] Tests work for Paseo (#827)** - **[AHM] Child bounties (#613)** - **[AHM] Cleanup and linter fixes (#828)** - **[AHM] Fix snowbridge test - wrong import of `RelayTreasuryPalletAccount` (instead of AH, it should be BH) (#831)** - **[AHM] Account Translation mapping (#829)** - **Fast unstake: remove alias** - **fmt** - **[AHM] Max migrated items per block (#834)** - **[AHM] Record migration timings (#835)** - **[AHM] Remove storage aliases and cleanup (#832)** - **[AHM] fix Kusama bags list pallet benchmarks (#836)** - **[AHM] Unprocessed msg buffer size 50 (#839)** - **[AHM] Post migration cool off stage (#841)** - **[AHM] Multisig test and storage_alias cleanup (#842)** - **[AHM] Remove fast-unstake and test fixes (#846)** - **Run try-state check for all pallets post AHM rust tests (#833)** - **[AHM] Preserve on RC manager' account (#843)** - **[AHM] Filter staking calls before migration starts (#847)** - **[AHM] State Decode Tests (#848)** - **[AHM] Send xcm extrinsic within migrator pallets (#851)** - **Merge and cleanup merge commit** - #845 - #852 - #862 - #875 - #872 - #877 - #626 - #879 - #885 - #886 - #882 - #883 - #854 - #888 - #895 - #892 - #896 - #889 </p> </details> // only to let all CIs to execute for now - [ ] Does not require a CHANGELOG entry --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Signed-off-by: Adrian Catangiu <adrian@parity.io> Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Muharem <ismailov.m.h@gmail.com> Co-authored-by: Dónal Murray <donalm@seadanda.dev> Co-authored-by: Adrian Catangiu <adrian@parity.io> Co-authored-by: Giuseppe Re <giuseppe.re@parity.io> Co-authored-by: Andrii <ndk@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Yuri Volkov <0@mcornholio.ru> Co-authored-by: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com> Co-authored-by: Pablo Andrés Dorado Suárez <hola@pablodorado.com> Co-authored-by: ordian <write@reusable.software> Co-authored-by: Alistair Singh <alistair.singh7@gmail.com> Co-authored-by: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Co-authored-by: Bastian Köcher <info@kchr.de> Co-authored-by: Serban Iorga <serban@parity.io> Co-authored-by: Xiliang Chen <xlchen1291@gmail.com> Co-authored-by: Nikolai Kozlov <1431590+nkpar@users.noreply.github.com> Co-authored-by: nkprt <nikolai@parity.io> Co-authored-by: Eugenio Paluello <eugypalu@gmail.com> Co-authored-by: Javier Viola <363911+pepoviola@users.noreply.github.com> Co-authored-by: polka.dom <polkadotdom@gmail.com> Co-authored-by: Dónal Murray <donal.murray@parity.io> Co-authored-by: Karol Kokoszka <karol.k91@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Clara van Staden <claravanstaden64@gmail.com> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> Co-authored-by: clangenb <37865735+clangenb@users.noreply.github.com> Co-authored-by: Andrei Sandu <andrei-mihail@parity.io> Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> Co-authored-by: Alexandre Baldé <alexandre.balde@parity.io> Co-authored-by: Maksym H <1177472+mordamax@users.noreply.github.com> Co-authored-by: Alin Dima <alin@parity.io> Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: Christian Langenbacher <clangenb+gh@protonmail.ch> Co-authored-by: Ankan <ankan.anurag@gmail.com> Co-authored-by: Karol Kokoszka <karol@parity.io> Co-authored-by: brenzi <brenzi@users.noreply.github.com> Co-authored-by: Doordashcon <jesse.chejieh@gmail.com> Co-authored-by: eskimor <eskimor@users.noreply.github.com> Co-authored-by: Robert <robert@gonimo.com> Co-authored-by: Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com> Co-authored-by: Maciej <kz_sky@outlook.com> Co-authored-by: Paolo La Camera <paolo.lacamera@pm.me> Co-authored-by: kianenigma <kian@parity.io> Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Co-authored-by: Alexander Cyon <Sajjon@users.noreply.github.com>
🎯 Goal
We want to ensure that all AccountIDs are translated when moved from RC to AH via a new ad-hoc
translate_account_rc_to_ah()function in theah-migratorpallet.This PR introduces
translate_account_rc_to_ah()inah-migratorpalletHow to translate
In this PR,
translate_account_rc_to_ah()is just a mock function that returns the input account.Here I introduced as PoC a version handling specifically sovereign accounts by converting "para" prefixed accounts to "sibl" prefixed accounts, preserving the para_id and maintaining the same account format:
I have then reverted since we will have dedicated and tested functions we will be use later on from the translation (ideally a static map containing existing RC accountId -> AH conversion, if it doesn't bloat the WASM binary too much).
Event handling
translate_account_rc_to_ah()will also be responsible to emit a translation event if and when needed (see TODO section).Account migration logic
While migrating pallet X from RC to AH, there are usually two places where we need to translate accounts:
do_receive_*method where we handle the whole translation logicpost_check()method, to ensure consistent account ID comparison between RC and AHFor all pallets the pattern is the same when it comes to accountIDs:
original_account→translated_accountIntegrated Pallets
vestingmultisigproxyconviction_votingstaking/nom_poolsstaking/bags_liststaking/fast_unstakestaking/delegated_stakingreferendabountiestreasury: NOTE: Extended the pre-check payload to store full proposal data, including account fields, instead of just proposal IDs. Close [AHM] Add account translation to treasury spend beneficiaries during RC->AH migration #811 to properly migrate thebeneficiaryfield intreasuryspendsscheduler: nothing to do. No direct account storage: unlike other pallets that store account fields directly,scheduler stores origins and calls. Origins are properly converted via T::RcToAhPalletsOrigin::try_convert(). Calls are properly converted via Self::map_rc_ah_call() which should handle account as well. The post-check reconstructs expected state using the same conversion logic
preimage. NOTE: preimage doesn't require post-check account translation. The account translation is applied during processing and the post-checks focus on hash integrity rather than account-based comparisons.claimscrowdloanasset_rate: no AccountId fields. It only deals with asset types and numeric ratesindicesTODO