Skip to content
  • joe petrowski's avatar
    Identity Deposits Relay to Parachain Migration (#1814) · c79b234b
    joe petrowski authored
    The goal of this PR is to migrate Identity deposits from the Relay Chain
    to a system parachain.
    
    The problem I want to solve is that `IdentityOf` and `SubsOf` both store
    an amount that's held in reserve as a storage deposit. When migrating to
    a parachain, we can take a snapshot of the actual `IdentityInfo` and
    sub-account mappings, but should migrate (off chain) the `deposit`s to
    zero, since the chain (and by extension, accounts) won't have any funds
    at genesis.
    
    The good news is that we expect parachain deposits to be significantly
    lower (possibly 100x) on the parachain. That is, a deposit of 21 DOT on
    the Relay Chain would need 0.21 DOT on a parachain. This PR proposes to
    migrate the deposits in the following way:
    
    1. Introduces a new pallet with two extrinsics: 
    - `reap_identity`: Has a configurable `ReapOrigin`, which would be set
    to `EnsureSigned` on the Relay Chain (i.e. callable by anyone) and
    `EnsureRoot` on the parachain (we don't want identities reaped from
    there).
    - `poke_deposit`: Checks what deposit the pallet holds (at genesis,
    zero) and attempts to update the amount based on the calculated deposit
    for storage data.
    2. `reap_identity` clears all storage data for a `target` account and
    unreserves their deposit.
    3. A `ReapIdentityHandler` teleports the necessary DOT to the parachain
    and calls `poke_deposit`. Since the parachain deposit is much lower, and
    was just unreserved, we know we have enough.
    
    One awkwardness I ran into was that the XCMv3 instruction set does not
    provide a way for the system to teleport assets without a fee being
    deducted on reception. Users shouldn't have to pay a fee for the system
    to migrate their info to a more efficient location. So I wrote my own
    program and did the `InitiateTeleport` accounting on my own to send a
    program with `UnpaidExecution`. Have discussed an
    `InitiateUnpaidTeleport` instruction with @franciscoaguirre
    
     . Obviously
    any chain executing this would have to pass a `Barrier` for free
    execution.
    
    TODO:
    
    - [x] Confirm People Chain ParaId
    - [x] Confirm People Chain deposit rates (determined in
    https://github.com/paritytech/polkadot-sdk/pull/2281)
    - [x] Add pallet to Westend
    
    ---------
    
    Co-authored-by: default avatarBastian Köcher <[email protected]>
    c79b234b