1. Apr 16, 2024
  2. Apr 12, 2024
    • Branislav Kontur's avatar
      Remove `xcm::v3` from `assets-common` nits (#4037) · 5601f286
      Branislav Kontur authored
      This PR mainly removes `xcm::v3` stuff from `assets-common` to make it
      more generic and facilitate the transition to newer XCM versions. Some
      of the implementations here used hard-coded `xcm::v3::Location`, but now
      it's up to the runtime to configure according to its needs.
      
      Additional/consequent changes:
      - `penpal` runtime uses now `xcm::latest::Location` for `pallet_assets`
      as `AssetId`, because we don't care about migrations here
      - it pretty much simplify xcm-emulator integration tests, where we don't
      need now a lots of boilerplate conversions:
            ```
            v3::Location::try_from(...).expect("conversion works")`
            ```
      - xcm-emulator tests
      - split macro `impl_assets_helpers_for_parachain` to the
      `impl_assets_helpers_for_parachain` and
      `impl_foreign_assets_helpers_for_parachain` (avoids using hard-coded
      `xcm::v3::Location`)
      5601f286
    • Adrian Catangiu's avatar
      pallet-xcm: add new extrinsic for asset transfers using explicit XCM transfer types (#3695) · 1e971b8d
      Adrian Catangiu authored
      
      
      # Description
      
      Add `transfer_assets_using()` for transferring assets from local chain
      to destination chain using explicit XCM transfer types such as:
      - `TransferType::LocalReserve`: transfer assets to sovereign account of
      destination chain and forward a notification XCM to `dest` to mint and
      deposit reserve-based assets to `beneficiary`.
      - `TransferType::DestinationReserve`: burn local assets and forward a
      notification to `dest` chain to withdraw the reserve assets from this
      chain's sovereign account and deposit them to `beneficiary`.
      - `TransferType::RemoteReserve(reserve)`: burn local assets, forward XCM
      to `reserve` chain to move reserves from this chain's SA to `dest`
      chain's SA, and forward another XCM to `dest` to mint and deposit
      reserve-based assets to `beneficiary`. Typically the remote `reserve` is
      Asset Hub.
      - `TransferType::Teleport`: burn local assets and forward XCM to `dest`
      chain to mint/teleport assets and deposit them to `beneficiary`.
      
      By default, an asset's reserve is its origin chain. But sometimes we may
      want to explicitly use another chain as reserve (as long as allowed by
      runtime `IsReserve` filter).
      
      This is very helpful for transferring assets with multiple configured
      reserves (such as Asset Hub ForeignAssets), when the transfer strictly
      depends on the used reserve.
      
      E.g. For transferring Foreign Assets over a bridge, Asset Hub must be
      used as the reserve location.
      
      # Example usage scenarios
      
      ## Transfer bridged ethereum ERC20-tokenX between ecosystem parachains.
      
      ERC20-tokenX is registered on AssetHub as a ForeignAsset by the
      Polkadot<>Ethereum bridge (Snowbridge). Its asset_id is something like
      `(parents:2, (GlobalConsensus(Ethereum), Address(tokenX_contract)))`.
      Its _original_ reserve is Ethereum (only we can't use Ethereum as a
      reserve in local transfers); but, since tokenX is also registered on
      AssetHub as a ForeignAsset, we can use AssetHub as a reserve.
      
      With this PR we can transfer tokenX from ParaA to ParaB while using
      AssetHub as a reserve.
      
      ## Transfer AssetHub ForeignAssets between parachains
      
      AssetA created on ParaA but also registered as foreign asset on Asset
      Hub. Can use AssetHub as a reserve.
      
      And all of the above can be done while still controlling transfer type
      for `fees` so mixing assets in same transfer is supported.
      
      # Tests
      
      Added integration tests for showcasing:
      - transferring local (not bridged) assets from parachain over bridge
      using local Asset Hub reserve,
      - transferring foreign assets from parachain to Asset Hub,
      - transferring foreign assets from Asset Hub to parachain,
      - transferring foreign assets from parachain to parachain using local
      Asset Hub reserve.
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      Co-authored-by: command-bot <>
      1e971b8d
  3. Apr 09, 2024
  4. Apr 05, 2024
  5. Apr 02, 2024
  6. Mar 27, 2024
  7. Mar 26, 2024
    • Dcompoze's avatar
      Fix spelling mistakes across the whole repository (#3808) · 002d9260
      Dcompoze authored
      **Update:** Pushed additional changes based on the review comments.
      
      **This pull request fixes various spelling mistakes in this
      repository.**
      
      Most of the changes are contained in the first **3** commits:
      
      - `Fix spelling mistakes in comments and docs`
      
      - `Fix spelling mistakes in test names`
      
      - `Fix spelling mistakes in error messages, panic messages, logs and
      tracing`
      
      Other source code spelling mistakes are separated into individual
      commits for easier reviewing:
      
      - `Fix the spelling of 'authority'`
      
      - `Fix the spelling of 'REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY'`
      
      - `Fix the spelling of 'prev_enqueud_messages'`
      
      - `Fix the spelling of 'endpoint'`
      
      - `Fix the spelling of 'children'`
      
      - `Fix the spelling of 'PenpalSiblingSovereignAccount'`
      
      - `Fix the spelling of 'PenpalSudoAccount'`
      
      - `Fix the spelling of 'insufficient'`
      
      - `Fix the spelling of 'PalletXcmExtrinsicsBenchmark'`
      
      - `Fix the spelling of 'subtracted'`
      
      - `Fix the spelling of 'CandidatePendingAvailability'`
      
      - `Fix the spelling of 'exclusive'`
      
      - `Fix the spelling of 'until'`
      
      - `Fix the spelling of 'discriminator'`
      
      - `Fix the spelling of 'nonexistent'`
      
      - `Fix the spelling of 'subsystem'`
      
      - `Fix the spelling of 'indices'`
      
      - `Fix the spelling of 'committed'`
      
      - `Fix the spelling of 'topology'`
      
      - `Fix the spelling of 'response'`
      
      - `Fix the spelling of 'beneficiary'`
      
      - `Fix the spelling of 'formatted'`
      
      - `Fix the spelling of 'UNKNOWN_PROOF_REQUEST'`
      
      - `Fix the spelling of 'succeeded'`
      
      - `Fix the spelling of 'reopened'`
      
      - `Fix the spelling of 'proposer'`
      
      - `Fix the spelling of 'InstantiationNonce'`
      
      - `Fix the spelling of 'depositor'`
      
      - `Fix the spelling of 'expiration'`
      
      - `Fix the spelling of 'phantom'`
      
      - `Fix the spelling of 'AggregatedKeyValue'`
      
      - `Fix the spelling of 'randomness'`
      
      - `Fix the spelling of 'defendant'`
      
      - `Fix the spelling of 'AquaticMammal'`
      
      - `Fix the spelling of 'transactions'`
      
      - `Fix the spelling of 'PassingTracingSubscriber'`
      
      - `Fix the spelling of 'TxSignaturePayload'`
      
      - `Fix the spelling of 'versioning'`
      
      - `Fix the spelling of 'descendant'`
      
      - `Fix the spelling of 'overridden'`
      
      - `Fix the spelling of 'network'`
      
      Let me know if this structure is adequate.
      
      **Note:** The usage of the words `Merkle`, `Merkelize`, `Merklization`,
      `Merkelization`, `Merkleization`, is somewhat inconsistent but I left it
      as it is.
      
      ~~**Note:** In some places the term `Receival` is used to refer to
      message reception, IMO `Reception` is the correct word here, but I left
      it as it is.~~
      
      ~~**Note:** In some places the term `Overlayed` is used instead of the
      more acceptable version `Overlaid` but I also left it as it is.~~
      
      ~~**Note:** In some places the term `Applyable` is used instead of the
      correct version `Applicable` but I also left it as it is.~~
      
      **Note:** Some usage of British vs American english e.g. `judgement` vs
      `judgment`, `initialise` vs `initialize`, `optimise` vs `optimize` etc.
      are both present in different places, but I suppose that's
      understandable given the number of contributors.
      
      ~~**Note:** There is a spelling mistake in `.github/CODEOWNERS` but it
      triggers errors in CI when I make changes to it, so I left it as it
      is.~~
      002d9260
  8. Mar 25, 2024
  9. Mar 22, 2024
  10. Mar 14, 2024
    • Ignacio Palacios's avatar
      Improve Penpal runtime + emulated tests (#3543) · cfc4050d
      Ignacio Palacios authored
      Issues addressed in this PR:
      - Improve *Penpal* runtime:
      - Properly handled received assets. Previously, it treated `(1, Here)`
      as the local native currency, whereas it should be treated as a
      `ForeignAsset`. This wasn't a great example of standard Parachain
      behaviour, as no Parachain treats the system asset as the local
      currency.
      - Remove `AllowExplicitUnpaidExecutionFrom` the system. Again, this
      wasn't a great example of standard Parachain behaviour.
      - Move duplicated
      `ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger` to
      `assets_common` crate.
      - Improve emulated tests:
        - Update *Penpal* tests to new runtime.
      - To simplify tests, register the reserve transferred, teleported, and
      system assets in *Penpal* and *AssetHub* genesis. This saves us from
      having to create the assets repeatedly for each test
      - Add missing test case:
      `reserve_transfer_assets_from_para_to_system_para`.
        - Cleanup.
      - Prevent integration tests crates imports from being re-exported, as
      they were polluting the `polkadot-sdk` docs.
      
      There is still a test case missing for reserve transfers:
      - Reserve transfer of system asset from *Parachain* to *Parachain*
      trough *AssetHub*.
      - This is not yet possible with `pallet-xcm` due to the reasons
      explained in https://github.com/paritytech/polkadot-sdk/pull/3339
      
      ---------
      
      Co-authored-by: command-bot <>
      cfc4050d
  11. Mar 08, 2024
  12. Mar 06, 2024
    • Branislav Kontur's avatar
      Make `penpal-runtime`'s `TrustedReserves` more connfigurable (#3564) · 117a9433
      Branislav Kontur authored
      
      
      The current `penpal` runtime utilizes the `EthereumLocation` parameter,
      which is employed for XCM emulated integration tests concerning the
      Rococo <> ETH bridge. It includes a hard-coded chainId for the Ethereum
      testnet utilized in Rococo. The `EthereumLocation` serves the purpose of
      aligning with the `TrustedReserves`. However, due to this hard-coded
      configuration, reusing `penpal` for testing various environments such as
      Kusama/Polkadot versus Ethereum bridge becomes unfeasible.
      
      This PR introduces the capability to easily customize the asset location
      for `TrustedReserves` without needing to know anything about Ethereum.
      
      
      ## TODO
      - [x] fix integration tests with
      `System::set_storage(CustomizableAssetFromSystemAssetHub::key(),
      <whatever-location-is-needed>)` @claravanstaden
      - [ ] ~~maybe add some helper function/macro to support `set_storage`
      for other runtimes (that we could reuse)~~
      - [ ] Release patch for: `penpal-runtime` + emulated crate with
      `set_storage` support (if needed)
        - [ ] backport to 1.7.0
        - [ ] backport to 1.8.0
      
      ---------
      
      Co-authored-by: default avatarClara van Staden <[email protected]>
      117a9433
  13. Feb 22, 2024
  14. Feb 15, 2024
  15. Feb 13, 2024
  16. Feb 02, 2024
    • Clara van Staden's avatar
      Removes Snowbridge parachain directory (#3186) · 2ab3f03f
      Clara van Staden authored
      Removes the `bridges/snowbridge/parachain` directory and moves
      everything up to under `snowbridge` directly. We are cleaning up our
      local dev env after merging our crates into the polkadot-sdk.
      
      ---------
      
      Co-authored-by: claravanstaden <Cats 4 life!>
      2ab3f03f
  17. Jan 31, 2024
  18. Jan 30, 2024
  19. Jan 26, 2024
  20. Jan 23, 2024
  21. Jan 18, 2024
  22. Jan 16, 2024
    • Francisco Aguirre's avatar
      XCMv4 (#1230) · 8428f678
      Francisco Aguirre authored
      
      
      # Note for reviewer
      
      Most changes are just syntax changes necessary for the new version.
      Most important files should be the ones under the `xcm` folder.
      
      # Description 
      
      Added XCMv4.
      
      ## Removed `Multi` prefix
      The following types have been renamed:
      - MultiLocation -> Location
      - MultiAsset -> Asset
      - MultiAssets -> Assets
      - InteriorMultiLocation -> InteriorLocation
      - MultiAssetFilter -> AssetFilter
      - VersionedMultiAsset -> VersionedAsset
      - WildMultiAsset -> WildAsset
      - VersionedMultiLocation -> VersionedLocation
      
      In order to fix a name conflict, the `Assets` in `xcm-executor` were
      renamed to `HoldingAssets`, as they represent assets in holding.
      
      ## Removed `Abstract` asset id
      
      It was not being used anywhere and this simplifies the code.
      
      Now assets are just constructed as follows:
      
      ```rust
      let asset: Asset = (AssetId(Location::new(1, Here)), 100u128).into();
      ```
      
      No need for specifying `Concrete` anymore.
      
      ## Outcome is now a named fields struct
      
      Instead of
      
      ```rust
      pub enum Outcome {
        Complete(Weight),
        Incomplete(Weight, Error),
        Error(Error),
      }
      ```
      
      we now have
      
      ```rust
      pub enum Outcome {
        Complete { used: Weight },
        Incomplete { used: Weight, error: Error },
        Error { error: Error },
      }
      ```
      
      ## Added Reanchorable trait
      
      Now both locations and assets implement this trait, making it easier to
      reanchor both.
      
      ## New syntax for building locations and junctions
      
      Now junctions are built using the following methods:
      
      ```rust
      let location = Location {
          parents: 1,
          interior: [Parachain(1000), PalletInstance(50), GeneralIndex(1984)].into()
      };
      ```
      
      or
      
      ```rust
      let location = Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]);
      ```
      
      And they are matched like so:
      
      ```rust
      match location.unpack() {
        (1, [Parachain(id)]) => ...
        (0, Here) => ...,
        (1, [_]) => ...,
      }
      ```
      
      This syntax is mandatory in v4, and has been also implemented for v2 and
      v3 for easier migration.
      
      This was needed to make all sizes smaller.
      
      # TODO
      - [x] Scaffold v4
      - [x] Port github.com/paritytech/polkadot/pull/7236
      - [x] Remove `Multi` prefix
      - [x] Remove `Abstract` asset id
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      8428f678
    • Muharem Ismailov's avatar
      XCM WeightTrader: Swap Fee Asset for Native Asset (#1845) · 2cb39f8d
      Muharem Ismailov authored
      Implements an XCM executor `WeightTrader`, facilitating fee payments in
      any asset that can be exchanged for a native asset.
      
      A few constraints need to be observed:
      - `buy_weight` and `refund` operations must be atomic, as another weight
      trader implementation might be attempted in case of failure.
      - swap credit must be utilized since there isn’t an account to which an
      asset of some class can be deposited with a guarantee to meet the
      existential deposit requirement. Also, operating with credits enhances
      the efficiency of the weight trader -
      https://github.com/paritytech/polkadot-sdk/pull/1677
      
      related PRs:
      - (depends) https://github.com/paritytech/polkadot-sdk/pull/2031
      - (depends) https://github.com/paritytech/polkadot-sdk/pull/1677
      - (caused) https://github.com/paritytech/polkadot-sdk/pull/1847
      - (caused) https://github.com/paritytech/polkadot-sdk/pull/1876
      
      // DONE: impl `OnUnbalanced` for a `fungible/s` credit
      // DONE: make the trader free from a concept of a native currency and
      drop few fallible conversions. related issue -
      https://github.com/paritytech/polkadot-sdk/issues/1842
      
      
      // DONE: tests
      
      ---------
      
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      2cb39f8d
    • Bastian Köcher's avatar
      Some random fixes (#2936) · 1c2db174
      Bastian Köcher authored
      - Do not disable `std` feature in the integration tests
      - `contracts-fixtures` test should only check for `riscv` build when the
      feature is enabled
      1c2db174
  23. Jan 10, 2024
  24. Jan 07, 2024
  25. Jan 05, 2024
  26. Jan 04, 2024
  27. Dec 22, 2023
  28. Dec 21, 2023
  29. Dec 20, 2023
  30. Dec 19, 2023
  31. Dec 13, 2023