1. Oct 20, 2023
    • 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
  2. Oct 16, 2023
  3. Oct 10, 2023
  4. Oct 09, 2023
    • David Emett's avatar
      Mixnet integration (#1346) · a808a3a0
      David Emett authored
      See #1345, <https://github.com/paritytech/substrate/pull/14207
      
      >.
      
      This adds all the necessary mixnet components, and puts them together in
      the "kitchen-sink" node/runtime. The components added are:
      
      - A pallet (`frame/mixnet`). This is responsible for determining the
      current mixnet session and phase, and the mixnodes to use in each
      session. It provides a function that validators can call to register a
      mixnode for the next session. The logic of this pallet is very similar
      to that of the `im-online` pallet.
      - A service (`client/mixnet`). This implements the core mixnet logic,
      building on the `mixnet` crate. The service communicates with other
      nodes using notifications sent over the "mixnet" protocol.
      - An RPC interface. This currently only supports sending transactions
      over the mixnet.
      
      ---------
      
      Co-authored-by: default avatarDavid Emett <[email protected]>
      Co-authored-by: default avatarJavier Viola <[email protected]>
      a808a3a0
  5. Oct 07, 2023
    • Muharem Ismailov's avatar
      Treasury spends various asset kinds (#1333) · cb944dc5
      Muharem Ismailov authored
      
      
      ### Summary 
      
      This PR introduces new dispatchables to the treasury pallet, allowing
      spends of various asset types. The enhanced features of the treasury
      pallet, in conjunction with the asset-rate pallet, are set up and
      enabled for Westend and Rococo.
      
      ### Westend and Rococo runtimes.
      
      Polkadot/Kusams/Rococo Treasury can accept proposals for `spends` of
      various asset kinds by specifying the asset's location and ID.
      
      #### Treasury Instance New Dispatchables:
      - `spend(AssetKind, AssetBalance, Beneficiary, Option<ValidFrom>)` -
      propose and approve a spend;
      - `payout(SpendIndex)` - payout an approved spend or retry a failed
      payout
      - `check_payment(SpendIndex)` - check the status of a payout;
      - `void_spend(SpendIndex)` - void previously approved spend;
      > existing spend dispatchable renamed to spend_local
      
      in this context, the `AssetKind` parameter contains the asset's location
      and it's corresponding `asset_id`, for example:
      `USDT` on `AssetHub`,
      ``` rust
      location = MultiLocation(0, X1(Parachain(1000)))
      asset_id = MultiLocation(0, X2(PalletInstance(50), GeneralIndex(1984)))
      ```
      
      the `Beneficiary` parameter is a `MultiLocation` in the context of the
      asset's location, for example
      ``` rust
      // the Fellowship salary pallet's location / account
      FellowshipSalaryPallet = MultiLocation(1, X2(Parachain(1001), PalletInstance(64)))
      // or custom `AccountId`
      Alice = MultiLocation(0, AccountId32(network: None, id: [1,...]))
      ```
      
      the `AssetBalance` represents the amount of the `AssetKind` to be
      transferred to the `Beneficiary`. For permission checks, the asset
      amount is converted to the native amount and compared against the
      maximum spendable amount determined by the commanding spend origin.
      
      the `spend` dispatchable allows for batching spends with different
      `ValidFrom` arguments, enabling milestone-based spending. If the
      expectations tied to an approved spend are not met, it is possible to
      void the spend later using the `void_spend` dispatchable.
      
      Asset Rate Pallet provides the conversion rate from the `AssetKind` to
      the native balance.
      
      #### Asset Rate Instance Dispatchables:
      - `create(AssetKind, Rate)` - initialize a conversion rate to the native
      balance for the given asset
      - `update(AssetKind, Rate)` - update the conversion rate to the native
      balance for the given asset
      - `remove(AssetKind)` - remove an existing conversion rate to the native
      balance for the given asset
      
      the pallet's dispatchables can be executed by the Root or Treasurer
      origins.
      
      ### Treasury Pallet
      
      Treasury Pallet can accept proposals for `spends` of various asset kinds
      and pay them out through the implementation of the `Pay` trait.
      
      New Dispatchables:
      - `spend(Config::AssetKind, AssetBalance, Config::Beneficiary,
      Option<ValidFrom>)` - propose and approve a spend;
      - `payout(SpendIndex)` - payout an approved spend or retry a failed
      payout;
      - `check_payment(SpendIndex)` - check the status of a payout;
      - `void_spend(SpendIndex)` - void previously approved spend;
      > existing spend dispatchable renamed to spend_local
      
      The parameters' types of the `spend` dispatchable exposed via the
      pallet's `Config` and allows to propose and accept a spend of a certain
      amount.
      
      An approved spend can be claimed via the `payout` within the
      `Config::SpendPeriod`. Clients provide an implementation of the `Pay`
      trait which can pay an asset of the `AssetKind` to the `Beneficiary` in
      `AssetBalance` units.
      
      The implementation of the Pay trait might not have an immediate final
      payment status, for example if implemented over `XCM` and the actual
      transfer happens on a remote chain.
      
      The `check_status` dispatchable can be executed to update the spend's
      payment state and retry the `payout` if the payment has failed.
      
      ---------
      
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: command-bot <>
      cb944dc5
  6. Oct 05, 2023
  7. Sep 29, 2023
    • Sebastian Kunert's avatar
      9485b0b4
    • Ankan's avatar
      [NPoS] Fix for Reward Deficit in the pool (#1255) · f820dc0a
      Ankan authored
      closes https://github.com/paritytech/polkadot-sdk/issues/158.
      partially addresses
      https://github.com/paritytech/polkadot-sdk/issues/226.
      
      Instead of fragile calculation of current balance by looking at `free
      balance - ED`, Nomination Pool now freezes ED in the pool reward account
      to restrict an account from going below minimum balance. This also has a
      nice side effect that if ED changes, we know how much is the imbalance
      in ED frozen in the pool and the current required ED. A pool operator
      can diligently top up the pool with the deficit in ED or vice versa,
      withdraw the excess they transferred to the pool.
      
      ## Notable changes
      - New call `adjust_pool_deposit`: Allows to top up the deficit or
      withdraw the excess deposited funds to the pool.
      - Uses Fungible trait (instead of Currency trait). Since NP was not
      doing any locking/reserving previously, no migration is needed for this.
      - One time migration of freezing ED from each of the existing pools (not
      very PoV friendly but fine for relay chain).
      f820dc0a
  8. Sep 28, 2023
    • Xavier Lau's avatar
      Add `MaxTipAmount` for pallet-tips (#1709) · de71fecc
      Xavier Lau authored
      Last week we experienced a governance attack.
      Surprisingly, there was no upper limit on the tip amount.
      
      Due to the mechanism of pallet-fragment-election, the council members
      will be refreshed immediately. Attacker is easy to control the council
      and give a large tip amount.
      de71fecc
  9. Sep 27, 2023
  10. Sep 22, 2023
    • Sebastian Kunert's avatar
      Use correct target dir in polkadot readme (#1643) · fb0fd3e6
      Sebastian Kunert authored
      Closes #1372 
      
      This fixes the target directories in the polkadot readme. I verified
      manually the Ubuntu based install works on a fresh cloud machine. Build
      from source also worked as described.
      
      Since #1304 landed `--dev` also works again (not on v1.1.0 though), so I
      would consider the install instructions fixed.
      fb0fd3e6
  11. Sep 20, 2023
  12. Sep 18, 2023
    • Gonçalo Pestana's avatar
      Implements a variable deposit base calculation for EPM signed submissions (#1547) · 614aa31b
      Gonçalo Pestana authored
      **Note**: This is a lift-and-shift PR from the old substrate and
      polkadot repos, both PRs have been reviewed and audited
      (https://github.com/paritytech/substrate/pull/13983,
      https://github.com/paritytech/polkadot/pull/7140)
      
      ---
      
      This PR implements a generic `BaseDeposit` calculation for signed
      submissions, based on the size of the submission queue.
      
      It adds a new associated type to EPM's config, `type SignedDepositBase`,
      that implements `Convert<usize, BalanceOf<T>>`, which is used to
      calculate the base deposit for signed submissions based on the size of
      the signed submissions queue.
      
      `struct GeometricDepositBase<Balance, Fixed, Inc>` implements the
      convert trait so that the deposit value increases as a geometric
      progression. The deposit base is calculated by `deposit_base =
      fixed_deposit_base * (1 + increase_factor)^n`, where `n` is the term of
      the progression (i.e. the number of signed submissions in the queue).
      `Fixed` and `Inc` generic params are getters for `Balance` and
      `IncreaseFactor` to compute the geometric progression. If
      `IncreaseFactor = 0`, then the signed deposit is constant and equal to
      `Fixed` regardless of the size of the queue.
      
      ### Runtime configs
      
      In Kusama, the progression with 10% increase without changing the
      current signed fixed deposit is: (term == size of the queue)
      
      Term 1: `1,333,333,332,000`
      Term 2: `1,333,333,332,000 * 1.10 = 1,466,666,665,200`
      Term 3: `1,333,333,332,000 * 1.10^2 = 1,613,333,331,200`
      Term 4: `1,333,333,332,000 * 1.10^3 = 1,774,666,664,320`
      Term 5: `1,333,333,332,000 * 1.10^4 = 1,952,133,330,752`
      Term 6: `1,333,333,332,000 * 1.10^5 = 2,147,346,663,827.20`
      Term 7: `1,333,333,332,000 * 1.10^6 = 2,362,081,330,210.92`
      Term 8: `1,333,333,332,000 * 1.10^7 = 2,598,289,463,231.01`
      Term 9: `1,333,333,332,000 * 1.10^8 = 2,858,118,409,554.11`
      Term 10: `1,333,333,332,000 * 1.10^9 = 3,143,930,250,509.52`
      
      Westend:
      
      Term 1: `2,000,000,000,000`
      Term 2: `2,000,000,000,000 * 1.10 = 2,200,000,000,000`
      Term 3: `2,000,000,000,000 * 1.10^2 = 2,420,000,000,000`
      Term 4: `2,000,000,000,000 * 1.10^3 = 2,662,000,000,000`
      Term 5: `2,000,000,000,000 * 1.10^4 = 2,928,200,000,000`
      Term 6: `2,000,000,000,000 * 1.10^5 = 3,221,020,000,000`
      Term 7: `2,000,000,000,000 * 1.10^6 = 3,543,122,000,000`
      Term 8: `2,000,000,000,000 * 1.10^7 = 3,897,434,200,000`
      Term 9: `2,000,000,000,000 * 1.10^8 = 4,287,177,620,000`
      Term 10: `2,000,000,000,000 * 1.10^9 = 4,715,895,382,000`
      
      and in Polkadot, the deposit increase is disabled in the current state
      of the PR, as the increase factor is 0% -- so nothing changes from the
      current behaviour.
      
      Closes https://github.com/paritytech-secops/srlabs_findings/issues/189
      614aa31b
  13. Sep 17, 2023
  14. Sep 15, 2023
  15. Sep 13, 2023
  16. Sep 11, 2023
  17. Sep 05, 2023
  18. Sep 04, 2023
  19. Sep 03, 2023
  20. Sep 02, 2023
  21. Sep 01, 2023
  22. Aug 30, 2023
  23. Aug 29, 2023
  24. Aug 28, 2023
  25. Aug 25, 2023
  26. Aug 24, 2023
    • Gavin Wood's avatar
      Frame: Agile Coretime Broker pallet (RFC-1) (#14568) · 46bd466e
      Gavin Wood authored
      
      
      * Add Broker pallet
      
      * Flesh out CorePart
      
      * Repotting and fleshing out
      
      * more drafting
      
      * process timeslice
      
      * Test Fungibles completed
      
      * Auctions
      
      * Price morphing
      
      * First tests
      
      * Tidying up config/status
      
      * Docs
      
      * Timeslice todying
      
      * More Timeslice tidying
      
      * Tests]
      
      * Repotting.
      
      * Tests
      
      * Tests
      
      * System InstaPool cores and payout
      
      * Better Relay Test framework
      
      * Tests and instapool fixes
      
      * Support NFT interface
      
      * Proper renewals
      
      * Better events, results
      
      * Test transfer
      
      * Renewal test
      
      * Repot some impls and make dispatchables.
      
      * Better weight
      
      * Test migration
      
      * Document events
      
      * Introduce durations
      
      * Core count
      
      * Allow reassignment
      
      * Better naming
      
      * Error docs
      
      * Docs
      
      * Formatting
      
      * Advance notice period is in RC blocks, not timeslices
      
      * Docs
      
      * Formatting
      
      * Docs
      
      * Missing file
      
      * Added some events
      
      * Events for all dispatchables
      
      * Remove benchmark
      
      * Fix
      
      * Adds benchmark for configure and some basic setup
      
      * Adds benchmark for reserve and unreserve
      
      * Adds a couple of more benchmarks
      
      * Docs
      
      * Event
      
      * Fix
      
      * Adds benchmark for purchase
      
      * Dedup
      
      * Add some weight breakdowns
      
      * Repotting
      
      * Adds more benchmarks
      
      * Renaming and one more event
      
      * Sale event
      
      * Better price API and docs
      
      * Avoid possibility of clobbering renewal record
      
      * Avoid possibility of clobbering renewal record
      
      * Fixes a few benchmarks
      
      * Another test
      
      * More tests
      
      * Drop history test
      
      * Rename and CORE_MASK_BITS constant
      
      * Update frame/broker/src/dispatchable_impls.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/broker/src/dispatchable_impls.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/broker/src/dispatchable_impls.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/broker/src/utility_impls.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/broker/src/dispatchable_impls.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/broker/src/mock.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Addresses few review comments
      
      * Addresses few review comments
      
      * Addresses few review comments
      
      * Merge
      
      * Merge
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Integrates broker in kitchensink
      
      * Minor update
      
      * Fixes typo
      
      * Moves balance back to u64
      
      * Fixes kitchensink build
      
      * Fixes worst case for assign
      
      * Adds benchmark for process_core_count
      
      * Adds a couple of more benchmarks
      
      * Adds an assert for partition
      
      * Uses max_timeslices as input in claim_revenue benchmark
      
      * Adds benchmark for drop_renewal
      
      * Adds benchmark for process_core_schedule
      
      * Adds benchmark for process_pool
      
      * Adds assertion for transfer
      
      * Fixes benchmark for broker in kitchensink
      
      * Adds todo for process_revenue benchmark
      
      * Minor update
      
      * Fix for pool revenue history
      
      * remove TODOs
      
      * Fix tests
      
      * Document CoretimeInterface
      
      * rename part to mask
      
      * Fixes
      
      * Grumble
      
      * ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_broker
      
      * Adds benchmark for drop_history and fixes worst case for claim_revenue
      
      * Adds drop_history in WeightInfo
      
      * ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_broker
      
      * Minor fix for Quick Benchmark CI
      
      * Fixes
      
      * Docs
      
      * Headers
      
      * Expose a couple of APIs for benchmarking (#14688)
      
      * Expose a couple of APIs for benchmarking
      
      * Adds doc
      
      * Minor fix in CoretimeInterface impl for kitchensik
      
      * Minor
      
      * Cap renewal price
      
      * Adds a few tests
      
      * Adds more tests
      
      * Minor updates
      
      * Adds a test for an edge case
      
      * Fixes feature propagation
      
      * Fixes feature propagation
      
      * Adds doc fix
      
      * Syntax nits
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Reuse Bit assign functions
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Bitwise tests
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * adapt_price: Edge case for sold == target
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Add sanity checking to ConfigRecord
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Add deny(missing_docs) where possible
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * partition: forbid pivot_offset == 0
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Sort features
      
      zepter format features
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Import Zero from new location
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Clippy: remove redundant clone
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * try to fix build
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Fix CI
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarNikhil Gupta <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: command-bot <>
      46bd466e
    • juangirini's avatar
      Restructure `frame_benchmarking` macro related exports (#14787) · bc2b3d9d
      juangirini authored
      
      
      * make reexports private
      
      * make reexports private 2
      
      * make reexports private for runtime-benchmarking
      
      * make reexports private for try-runtime
      
      * fix for try-runtime
      
      * make reexports private for tests
      
      * fmt
      
      * make reexports private for tests
      
      * make reexports private for experimental
      
      * fix beefy
      
      * fix ui test
      
      * fix ui test
      
      * fix benches
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * fix contracts use
      
      * wip
      
      * wip
      
      * do not reexport sp_api::metadata_ir
      
      * fix CI checks
      
      * fix support tests
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Update frame/support/src/lib.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * import codec directly
      
      * fmt
      
      * wip
      
      * wip
      
      * remove benchmarking private exports
      
      * fix zepter warning
      
      * fix imports
      
      * partially fix node-cli tests
      
      * fix node-cli tests
      
      * fix node-cli build
      
      * fix zepter warning
      
      * fix test
      
      * fix ui test
      
      * fix ci
      
      * remove unnecessary imports
      
      * add import back
      
      * add import back
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      bc2b3d9d
    • PG Herveou's avatar
      Contracts: Update Config::Debug (#14789) · cd464f9c
      PG Herveou authored
      * Update Debug trait
      
      * Rename
      
      * tweak
      
      * fmt
      
      * Better namings
      
      * rm unsafe-debug
      
      * rework doc
      
      * nit
      
      * fix comment
      
      * clippy
      
      * update naming
      
      * Rename file
      
      * fmt fixes
      
      * rename
      
      * Move tracing behind umbrella Debugging trait
      
      * fix
      
      * fix comment
      
      * reorder imports
      
      * comment
      
      * update doc
      
      * add missing doc
      
      * add missing doc
      
      * Update Debugging -> Debugger
      
      * Update bin/node/runtime/Cargo.toml
      cd464f9c
  27. Aug 23, 2023
  28. Aug 17, 2023