Skip to content
  1. Nov 28, 2023
    • gupnik's avatar
      Moves all test runtimes to use `derive_impl` (#2409) · cd8741c8
      gupnik authored
      
      
      Step in https://github.com/paritytech/polkadot-sdk/issues/171
      
      This PR adds `derive_impl` on all `frame_system` config impls for mock
      runtimes. The overridden configs are maintained as of now to ensure
      minimal changes.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      cd8741c8
    • Liam Aharon's avatar
      Set `frame_system::LastRuntimeUpgrade` after running `try-runtime` migrations (#2515) · 6dc3e6c9
      Liam Aharon authored
      Sets `frame_system::LastRuntimeUpgrade` after running try-runtime
      migrations to better emulate real behavior.
      
      This fixes an issue where migrations using the spec version to determine
      whether to execute can incorrectly fail idempotency checks.
      
      @s0me0ne-unkn0wn noticed this issue with the session key migration
      introduced in https://github.com/paritytech/polkadot-sdk/pull/2265.
      6dc3e6c9
    • Ross Bulat's avatar
      Pools: Add ability to configure commission claiming permissions (#2474) · 75062717
      Ross Bulat authored
      Addresses #409.
      
      This request has been raised by multiple community members - the ability
      for the nomination pool root role to configure permissionless commission
      claiming:
      
      > Would it be possible to have a claim_commission_other extrinsic for
      claiming commission of nomination pools permissionless?
      
      This PR does not quite introduce this additional call, but amends
      `do_claim_commission` to check a new `claim_permission` field in the
      `Commission` struct, configured by an enum:
      
      ```
      enum CommissionClaimPermission {
         Permissionless,
         Account(AccountId),
      }
      ```
      This can be optionally set in a bonded pool's
      `commission.claim_permission` field:
      
      ```
      struct BondedPool {
         commission: {
            <snip>
            claim_permission: Option<CommissionClaimPermission<T::AccountId>>,
         },
         <snip>
      }
      ```
      
      This is a new field and requires a migration to add it to existing
      pools. This will be `None` on pool creation, falling back to the `root`
      role having sole access to claim commission if it is not set; this is
      the behaviour as it is today. Once set, the field _can_ be set to `None`
      again.
      
      #### Changes
      - [x] Add `commision.claim_permission` field.
      - [x] Add `can_claim_commission` and amend `do_claim_commission`.
      - [x] Add `set_commission_claim_permission` call.
      - [x] Test to cover new configs and call.
      - [x] Add and amend benchmarks.
      - [x] Generate new weights + slot into call
      `set_commission_claim_permission`.
      - [x] Add migration to introduce `commission.claim_permission`, bump
      storage version.
      - [x] Update Westend weights.
      - [x] Migration working.
      
      ---------
      
      Co-authored-by: command-bot <>
      75062717
  2. Nov 27, 2023
    • Ross Bulat's avatar
      Staking: `chill_other` takes stash instead of controller (#2501) · 838a534d
      Ross Bulat authored
      
      
      The `chill_other` call is the only staking call that explicitly requires
      `controller` in its signature. This PR changes the controller arg to be
      the stash instead, with `StakingLedger` then fetching the controller
      from storage.
      
      This is not a breaking change per se - the call types do not change, but
      is noteworthy as UIs will now want to pass the stash account into
      `chill_other` calls, & metadata will reflect this.
      
      Note: This is very low impact. `chill_other` has [hardly ever been
      used](https://polkadot.subscan.io/extrinsic?address=&module=staking&call=chill_other&result=all&signedChecked=signed%20only&startDate=&endDate=&startBlock=&timeType=date&version=9431&endBlock=)
      on Polkadot - notwithstanding the one called 11 days ago at block
      18177457 that was a part of test I did, the last call was made 493 days
      ago. Only 2 calls have ever been successful.
      
      Addresses controller deprecation #2500
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarGonçalo Pestana <[email protected]>
      838a534d
    • Koute's avatar
      Build the standard library crates when building the runtimes (#2217) · 2610450a
      Koute authored
      
      
      Our executor currently only supports the WASM MVP feature set, however
      nowadays when compiling WASM the Rust compiler has more features enabled
      by default.
      
      We do set the `-C target-cpu=mvp` flag to make sure that *our* code gets
      compiled in a way that is compatible with our executor, however this
      doesn't affect Rust's standard library crates (`std`, `core` and
      `alloc`) which are by default precompiled and still can make use of
      these extra features.
      
      So in this PR we force the compiler to also compile the standard library
      crates for us to make sure that they also only use the MVP features.
      
      I've added the `WASM_BUILD_STD` environment variable which can be used
      to disable this behavior if set to `0`.
      
      Unfortunately this *will* slow down the compile times when building
      runtimes, but there isn't much that we can do about that.
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/1755
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      2610450a
  3. Nov 25, 2023
  4. Nov 24, 2023
  5. Nov 23, 2023
    • Ross Bulat's avatar
      Amend staking docs to account for state of controller deprecation (#2451) · c29b74dc
      Ross Bulat authored
      Amends some staking pallet docs, and deprecation comment, to adjust to
      the latest controller deprecation state.
      
      Note, do we need the `README.md` file, which is a duplicate of the
      pallet docs? Docs would be easier to maintain, and less ambiguity for
      devs to refer to, if we had one source of truth in the generated pallet
      docs.
      c29b74dc
    • Bastian Köcher's avatar
      sp-api: Move macro related re-exports to `__private` (#2446) · 21f1811c
      Bastian Köcher authored
      This moves the macro related re-exports to `__private` to make it more
      obvious for downstream users that they are using an internal api.
      
      ---------
      
      Co-authored-by: command-bot <>
      21f1811c
    • Liam Aharon's avatar
      CI: Disable runtime upgrade spec name check on Westend Asset Hub and fix... · 12062f6a
      Liam Aharon authored
      CI: Disable runtime upgrade spec name check on Westend Asset Hub and fix Staking pallet migration (#2447)
      
      Westend Asset Hub currently failing because the spec name is being
      changed next runtime upgrade
      (https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4413125).
      
      This also fixes an idempotency issue with a staking pallet migration.
      Similar issues will be caught automatically now that we've also updated
      to try-runtime-cli v0.5.0 which checks for idempotency issues.
      
      This also enables try-state checks running in the CI.
      12062f6a
  6. Nov 22, 2023
    • Joshy Orndorff's avatar
      Remove `#[macro_use]` annotation from `mod service` in all nodes. (#2456) · ec189333
      Joshy Orndorff authored
      
      
      This PR removes `#[macro_use]` from the service module in each of the
      Substrate nodes in the repo.
      
      * Parachain Template
      * Polkadot Parachain
      * Minimal Node
      * Node Template
      * Kitchen Sink Node
      
      IDK why this annotation was present, maybe from when we had the
      `new_partial!` macro?
      
      ---------
      
      Co-authored-by: default avatarJoshy Orndorff <[email protected]>
      ec189333
    • James Wilson's avatar
      Make TypeInfo for SkipCheckIfFeeless transparent, too (#2449) · 0d6dcb3f
      James Wilson authored
      
      
      The `SkipCheckifFeeless::IDENTIFIER` became transparent (ie was whatever
      the inner signed ext was). This PR just makes the `TypeInfo` transparent
      too, so that libraries that use said info to decode the data (ie subxt)
      can behave identically whether or not the `SkipCheckifFeeless` wrapper
      is used or not.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      0d6dcb3f
    • gupnik's avatar
      Fixes import path in benchmark macro (#2437) · 98f9e2ea
      gupnik authored
      Fully-qualified path was not being used in benchmark macro for one of
      the cases. This PR fixes this and removes the unnecessary import in a
      couple of files, which I believe was done to fix this issue.
      98f9e2ea
    • Ross Bulat's avatar
      Deprecate `RewardDestination::Controller` (#2380) · 7a32f4be
      Ross Bulat authored
      
      
      Deprecates `RewardDestination::Controller` variant.
      
      - [x] `RewardDestination::Controller` annotated with `#[deprecated]`.
      - [x] `Controller` variant is now handled the same way as `Stash` in
      `payout_stakers`.
      - [x] `set_payee` errors if `RewardDestination::Controller` is provided.
      - [x] Added `update_payee` call to lazily migrate
      `RewardDestination::Controller` `Payee` storage entries to
      `RewardDestination::Account(controller)` .
      - [x] `payout_stakers_dead_controller` has been removed from benches &
      weights - was not used.
      - [x] Tests no longer use `RewardDestination::Controller`.
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarGonçalo Pestana <[email protected]>
      Co-authored-by: default avatargeorgepisaltu <[email protected]>
      7a32f4be
  7. Nov 21, 2023
  8. Nov 20, 2023
  9. Nov 19, 2023
  10. Nov 18, 2023
    • dependabot[bot]'s avatar
      Bump secp256k1 from 0.24.3 to 0.28.0 (#2357) · 794ee980
      dependabot[bot] authored
      
      
      Bumps [secp256k1](https://github.com/rust-bitcoin/rust-secp256k1) from
      0.24.3 to 0.28.0.
      <details>
      <summary>Changelog</summary>
      <p><em>Sourced from <a
      href="https://github.com/rust-bitcoin/rust-secp256k1/blob/master/CHANGELOG.md">secp256k1's
      changelog</a>.</em></p>
      <blockquote>
      <h1>0.28.0 - 2023-10-23</h1>
      <ul>
      <li>Add bindings to the ElligatorSwift implementation <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/627">#627</a></li>
      <li>Depend on recent release of <code>bitcoin_hashes</code> v0.13.0 <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/621">#621</a></li>
      <li>Add a verify function to <code>PublicKey</code> <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/618">#618</a></li>
      <li>Add serialize function for schnorr::Signature <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/607">#607</a></li>
      <li>Bump MSRV to 1.48 <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/595">#595</a></li>
      <li>Remove implementations of <code>PartialEq</code>, <code>Eq</code>,
      <code>PartialOrd</code>, <code>Ord</code>, and <code>Hash</code> from
      the
      <code>impl_array_newtype</code> macro. Users will now need to derive
      these traits if they are wanted.</li>
      </ul>
      <h1>0.27.0 - 2023-03-15</h1>
      <ul>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/588">Depend
      on newly release <code>bitcoin_hashes</code> v0.12</a>.</li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/578">Implement
      <code>Debug</code> trait for <code>Scalar</code> type</a>.</li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/582">Implement
      <code>insecure-erase</code></a>.</li>
      </ul>
      <h1>0.26.0 - 2202-12-19</h1>
      <ul>
      <li>Update libsecp25k1 to v0.2.0</li>
      </ul>
      <h1>0.25.0 - 2022-12-07</h1>
      <ul>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/548">Fix
      soundness issue with <code>preallocated_gen_new</code></a></li>
      <li>Update to <code>secp256k1-sys</code> <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/549">v0.7.0</a></li>
      <li>Use type system to <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/483">improve
      safety</a>.</li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/490">Change
      secp256k1-sys symbol names to 0_6_1</a>.</li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/499">Introduce
      <code>rustfmt</code></a> to the codebase.</li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/507">Make
      all raw pointer methods go through the CPtr trait</a>.</li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/518">Make
      comparison functions stable</a>.</li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/512">Remove</a>
      public constant <code>ONE_KEY</code> (consider using
      <code>FromStr</code> as a replacement).</li>
      </ul>
      <h1>0.24.1 - 2022-10-25</h1>
      <ul>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/491">Fix
      broken deserialization logic of <code>KeyPair</code></a> that previously
      always panicked. After the patch deserialization only panics if neither
      the <code>global-context</code> nor the <code>alloc</code> (default)
      feature is active.</li>
      </ul>
      <h1>0.24.0 - 2022-07-20</h1>
      <ul>
      <li>Upgrade to new release of <a
      href="https://github.com/rust-bitcoin/bitcoin_hashes/releases/tag/0.11.0">bitcoin_hashes</a>.</li>
      </ul>
      <h1>0.23.4 - 2022-07-14</h1>
      <ul>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/474">Disable
      automatic rerandomization of contexts under WASM</a></li>
      </ul>
      <h1>0.23.3 - 2022-06-29</h1>
      <ul>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/465">Add
      must_use for mut self key manipulation methods</a></li>
      <li><a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/466">Fix
      fuzzing feature guard</a></li>
      </ul>
      <h1>0.23.2 - 2022-06-27</h1>
      <!-- raw HTML omitted -->
      </blockquote>
      <p>... (truncated)</p>
      </details>
      <details>
      <summary>Commits</summary>
      <ul>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/7de09c8050da12a13ef9ee3850597f69c887952d"><code>7de09c8</code></a>
      Merge <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/256">rust-bitcoin/rust-secp256k1256</a>:
      Tracking PR for release: `secp256k1 v0...</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/3dc5b165401f249c01a88cec54061301cffd97a0"><code>3dc5b16</code></a>
      Bump version to v0.28.0</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/3aada83180beec2b9f5ab8e7b9280a5517d3bcde"><code>3aada83</code></a>
      Merge <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/256">rust-bitcoin/rust-secp256k1256</a>:
      Add bindings to the ElligatorSwift imp...</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/39febcb866ce285d53052a3636602f04483aa710"><code>39febcb</code></a>
      Create rust-bidings</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/da4f67b274c3061717723a568cfb182e4e2e7cce"><code>da4f67b</code></a>
      Merge <a
      href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/256">rust-bitcoin/rust-secp256k1256</a>:
      Update vendored lib secp256k1 to v0.4.0</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/80b2a8d4aa6ffa72041d569eab2278cd8c1ace2a"><code>80b2a8d</code></a>
      Update vendored libsecp to v0.4.0</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/d2285c929a086276ce6d1670d795c49191e30c65"><code>d2285c9</code></a>
      ci: Remove MIPS* from CI</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/0d58f50d523b40a78de0b87146208e3ad338c8ba"><code>0d58f50</code></a>
      ci: generalize grp in &quot;illegal callback&quot; test</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/acf9ac13e9f8df84dd52d2f012cda7211a6af10c"><code>acf9ac1</code></a>
      delete <code>test_manual_create_destroy</code> test</li>
      <li><a
      href="https://github.com/rust-bitcoin/rust-secp256k1/commit/04ce50891bb0d49be5355f5c0d82db70d7dda65a"><code>04ce508</code></a>
      lib: fix bad unit test</li>
      <li>Additional commits viewable in <a
      href="https://github.com/rust-bitcoin/rust-secp256k1/compare/secp256k1-0.24.3...secp256k1-0.28.0">compare
      view</a></li>
      </ul>
      </details>
      <br />
      
      
      [![Dependabot compatibility
      score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=secp256k1&package-manager=cargo&previous-version=0.24.3&new-version=0.28.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]>
      794ee980
  11. Nov 17, 2023
    • Davide Galassi's avatar
      Bump bandersnatch VRF revision (#2389) · 1d1c3719
      Davide Galassi authored
      Closes https://github.com/paritytech/polkadot-sdk/issues/2327
      
      cc @burdges
      1d1c3719
    • Nazar Mokrynskyi's avatar
      Do not panic if the `fdlimit` call to increase the file descriptor limit fails (#2155) · 079b14f6
      Nazar Mokrynskyi authored
      
      
      # Description
      
      Sometimes changing file descriptor limits is not allowed, but there is
      no need to crash the node if/when this happens. Since `fdlimit`'s author
      decided to use panics instead of returning `Result`, we need to catch
      it.
      
      # 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)
      - [ ] I have made corresponding changes to the documentation (if
      applicable)
      - [ ] I have added tests that prove my fix is effective or that my
      feature works (if applicable)
      
      ---------
      
      Co-authored-by: default avatarKoute <[email protected]>
      079b14f6
    • Michal Kucharczyk's avatar
      crypto: `lazy_static` removed, light parser for address URI added (#2250) · 5007e2dd
      Michal Kucharczyk authored
      
      
      The `lazy_static` package does not work well in `no-std`: it requires
      `spin_no_std` feature, which also will propagate into `std` if enabled.
      This is not what we want.
      
      This PR provides simple address uri parser which allows to get rid of
      _regex_ which was used to parse the address uri, what in turns allows to
      remove lazy_static.
      
      Three regular expressions
      (`SS58_REGEX`,`SECRET_PHRASE_REGEX`,`JUNCTION_REGEX`) were replaced with
      the parser which unifies all of them.
      
      The new parser does not support Unicode, it is ASCII only.
      
      Related to: #2044
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: default avatarKoute <[email protected]>
      Co-authored-by: command-bot <>
      5007e2dd
    • Serban Iorga's avatar
      Beefy: small fixes (#2378) · 3ab2bc9f
      Serban Iorga authored
      Related to #2285
      
      - save the state of the BEEFY gadget after processing a finality proof.
      We need this in order to avoid skipping blocks.
      - avoid reprocessing the old state when not necessary
      3ab2bc9f
    • Ankan's avatar
      [NPoS] Check if staker is exposed in paged exposure storage entries (#2369) · 2e001de9
      Ankan authored
      Addresses a bug caused by
      https://github.com/paritytech/polkadot-sdk/pull/1189. The changes are
      still not released yet, so would like to push the fix soon so it can go
      together with the release of the above PR.
      
      `fast_unstake` checks if a staker is exposed in an era. However, this fn
      is still returning whether the staker is exposed based on the old
      storage item. This PR fixes that by looking in both old and new exposure
      storages.
      
      Also adds some integrity tests for paged exposures.
      2e001de9
    • cuteolaf's avatar
      fix typo (#2377) · b85c64aa
      cuteolaf authored
      b85c64aa
    • Bruno Galvao's avatar
      add pallet nomination-pools versioned migration to kitchensink (#2167) · 596088a2
      Bruno Galvao authored
      The versioned migrations are already there in pallet nomination-pools:
      
      https://github.com/paritytech/polkadot-sdk/blob/f6ee4781/substrate/frame/nomination-pools/src/migration.rs#L27-L48
      
      Just updating the kitchensink runtime to point to them.
      
      This is also nice because it points the dev to an example of how to use
      `VersionedMigration`.
      596088a2
  12. Nov 15, 2023
    • Bastian Köcher's avatar
      frame-system: Add `last_runtime_upgrade_spec_version` (#2351) · ea4085ab
      Bastian Köcher authored
      
      
      Adds a function for querying the last runtime upgrade spec version. This
      can be useful for when writing runtime level migrations to ensure that
      they are not executed multiple times. An example would be a session key
      migration.
      
      ---------
      
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      ea4085ab
    • joe petrowski's avatar
      Identity Deposits Relay to Parachain Migration (#1814) · c79b234b
      joe petrowski authored
      The goal of this PR is to migrate Identity deposits from the Relay Chain
      to a system parachain.
      
      The problem I want to solve is that `IdentityOf` and `SubsOf` both store
      an amount that's held in reserve as a storage deposit. When migrating to
      a parachain, we can take a snapshot of the actual `IdentityInfo` and
      sub-account mappings, but should migrate (off chain) the `deposit`s to
      zero, since the chain (and by extension, accounts) won't have any funds
      at genesis.
      
      The good news is that we expect parachain deposits to be significantly
      lower (possibly 100x) on the parachain. That is, a deposit of 21 DOT on
      the Relay Chain would need 0.21 DOT on a parachain. This PR proposes to
      migrate the deposits in the following way:
      
      1. Introduces a new pallet with two extrinsics: 
      - `reap_identity`: Has a configurable `ReapOrigin`, which would be set
      to `EnsureSigned` on the Relay Chain (i.e. callable by anyone) and
      `EnsureRoot` on the parachain (we don't want identities reaped from
      there).
      - `poke_deposit`: Checks what deposit the pallet holds (at genesis,
      zero) and attempts to update the amount based on the calculated deposit
      for storage data.
      2. `reap_identity` clears all storage data for a `target` account and
      unreserves their deposit.
      3. A `ReapIdentityHandler` teleports the necessary DOT to the parachain
      and calls `poke_deposit`. Since the parachain deposit is much lower, and
      was just unreserved, we know we have enough.
      
      One awkwardness I ran into was that the XCMv3 instruction set does not
      provide a way for the system to teleport assets without a fee being
      deducted on reception. Users shouldn't have to pay a fee for the system
      to migrate their info to a more efficient location. So I wrote my own
      program and did the `InitiateTeleport` accounting on my own to send a
      program with `UnpaidExecution`. Have discussed an
      `InitiateUnpaidTeleport` instruction with @franciscoaguirre
      
       . Obviously
      any chain executing this would have to pass a `Barrier` for free
      execution.
      
      TODO:
      
      - [x] Confirm People Chain ParaId
      - [x] Confirm People Chain deposit rates (determined in
      https://github.com/paritytech/polkadot-sdk/pull/2281)
      - [x] Add pallet to Westend
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      c79b234b
    • Dmitry Markin's avatar
      Unify `ChainSync` actions under one enum (follow-up) (#2317) · 18165ebb
      Dmitry Markin authored
      
      
      Get rid of public `ChainSync::..._requests()` functions and return all
      requests as actions.
      
      ---------
      
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      18165ebb
  13. Nov 14, 2023
    • PG Herveou's avatar
      Contracts expose pallet-xcm (#1248) · f517900a
      PG Herveou authored
      
      
      This PR introduces:
      - XCM  host functions `xcm_send`, `xcm_execute`
      - An Xcm trait into the config. that proxy these functions to to
      `pallet_xcm`, or disable their usage by using `()`.
      - A mock_network and xcm_test files to test the newly added xcm-related
      functions.
      
      ---------
      
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      f517900a
    • Alexandru Vasile's avatar
      chainHead/tests: Fix clippy (#2325) · 3a87390b
      Alexandru Vasile authored
      
      
      Remove the genesis hash from tests:
      - Clippy was passing on the PR:
      https://github.com/paritytech/polkadot-sdk/pull/2296
      - Clippy fails on master:
      https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4328487
      
      This was a race with merging:
      https://github.com/paritytech/polkadot-sdk/pull/2295, which introduced
      another test that used the `CHAIN_GENESIS`
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      3a87390b
    • Alexandru Vasile's avatar
      chainHead: Remove `chainHead_genesis` method (#2296) · cd38ccff
      Alexandru Vasile authored
      
      
      The method has been removed from the spec
      (https://github.com/paritytech/json-rpc-interface-spec/tree/main/src),
      this PR keeps the `chainHead` in sync with that change.
      
      @paritytech/subxt-team
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      cd38ccff
    • Alexandru Vasile's avatar
      chainHead: Support multiple hashes for `chainHead_unpin` method (#2295) · cfe5e626
      Alexandru Vasile authored
      
      
      This PR adds support for multiple hashes being passed to the
      `chainHeda_unpin` parameters.
      
      The `hash` parameter is renamed to `hash_or_hashes` per
      https://github.com/paritytech/json-rpc-interface-spec/pull/111.
      
      While at it, a new integration test is added to check the unpinning of
      multiple hashes. The API is checked against a hash or a vector of
      hashes.
      
      cc @paritytech/subxt-team
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      cfe5e626
    • Hugo Trentesaux's avatar
      Add details in `--dev` cli flag documentation (#2305) · a393cfcb
      Hugo Trentesaux authored
      add details in `--dev` flag to tell that it disables local peer
      discovery
      
      ### Context
      
      When adding automated end-to-end tests, we replaced `--dev` by 
      
      ```
      `--chain=dev`, `--force-authoring`, `--rpc-cors=all`, `--alice`, and `--tmp` flags
      ```
      
      as stated in the command line documentation. But the tests started
      failing due to the nodes connecting to each other.
      
      ### Fix
      
      This PR includes additional command line documentation to explain more
      in detail what `--dev` flag inludes.
      a393cfcb
    • drskalman's avatar
      Fix `ecdsa_bls` verify in BEEFY primitives (#2066) · b371c357
      drskalman authored
      
      
      BEEFY ECDSA signatures are on keccak has of the messages. As such we can
      not simply call
      
      `EcdsaBlsPair::verify(signature.as_inner_ref(), msg,
      self.as_inner_ref())`
      
      because that invokes ecdsa default verification which perfoms blake2
      hash which we don't want.
      
      This bring up the second issue makes: This makes `sign` and `verify`
      function in `pair_crypto` useless, at least for BEEFY use case.
      Moreover, there is no obvious clean way to generate the signature given
      that pair_crypto does not exposes `sign_prehashed`. You could in theory
      query the keystore for the pair (could you?), invoke `to_raw` and
      re-generate each sub-pair and sign using each. But that sounds extremely
      anticlimactic and will be frow upon by auditors . So I appreciate any
      alternative suggestion.
      
      ---------
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarRobert Hambrock <[email protected]>
      b371c357
  14. Nov 13, 2023
    • Assem's avatar
      f332d688
    • gupnik's avatar
      Adds syntax for marking calls feeless (#1926) · 60c77a2e
      gupnik authored
      
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/1725
      
      This PR adds the following changes:
      1. An attribute `pallet::feeless_if` that can be optionally attached to
      a call like so:
      ```rust
      #[pallet::feeless_if(|_origin: &OriginFor<T>, something: &u32| -> bool {
      	*something == 0
      })]
      pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
           ....
      }
      ```
      The closure passed accepts references to arguments as specified in the
      call fn. It returns a boolean that denotes the conditions required for
      this call to be "feeless".
      
      2. A signed extension `SkipCheckIfFeeless<T: SignedExtension>` that
      wraps a transaction payment processor such as
      `pallet_transaction_payment::ChargeTransactionPayment`. It checks for
      all calls annotated with `pallet::feeless_if` to see if the conditions
      are met. If so, the wrapped signed extension is not called, essentially
      making the call feeless.
      
      In order to use this, you can simply replace your existing signed
      extension that manages transaction payment like so:
      ```diff
      - pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
      + pallet_skip_feeless_payment::SkipCheckIfFeeless<
      +	Runtime,
      +	pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
      + >,
      ```
      
      ### Todo
      - [x] Tests
      - [x] Docs
      - [x] Prdoc
      
      ---------
      
      Co-authored-by: Nikhil Gupta <>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      60c77a2e