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

Inbound queue v2 #3

Closed
wants to merge 81 commits into from
Closed

Inbound queue v2 #3

wants to merge 81 commits into from

Commits on Jun 5, 2024

  1. Configuration menu
    Copy the full SHA
    b01161f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0b83e68 View commit details
    Browse the repository at this point in the history
  3. feat: remove XCMv2

    franciscoaguirre committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    e917d67 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2024

  1. Configuration menu
    Copy the full SHA
    9005e04 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5fc4a32 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2024

  1. Configuration menu
    Copy the full SHA
    337e26e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    19cc1da View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2024

  1. Configuration menu
    Copy the full SHA
    5cfd108 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    96b5b4b View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2024

  1. Configuration menu
    Copy the full SHA
    6de7a42 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    126ef2f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a16e19f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a3a09af View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bbba323 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    98c3906 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2024

  1. Configuration menu
    Copy the full SHA
    08a82d1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1f031ec View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2024

  1. Configuration menu
    Copy the full SHA
    5b423ad View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1116cbb View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2024

  1. Configuration menu
    Copy the full SHA
    cfa2ef4 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. Configuration menu
    Copy the full SHA
    241e992 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d421d3f View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2024

  1. Configuration menu
    Copy the full SHA
    3e85791 View commit details
    Browse the repository at this point in the history
  2. fix: v4 -> v5

    franciscoaguirre committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    f80c76a View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2024

  1. Initialize bridge V2

    yrong committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    d8895c2 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2024

  1. Revamp outbound for V2

    yrong committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    10d7bcb View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2024

  1. Configuration menu
    Copy the full SHA
    821ffdc View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2024

  1. Improve error & more tests

    yrong committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    d5cadfa View commit details
    Browse the repository at this point in the history
  2. Move merkle impl to core

    yrong committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    0905c41 View commit details
    Browse the repository at this point in the history
  3. Revert FeeManager

    yrong committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    7a37072 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2024

  1. Configuration menu
    Copy the full SHA
    db634a3 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2024

  1. [XCMv5] Better fee mechanism (paritytech#5420)

    Implements [RFC#105](polkadot-fellows/RFCs#105)
    which, at the time of this PR, has not been approved yet. Some aspects
    might be changed as a result of discussion.
    
    ## TODO
    - [x] Add new instruction and use it in conversion functions
    - [x] Implement in xcm-executor
    - [x] Setup for xcm-executor unit tests
    - [x] Actual xcm-executor unit tests
      - [x] Happy path
      - [x] Unhappy path
    - [x] Emulated tests
      - [x] Asset hub westend
      - [x] Asset hub rococo
    - [x] Benchmarks
      - [x] Dummy values
      - [x] Actual benchmarks
    - [x] PRDoc
    
    ---------
    
    Co-authored-by: command-bot <>
    Co-authored-by: Adrian Catangiu <[email protected]>
    franciscoaguirre and acatangiu authored Oct 17, 2024
    Configuration menu
    Copy the full SHA
    d1425bb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f481f8e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    678a379 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4d9cc77 View commit details
    Browse the repository at this point in the history
  5. fix merge dmg

    acatangiu committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    cdfecb7 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2024

  1. Fix fee amount

    yrong committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    99ba809 View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2024

  1. Added SetAssetClaimer Instruction to XCM v5 (paritytech#5585)

    Added SetAssetClaimer instruction
    
    ---------
    
    Co-authored-by: Francisco Aguirre <[email protected]>
    Co-authored-by: command-bot <>
    Co-authored-by: Adrian Catangiu <[email protected]>
    3 people authored Oct 21, 2024
    Configuration menu
    Copy the full SHA
    446465b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4a6e85c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ec16524 View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2024

  1. Fix abi encode command

    yrong committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    58de17b View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2024

  1. Configuration menu
    Copy the full SHA
    9cd9890 View commit details
    Browse the repository at this point in the history
  2. Seperate V1&V2 more clearly

    yrong committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    a0deaba View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    850fe96 View commit details
    Browse the repository at this point in the history
  4. Fix breaking tests

    yrong committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    273b971 View commit details
    Browse the repository at this point in the history
  5. Remove command deprecated

    yrong committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    2bc9b58 View commit details
    Browse the repository at this point in the history
  6. Update bridges/snowbridge/pallets/outbound-queue-v2/src/types.rs

    Co-authored-by: Vincent Geddes <[email protected]>
    yrong and vgeddes authored Oct 23, 2024
    Configuration menu
    Copy the full SHA
    165e5a6 View commit details
    Browse the repository at this point in the history
  7. Remove MAXIMUM_BASE_GAS

    yrong committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    f7a1dbd View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    2fdd374 View commit details
    Browse the repository at this point in the history
  9. [xcm-v5] implement RFC#100: add new InitiateTransfer instruction (par…

    …itytech#5876)
    
    A new instruction `InitiateTransfer` is introduced that initiates an
    assets transfer from the chain it is executed on, to another chain. The
    executed transfer is point-to-point (chain-to-chain) with all of the
    transfer properties specified in the instruction parameters. The
    instruction also allows specifying another XCM program to be executed on
    the remote chain.
    If a transfer requires going through multiple hops, an XCM program can
    compose this instruction to be used at every chain along the path, on
    each hop describing that specific leg of the transfer.
    
    **Note:** Transferring assets that require different paths (chains along
    the way) is _not supported within same XCM_ because of the async nature
    of cross chain messages. This new instruction, however, enables
    initiating transfers for multiple assets that take the same path even if
    they require different transfer types along that path.
    
    The usage and composition model of `InitiateTransfer` is the same as
    with existing `DepositReserveAsset`, `InitiateReserveWithdraw` and
    `InitiateTeleport` instructions. The main difference comes from the
    ability to handle assets that have different point-to-point transfer
    type between A and B. The other benefit is that it also allows
    specifying remote fee payment and transparently appends the required
    remote fees logic to the remote XCM.
    
    We can specify the desired transfer type for some asset(s) using:
    
    ```rust
    /// Specify which type of asset transfer is required for a particular `(asset, dest)` combination.
    pub enum AssetTransferFilter {
    	/// teleport assets matching `AssetFilter` to `dest`
    	Teleport(AssetFilter),
    	/// reserve-transfer assets matching `AssetFilter` to `dest`, using the local chain as reserve
    	ReserveDeposit(AssetFilter),
    	/// reserve-transfer assets matching `AssetFilter` to `dest`, using `dest` as reserve
    	ReserveWithdraw(AssetFilter),
    }
    ```
    
    This PR adds 1 new XCM instruction:
    ```rust
    /// Cross-chain transfer matching `assets` in the holding register as follows:
    ///
    /// Assets in the holding register are matched using the given list of `AssetTransferFilter`s,
    /// they are then transferred based on their specified transfer type:
    ///
    /// - teleport: burn local assets and append a `ReceiveTeleportedAsset` XCM instruction to
    ///   the XCM program to be sent onward to the `dest` location,
    ///
    /// - reserve deposit: place assets under the ownership of `dest` within this consensus system
    ///   (i.e. its sovereign account), and append a `ReserveAssetDeposited` XCM instruction
    ///   to the XCM program to be sent onward to the `dest` location,
    ///
    /// - reserve withdraw: burn local assets and append a `WithdrawAsset` XCM instruction
    ///   to the XCM program to be sent onward to the `dest` location,
    ///
    /// The onward XCM is then appended a `ClearOrigin` to allow safe execution of any following
    /// custom XCM instructions provided in `remote_xcm`.
    ///
    /// The onward XCM also potentially contains a `BuyExecution` instruction based on the presence
    /// of the `remote_fees` parameter (see below).
    ///
    /// If a transfer requires going through multiple hops, an XCM program can compose this instruction
    /// to be used at every chain along the path, describing that specific leg of the transfer.
    ///
    /// Parameters:
    /// - `dest`: The location of the transfer next hop.
    /// - `remote_fees`: If set to `Some(asset_xfer_filter)`, the single asset matching
    ///   `asset_xfer_filter` in the holding register will be transferred first in the remote XCM
    ///   program, followed by a `BuyExecution(fee)`, then rest of transfers follow.
    ///   This guarantees `remote_xcm` will successfully pass a `AllowTopLevelPaidExecutionFrom` barrier.
    /// - `remote_xcm`: Custom instructions that will be executed on the `dest` chain. Note that
    ///   these instructions will be executed after a `ClearOrigin` so their origin will be `None`.
    ///
    /// Safety: No concerns.
    ///
    /// Kind: *Command*.
    ///
    InitiateTransfer {
    	destination: Location,
    	remote_fees: Option<AssetTransferFilter>,
    	assets: Vec<AssetTransferFilter>,
    	remote_xcm: Xcm<()>,
    }
    ```
    
    An `InitiateTransfer { .. }` instruction shall transfer to `dest`, all
    assets in the `holding` register that match the provided `assets` and
    `remote_fees` filters.
    These filters identify the assets to be transferred as well as the
    transfer type to be used for transferring them.
    It shall handle the local side of the transfer, then forward an onward
    XCM to `dest` for handling the remote side of the transfer.
    
    It should do so using same mechanisms as existing `DepositReserveAsset`,
    `InitiateReserveWithdraw`, `InitiateTeleport` instructions but
    practically combining all required XCM instructions to be remotely
    executed into a _single_ remote XCM program to be sent over to `dest`.
    
    Furthermore, through `remote_fees: Option<AssetTransferFilter>`, it
    shall allow specifying a single asset to be used for fees on `dest`
    chain. This single asset shall be remotely handled/received by the
    **first instruction** in the onward XCM and shall be followed by a
    `BuyExecution` instruction using it.
    If `remote_fees` is set to `None`, the **first instruction** in the
    onward XCM shall be a `UnpaidExecution` instruction. The rest of the
    assets shall be handled by subsequent instructions, thus also finally
    allowing [single asset buy
    execution](paritytech#2423)
    barrier security recommendation.
    
    The `BuyExecution` appended to the onward XCM specifies
    `WeightLimit::Unlimited`, thus being limited only by the `remote_fees`
    asset "amount". This is a deliberate decision for enhancing UX - in
    practice, people/dApps care about limiting the amount of fee asset used
    and not the actually used weight.
    
    The onward XCM, following the assets transfers instructions,
    `ClearOrigin` or `DescendOrigin` instructions shall be appended to stop
    acting on behalf of the source chain, then the caller-provided
    `remote_xcm` shall also be appended, allowing the caller to control what
    to do with the transferred assets.
    
    Closes paritytech#5209
    
    ---------
    
    Co-authored-by: Francisco Aguirre <[email protected]>
    Co-authored-by: command-bot <>
    acatangiu and franciscoaguirre authored Oct 23, 2024
    Configuration menu
    Copy the full SHA
    8fe7700 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    10d6795 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2024

  1. Refactor with alloy macro

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    33fdc5f View commit details
    Browse the repository at this point in the history
  2. Update bridges/snowbridge/pallets/outbound-queue-v2/src/types.rs

    Co-authored-by: Vincent Geddes <[email protected]>
    yrong and vgeddes authored Oct 24, 2024
    Configuration menu
    Copy the full SHA
    6bd7eb1 View commit details
    Browse the repository at this point in the history
  3. Use const for MAX_COMMANDS

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    353e925 View commit details
    Browse the repository at this point in the history
  4. Rename to PendingOrder

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    ba03ae6 View commit details
    Browse the repository at this point in the history
  5. Encode as compact

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    57fad4c View commit details
    Browse the repository at this point in the history
  6. Cleanup

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    12bb98f View commit details
    Browse the repository at this point in the history
  7. Add RewardLedger trait

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    bf3041c View commit details
    Browse the repository at this point in the history
  8. Reorganize route v2

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    3963326 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4796240 View commit details
    Browse the repository at this point in the history
  10. Rebase inbound queue

    yrong committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    0e9cca0 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2024

  1. Emit the entire message

    yrong committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    c90bfed View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2024

  1. Configuration menu
    Copy the full SHA
    3233c3f View commit details
    Browse the repository at this point in the history
  2. Update tests

    yrong committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    d3b26bb View commit details
    Browse the repository at this point in the history
  3. Fix compile error

    yrong committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    32ac7aa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8f59cc4 View commit details
    Browse the repository at this point in the history
  5. Fix test

    yrong committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    3660624 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ee92d41 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    bd02251 View commit details
    Browse the repository at this point in the history
  8. Use XCM V5 instructions

    yrong committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    91b6405 View commit details
    Browse the repository at this point in the history
  9. Transact without specifying weight (paritytech#6228)

    Addresses paritytech#4284
    
    For V5, removed `required_weight_at_most` from `Transact`.
    The weigher now has to decode the call inside of a transaction in order
    to know it's dispatch weight.
    It's harder to make mistakes now, since the user no longer specifies a
    weight value which might be wrong.
    franciscoaguirre authored Oct 29, 2024
    Configuration menu
    Copy the full SHA
    a1b8381 View commit details
    Browse the repository at this point in the history
  10. [xcm-v5] implement RFC#122: InitiateTransfer can alias XCM original o…

    …rigin on destination (paritytech#5971)
    
    Built on top of paritytech#5876
    
    # Description
    
    Currently, all XCM asset transfer instructions ultimately clear the
    origin in the remote XCM message by use of the `ClearOrigin`
    instruction. This is done for security considerations to ensure that
    subsequent (user-controlled) instructions cannot command the authority
    of the sending chain.
    
    The problem with this approach is that it limits what can be achieved on
    remote chains through XCM. Most XCM operations require having an origin,
    and following any asset transfer the origin is lost, meaning not much
    can be done other than depositing the transferred assets to some local
    account or transferring them onward to another chain.
    
    For example, we cannot transfer some funds for buying execution, then do
    a `Transact` (all in the same XCM message).
    
    In the case of XCM programs going from source-chain directly to
    dest-chain without an intermediary hop, we can enable scenarios such as
    above by using the AliasOrigin instruction instead of the ClearOrigin
    instruction.
    
    Instead of clearing the source-chain origin, the destination chain shall
    attempt to alias source-chain to "original origin" on the source chain.
    Most common such origin aliasing would be X1(Parachain(source-chain)) ->
    X2(Parachain(source-chain), AccountId32(origin-account)) for the case of
    a single hop transfer where the initiator is a (signed/pure/proxy)
    account origin-account on source-chain. This is equivalent to using the
    DescendOrigin instruction in this case, but also usable in the multi hop
    case.
    
    This allows an actor on chain A to Transact on chain B without having to
    prefund its SA account on chain B, instead they can simply transfer the
    required fees in the same XCM program as the Transact.
    
    As long as the asset transfer has the same XCM route/hops as the rest of
    the program, this pattern of usage can be composed across multiple hops,
    to ultimately Transact on the final hop using the original origin on the
    source chain, effectively abstracting away any intermediary hops.
    
    ### XCM `InitiateAssetsTransfer` instruction changes
    
    A new parameter `preserve_origin` to be added to the
    `InitiateAssetsTransfer` XCM instruction that specifies if the original
    origin should be preserved or cleared.
    
    ```diff
    InitiateAssetsTransfer {
    	destination: Location,
    	assets: Vec<AssetTransferFilter>,
    	remote_fees: Option<AssetTransferFilter>,
    +	preserve_origin: bool,
    	remote_xcm: Xcm<()>,
    }
    ```
    
    This parameter is explicitly necessary because the instruction should be
    usable between any two chains regardless of their origin-aliasing trust
    relationship. Preserving the origin requires some level of trust, while
    clearing it works regardless of that relationship.
    Specifying `preserve_origin: false` will always work regardless of the
    configured alias filters of the
    involved chains.
    
    # Testing
    
    - [x] e2e test: User on PenpalA registers foreign token (transacts) on
    PenpalB through XCM, while paying all fees using USDT (meaning XCM has
    to go through AssetHub) - AH carries over the original origin,
    effectively being a transparent proxy,
    - [x] e2e test: User/contract on Ethereum registers foreign token
    (transacts) on Polkadot-PenpalA through XCM (over bridge), while paying
    all fees using DOT (has to go through AssetHub) - AH carries over the
    original origin, effectively being a transparent proxy for Ethereum,
    
    ---------
    
    Signed-off-by: Adrian Catangiu <[email protected]>
    Co-authored-by: Francisco Aguirre <[email protected]>
    Co-authored-by: Branislav Kontur <[email protected]>
    3 people authored Oct 29, 2024
    Configuration menu
    Copy the full SHA
    86542d6 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    e8807a3 View commit details
    Browse the repository at this point in the history
  12. Transfer PNA with XCMV5

    yrong committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    d9bb2c4 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    67c6e79 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    f40656c View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2024

  1. Improve commens

    yrong committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    bbf1299 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    593c182 View commit details
    Browse the repository at this point in the history
  3. Fix tests

    yrong committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    48f5e19 View commit details
    Browse the repository at this point in the history
  4. Fix test

    yrong committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    d1e901d View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2024

  1. Configuration menu
    Copy the full SHA
    9e39dca View commit details
    Browse the repository at this point in the history