1. Apr 25, 2024
  2. Mar 27, 2024
  3. Mar 15, 2024
  4. Mar 05, 2024
  5. Feb 19, 2024
    • Gilt0's avatar
      [FRAME Core] remove unnecessary overrides while using derive_impl for frame_system (#3317) · b78c72cf
      Gilt0 authored
      
      
      # Description
      
      This PR removes redundant type definition from test definition config
      implementations like
      ```
      #[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
      impl frame_system::Config for Test {
          type A = A;
          ...
      }
      ```
      
      This changes avoid redundancies in the code as the macro `derive_impl`
      defines the relevant types. To implement the changes, it was a simple
      fact of running tests and making sure that the tests would still run
      while the definition would be removed.
      
      Closes #3237
      
      As a note, here is a brief account of things done from the Issue's
      description statement
      ```
      alliance migrate alliance, fast-unstake and bags list to use derive-impl #1636
      asset-conversion                                                                                            DONE
      asset-rate                                                                                                  DONE
      assets                                                                                                      DONE
      atomic-swap                                                                                                 DONE
      aura                                                                                                        DONE
      authority-discovery                                                                                         DONE                                                                     
      authorship  migrate babe and authorship to use derive-impl #1790
      babe  migrate babe and authorship to use derive-impl #1790
      bags-list migrate alliance, fast-unstake and bags list to use derive-impl #1636
      balances                                                                                                    DONE
      beefy                                                                                                       NOTHING TO DO --- also noted this error without failing tests Feb 13 13:49:08.941 ERROR runtime::timestamp: `pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0
      beefy-mmr                                                                                                   NOTHING TO DO
      bounties                                                                                                    DONE
      child-bounties                                                                                              DONE
      collective                                                                                                  DONE
      contracts                                                                                                   DONE
      conviction-voting                                                                                           DONE
      core-fellowship                                                                                             NOTHING TO DO
      democracy                                                                                                   DONE
      election-provider-multi-phase                                                                               NOTHING TO DO
      elections-phragmen                                                                                          DONE
      executive                                                                                                   NOTHING TO DO
      fast-unstake migrate alliance, fast-unstake and bags list to use derive-impl #1636
      glutton                                                                                                     DONE
      grandpa                                                                                                     DONE
      identity                                                                                                    DONE
      im-online                                                                                                   NOTHING TO DO
      indices Refactor indices pallet #1789
      insecure-randomness-collective-flip                                                                         DONE
      lottery                                                                                                     DONE
      membership                                                                                                  DONE
      merkle-mountain-range                                                                                       NOTHING TO DO
      message-queue                                                                                               DONE
      multisig add frame_system::DefaultConfig to individual pallet DefaultConfigs substrate#14453
      nft-fractionalization                                                                                       DONE
      nfts                                                                                                        DONE
      nicks Refactor pallet-state-trie-migration to fungible::* traits #1801                                      NOT IN REPO
      nis                                                                                                         DONE
      node-authorization                                                                                          DONE
      nomination-pools                                                                                            NOTHING TO DO -- ONLY impl for Runtime
      offences                                                                                                    DELETED EVERYTHING -- IS THAT CORRECT??
      preimage                                                                                                    DONE
      proxy add frame_system::DefaultConfig to individual pallet DefaultConfigs substrate#14453
      ranked-collective                                                                                           NOTHING TO DO
      recovery                                                                                                    DONE
      referenda                                                                                                   DONE
      remark                                                                                                      DONE
      root-offences                                                                                               DONE
      root-testing                                                                                                NOTHING TO DO
      salary                                                                                                      NOTHING TO DO
      scheduler                                                                                                   DONE
      scored-pool                                                                                                 DONE
      session                                                                                                     DONE -- substrate/frame/session/benchmarking/src/mock.rs untouched
      society                                                                                                     NOTHING TO DO
      staking                                                                                                     DONE
      staking-bags-benchmarks                                                                                     NOT IN REPO
      state-trie-migration                                                                                        NOTHING TO DO
      statement                                                                                                   DONE
      sudo                                                                                                        DONE
      system                                                                                                      DONE
      timestamp                                                                                                   DONE
      tips                                                                                                        DONE
      transaction-payment                                                                                         NOTHING TO DO
      transaction-storage                                                                                         NOTHING TO DO
      treasury                                                                                                    DONE
      try-runtime                                                                                                 NOTHING TO DO -- no specific mention of 'for Test'
      uniques                                                                                                     DONE
      utility                                                                                                     DONE
      vesting                                                                                                     DONE
      whitelist                                                                                                   DONE
      ```
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatargupnik <[email protected]>
      b78c72cf
  6. Jan 22, 2024
  7. Dec 07, 2023
  8. Nov 28, 2023
  9. Nov 02, 2023
    • Oliver Tale-Yazdi's avatar
      Use `Message Queue` as DMP and XCMP dispatch queue (#1246) · e1c033eb
      Oliver Tale-Yazdi authored
      (imported from https://github.com/paritytech/cumulus/pull/2157)
      
      ## Changes
      
      This MR refactores the XCMP, Parachains System and DMP pallets to use
      the [MessageQueue](https://github.com/paritytech/substrate/pull/12485)
      for delayed execution of incoming messages. The DMP pallet is entirely
      replaced by the MQ and thereby removed. This allows for PoV-bounded
      execution and resolves a number of issues that stem from the current
      work-around.
      
      All System Parachains adopt this change.  
      The most important changes are in `primitives/core/src/lib.rs`,
      `parachains/common/src/process_xcm_message.rs`,
      `pallets/parachain-system/src/lib.rs`, `pallets/xcmp-queue/src/lib.rs`
      and the runtime configs.
      
      ### DMP Queue Pallet
      
      The pallet got removed and its logic refactored into parachain-system.
      Overweight message management can be done directly through the MQ
      pallet.
      
      Final undeployment migrations are provided by
      `cumulus_pallet_dmp_queue::UndeployDmpQueue` and `DeleteDmpQueue` that
      can be configured with an aux config trait like:
      
      ```rust
      parameter_types! {
      	pub const DmpQueuePalletName: &'static str = \"DmpQueue\" < CHANGE ME;
      	pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
      }
      
      impl cumulus_pallet_dmp_queue::MigrationConfig for Runtime {
      	type PalletName = DmpQueuePalletName;
      	type DmpHandler = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
      	type DbWeight = <Runtime as frame_system::Config>::DbWeight;
      }
      
      // And adding them to your Migrations tuple:
      pub type Migrations = (
      	...
      	cumulus_pallet_dmp_queue::UndeployDmpQueue<Runtime>,
      	cumulus_pallet_dmp_queue::DeleteDmpQueue<Runtime>,
      );
      ```
      
      ### XCMP Queue pallet
      
      Removed all dispatch queue functionality. Incoming XCMP messages are now
      either: Immediately handled if they are Signals, enqueued into the MQ
      pallet otherwise.
      
      New config items for the XCMP queue pallet:
      ```rust
      /// The actual queue implementation that retains the messages for later processing.
      type XcmpQueue: EnqueueMessage<ParaId>;
      
      /// How a XCM over HRMP from a sibling parachain should be processed.
      type XcmpProcessor: ProcessMessage<Origin = ParaId>;
      
      /// The maximal number of suspended XCMP channels at the same time.
      #[pallet::constant]
      type MaxInboundSuspended: Get<u32>;
      ```
      
      How to configure those:
      
      ```rust
      // Use the MessageQueue pallet to store messages for later processing. The `TransformOrigin` is needed since
      // the MQ pallet itself operators on `AggregateMessageOrigin` but we want to enqueue `ParaId`s.
      type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
      
      // Process XCMP messages from siblings. This is type-safe to only accept `ParaId`s. They will be dispatched
      // with origin `Junction::Sibling(…)`.
      type XcmpProcessor = ProcessFromSibling<
      	ProcessXcmMessage<
      		AggregateMessageOrigin,
      		xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
      		RuntimeCall,
      	>,
      >;
      
      // Not really important what to choose here. Just something larger than the maximal number of channels.
      type MaxInboundSuspended = sp_core::ConstU32<1_000>;
      ```
      
      The `InboundXcmpStatus` storage item was replaced by
      `InboundXcmpSuspended` since it now only tracks inbound queue suspension
      and no message indices anymore.
      
      Now only sends the most recent channel `Signals`, as all prio ones are
      out-dated anyway.
      
      ### Parachain System pallet
      
      For `DMP` messages instead of forwarding them to the `DMP` pallet, it
      now pushes them to the configured `DmpQueue`. The message processing
      which was triggered in `set_validation_data` is now being done by the MQ
      pallet `on_initialize`.
      
      XCMP messages are still handed off to the `XcmpMessageHandler`
      (XCMP-Queue pallet) - no change here.
      
      New config items for the parachain system pallet:
      ```rust
      /// Queues inbound downward messages for delayed processing. 
      ///
      /// Analogous to the `XcmpQueue` of the XCMP queue pallet.
      type DmpQueue: EnqueueMessage<AggregateMessageOrigin>;
      ``` 
      
      How to configure:
      ```rust
      /// Use the MQ pallet to store DMP messages for delayed processing.
      type DmpQueue = MessageQueue;
      ``` 
      
      ## Message Flow
      
      The flow of messages on the parachain side. Messages come in from the
      left via the `Validation Data` and finally end up at the `Xcm Executor`
      on the right.
      
      ![Untitled
      (1)](https://github.com/paritytech/cumulus/assets/10380170/6cf8b377-88c9-4aed-96df-baace266e04d)
      
      ## Further changes
      
      - Bumped the default suspension, drop and resume thresholds in
      `QueueConfigData::default()`.
      - `XcmpQueue::{suspend_xcm_execution, resume_xcm_execution}` errors when
      they would be a noop.
      - Properly validate the `QueueConfigData` before setting it.
      - Marked weight files as auto-generated so they wont auto-expand in the
      MR files view.
      - Move the `hypothetical` asserts to `frame_support` under the name
      `experimental_hypothetically`
      
      Questions:
      - [ ] What about the ugly `#[cfg(feature = \"runtime-benchmarks\")]` in
      the runtimes? Not sure how to best fix. Just having them like this makes
      tests fail that rely on the real message processor when the feature is
      enabled.
      - [ ] Need a good weight for `MessageQueueServiceWeight`. The scheduler
      already takes 80% so I put it to 10% but that is quite low.
      
      TODO:
      - [x] Remove c&p code after
      https://github.com/paritytech/polkadot/pull/6271
      - [x] Use `HandleMessage` once it is public in Substrate
      - [x] fix `runtime-benchmarks` feature
      https://github.com/paritytech/polkadot/pull/6966
      
      
      - [x] Benchmarks
      - [x] Tests
      - [ ] Migrate `InboundXcmpStatus` to `InboundXcmpSuspended`
      - [x] Possibly cleanup Migrations (DMP+XCMP)
      - [x] optional: create `TransformProcessMessageOrigin` in Substrate and
      replace `ProcessFromSibling`
      - [ ] Rerun weights on ref HW
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: command-bot <>
      e1c033eb
  10. Oct 19, 2023
  11. Aug 14, 2023
  12. Jul 18, 2023
  13. Jul 14, 2023
    • juangirini's avatar
      Replace system config `Index` for `Nonce` (#14290) · 6a29a70a
      juangirini authored
      * replace Index by Nonce
      
      * replace Index by Nonce
      
      * replace Index by Nonce
      
      * replace Index by Nonce
      
      * replace Index by Nonce
      
      * wip
      
      * remove index in lieu of nonce
      
      * wip
      
      * remove accountnonce in lieu of nonce
      
      * add minor improvement
      
      * rebase and merge conflicts
      6a29a70a
  14. Jul 13, 2023
    • gupnik's avatar
      Moves `Block` to `frame_system` instead of `construct_runtime` and removes... · 5e7b27e9
      gupnik authored
      
      Moves `Block` to `frame_system` instead of `construct_runtime` and removes `Header` and `BlockNumber` (#14437)
      
      * Initial setup
      
      * Adds node block
      
      * Uses UncheckedExtrinsic and removes Where section
      
      * Updates frame_system to use Block
      
      * Adds deprecation warning
      
      * Fixes pallet-timestamp
      
      * Removes Header and BlockNumber
      
      * Addresses review comments
      
      * Addresses review comments
      
      * Adds comment about compiler bug
      
      * Removes where clause
      
      * Refactors code
      
      * Fixes errors in cargo check
      
      * Fixes errors in cargo check
      
      * Fixes warnings in cargo check
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Uses import instead of full path for BlockNumber
      
      * Uses import instead of full path for Header
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Fixes imports in benchmarks
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Formatting
      
      * Minor updates
      
      * Fixes construct_runtime ui tests
      
      * Fixes construct_runtime ui tests with 1.70
      
      * Fixes docs
      
      * Fixes docs
      
      * Adds u128 mock block type
      
      * Fixes split example
      
      * fixes for cumulus
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Updates new tests
      
      * Fixes fully-qualified path in few places
      
      * Formatting
      
      * Update frame/examples/default-config/src/lib.rs
      
      Co-authored-by: default avatarJuan <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarJuan <[email protected]>
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Addresses some review comments
      
      * Fixes build
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Update frame/democracy/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/democracy/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Addresses review comments
      
      * Updates trait bounds
      
      * Minor fix
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Removes unnecessary bound
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Updates test
      
      * Fixes build
      
      * Adds a bound for header
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Removes where block
      
      * Minor fix
      
      * Minor fix
      
      * Fixes tests
      
      * ".git/.scripts/commands/update-ui/update-ui.sh" 1.70
      
      * Updates test
      
      * Update primitives/runtime/src/traits.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Update primitives/runtime/src/traits.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Updates doc
      
      * Updates doc
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarJuan <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      5e7b27e9
  15. Jul 12, 2023
    • Michal Kucharczyk's avatar
      `GenesisBuild<T,I>` deprecated. `BuildGenesisConfig` added. (#14306) · 87d41d0a
      Michal Kucharczyk authored
      
      
      * frame::support: GenesisConfig types for Runtime enabled
      
      * frame::support: macro generating GenesisBuild::build for RuntimeGenesisConfig
      
      * frame: ambiguity BuildStorage vs GenesisBuild fixed
      
      * fix
      
      * RuntimeGenesisBuild added
      
      * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"
      
      This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293.
      
      * Revert "fix"
      
      This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b.
      
      * Revert "RuntimeGenesisBuild added"
      
      This reverts commit 3c131b618138ced29c01ab8d15d8c6410c9e128b.
      
      * Revert "Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed""
      
      This reverts commit 2b1ecd467231eddec69f8d328039ba48a380da3d.
      
      * Revert "Revert "fix""
      
      This reverts commit fd7fa629adf579d83e30e6ae9fd162637fc45e30.
      
      * Code review suggestions
      
      * frame: BuildGenesisConfig added, BuildGenesis deprecated
      
      * frame: some pallets updated with BuildGenesisConfig
      
      * constuct_runtime: support for BuildGenesisConfig
      
      * frame::support: genesis_build macro supports BuildGenesisConfig
      
      * frame: BuildGenesisConfig added, BuildGenesis deprecated
      
      * Cargo.lock update
      
      * test-runtime: fixes
      
      * Revert "fix"
      
      This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b.
      
      * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"
      
      This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293.
      
      * self review
      
      * doc fixed
      
      * ui tests fixed
      
      * fmt
      
      * tests fixed
      
      * genesis_build macrto fixed for non-generic GenesisConfig
      
      * BuildGenesisConfig constraints added
      
      * warning fixed
      
      * some duplication removed
      
      * fmt
      
      * fix
      
      * doc tests fix
      
      * doc fix
      
      * cleanup: remove BuildModuleGenesisStorage
      
      * self review comments
      
      * fix
      
      * Update frame/treasury/src/tests.rs
      
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      
      * Update frame/support/src/traits/hooks.rs
      
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      
      * doc fix: GenesisBuild exposed
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * frame: more serde(skip) + cleanup
      
      * Update frame/support/src/traits/hooks.rs
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * frame: phantom fields moved to the end of structs
      
      * chain-spec: Default::default cleanup
      
      * test-runtime: phantom at the end
      
      * merge master fixes
      
      * fix
      
      * fix
      
      * fix
      
      * fix
      
      * fix (facepalm)
      
      * Update frame/support/procedural/src/pallet/expand/genesis_build.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * fmt
      
      * fix
      
      * fix
      
      ---------
      
      Co-authored-by: parity-processbot <>
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      87d41d0a
  16. Jun 28, 2023
  17. May 21, 2023
  18. Mar 07, 2023
  19. Feb 25, 2023
  20. Feb 21, 2023
    • Vivek Pandya's avatar
      Remove years from copyright notes. (#13415) · bc53b9a0
      Vivek Pandya authored
      * Change copyright year to 2023 from 2022
      
      * Fix incorrect update of copyright year
      
      * Remove years from copy right header
      
      * Fix remaining files
      
      * Fix typo in a header and remove update-copyright.sh
      bc53b9a0
  21. Jan 07, 2023
  22. Dec 12, 2022
  23. Dec 09, 2022