Skip to content
  1. Feb 03, 2024
    • Cyrill Leutwiler's avatar
      Contracts: Stabilize `caller_is_root` API (#3154) · 966a8864
      Cyrill Leutwiler authored
      
      
      Can this API be marked stable? Implemented in [solang
      here](https://github.com/hyperledger/solang/pull/1620)
      
      ---------
      
      Signed-off-by: default avatarCyrill Leutwiler <[email protected]>
      966a8864
    • Koute's avatar
      Initial support for building RISC-V runtimes targeting PolkaVM (#3179) · e349fc9e
      Koute authored
      This PR adds initial support for building RISC-V runtimes targeting
      PolkaVM.
      
      - Setting the `SUBSTRATE_RUNTIME_TARGET=riscv` environment variable will
      now build a RISC-V runtime instead of a WASM runtime.
      - This only adds support for *building* runtimes; running them will need
      a PolkaVM-based executor, which I will add in a future PR.
      - Only building the minimal runtime is supported (building the Polkadot
      runtime doesn't work *yet* due to one of the dependencies).
      - The builder now sets a `substrate_runtime` cfg flag when building the
      runtimes, with the idea being that instead of doing `#[cfg(not(feature =
      "std"))]` or `#[cfg(target_arch = "wasm32")]` to detect that we're
      building a runtime you'll do `#[cfg(substrate_runtime)]`. (Switching the
      whole codebase to use this will be done in a future PR; I deliberately
      didn't do this here to keep this PR minimal and reviewable.)
      - Further renaming of things (e.g. types, environment variables and proc
      macro attributes having "wasm" in their name) to be target-agnostic will
      also be done in a future refactoring PR (while keeping backwards
      compatibility where it makes sense; I don't intend to break anyone's
      workflow or create unnecessary churn).
      - This PR also fixes two bugs in the `wasm-builder` crate:
      * The `RUSTC` environment variable is now removed when invoking the
      compiler. This prevents the toolchain version from being overridden when
      called from a `build.rs` script.
      * When parsing the `rustup toolchain list` output the `(default)` is now
      properly stripped and not treated as part of the version.
      - I've also added a minimal CI job that makes sure this doesn't break in
      the future. (cc @paritytech/ci)
      
      cc @athei
      
      
      
      ------
      
      Also, just a fun little tidbit: quickly comparing the size of the built
      runtimes it seems that the PolkaVM runtime is slightly smaller than the
      WASM one. (`production` build, with the `names` section substracted from
      the WASM's size to keep things fair, since for the PolkaVM runtime we're
      currently stripping out everything)
      
      - `.wasm`: 625505 bytes
      - `.wasm` (after wasm-opt -O3): 563205 bytes
      - `.wasm` (after wasm-opt -Os): 562987 bytes
      - `.wasm` (after wasm-opt -Oz): 536852 bytes
      - `.polkavm`: ~~580338 bytes~~ 550476 bytes (after enabling extra target
      features; I'll add those in another PR once we have an executor working)
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      e349fc9e
  2. Feb 02, 2024
    • dependabot[bot]'s avatar
      Bump wasmi from 0.31.0 to 0.31.2 (#3164) · 41db45a2
      dependabot[bot] authored
      
      
      Bumps [wasmi](https://github.com/paritytech/wasmi) from 0.31.0 to
      0.31.2.
      <details>
      <summary>Release notes</summary>
      <p><em>Sourced from <a
      href="https://github.com/paritytech/wasmi/releases">wasmi's
      releases</a>.</em></p>
      <blockquote>
      <h2>v0.31.1 - 2023-12-01</h2>
      <h3>Fixes</h3>
      <ul>
      <li>Fixed a bug, in the <code>wasmi</code> engine executor, that causes
      an out of bounds buffer write when calling or resuming a Wasm function
      with a high number of parameters from the host side.</li>
      </ul>
      </blockquote>
      </details>
      <details>
      <summary>Changelog</summary>
      <p><em>Sourced from <a
      href="https://github.com/paritytech/wasmi/blob/master/CHANGELOG.md">wasmi's
      changelog</a>.</em></p>
      <blockquote>
      <h1>Changelog</h1>
      <p>All notable changes to this project will be documented in this
      file.</p>
      <p>The format is loosely based on <a
      href="https://keepachangelog.com/en/1.0.0/">Keep a Changelog</a>,
      and this project adheres to <a
      href="https://semver.org/spec/v2.0.0.html">Semantic Versioning</a>.
      Additionally we have an <code>Internal</code> section for changes that
      are of interest to developers.</p>
      <p>Dates in this file are formattes as <code>YYYY-MM-DD</code>.</p>
      <h2>[<code>0.32.0-beta.5</code>] - 2024-01-15</h2>
      <p><strong>Note:</strong></p>
      <ul>
      <li>This is the beta of the upcoming <code>v0.32.0</code> release.
      This version is not production ready yet and might contain serious bugs.
      Please use this only for experimentation or at your own risk.</li>
      <li>Performance tests indicated that the new register-machine bytecode
      based
      Wasmi engine performance is very sensitive to hardware or OS specifics
      which may lead to very different performance characteristics.
      <ul>
      <li>We are working on fixing this until the stable release.</li>
      <li>Measurements concluded that execution performance can be equal or
      sometimes
      even surpass Wasm3 execution performance.</li>
      </ul>
      </li>
      </ul>
      <h3>Added</h3>
      <ul>
      <li>Added a new execution engine based on register-machine bytecode. (<a
      href="https://redirect.github.com/paritytech/wasmi/pull/729">paritytech/wasmi#729</a>)
      <ul>
      <li>The register-machine Wasmi <code>Engine</code> executes roughly
      80-100% faster and
      compiles roughly 30% slower according to benchmarks conducted so
      far.</li>
      </ul>
      </li>
      <li>Added <code>Module::new_unchecked</code> API. (<a
      href="https://redirect.github.com/paritytech/wasmi/pull/829">paritytech/wasmi#829</a>)
      <ul>
      <li>This allows to compile a Wasm module without Wasm validation which
      can be useful
      when users know that their inputs are valid Wasm binaries.</li>
      <li>This improves Wasm compilation performance for faster startup times
      by roughly 10-20%.</li>
      </ul>
      </li>
      <li>Added Wasm compilation modes. (<a
      href="https://redirect.github.com/paritytech/wasmi/pull/844">paritytech/wasmi#844</a>)
      <ul>
      <li>When using <code>Module::new</code> Wasmi eagerly compiles Wasm
      bytecode into Wasmi bytecode
      which is optimized for efficient execution. However, this compilation
      can become very
      costly especially for large Wasm binaries.</li>
      <li>The solution to this problem is to introduce new compilation modes,
      namely:
      <ul>
      <li><code>CompilationMode::Eager</code>: Eager compilation, what Wasmi
      did so far. (default)</li>
      <li><code>CompilationMode::LazyTranslation</code>: Eager Wasm validation
      and lazy Wasm translation.</li>
      <li><code>CompilationMode::Lazy</code>: Lazy Wasm validation and
      translation.</li>
      </ul>
      </li>
      <li>Benchmarks concluded that
      <ul>
      <li><code>CompilationMode::LazyTanslation</code>: Usually improves
      startup performance by a factor of 2 to 3.</li>
      <li><code>CompilationMode::Lazy</code>: Usually improves startup
      performance by a factor of up to 27.</li>
      </ul>
      </li>
      <li>Note that <code>CompilationMode::Lazy</code> can lead to partially
      validated Wasm modules
      which can introduce non-determinism when using different Wasm
      implementations.
      Therefore users should know what they are doing when using
      <code>CompilationMode::Lazy</code> if this is a concern.</li>
      <li>Enable lazy Wasm compilation with:
      <pre lang="rust"><code>let mut config = wasmi::Config::default();
      </code></pre>
      </li>
      </ul>
      </li>
      </ul>
      <!-- raw HTML omitted -->
      </blockquote>
      <p>... (truncated)</p>
      </details>
      <details>
      <summary>Commits</summary>
      <ul>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/0218dfc74b4c4a83261d46d90ac83fb513fd6b3f"><code>0218dfc</code></a>
      Fix <code>InstanceCache</code> bug (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/904">#904</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/3fd0cc2b2d7b7a55142e6a6cffffbe4212ed00ae"><code>3fd0cc2</code></a>
      Bump <code>wasmi_arena</code> version (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/903">#903</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/86c874029eba5067f4ecd01bc3c4f6dacab5a16e"><code>86c8740</code></a>
      Fix <code>Sync</code> impl bug in <code>wasmi_arena</code> crate (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/902">#902</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/27def282b06613e770d0ab96de88b9909973a12b"><code>27def28</code></a>
      Bump actions/cache from 3 to 4 (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/900">#900</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/59f9acc4776c09a35c6d563609de6818e9b65084"><code>59f9acc</code></a>
      Fix typos (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/899">#899</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/4c06acd816ccde6f45f9cc16aac4e18d36066054"><code>4c06acd</code></a>
      Update and improve Wasmi's readme (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/898">#898</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/2354a20ecc5e4209af2ba7458a8c383789ad8b4f"><code>2354a20</code></a>
      Prepare release for Wasmi <code>v0.32.0 beta.5</code> (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/893">#893</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/a4dc251bf066c362a2fc6acf00da924659894c6d"><code>a4dc251</code></a>
      Fix heap buffer overflow due to Wasmi codegen bug (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/892">#892</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/e60da4979009370cb1149b29dbb612886854efa9"><code>e60da49</code></a>
      Add CI test job using LLVM's Address Sanitizer (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/891">#891</a>)</li>
      <li><a
      href="https://github.com/paritytech/wasmi/commit/28c770ac9623d78ce10c67d9bec013e0d3a43bcb"><code>28c770a</code></a>
      Prepare release for Wasmi <code>v0.32.0-beta.4</code> (<a
      href="https://redirect.github.com/paritytech/wasmi/issues/889">#889</a>)</li>
      <li>Additional commits viewable in <a
      href="https://github.com/paritytech/wasmi/compare/v0.31.0...v0.31.2">compare
      view</a></li>
      </ul>
      </details>
      <br />
      
      
      [![Dependabot compatibility
      score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=wasmi&package-manager=cargo&previous-version=0.31.0&new-version=0.31.2)](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>
      41db45a2
    • Bastian Köcher's avatar
      Enable async backing by default for Rococo/Westend (#3162) · e0674cb3
      Bastian Köcher authored
      
      
      This change is mainly for people running the local variants. They can
      directly start with async backing.
      
      ---------
      
      Signed-off-by: default avatarAlexandru Gheorghe <[email protected]>
      Co-authored-by: default avatarAlexandru Gheorghe <[email protected]>
      e0674cb3
    • Tsvetomir Dimitrov's avatar
      Small fixes coretime related fixes (#3188) · 4d78c6eb
      Tsvetomir Dimitrov authored
      The PR contains small fixes for:
      * A test `HostConfig v11` storage migration - v11 was compared with
      itself instead of with `v10`.
      * Outdated comment for `ClaimQueue`
      * Typos
      4d78c6eb
    • 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
    • Marcin S.'s avatar
      Enable async backing on all testnet system chains (#2949) · 700d5f85
      Marcin S. authored
      
      
      Built on top of https://github.com/paritytech/polkadot-sdk/pull/2826/
      which was a trial run.
      
      Guide:
      https://github.com/w3f/polkadot-wiki/blob/master/docs/maintain/maintain-guides-async-backing.md
      
      ---------
      
      Signed-off-by: default avatargeorgepisaltu <[email protected]>
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      Co-authored-by: default avatarDónal Murray <[email protected]>
      Co-authored-by: default avatarDmitry Sinyavin <[email protected]>
      Co-authored-by: default avatars0me0ne-unkn0wn <[email protected]>
      Co-authored-by: default avatarSvyatoslav Nikolsky <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: default avatargeorgepisaltu <[email protected]>
      700d5f85
    • Branislav Kontur's avatar
      [cumulus] Improved check for sane bridge fees calculations (#3175) · 74b597fc
      Branislav Kontur authored
      ## TODO
      - [x] change constants when CI fails (should fail :) )
      
      ## Result
      
      On the AssetHubRococo: 1701175800126 -> 1700929825257 = 0.15 %
      decreased.
      ```
      # Before ( [xcm] Fix `SovereignPaidRemoteExporter` and `DepositAsset` handling (#3157))
      Feb 02 12:59:05.520 ERROR bridges::estimate: `bridging::XcmBridgeHubRouterBaseFee` actual value: 1701175800126 for runtime: statemine-1006000 (statemine-0.tx14.au1)    
      
      # After
      Feb 02 13:02:40.647 ERROR bridges::estimate: `bridging::XcmBridgeHubRouterBaseFee` actual value: 1700929825257 for runtime: statemine-1006000 (statemine-0.tx14.au1)    
      
      ```
      
      On the AssetHubWestend: 2116038876326 -> 1641718372993 = 22.4 %
      decreased.
      ```
      # Before ( [xcm] Fix `SovereignPaidRemoteExporter` and `DepositAsset` handling (#3157))
      Feb 02 12:56:00.880 ERROR bridges::estimate: `bridging::XcmBridgeHubRouterBaseFee` actual value: 2116038876326 for runtime: westmint-1006000 (westmint-0.tx14.au1)    
      
      
      # After
      Feb 02 13:04:42.515 ERROR bridges::estimate: `bridging::XcmBridgeHubRouterBaseFee` actual value: 1641718372993 for runtime: westmint-1006000 (westmint-0.tx14.au1)    
      ```
      74b597fc
    • Alexandru Gheorghe's avatar
      Fixup backing group computation time (#3170) · 5ba89217
      Alexandru Gheorghe authored
      
      
      Fixes: https://github.com/paritytech/polkadot-sdk/issues/3165
      
      ---------
      
      Signed-off-by: default avatarAlexandru Gheorghe <[email protected]>
      5ba89217
  3. Feb 01, 2024
  4. Jan 31, 2024
    • Pablo Andrés Dorado Suárez's avatar
      [Documentation] Add description for VoteTally's methods (#3140) · 8a8f6f98
      Pablo Andrés Dorado Suárez authored
      
      
      # Description
      
      While methods' names on [`VoteTally`][1] trait might be self-explanatory
      at first sight, the distinction between `support` and `approval` can be
      a bit ambiguous for some readers. This PR aims to clarify the
      distinction and inform about the expected values for every not yet
      documented method on this trait.
      
      # Checklist
      
      - [x] My PR includes a detailed description as outlined in the
      "Description" section above
      - [ ] My PR follows the [labeling requirements](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)
      
      [1]:
      https://docs.rs/frame-support/latest/frame_support/traits/trait.VoteTally.html
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      8a8f6f98
    • Oliver Tale-Yazdi's avatar
      [FRAME] Make `core-fellowship` ans `salary` work for swapped members (#3156) · 07e55006
      Oliver Tale-Yazdi authored
      Fixup for https://github.com/paritytech/polkadot-sdk/pull/2587 to make
      the `core-fellowship` crate work with swapped members.
      
      Adds a `MemberSwappedHandler` to the `ranked-collective` pallet that are
      implemented by `core-fellowship+salary`.
      There is are exhaustive tests
      [here](https://github.com/paritytech/polkadot-sdk/blob/72aa7ac1/substrate/frame/core-fellowship/src/tests/integration.rs#L338)
      and
      [here](https://github.com/paritytech/polkadot-sdk/blob/ab3cdb05
      
      /substrate/frame/salary/src/tests/integration.rs#L224)
      to check that adding member `1` is equivalent to adding member `0` and
      then swapping.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      07e55006
    • Branislav Kontur's avatar
      [xcm] Fix `SovereignPaidRemoteExporter` and `DepositAsset` handling (#3157) · 6ea472ad
      Branislav Kontur authored
      This PR addresses two issues:
      - It modifies `DepositAsset`'s asset filter from `All` to
      `AllCounted(1)` to prevent potentially charging excessive weight/fees.
      This adjustment avoids situations where fees could be calculated based
      on the count of assets, as illustrated
      [here](https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs#L38-L46).
      - It encapsulates `DepositAsset` with `SetAppendix` to ensure that
      `fees` are not trapped in any case. For instance, this prevents issues
      when `ExportXcm::validate` encounters an error during the processing of
      `ExportMessage`.
      6ea472ad
    • dependabot[bot]'s avatar
      Bump bounded-collections from 0.1.9 to 0.2.0 (#3118) · 2adf499a
      dependabot[bot] authored
      
      
      Bumps [bounded-collections](https://github.com/paritytech/parity-common)
      from 0.1.9 to 0.2.0.
      <details>
      <summary>Commits</summary>
      <ul>
      <li>See full diff in <a
      href="https://github.com/paritytech/parity-common/commits/impl-rlp-v0.2.0">compare
      view</a></li>
      </ul>
      </details>
      <br />
      
      
      [![Dependabot compatibility
      score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=bounded-collections&package-manager=cargo&previous-version=0.1.9&new-version=0.2.0)](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>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      2adf499a
    • Branislav Kontur's avatar
    • Alexandru Gheorghe's avatar
    • Adrian Catangiu's avatar
      xcm-executor: DepositReserveAsset charges delivery fees from inner assets (#3142) · 5354097a
      Adrian Catangiu authored
      
      
      This fix aims to solve an issue in Kusama that resulted in failed
      reserve asset transfers.
      
      During multi-hop XCMs, like reserve asset transfers where the reserve is
      not the sender nor the destination, but a third remote chain, the origin
      is not available to pay for delivery fees out of their account directly,
      so delivery fees should be paid out of transferred assets.
      
      This commit also adds an xcm-emulator regression test that validates
      this scenario is now working.
      
      Signed-off-by: default avatarAdrian Catangiu <[email protected]>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      5354097a
    • Vladimir Istyufeev's avatar
      Use external reference for the CI image as before (#3153) · e757f811
      Vladimir Istyufeev authored
      Usual chore after bumping Rust toolchain version.
      e757f811
    • Branislav Kontur's avatar
      Fix for `poeple-*` benchmarks command + added them to CI (#3146) · 2aa7926c
      Branislav Kontur authored
      Found it when trying to run: 
      ```
      bot bench-all pallet --pallet=pallet_balances
      ```
      https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5081585
      
      ## TODO
      - [x] check/fix command bot for `people-westend-dev` /
      `people-rococo-dev`
      https://github.com/paritytech/command-bot-scripts/pull/67
      2aa7926c
    • Branislav Kontur's avatar
      [frame] `#[pallet::composite_enum]` improved variant count handling + removed... · bb8ddc46
      Branislav Kontur authored
      [frame] `#[pallet::composite_enum]` improved variant count handling + removed `pallet_balances`'s `MaxHolds` config (#2657)
      
      I started this investigation/issue based on @liamaharon
      
       question
      [here](https://github.com/paritytech/polkadot-sdk/pull/1801#discussion_r1410452499).
      
      ## Problem
      
      The `pallet_balances` integrity test should correctly detect that the
      runtime has correct distinct `HoldReasons` variant count. I assume the
      same situation exists for RuntimeFreezeReason.
      
      It is not a critical problem, if we set `MaxHolds` with a sufficiently
      large value, everything should be ok. However, in this case, the
      integrity_test check becomes less useful.
      
      **Situation for "any" runtime:**
      - `HoldReason` enums from different pallets:
      ```rust
              /// from pallet_nis
              #[pallet::composite_enum]
      	pub enum HoldReason {
      		NftReceipt,
      	}
      
              /// from pallet_preimage
              #[pallet::composite_enum]
      	pub enum HoldReason {
      		Preimage,
      	}
      
              // from pallet_state-trie-migration
              #[pallet::composite_enum]
      	pub enum HoldReason {
      		SlashForContinueMigrate,
      		SlashForMigrateCustomTop,
      		SlashForMigrateCustomChild,
      	}
      ```
      
      - generated `RuntimeHoldReason` enum looks like:
      ```rust
      pub enum RuntimeHoldReason {
      
          #[codec(index = 32u8)]
          Preimage(pallet_preimage::HoldReason),
      
          #[codec(index = 38u8)]
          Nis(pallet_nis::HoldReason),
      
          #[codec(index = 42u8)]
          StateTrieMigration(pallet_state_trie_migration::HoldReason),
      }
      ```
      
      - composite enum `RuntimeHoldReason` variant count is detected as `3`
      - we set `type MaxHolds = ConstU32<3>`
      - `pallet_balances::integrity_test` is ok with `3`(at least 3)
      
      However, the real problem can occur in a live runtime where some
      functionality might stop working. This is due to a total of 5 distinct
      hold reasons (for pallets with multi-instance support, it is even more),
      and not all of them can be used because of an incorrect `MaxHolds`,
      which is deemed acceptable according to the `integrity_test`:
        ```
        // pseudo-code - if we try to call all of these:
      
      T::Currency::hold(&pallet_nis::HoldReason::NftReceipt.into(),
      &nft_owner, deposit)?;
      T::Currency::hold(&pallet_preimage::HoldReason::Preimage.into(),
      &nft_owner, deposit)?;
      
      T::Currency::hold(&pallet_state_trie_migration::HoldReason::SlashForContinueMigrate.into(),
      &nft_owner, deposit)?;
      
        // With `type MaxHolds = ConstU32<3>` these two will fail
      
      T::Currency::hold(&pallet_state_trie_migration::HoldReason::SlashForMigrateCustomTop.into(),
      &nft_owner, deposit)?;
      
      T::Currency::hold(&pallet_state_trie_migration::HoldReason::SlashForMigrateCustomChild.into(),
      &nft_owner, deposit)?;
        ```  
      
      
      ## Solutions
      
      A macro `#[pallet::*]` expansion is extended of `VariantCount`
      implementation for the `#[pallet::composite_enum]` enum type. This
      expansion generates the `VariantCount` implementation for pallets'
      `HoldReason`, `FreezeReason`, `LockId`, and `SlashReason`. Enum variants
      must be plain enum values without fields to ensure a deterministic
      count.
      
      The composite runtime enum, `RuntimeHoldReason` and
      `RuntimeFreezeReason`, now sets `VariantCount::VARIANT_COUNT` as the sum
      of pallets' enum `VariantCount::VARIANT_COUNT`:
      ```rust
      #[frame_support::pallet(dev_mode)]
      mod module_single_instance {
      
      	#[pallet::composite_enum]
      	pub enum HoldReason {
      		ModuleSingleInstanceReason1,
      		ModuleSingleInstanceReason2,
      	}
      ...
      }
      
      #[frame_support::pallet(dev_mode)]
      mod module_multi_instance {
      
      	#[pallet::composite_enum]
      	pub enum HoldReason<I: 'static = ()> {
      		ModuleMultiInstanceReason1,
      		ModuleMultiInstanceReason2,
      		ModuleMultiInstanceReason3,
      	}
      ...
      }
      
      
      impl self::sp_api_hidden_includes_construct_runtime::hidden_include::traits::VariantCount
          for RuntimeHoldReason
      {
          const VARIANT_COUNT: u32 = 0
              + module_single_instance::HoldReason::VARIANT_COUNT
              + module_multi_instance::HoldReason::<module_multi_instance::Instance1>::VARIANT_COUNT
              + module_multi_instance::HoldReason::<module_multi_instance::Instance2>::VARIANT_COUNT
              + module_multi_instance::HoldReason::<module_multi_instance::Instance3>::VARIANT_COUNT;
      }
      ```
      
      In addition, `MaxHolds` is removed (as suggested
      [here](https://github.com/paritytech/polkadot-sdk/pull/2657#discussion_r1443324573))
      from `pallet_balances`, and its `Holds` are now bounded to
      `RuntimeHoldReason::VARIANT_COUNT`. Therefore, there is no need to let
      the runtime specify `MaxHolds`.
      
      
      ## For reviewers
      
      Relevant changes can be found here:
      - `substrate/frame/support/procedural/src/lib.rs` 
      -  `substrate/frame/support/procedural/src/pallet/parse/composite.rs`
      -  `substrate/frame/support/procedural/src/pallet/expand/composite.rs`
      -
      `substrate/frame/support/procedural/src/construct_runtime/expand/composite_helper.rs`
      -
      `substrate/frame/support/procedural/src/construct_runtime/expand/hold_reason.rs`
      -
      `substrate/frame/support/procedural/src/construct_runtime/expand/freeze_reason.rs`
      - `substrate/frame/support/src/traits/misc.rs`
      
      And the rest of the files is just about removed `MaxHolds` from
      `pallet_balances`
      
      ## Next steps
      
      Do the same for `MaxFreezes`
      https://github.com/paritytech/polkadot-sdk/issues/2997.
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: default avatarDónal Murray <[email protected]>
      Co-authored-by: default avatargupnik <[email protected]>
      bb8ddc46
    • Francisco Aguirre's avatar
      Add limits to XCMv4 (#3114) · cc4805b5
      Francisco Aguirre authored
      
      
      Some more work regarding XCMv4. Two limits from v3 were not transferred
      over, those are:
      - The instructions limit
      - The number of assets limit
      Both of these are now in v4.
      
      For some reason `AssetInstance` increased in size, don't know why CI
      didn't catch that before.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: command-bot <>
      cc4805b5
    • Branislav Kontur's avatar
      [cumulus] `parachains-common` testnet constants cleaning (#3134) · 4450b615
      Branislav Kontur authored
      
      
      The `parachains-common` contains a lots of constants and type
      definitions which are used for `polkadot-sdk`'s testnet runtimes and
      also for `polkadot-fellows`'s production [SP
      runtimes](https://github.com/polkadot-fellows/runtimes/tree/main/system-parachains/constants).
      This PR cleans `parachains-common` module to contain only common and
      generic functionality.
      
      Testnet-specific constants have been moved to the separate module
      dedicated just for testnets:
      `polkadot-sdk/cumulus/parachains/runtimes/constants/`
      
      
      Part of: https://github.com/paritytech/polkadot-sdk/issues/3054
      
      ---------
      
      Co-authored-by: default avatargeorgepisaltu <[email protected]>
      4450b615
  5. Jan 30, 2024
  6. Jan 29, 2024
    • Oliver Tale-Yazdi's avatar
      [Runtime] Bound XCMP queue (#2302) · b8f55d1b
      Oliver Tale-Yazdi authored
      
      
      Remove `without_storage_info` from the XCMP queue pallet. Part of
      https://github.com/paritytech/polkadot-sdk/issues/323
      
      Changes:
      - Limit the number of channels that can be suspended at the same time.
      - Limit the number of channels that can have messages or signals pending
      at the same time.
      
      A No-OP migration is put in place to ensure that all `BoundedVec`s still
      decode and not truncate after upgrade. The storage version is thereby
      bumped to 4 to have our tooling remind us to deploy that migration.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      b8f55d1b
    • Alexandru Gheorghe's avatar
      Fix recv_signal in orchestra (#3105) · a6649083
      Alexandru Gheorghe authored
      
      
      Pulls: https://github.com/paritytech/orchestra/pull/71
      
      ---------
      
      Signed-off-by: default avatarAlexandru Gheorghe <[email protected]>
      a6649083
    • Oliver Tale-Yazdi's avatar
      Error on duplicated crates (#3082) · 0291658e
      Oliver Tale-Yazdi authored
      
      
      #2970 accidentally added a crate twice to the workspace. Now extending
      the workspace check to explicitly error then.
      
      I think the check should also be required now.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      0291658e
    • Lulu's avatar
      Link mermaid docs to crate that uses them (#3087) · 6a168ad5
      Lulu authored
      While including files cross crate works locally. When pushed to
      crates.io each crate is seperate so the file path no longer exists.
      
      Instead change it to a symlink, which cargo will change to a read
      directory when published.
      6a168ad5
    • Svyatoslav Nikolsky's avatar
      Add two new zombienet tests for bridges (manual run) (#3072) · 2e6067d7
      Svyatoslav Nikolsky authored
      extracted useful code from #2982 
      
      This PR:
      - adds test 2 for Rococo <> Westend bridge: checks that relayer doesn't
      submit any extra headers while there are no any messages;
      - adds test 3 for Rococo <> Westend bridge: checks that relayer doesn't
      submit any extra headers when there are messages;
      - fixes most of comments from #2439 (like: log names, ability to run
      specify test number when calling `run-tests.sh`).
      
      Right now of all our tests, only test 2 is working (until BHs will be
      upgraded to use async backing), so you can test it with
      `./bridges/zombienet/run-tests.sh --test 2` locally.
      2e6067d7