Skip to content
  1. Oct 03, 2023
    • yjh's avatar
      feat: compute pallet/storage prefix hash at compile time (#1539) · aad80cce
      yjh authored
      
      
      Since the hash rules of this part of the `pallet_prefix/storage_prefix`
      are always fixed, we can put the runtime calculation into compile time.
      
      ---
      polkadot address: 15ouFh2SHpGbHtDPsJ6cXQfes9Cx1gEFnJJsJVqPGzBSTudr
      
      ---------
      
      Co-authored-by: default avatarJuan <[email protected]>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      aad80cce
    • asynchronous rob's avatar
      expose the last relay chain block number as an API from parachain-system (#1761) · 3ea497b5
      asynchronous rob authored
      re:
      https://forum.polkadot.network/t/blocknumber-vs-timestamps-should-we-abandon-blocktimes-altogether/4077
      
      This exposes the `LastRelayChainBlockNumber` storage member of
      `cumulus-pallet-parachain-system` with a getter and alters the behavior
      of this storage item to only be updated in `on_finalize` to ensure a
      consistent value throughout `on_initialize` and within transactions.
      
      Parachains, especially with features such as asynchronous backing and
      agile coretime, should not use the parachain block number as a clock.
      Any feature of Polkadot intended to optimize core utilization and
      parachain coretime consumption is likely to worsen this clock as it is
      practically applied.
      3ea497b5
  2. 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
  3. Oct 01, 2023
  4. Sep 30, 2023
  5. 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
  6. 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
    • Alexandru Vasile's avatar
      rpc/client: Propagate `rpc_methods` method to reported methods (#1713) · b5a0708f
      Alexandru Vasile authored
      
      
      The PR exposes the `rpc_methods` name in the `rpc_methods` response.
      This feature is useful for servers that only forward requests to methods
      that are reported by the `rpc_methods`.
      
      Jsonrpsee exposes the available methods registered so far. Registering
      the `rpc_methods` requires a closure that already stores the result. As
      such, the `rpc_methods` method name is manually added to the available
      methods.
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/1627
      
      ### Testing Done
      
      ```
      $> curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "rpc_methods", "params":[]}' http://localhost:9944
      
      {"jsonrpc":"2.0","result":{"methods":["account_nextIndex",... "rpc_methods",..."unsubscribe_newHead"]},"id":1}⏎
      ```
      
      @paritytech/subxt-team
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      b5a0708f
    • Michal Kucharczyk's avatar
      rococo-runtime: `RococoGenesisExt` removed (#1490) · 50242a61
      Michal Kucharczyk authored
      [`RococoGenesisExt`](https://github.com/paritytech/polkadot-sdk/blob/a414ea75
      
      /polkadot/node/service/src/chain_spec.rs#L152-L171)
      is removed. It was the hack to allow overwriting
      `EpochDurationInBlocks`. Removal of `RococGenesisExt` prevents from
      manipulating the state to change the runtime constants.
      
      Changes:
      - Environment variable which controls the `time::EpochDurationInBlocks`
      value was added: `ROCOCO_EPOCH_DURATION` (epoch duration will be set to
      the value of env),
      - `10,100,600` versions of rococo-runtime are built in CI and put into `polkadot-debug` docker image.
      
      `rococo-runtime` building examples:
      - to build runtime for `versi_staging_testnet` which had
      EpochDurationInBlocks set to 100:
        ```
      ROCOCO_EPOCH_DURATION=100 cargo build --features=fast-runtime -p
      rococo-runtime
        ```
      - to build runtime for `wococo_development`
        ```
      ROCOCO_EPOCH_DURATION=10 cargo build --features=fast-runtime -p
      rococo-runtime
        ```
      - to build `versi-staging` chain spec:
        ```
      ROCOCO_EPOCH_DURATION=100 cargo run -p polkadot --features=fast-runtime
      -- build-spec --chain versi-staging --raw
        ```
      - to build `wococo-dev` chain spec:
        ```
      ROCOCO_EPOCH_DURATION=10 cargo run -p polkadot --features=fast-runtime
      -- build-spec --chain wococo-dev --raw
        ```
      
      It is also possible to change the epoch duration by replacing the `code` field in the chain spec with the hex dump of pre-built runtime wasm blob (because the epoch duration is hard-coded into wasm blob).
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      50242a61
    • Marcin S.'s avatar
      PVF: more filesystem sandboxing (#1373) · c1eb342b
      Marcin S. authored
      c1eb342b
    • Xavier Lau's avatar
      Add `MaxTipAmount` for pallet-tips (#1709) · de71fecc
      Xavier Lau authored
      Last week we experienced a governance attack.
      Surprisingly, there was no upper limit on the tip amount.
      
      Due to the mechanism of pallet-fragment-election, the council members
      will be refreshed immediately. Attacker is easy to control the council
      and give a large tip amount.
      de71fecc
    • Xiliang Chen's avatar
      add some events for pallet-bounties (#1706) · b50d8e6f
      Xiliang Chen authored
      Add missing events for pallet-bounties
      b50d8e6f
    • Javyer's avatar
      Added `review-bot` to fine tune review requirements (#1673) · 4384c613
      Javyer authored
      Created a Github Action that uses the [Review-Bot
      app](https://github.com/paritytech/review-bot) to require more fine
      tuned requirements to review pull requests before allowing the PR to be
      merged.
      
      This uses
      [`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target)
      for the event, not `pull_request`. This is a security measure so that an
      attacker doesn’t have access to the secrets.
      
      All the rules have been copied from the original
      `.github/pr-custom-review.yml` file.
      
      I want to clarify, this particular commit is **not intended to replace
      PRCR yet**.
      
      # Advantages it brings over `PRCR`
      
      Most of the features available in `PRCR` have been duplicated and
      enhanced. For a complete detailed write up, please see:
      - paritytech/pr-custom-review#114 -> Proposal for the rewrite
      - [Review Bot
      Documentation](https://github.com/paritytech/review-bot/blob/main/README.md)
      
      The most important features are:
      - `include` and `exclude` fields now accept an array, making it easier
      to read the regular expressions.
      - Ability to skip a rule
      - We can set that PRs coming from a particular user or team will cause
      the rule to be skipped.
      - This is used in the `Audit rule`, which was requested by
      @the-right-joyce.
        - This resolves paritytech/pr-custom-review#136
      - Ability to request fellows instead of teams
      - As requested in polkadot-fellows/runtimes#7, this bot has the ability
      to request fellows by rank instead of users.
      - We currently have polkadot-fellows/runtimes#31 which is using that
      feature.
      
      Aside from all the rules available in `PRCR` I have added a particular
      rule to lock the review-bot files and require a review from the
      `locks-review` team, the @paritytech/ci team and the
      @paritytech/opstooling team to ensure that the file has been written
      correctly.
      
      ## Next steps
      
      The next steps will consist on paritytech/review-bot#53, once this issue
      has been resolved, and `review-bot` has worked without any issues on
      this repository for a while, we will upgrade it to be able to fully
      replace `PRCR`.
      4384c613
    • Dónal Murray's avatar
      Add event field names to HRMP Event variants (#1695) · 4bc97e48
      Dónal Murray authored
      Update the HRMP pallet to use field names for Event variants to improve
      metadata for a better client experience.
      Event variants are now structs instead of unnamed tuples.
      
      Partially implements Substrate issue
      [9903](https://github.com/paritytech/substrate/issues/9903) which
      doesn't appear to have been moved to the monorepo.
      4bc97e48
  7. Sep 27, 2023
  8. Sep 26, 2023
    • dependabot[bot]'s avatar
      Bump directories from 4.0.1 to 5.0.1 (#1656) · a846b746
      dependabot[bot] authored
      
      
      Bumps [directories](https://github.com/soc/directories-rs) from 4.0.1 to
      5.0.1.
      <details>
      <summary>Commits</summary>
      <ul>
      <li>See full diff in <a
      href="https://github.com/soc/directories-rs/commits">compare
      view</a></li>
      </ul>
      </details>
      <br />
      
      
      [![Dependabot compatibility
      score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=directories&package-manager=cargo&previous-version=4.0.1&new-version=5.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
      
      Dependabot will resolve any conflicts with this PR as long as you don't
      alter it yourself. You can also trigger a rebase manually by commenting
      `@dependabot rebase`.
      
      [//]: # (dependabot-automerge-start)
      [//]: # (dependabot-automerge-end)
      
      ---
      
      <details>
      <summary>Dependabot commands and options</summary>
      <br />
      
      You can trigger Dependabot actions by commenting on this PR:
      - `@dependabot rebase` will rebase this PR
      - `@dependabot recreate` will recreate this PR, overwriting any edits
      that have been made to it
      - `@dependabot merge` will merge this PR after your CI passes on it
      - `@dependabot squash and merge` will squash and merge this PR after
      your CI passes on it
      - `@dependabot cancel merge` will cancel a previously requested merge
      and block automerging
      - `@dependabot reopen` will reopen this PR if it is closed
      - `@dependabot close` will close this PR and stop Dependabot recreating
      it. You can achieve the same result by closing it manually
      - `@dependabot show <dependency name> ignore conditions` will show all
      of the ignore conditions of the specified dependency
      - `@dependabot ignore <dependency name> major version` will close this
      group update PR and stop Dependabot creating any more for the specific
      dependency's major version (unless you unignore this specific
      dependency's major version or upgrade to it yourself)
      - `@dependabot ignore <dependency name> minor version` will close this
      group update PR and stop Dependabot creating any more for the specific
      dependency's minor version (unless you unignore this specific
      dependency's minor version or upgrade to it yourself)
      - `@dependabot ignore <dependency name>` will close this group update PR
      and stop Dependabot creating any more for the specific dependency
      (unless you unignore this specific dependency or upgrade to it yourself)
      - `@dependabot unignore <dependency name>` will remove all of the ignore
      conditions of the specified dependency
      - `@dependabot unignore <dependency name> <ignore condition>` will
      remove the ignore condition of the specified dependency and ignore
      conditions
      
      
      </details>
      
      Signed-off-by: default avatardependabot[bot] <[email protected]>
      Co-authored-by: default avatardependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      a846b746
    • Dónal Murray's avatar
      Allow debug_assertions in short-benchmarks CI job (#1711) · 7d3ce4df
      Dónal Murray authored
      Add debug_assertions to WASM builds in the short-benchmarks CI job.
      
      Disallow warnings, show a full backtrace and remove the WASM output
      colour to improve information from this CI step in the event of a failure.
      
      This is motivated by a
      [case](https://github.com/paritytech/polkadot-sdk/pull/1676/commits/23d64918)
      where a benchmark was misconfigured in master and failing to send
      notifications, but passing CI. We don't want this to fail if the problem
      happens in production, but ideally we'd know from the CI if it was
      misconfigured and the messages weren't getting sent, as that could
      (would?) affect the weights that the benchmark generates.
      
      Enabling debug-assertions in WASM builds for the short-benchmarks would
      catch "soft" failures like this in future.
      7d3ce4df
    • Alexandru Vasile's avatar
      chainHead/storage: Fix storage iteration using the query key (#1665) · cc50eda0
      Alexandru Vasile authored
      
      
      This PR ensures that all storage keys under a prefix are returned by the
      `chainHead_storage` method.
      
      Before this PR, the `storage_keys` was used with just the `start_key`.
      Before the pagination event was generated, the last reported key
      `last_key` was saved internally.
      When the pagination is resumed, the `last_key` will serve as the next
      `start_key` to the `storage_keys` API.
      
      However, this behavior does not function properly for non-prefixed
      storage keys.
      
      Entry keys `a`, `ab`, `abc` share a common prefix and therefore the `ab`
      key leads to `abc`.
      However, for `a`, `ab`, `aB` and `abc`, the `aB` key does not
      immediately lead to `abc`.
      
      To mitigate this, the PR saves the start key of the query, together with
      the next pagination key.
      Improve testing to ensure we have a key entry that doesn't share the
      prefix with the descendant key.
      
      @paritytech/subxt-team
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      cc50eda0
  9. Sep 25, 2023