1. Oct 10, 2023
  2. Oct 09, 2023
  3. Oct 07, 2023
    • Muharem Ismailov's avatar
      Treasury spends various asset kinds (#1333) · cb944dc5
      Muharem Ismailov authored
      
      
      ### Summary 
      
      This PR introduces new dispatchables to the treasury pallet, allowing
      spends of various asset types. The enhanced features of the treasury
      pallet, in conjunction with the asset-rate pallet, are set up and
      enabled for Westend and Rococo.
      
      ### Westend and Rococo runtimes.
      
      Polkadot/Kusams/Rococo Treasury can accept proposals for `spends` of
      various asset kinds by specifying the asset's location and ID.
      
      #### Treasury Instance New Dispatchables:
      - `spend(AssetKind, AssetBalance, Beneficiary, Option<ValidFrom>)` -
      propose and approve a spend;
      - `payout(SpendIndex)` - payout an approved spend or retry a failed
      payout
      - `check_payment(SpendIndex)` - check the status of a payout;
      - `void_spend(SpendIndex)` - void previously approved spend;
      > existing spend dispatchable renamed to spend_local
      
      in this context, the `AssetKind` parameter contains the asset's location
      and it's corresponding `asset_id`, for example:
      `USDT` on `AssetHub`,
      ``` rust
      location = MultiLocation(0, X1(Parachain(1000)))
      asset_id = MultiLocation(0, X2(PalletInstance(50), GeneralIndex(1984)))
      ```
      
      the `Beneficiary` parameter is a `MultiLocation` in the context of the
      asset's location, for example
      ``` rust
      // the Fellowship salary pallet's location / account
      FellowshipSalaryPallet = MultiLocation(1, X2(Parachain(1001), PalletInstance(64)))
      // or custom `AccountId`
      Alice = MultiLocation(0, AccountId32(network: None, id: [1,...]))
      ```
      
      the `AssetBalance` represents the amount of the `AssetKind` to be
      transferred to the `Beneficiary`. For permission checks, the asset
      amount is converted to the native amount and compared against the
      maximum spendable amount determined by the commanding spend origin.
      
      the `spend` dispatchable allows for batching spends with different
      `ValidFrom` arguments, enabling milestone-based spending. If the
      expectations tied to an approved spend are not met, it is possible to
      void the spend later using the `void_spend` dispatchable.
      
      Asset Rate Pallet provides the conversion rate from the `AssetKind` to
      the native balance.
      
      #### Asset Rate Instance Dispatchables:
      - `create(AssetKind, Rate)` - initialize a conversion rate to the native
      balance for the given asset
      - `update(AssetKind, Rate)` - update the conversion rate to the native
      balance for the given asset
      - `remove(AssetKind)` - remove an existing conversion rate to the native
      balance for the given asset
      
      the pallet's dispatchables can be executed by the Root or Treasurer
      origins.
      
      ### Treasury Pallet
      
      Treasury Pallet can accept proposals for `spends` of various asset kinds
      and pay them out through the implementation of the `Pay` trait.
      
      New Dispatchables:
      - `spend(Config::AssetKind, AssetBalance, Config::Beneficiary,
      Option<ValidFrom>)` - propose and approve a spend;
      - `payout(SpendIndex)` - payout an approved spend or retry a failed
      payout;
      - `check_payment(SpendIndex)` - check the status of a payout;
      - `void_spend(SpendIndex)` - void previously approved spend;
      > existing spend dispatchable renamed to spend_local
      
      The parameters' types of the `spend` dispatchable exposed via the
      pallet's `Config` and allows to propose and accept a spend of a certain
      amount.
      
      An approved spend can be claimed via the `payout` within the
      `Config::SpendPeriod`. Clients provide an implementation of the `Pay`
      trait which can pay an asset of the `AssetKind` to the `Beneficiary` in
      `AssetBalance` units.
      
      The implementation of the Pay trait might not have an immediate final
      payment status, for example if implemented over `XCM` and the actual
      transfer happens on a remote chain.
      
      The `check_status` dispatchable can be executed to update the spend's
      payment state and retry the `payout` if the payment has failed.
      
      ---------
      
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: command-bot <>
      cb944dc5
    • Javier Viola's avatar
      chore: bump zombienter version (#1806) · 5a691260
      Javier Viola authored
      Bump zombiente version. This version includes the fixes needed for
      `mixnet`.
      Thx!
      5a691260
    • Dmitry Borodin's avatar
      migrate babe and authorship to use derive-impl (#1790) · 35ed272d
      Dmitry Borodin authored
      Moving a babe and authorship pallets to the latest and greatest
      derive_impl.
      
      Part of https://github.com/paritytech/polkadot-sdk/issues/171
      
      
      
      ---------
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      35ed272d
  4. Oct 06, 2023
  5. Oct 05, 2023
  6. Oct 04, 2023
  7. Oct 03, 2023
  8. Oct 02, 2023
    • Liam Aharon's avatar
      Init System Parachain storage versions and add migration check jobs to CI (#1344) · db3fd687
      Liam Aharon authored
      Makes SPs first class citizens along with the relay chains in the
      context of our CI runtime upgrade checks.
      
      ## Code changes
      
      - Sets missing current storage version in `uniques` pallet
      - Adds multisig V1 migration to run where it was missing
      - Removes executed migration whos pre/post hooks were failing from
      collectives runtime
      - Initializes storage versions for SP pallets added after genesis
      - Originally I was going to wait for
      https://github.com/paritytech/polkadot-sdk/pull/1297 to be merged so
      this wouldn't need to be done manually, but it doesn't seem like it'll
      be merged any time soon so I've decided to set them manually to unblock
      this
      
      ## CI changes
      
      - Removed dependency of `westend` runtime upgrades being complete prior
      to other ones running. I assume it is supposed to cache the
      `try-runtime` build for a performance benefit, but it seems it wasn't
      working. Maybe someone from the CI team can look into this or explain
      why it needs to be there?
      
      - Adds check-runtime-migration jobs for Parity asset-hubs, bridge-hubs
      and contract chains
      
      - Updated VARIABLES to accomodate the `kusama-runtime` package being
      renamed to `staging-kusama-runtime` in
      https://github.com/paritytech/polkadot-sdk/pull/1241
      
      - Added `EXTRA_ARGS` variable to `check-runtime-migration`, and set
      `--no-weight-warnings` to the relay chain runtime upgrade checks (relay
      chains don't have weight restrictions).
      db3fd687
  9. Oct 01, 2023
  10. Sep 30, 2023
  11. Sep 29, 2023
    • Muharem Ismailov's avatar
      frame-support: `RuntimeDebug\Eq\PartialEq` impls for `Imbalance` (#1717) · 7d4f8296
      Muharem Ismailov authored
      Derive `RuntimeDebug\Eq\PartialEq` but do not bound any generics.
      
      This achieved by using their equivalent no bound versions:
      `EqNoBound\PartialEqNoBound\RuntimeDebugNoBound`.
      
      Deriving with `Debug`, `Eq`, and `PartialEq` for the `Debt` and `Credit`
      type aliases of `Imbalance` is not feasible due to the `OnDrop` and
      `OppositeOnDrop` generic types lacking implementations of the same
      traits.
      
      This absence posed challenges in testing and any scenarios that demanded
      the traits implementations for the type.
      7d4f8296
    • Sebastian Kunert's avatar
      9485b0b4
    • Ankan's avatar
      [NPoS] Fix for Reward Deficit in the pool (#1255) · f820dc0a
      Ankan authored
      closes https://github.com/paritytech/polkadot-sdk/issues/158.
      partially addresses
      https://github.com/paritytech/polkadot-sdk/issues/226.
      
      Instead of fragile calculation of current balance by looking at `free
      balance - ED`, Nomination Pool now freezes ED in the pool reward account
      to restrict an account from going below minimum balance. This also has a
      nice side effect that if ED changes, we know how much is the imbalance
      in ED frozen in the pool and the current required ED. A pool operator
      can diligently top up the pool with the deficit in ED or vice versa,
      withdraw the excess they transferred to the pool.
      
      ## Notable changes
      - New call `adjust_pool_deposit`: Allows to top up the deficit or
      withdraw the excess deposited funds to the pool.
      - Uses Fungible trait (instead of Currency trait). Since NP was not
      doing any locking/reserving previously, no migration is needed for this.
      - One time migration of freezing ED from each of the existing pools (not
      very PoV friendly but fine for relay chain).
      f820dc0a
    • Dmitry Markin's avatar
      Move import queue from `ChainSync` to `SyncingEngine` (#1736) · 0691c91e
      Dmitry Markin authored
      This PR is part of [Sync
      2.0](https://github.com/paritytech/polkadot-sdk/issues/534) refactoring
      aimed at making `ChainSync` a pure state machine.
      
      Resolves https://github.com/paritytech/polkadot-sdk/issues/501.
      0691c91e
    • Piotr Mikołajczyk's avatar
      Enable mocking contracts (#1331) · d8d90a82
      Piotr Mikołajczyk authored
      # Description
      This PR introduces two changes:
      - the previous `Tracing` trait has been modified to accept contract
      address instead of code hash (seems to be way more convenient)
      - a new trait `CallInterceptor` that allows intercepting contract calls;
      in particular the default implementation for `()` will just proceed in a
      standard way (after compilation optimizations, there will be no
      footprint of that); however, implementing type might decide to mock
      invocation and return `ExecResult` instead
      
      Note: one might try merging `before_call` and `intercept_call`. However,
      IMHO this would be bad, since it would mix two completely different
      abstractions - tracing without any effects and actual intervention into
      execution process.
      
      This will unblock working on mocking contracts utility in drink and
      similar tools (https://github.com/Cardinal-Cryptography/drink/issues/33)
      
      # Checklist
      
      - [x] My PR includes a detailed description as outlined in the
      "Description" section above
      - [ ] My PR follows the [labeling
      requirements](https://github.com/paritytech/polkadot-sdk/blob/master/docs/CONTRIBUTING.md#process)
      of this project (at minimum one label for `T` required)
      - [x] I have made corresponding changes to the documentation (if
      applicable)
      - [x] I have added tests that prove my fix is effective or that my
      feature works (if applicable)
      d8d90a82
    • Mira Ressel's avatar
      Revert "fix(review-bot): pull secrets from `master` environment" (#1748) · ef3adf9a
      Mira Ressel authored
      This reverts commit b749ff22 (#1745).
      ef3adf9a
    • Bastian Köcher's avatar
      Remove kusama and polkadot runtime crates (#1731) · bf90cb0b
      Bastian Köcher authored
      This pull request is removing the Kusama and Polkadot runtime crates. As
      still some crates dependent on the runtime crates, this pull request is
      doing some more changes.
      
      - It removes the `hostperfcheck` CLI command. This CLI command could
      compare the current node against the standard hardware by doing some
      checks. Later we added the hardware benchmark feature to Substrate. This
      hardware benchmark is running on every node startup and prints a warning
      if the current node is too slow. This makes this CLI command a duplicate
      that was also depending on the kusama runtime.
      
      - The pull request is removing the emulated integration tests that were
      requiring the Kusama or Polkadot runtime crates.
      bf90cb0b
    • Sebastian Kunert's avatar
      Use `Extensions` to register offchain worker custom extensions (#1719) · 4902db21
      Sebastian Kunert authored
      
      
      Closes #1671 
      
      Adds a `type_id` function to the `Extension` trait, allowing to properly store an retrieve
      boxed `Extensions`.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      4902db21
    • Tadeo Hepperle's avatar
      [RPC-Spec-V2] chainHead: use integer for block index and adjust RuntimeVersion JSON format (#1666) · 379be3d7
      Tadeo Hepperle authored
      This PR adjusts the serialized format of the the returned RuntimeVersion
      in the rpc-spec-v2 methods. This is done to match the format defined
      here:
      https://paritytech.github.io/json-rpc-interface-spec/api/chainHead_unstable_follow.html#about-the-runtime
      
      - ##### `apis` field as object
      `apis` field of `RuntimeVersion` is now returned as an object, e.g. 
      ```
      "apis": {
            "0xdf6acb689907609b": 3,
            "0x37e397fc7c91f5e4": 1,
      }
      ```
      instead of 
      ```
      "apis": [
            ["0xdf6acb689907609b", 3],
            ["0x37e397fc7c91f5e4", 1],
      ]
      ```
      - ##### removed `stateVersion` and `authoringVersion`
      `stateVersion` and `authoringVersion` are no longer returned in the
      `RuntimeVersion` JSON Object.
      
      - ##### block index in chain head events as integer
      
      ### Related Issues
      
      Closes: #1507
      Closes: #1146
      
      ### Testing Done
      Adjusted existing tests to make sure data is returned in the correct
      format.
      379be3d7
  12. Sep 28, 2023
    • Mira Ressel's avatar
    • btwiuse's avatar
      Fix `subkey inspect` output text padding (#1744) · 7b9861a2
      btwiuse authored
      
      
      This pull request is to fix the output text misalignment of `subkey
      inspect` command:
      
      (the `Network ID` line has an extra space at the end, and the `Secret
      seed` line lacks a leading space)
      
      ```
      [btwiuse@railway ~]$ subkey inspect '' | cat -A
      Secret Key URI `` is account:$
        Network ID:        substrate $
       Secret seed:       0xfac7959dbfe72f052e5a0c3c8d6530f202b02fd8f9f5ca3580ec8deb7797479e$
        Public key (hex):  0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a$
        Account ID:        0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a$
        Public key (SS58): 5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV$
        SS58 Address:      5DfhGyQdFobKM8NsWvEeAKk5EQQgYe9AydgJ7rMB6E1EqRzV$
      ```
      
      The output should be in the same YAML-like format as `subkey generate`:
      
      ```
      [btwiuse@railway ~]$ subkey generate  | cat -A
      Secret phrase:       awkward eagle survey resemble novel resist modify memory pistol shed flower run$
        Network ID:        substrate$
        Secret seed:       0x20502f79366325b7dc7620664e8844ae69d441baf6e5b571a57d3b3ff28e9586$
        Public key (hex):  0x468874b9e5b6b77333fa702b9201b924d6834bf956e33e2bbe37d131134ca830$
        Account ID:        0x468874b9e5b6b77333fa702b9201b924d6834bf956e33e2bbe37d131134ca830$
        Public key (SS58): 5DfBkAMg5xQmsePFr3BWLZm99smiNyy9axWSgembvFgDKh9v$
        SS58 Address:      5DfBkAMg5xQmsePFr3BWLZm99smiNyy9axWSgembvFgDKh9v$
      ```
      
      This change will fix `subkey` as well as all binaries that embed it as
      the `key` subcommand, for example: `substrate key`, `polkadot key`, etc.
      
      ---------
      
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      7b9861a2
    • Alexandru Vasile's avatar
      archive: Implement height, hashByHeight and call (#1582) · 945ebbbc
      Alexandru Vasile authored
      This PR implements:
      - `archive_unstable_finalized_height`: Get the height of the most recent
      finalized block
      - `archive_unstable_hash_by_height`: Get the hashes (possible empty) of
      blocks from the given height
      - `archive_unstable_call`: Call into the runtime of a block
      
      Builds on top of: https://github.com/paritytech/polkadot-sdk/pull/1560
      
      ### Testing Done
      - unit tests for the methods with custom block tree for different
      heights / forks
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/1510
      Closes: https://github.com/paritytech/polkadot-sdk/issues/1513
      Closes: https://github.com/paritytech/polkadot-sdk/issues/1511
      
      
      
      @paritytech/subxt-team
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      945ebbbc