Skip to content
  1. Oct 24, 2023
    • Bastian Köcher's avatar
      `CheckWeight`: Add more logging (#1996) · a5a2432d
      Bastian Köcher authored
      This adds more logging to `CheckWeight` to get a better understanding
      why a transaction exhausts resources.
      a5a2432d
    • Brian Anderson's avatar
      Update wasm-opt to 0.116 (#1995) · 39c04fdd
      Brian Anderson authored
      Just keeping wasm-opt up to date.
      
      I don't see anything in the [binaryen
      changelog](https://github.com/WebAssembly/binaryen/blob/main/CHANGELOG.md)
      that should affect substrate.
      
      This release includes dwarf passes that were accidentally omitted from
      previous versions of the wasm-opt crate. I suspect this will not affect
      substrate as their omission hasn't been noticed until recently.
      39c04fdd
  2. Oct 23, 2023
    • Muharem Ismailov's avatar
      Resolve Credit to Account impls of `OnUnbalanced` trait (#1876) · d0fd2660
      Muharem Ismailov authored
      Implements the `OnUnbalanced` trait to resolve received credits to the
      specified account. Credits that fail to resolve are dropped.
      
      ### Motivation 
      Throughout the codebase, several types implement the trait with the same
      behavior. While some currently utilize older currency trait, a migration
      to the new fungible/s is anticipated for all. Examples:
      [1](https://github.com/paritytech/polkadot-sdk/blob/1b34571c/cumulus/parachains/common/src/impls.rs#L37),
      [2](https://github.com/paritytech/polkadot-sdk/blob/1b34571c/polkadot/runtime/common/src/impls.rs#L36),
      [3](https://github.com/paritytech/polkadot-sdk/blob/1b34571c/substrate/bin/node/runtime/src/impls.rs#L40),
      [4](https://github.com/paritytech/polkadot-sdk/blob/1b34571c/substrate/bin/node/runtime/src/lib.rs#L1969),
      [5](https://github.com/paritytech/polkadot-sdk/blob/1b34571c/substrate/frame/broker/src/mock.rs#L198),
      [6](https://github.com/paritytech/polkadot-sdk/blob/1b34571c/substrate/frame/society/src/lib.rs#L2031),
      [7](https://github.com/paritytech/polkadot-sdk/blob/1b34571c/substrate/frame/treasury/src/lib.rs#L1118)
      d0fd2660
    • aj3n's avatar
      wasm-builder: manually set CARGO_TARGET_DIR (#1951) · 38c3c625
      aj3n authored
      ✄
      -----------------------------------------------------------------------------
      
      Thank you for your Pull Request! 🙏 Please make sure it follows the
      contribution guidelines outlined in
      [this
      document](https://github.com/paritytech/polkadot-sdk/blob/master/docs/CONTRIBUTING.md)
      and fill
      out the sections below. Once you're ready to submit your PR for review,
      please
      delete this section and leave only the text under the "Description"
      heading.
      
      # Description
      
      *Please include a summary of the changes and the related issue. Please
      also include relevant motivation and context,
      including:*
      
      - What does this PR do?
      
      make 'substrate-wasm-builder' manually set 'CARGO_TARGET_DIR' to
      '$project_dir/target' while building instead of unset
      'CARGO_TARGET_DIR';
      
      - Why are these changes needed?
      
      If you using this in the `build.rs` with following content in your
      `~/.cargo/config.toml':
      
          [build]
          target-dir = "target"
      
      the build process will stuck because of dead lock -- two `cargo build`
      on same target directory in the same time.
      There is already an attempt to avoid such dead lock by unset the
      `CARGO_TARGET_DIR`, but for users with config above in his build
      enviroment (like me), this workaround won't work.
      
      - How were these changes implemented and what do they affect?
      
      Instead of unset 'CARGO_TARGET_DIR', we set 'CARGO_TARGET_DIR' to
      '$project/target/', which is already assumed to be true by rest of the
      code.
      
      *Use [Github semantic
      
      linking](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)
      to address any open issues this PR relates to or closes.*
      
      Fixes # (issue number, *if applicable*)
      
      Closes # (issue number, *if applicable*)
      
      # 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)
      
      You can remove the "Checklist" section once all have been checked. Thank
      you for your contribution!
      
      ✄
      -----------------------------------------------------------------------------
      
      I have built my project with this fix, there's still some warnings with
      `build.target-dir` set but the building process won't hang.
      I haven't found related issue in this repo. But I did find one issue
      [here](https://github.com/substrate-developer-hub/substrate-node-template/issues/116).
      38c3c625
  3. Oct 22, 2023
    • Bastian Köcher's avatar
      sc-executor: Increase maximum instance count (#1856) · e2b21d00
      Bastian Köcher authored
      
      
      Changes the maximum instances count for `wasmtime` to `64`. It also
      allows to only pass in maximum `32` for `--max-runtime-instances` as
      `256` was way too big. With `64` instances in total and `32` that can be
      configured in maximum, there should be enough space to accommodate for
      extra instances that are may required to be allocated adhoc.
      
      ---------
      
      Co-authored-by: default avatarKoute <[email protected]>
      e2b21d00
  4. Oct 20, 2023
    • Dmitry Markin's avatar
      Revert "Check for parent of first ready block being on chain (#1812)" (#1950) · 69c986f4
      Dmitry Markin authored
      This reverts https://github.com/paritytech/polkadot-sdk/pull/1812 until
      we know why it causes syncing issues reported in
      https://github.com/subspace/subspace/issues/2122.
      69c986f4
    • Bastian Köcher's avatar
      `xcm`: Change `TypeInfo::path` to not include `staging` (#1948) · f3bf5c1a
      Bastian Köcher authored
      
      
      The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
      crates.io as someone as squatted `xcm`. The problem with this rename is
      that the `TypeInfo` includes the crate name which ultimately lands in
      the metadata. The metadata is consumed by downstream users like
      `polkadot-js` or people building on top of `polkadot-js`. These people
      are using the entire `path` to find the type in the type registry. Thus,
      their code would break as the type path would now be [`staging_xcm`,
      `VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
      fixes this by renaming the path segment `staging_xcm` to `xcm`.
      
      This requires: https://github.com/paritytech/scale-info/pull/197
      
      ---------
      
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      f3bf5c1a
    • cheme's avatar
      Switch trie cache random seed (#1935) · f4c4c0fe
      cheme authored
      Use a more secure seed for hashsets of cache.
      f4c4c0fe
  5. Oct 19, 2023
  6. Oct 18, 2023
    • Keith Yeung's avatar
      Introduce XcmFeesToAccount fee manager (#1234) · 3dece311
      Keith Yeung authored
      
      
      Combination of paritytech/polkadot#7005, its addon PR
      paritytech/polkadot#7585 and its companion paritytech/cumulus#2433.
      
      This PR introduces a new XcmFeesToAccount struct which implements the
      `FeeManager` trait, and assigns this struct as the `FeeManager` in the
      XCM config for all runtimes.
      
      The struct simply deposits all fees handled by the XCM executor to a
      specified account. In all runtimes, the specified account is configured
      as the treasury account.
      
      XCM __delivery__ fees are now being introduced (unless the root origin
      is sending a message to a system parachain on behalf of the originating
      chain).
      
      # Note for reviewers
      
      Most file changes are tests that had to be modified to account for the
      new fees.
      Main changes are in:
      - cumulus/pallets/xcmp-queue/src/lib.rs <- To make it track the delivery
      fees exponential factor
      - polkadot/xcm/xcm-builder/src/fee_handling.rs <- Added. Has the
      FeeManager implementation
      - All runtime xcm_config files <- To add the FeeManager to the XCM
      configuration
      
      # Important note
      
      After this change, instructions that create and send a new XCM (Query*,
      Report*, ExportMessage, InitiateReserveWithdraw, InitiateTeleport,
      DepositReserveAsset, TransferReserveAsset, LockAsset and RequestUnlock)
      will require the corresponding origin account in the origin register to
      pay for transport delivery fees, and the onward message will fail to be
      sent if the origin account does not have the required amount. This
      delivery fee is on top of what we already collect as tx fees in
      pallet-xcm and XCM BuyExecution fees!
      
      Wallet UIs that want to expose the new delivery fee can do so using the
      formula:
      
      ```
      delivery_fee_factor * (base_fee + encoded_msg_len * per_byte_fee)
      ```
      
      where the delivery fee factor can be obtained from the corresponding
      pallet based on which transport you are using (UMP, HRMP or bridges),
      the base fee is a constant, the encoded message length from the message
      itself and the per byte fee is the same as the configured per byte fee
      for txs (i.e. `TransactionByteFee`).
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarGiles Cope <[email protected]>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      3dece311
    • alexd10s's avatar
      Trading trait and deal with metadata in Mutate trait for nonfungibles_v2 (#1561) · 3aaf62ad
      alexd10s authored
      
      
      I have added some Traits that are missing and are useful for dealing
      with non-fungible tokens on other pallets and their implementations for
      NFTs pallet.
      
      - In the Mutate trait, added methods for dealing with the metadata:
      `set_metadata`, `set_collection_metadata`, `clear_metadata` and
      `clear_collection_metadata`.
      The motivation of adding this methods coming from a StackExchange
      question asking for it: [Setting metadata of an item of the Nfts pallet
      in a custom
      pallet](https://substrate.stackexchange.com/questions/9974/setting-metadata-of-an-item-of-the-nfts-pallet-in-a-custom-pallet)
      
      - A Trait for trading non-fungible items. The methods in that Trait are
      `buy_item`, `set_price` and `item_price`
      An example of where this Trait can be useful is a pallet that deals with
      [NFT
      Royalties](https://forum.polkadot.network/t/nfts-royalty-pallet/3766)
      and needs to perform this actions.
      
      ---------
      
      Co-authored-by: default avatarJegor Sidorenko <[email protected]>
      3aaf62ad
  7. Oct 17, 2023
    • Oliver Tale-Yazdi's avatar
      Fix para-scheduler migration on Rococo (#1921) · 58b79272
      Oliver Tale-Yazdi authored
      Closes https://github.com/paritytech/polkadot-sdk/issues/1916
      
      Changes:
      - Trivially wrap the migration into a version migration to enforce
      idempotency.
      - Opinionated logging nits
      
      @liamaharon maybe we can add a check to the `try-runtime-cli` that
      migrations are idempotent? It should be possible to check that the
      storage root is identical after executing a second time (and that it
      does not panic like it did here 😆
      
      ).
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      58b79272
    • Squirrel's avatar
      nit: use traits::tokens::fungible => use traits::fungible (#1753) · d9e266f4
      Squirrel authored
      
      
      Slightly less verbose use of fungible(s).
      
      ---------
      
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      d9e266f4
    • Branislav Kontur's avatar
      [xcm] Small enhancements for `NetworkExportTable` and `xcm-builder` (#1848) · 5cdd819e
      Branislav Kontur authored
      
      
      ## Summary
      
      This PR introduces several enhancements.
      
      The current implementation of `NetworkExportTable` lacks remote location
      filtering support beyond `NetworkId` lookup. To provide more control and
      granularity, it's essential to allow configuration for bridging to
      different consensus `NetworkId` while restricting access e.g. to
      particular remote parachains.
      
      Additionally, the `StartsWith` and `Equals` and
      `StartsWithExplicitGlobalConsensus` helper functions, which are in
      active use, are moved to the `xcm-builder` and `frame_support` modules
      for better code organization.
      
      Adds a new `LocationWithAssetFilters` filter to enable location-based
      and asset-related filtering. This filter is useful for configuring the
      `pallet_xcm` filter for
      [XcmTeleportFilter](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/pallet-xcm/src/lib.rs#L212)
      and
      [XcmReserveTransferFilter](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/pallet-xcm/src/lib.rs#L216)
      to restrict specific assets.
      
      Furthermore, the `BridgeMessage` fields are not accessible outside of
      `xcm-builder`, limiting the ability to create custom logic dependent on
      it.
      
      ---------
      
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      5cdd819e
    • Kian Paimani's avatar
      cleanup a few hidden imports in frame-support (#1770) · e10de2e2
      Kian Paimani authored
      
      
      Just making a few hidden imports cleaner and hidden in docs.
      
      ---------
      
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      e10de2e2
  8. Oct 16, 2023
    • Liam Aharon's avatar
      Allow Locks/Holds/Reserves/Freezes by default when using `pallet_balances`... · fcc1bb41
      Liam Aharon authored
      Allow Locks/Holds/Reserves/Freezes by default when using `pallet_balances` `TestDefaultConfig` (#1880)
      
      Allow Locks/Holds/Reserves/Freezes by default when using
      `pallet_balances` `TestDefaultConfig`.
      fcc1bb41
    • Oliver Tale-Yazdi's avatar
      Workspace maintenance (#1884) · 9c1a2b38
      Oliver Tale-Yazdi authored
      
      
      Changes:
      - Add missing crate to the workspace
      - Remove versions from local dependency links
      
      Maybe it is finally worth it to add this scrip to the CI to find these
      things earlier:
      [check-deps.py](https://github.com/ggwpez/substrate-scripts/blob/master/import-runtime-repos/check-deps.py).
      
      @paritytech/ci what would be the best location for that check?  
      It takes only a second to run, so maybe we can squeeze it into one of
      the existing checks?
      Otherwise creating a new GH workflow feels a bit wasteful... maybe i can
      group it with https://github.com/paritytech/polkadot-sdk/pull/1831
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      9c1a2b38
    • Muharem Ismailov's avatar
      `extract` amount method for `fungible/s` `Imbalance` (#1847) · c422e3f5
      Muharem Ismailov authored
      Introduces an `extract` amount method for `fungible/s` `Imbalance`.
      c422e3f5
    • Adrian Catangiu's avatar
      sc-consensus-beefy: fix initialization when state is unavailable (#1888) · 646ecd0e
      Adrian Catangiu authored
      
      
      Fix situation where BEEFY initial validator set could not be determined.
      
      If state is unavailable at BEEFY genesis block to get initial validator
      set, get the info from header digests. For this, we need to walk back
      the chain starting from BEEFY genesis looking for the BEEFY digest
      announcing the active validator set for that respective session.
      
      This commit fixes a silly bug where walking back the chain was stopped
      when reaching BEEFY genesis block, which is incorrect when BEEFY genesis
      is not session boundary block. When BEEFY genesis is set to some random
      block within a session, we need to walk back to the start of the session
      to see the validator set announcement.
      
      Added regression test for this fix.
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/1885
      
      Signed-off-by: default avatarAdrian Catangiu <[email protected]>
      646ecd0e
    • Bastian Köcher's avatar
      sp-api: Improve error message for duplicate runtime apis (#1877) · 4e98bec3
      Bastian Köcher authored
      Co-authored-by: command-bot <>
      4e98bec3
    • Bulat Saifullin's avatar
      Update the alerts to use a new metric substrate_unbounded_channel_size (#1568) · 73ec161e
      Bulat Saifullin authored
      # Description
      
      Follow up for https://github.com/paritytech/polkadot-sdk/pull/1489.
      Closes #611 
      
      Before we calculated the channel size during alert expression but in
      #1489 a new metric was introduced that reports channel size.
      ## Changes:
      1. updated alert rule to use new metric.
      73ec161e
    • Davide Galassi's avatar
      Arkworks Elliptic Curve utils overhaul (#1870) · 38ef04eb
      Davide Galassi authored
      - Removal of Arkworks unit tests. These tests were just testing the
      arkworks upstream implementation which should be assumed correct. This
      is not the place to test well known dependencies.
      - Removal of some over-engineering. We just store the calls to Arkworks
      in one file. Per-curve sources are not required.
      - Docs formatting
      
      ---
      
      I also took the opportunity to bump the `bandersnatch-vrfs` crate
      revision internally providing some new shiny stuff.
      38ef04eb
  9. Oct 15, 2023
    • Gonçalo Pestana's avatar
      Refactor staking ledger (#1484) · 8ee4042c
      Gonçalo Pestana authored
      This PR refactors the staking ledger logic to encapsulate all reads and
      mutations of `Ledger`, `Bonded`, `Payee` and stake locks within the
      `StakingLedger` struct implementation.
      
      With these changes, all the reads and mutations to the `Ledger`, `Payee`
      and `Bonded` storage map should be done through the methods exposed by
      StakingLedger to ensure the data and lock consistency of the operations.
      The new introduced methods that mutate and read Ledger are:
      
      - `ledger.update()`: inserts/updates a staking ledger in storage;
      updates staking locks accordingly (and ledger.bond(), which is synthatic
      sugar for ledger.update())
      - `ledger.kill()`: removes all Bonded and StakingLedger related data for
      a given ledger; updates staking locks accordingly;
      `StakingLedger::get(account)`: queries both the `Bonded` and `Ledger`
      storages and returns a `Option<StakingLedger>`. The pallet impl exposes
      fn ledger(account) as synthatic sugar for `StakingLedger::get(account)`.
      
      Retrieving a ledger with `StakingLedger::get()` can be done by providing
      either a stash or controller account. The input must be wrapped in a
      `StakingAccount` variant (Stash or Controller) which is treated
      accordingly. This simplifies the caller API but will eventually be
      deprecated once we completely get rid of the controller account in
      staking. However, this refactor will help with the work necessary when
      completely removing the controller.
      
      Other goals:
      
      - No logical changes have been introduced in this PR;
      - No breaking changes or updates in wallets required;
      - No new storage items or need to perform storage migrations;
      - Centralise the changes to bonds and ledger updates to simplify the
      OnStakingUpdate updates to the target list (related to
      https://github.com/paritytech/polkadot-sdk/issues/443)
      
      Note: it would be great to prevent or at least raise a warning if
      `Ledger<T>`, `Payee<T>` and `Bonded<T>` storage types are accessed
      outside the `StakingLedger` implementation. This PR should not get
      blocked by that feature, but there's a tracking issue here
      https://github.com/paritytech/polkadot-sdk/issues/149
      
      Related and step towards
      https://github.com/paritytech/polkadot-sdk/issues/443
      8ee4042c
    • drskalman's avatar
      Paired-key Crypto Scheme (#1705) · 1b34571c
      drskalman authored
      
      
      BEEFY needs two cryptographic keys at the same time. Validators should
      sign BEEFY payload using both ECDSA and BLS key. The network will gossip
      a payload which contains a valid ECDSA key. The prover nodes aggregate
      the BLS keys if aggregation fails to verifies the validator which
      provided a valid ECDSA signature but an invalid BLS signature is subject
      to slashing.
      
      As such BEEFY session should be initiated with both key. Currently there
      is no straight forward way of doing so, beside having a session with
      RuntimeApp corresponding to a crypto scheme contains both keys.
      
      This pull request implement a generic paired_crypto scheme as well as
      implementing it for (ECDSA, BLS) pair.
      
      ---------
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarRobert Hambrock <[email protected]>
      1b34571c
    • S E R A Y A's avatar
      add link to rfc-0001 in broker README (#1862) · c9b51cd4
      S E R A Y A authored
      # Description
      - What does this PR do?
        - link added
      - Why are these changes needed?
        - improve docs
      - How were these changes implemented and what do they affect?
        - only concerns docs
      c9b51cd4
  10. Oct 14, 2023
    • Julian Eager's avatar
      Discard `Executor` (#1855) · 9f7656df
      Julian Eager authored
      
      
      closes #622 
      
      Pros:
      * simpler interface, just functions:
      `create_runtime_from_artifact_bytes()` and `execute_artifact()`
      
      Cons:
      * extra overhead of constructing executor semantics each time
      
      I could make it a combination of
      * `create_runtime_config(params)` (such that we could clone the
      constructed semantics)
      * `create_runtime(blob, config)`
      * `execute_artifact(blob, config, params)`
      
      Not sure if it's worth it though.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      9f7656df
    • juangirini's avatar
      Macros to use path instead of ident (#1474) · 7c87d61f
      juangirini authored
      7c87d61f
  11. Oct 13, 2023
    • 0xmovses's avatar
      Refactor alliance benchmarks to v2 (#1868) · 24840290
      0xmovses authored
      - This PR refactors `alliance/src/benchmarkings.rs` to use benchmarking
      v2. These changes are needed to improve the readability and
      maintainability of the benchmarking code.
      
      - No known issue to backlink.
      
      ## Local Testing 
      1. `cargo build --features runtime-benchmarks` 
      2. `cargo run --locked --release -p node-cli --bin substrate-node
      --features runtime-benchmarks -- benchmark pallet --execution wasm
      --wasm-execution compiled --chain dev --pallet "*" --extrinsic "*"
      --steps 2 --repeat 1`
      24840290
    • Adrian Catangiu's avatar
      frame: use derive-impl for beefy and mmr pallets (#1867) · 82bfe284
      Adrian Catangiu authored
      Part of #171
      82bfe284
    • Adrian Catangiu's avatar
      sc-consensus-beefy: improve gossip logic (#1852) · 83206000
      Adrian Catangiu authored
      - Remove cached messages used for deduplication in `GossipValidator`
      since they're already deduplicated in upper layer `NetworkGossip`.
      - Add cache for "justified rounds" to quickly discard any further (even
      if potentially different) justifications at the gossip level, once a
      valid one (for a respective round) is submitted to the worker.
      - Add short-circuit in worker `finalize()` method to not attempt to
      finalize same block multiple times (for example when we get
      justifications for same block from multiple components like
      block-import, gossip or on-demand).
      - Change a test which had A LOT of latency in syncing blocks for some
      weird reason and would only run after ~150seconds. It now runs
      instantly.
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/1728
      83206000
    • gupnik's avatar
      Adds instance support for composite enums (#1857) · 6b27dad3
      gupnik authored
      Fixes https://github.com/paritytech/polkadot-sdk/issues/1839
      
      Currently, `composite_enum`s do not support pallet instances. This PR
      allows the following:
      ```rust
      	#[pallet::composite_enum]
      	pub enum HoldReason<I: 'static = ()> {
      		SomeHoldReason
      	}
      ```
      
      ### Todo
      
      - [x]  UI Test
      6b27dad3
  12. Oct 12, 2023
  13. Oct 11, 2023
    • Mira Ressel's avatar
      ci: bump ci image to rust 1.73.0 (#1830) · 447e7533
      Mira Ressel authored
      Co-authored-by: command-bot <>
      447e7533
    • 0xmovses's avatar
      Refactor Identity to benchmark v2 (#1838) · 1d9ec572
      0xmovses authored
      This PR refactors `identity/benchmarkings.rs` to use benchmarking v2.
      These changes are needed to improve the readability and maintainability
      of the benchmarking code. Changes were implemented using
      [this](https://github.com/paritytech/polkadot-sdk/commit/9ec80090
      
      )
      commit as a guide. The logic of the benchmarks remains the same.
      
      No known issue to backlink.
      
      ## Local Testing
      To test the new benchmarks:
      1. `cargo build --features runtime-benchmarks`
      2. `./target/debug/polkadot benchmark pallet --steps=5 --repeat=2
      --pallet=pallet_identity --extrinsic='*'`
      
      ---------
      
      Co-authored-by: default avatarRichard Melkonian <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      1d9ec572
    • gupnik's avatar
      Fixes path issue in derive-impl (#1823) · 294e9983
      gupnik authored
      Needs https://github.com/sam0x17/macro_magic/pull/13
      
      The associated PR allows the export of tokens from macro_magic at the
      specified path. This fixes the path issue in derive-impl. Now, we can
      import the default config using the standard rust syntax:
      
      ```rust
      use frame_system::config_preludes::TestDefaultConfig;
      
      [derive_impl(TestDefaultConfig as frame_system::DefaultConfig)]
      impl frame_system::DefaultConfig for Test {
         //....
      }
      ```
      294e9983
  14. Oct 10, 2023
    • Sam Johnson's avatar
      upgrade to macro_magic 0.4.3 (#1832) · 5adcb3e1
      Sam Johnson authored
      # Description
      
      Upgrades `macro_magic` to 0.4.3, which introduces the ability to have
      `export_tokens` use the same name as the underlying item for its
      auto-generated macro name. Ultimately this will allow for better dev ux
      in our derive_impl feature.
      5adcb3e1
    • Liam Aharon's avatar
      remote-ext: fix state download stall on slow connections and reduce memory usage (#1295) · 55f35442
      Liam Aharon authored
      Original PR https://github.com/paritytech/substrate/pull/14746
      
      ---
      
      ## Fixing stall
      
      ### Introduction
      I experienced an apparent stall downloading state from
      `https://rococo-try-runtime-node.parity-chains.parity.io:443` which was
      having networking difficulties only responding to my JSONRPC requests
      with 50-200KB/s of bandwidth.
      
      This PR fixes the issue causing the stall, and generally improves
      performance remote-ext when it downloads state by greatly reducing the
      chances of a timeout occuring.
      
      ### Description
      Introduces a new `REQUEST_DURATION_TARGET` constant and modifies
      `get_storage_data_dynamic_batch_size` to
      
      - Increase or decrease the batch size of the next request depending on
      whether the elapsed time of the last request was gt or lt the target
      - Reset the batch size to 1 if the request times out
      
      This fixes an issue on slow connections that can otherwise cause
      multiple timeouts and a stalled download when:
      
      1. The batch size increases rapidly as remote-ext downloads keys with
      small associated storage values
      2. remote-ext tries to process a large series of subsequent keys all
      with extremely large associated storage values (Rococo has a series of
      keys 1-5MB large)
      3. The huge storage values download for 5 minutes until the request
      times out
      4. The partially downloaded keys are thrown out and remote-ext tries
      again with a smaller batch size, but the batch size is still far too
      large and takes 5 minutes to be reduced again
      5. The download will be essentially stalled for many hours while the
      above step cycles
      
      
      After this PR, the request size will
      
      - Not grow as large to begin with, as it is regulated downwards as the
      request duration exceeds the target
      - Drop immediately to 1 if the request times out. A timeout indicates
      the keys next in line to download have extremely large storage values
      compared to previously downloaded keys, and we need to reset the batch
      size to figure out what our new ideal batch size is. By not resetting
      down to 1, we risk the next request timing out again.
      
      ## Reducing memory
      
      As suggested by @bkchr, I adjusted `get_storage_data_dynamic_batch_size`
      from being recursive to a loop which allows removing a bunch of clones
      that were chewing through a lot of memory. I noticed actually it was
      using up to 50GB swap previously when downloading Polkadot keys on a
      slow connection, because it needed to recurse and clone a lot.
      
      After this change it uses only ~1.5GB memory.
      55f35442
    • Oliver Tale-Yazdi's avatar
      [FRAME] Warn on unchecked weight witness (#1818) · 64877492
      Oliver Tale-Yazdi authored
      Adds a warning to FRAME pallets when a function argument that starts
      with `_` is used in the weight formula.
      This is in most cases an error since the weight witness needs to be
      checked.
      
      Example:
      
      ```rust
      #[pallet::call_index(0)]
      #[pallet::weight(T::SystemWeightInfo::remark(_remark.len() as u32))]
      pub fn remark(_origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
      	Ok(().into())
      }
      ```
      
      Produces this warning:
      
      ```pre
      warning: use of deprecated constant `pallet::warnings::UncheckedWeightWitness_0::_w`: 
                       It is deprecated to not check weight witness data.
                       Please instead ensure that all witness data for weight calculation is checked before usage.
               
                       For more info see:
                           <https://github.com/paritytech/polkadot-sdk/pull/1818>
         --> substrate/frame/system/src/lib.rs:424:40
          |
      424 |         pub fn remark(_origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
          |                                              ^^^^^^^
          |
          = note: `#[warn(deprecated)]` on by default
      ```
      
      Can be suppressed like this, since in this case it is legit:
      
      ```rust
      #[pallet::call_index(0)]
      #[pallet::weight(T::SystemWeightInfo::remark(remark.len() as u32))]
      pub fn remark(_origin: OriginFor<T>, remark: Vec<u8>) -> DispatchResultWithPostInfo {
      	let _ = remark; // We dont need to check the weight witness.
      	Ok(().into())
      }
      ```
      
      Changes:
      - Add warning on uncheded weight witness
      - Respect `subkeys` limit in `System::kill_prefix`
      - Fix HRMP pallet and other warnings
      - Update`proc_macro_warning` dependency
      - Delete random folder `substrate/src/src` 🙈
      
       
      - Adding Prdoc
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      64877492
    • Rahul Subramaniyam's avatar
      Check for parent of first ready block being on chain (#1812) · 2b4b33d0
      Rahul Subramaniyam authored
      
      
      When retrieving the ready blocks, verify that the parent of the first
      ready block is on chain. If the parent is not on chain, we are
      downloading from a fork. In this case, keep downloading until we have a
      parent on chain (common ancestor).
      
      Resolves https://github.com/paritytech/polkadot-sdk/issues/493.
      
      ---------
      
      Co-authored-by: default avatarAaro Altonen <[email protected]>
      2b4b33d0
    • David Emett's avatar