Skip to content
Snippets Groups Projects
  1. May 15, 2024
    • Dastan's avatar
      Export all public functions of `sc-service` (#4457) · 59d7e037
      Dastan authored
      
      https://github.com/paritytech/polkadot-sdk/pull/3166 made private
      functions used in `spawn_tasks()` public but forgot to add them in
      exported functions of the crate.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
    • Liu-Cheng Xu's avatar
      Fix extrinsics count logging in frame-system (#4461) · 404027e5
      Liu-Cheng Xu authored
      
      The storage item ExtrinsicIndex is already taken before the `finalize()`
      in `note_finished_extrinsics()`, rendering it's always 0 in the log.
      This commit fixes it by using the proper API for extrinsics count.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
    • Ankan's avatar
      Introduces: Delegated Staking Pallet (#3904) · 4d47b443
      Ankan authored
      This is the second PR in preparation for
      https://github.com/paritytech/polkadot-sdk/issues/454.
      
      ## Also see
      - **Precursor** https://github.com/paritytech/polkadot-sdk/pull/3889.
      - **Follow up** https://github.com/paritytech/polkadot-sdk/pull/3905.
      
      Overall changes are documented here (lot more visual :heart_eyes:
      
      ):
      https://hackmd.io/@ak0n/454-np-governance
      
      ## Changes
      ### Delegation Interface
      Provides delegation primitives for staking. 
      
      Introduces two new roles:
      - Agent: These are accounts who receive delegation from other accounts
      (delegators) and stakes on behalf of them. The funds are held in
      delegator accounts.
      - Delegator: Accounts who delegate their funds to an agent authorising
      them to use it for staking.
      
      Supports
      - A way for delegators to add or withdraw delegation to an agent.
      - A way for an agent to slash a delegator during a slashing event.
      
      ### Pallet Delegated Staking
      - Implements `DelegationInterface`.
      - Lazy slashing: Any slashes to an Agent is posted in a ledger but not
      immediately slashed. The agent can call
      `DelegationInterface::delegator_slash` to slash the member and clear the
      corresponding slash from its ledger.
      - Consumes `StakingInterface` to provide `CoreStaking` features. In
      reality, this will be `pallet-staking`.
      - Ensures bookkeeping for agent and delegator are correct but leaves the
      management of reward and slash logic upto the consumer of this pallet.
      - While it does not expose any calls yet, it is written with the intent
      of exposing these primitives via extrinsics.
      
      ## TODO
      - [x] Improve unit tests in the pallet.
      - [x] Separate slash reward perbill for rewarding the slash reporters?
      - [x] Review if we should add more events.
      
      ---------
      
      Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
      Co-authored-by: default avatarGonçalo Pestana <g6pestana@gmail.com>
      Co-authored-by: default avatargeorgepisaltu <52418509+georgepisaltu@users.noreply.github.com>
    • shamil-gadelshin's avatar
      Change forks pruning algorithm. (#3962) · 9c69bb98
      shamil-gadelshin authored
      
      This PR changes the fork calculation and pruning algorithm to enable
      future block header pruning. It's required because the previous
      algorithm relied on the block header persistence. It follows the
      [related
      discussion](https://github.com/paritytech/polkadot-sdk/issues/1570)
      
      The previous code contained this comment describing the situation:
      ```
      	/// Note a block height finalized, displacing all leaves with number less than the finalized
      	/// block's.
      	///
      	/// Although it would be more technically correct to also prune out leaves at the
      	/// same number as the finalized block, but with different hashes, the current behavior
      	/// is simpler and our assumptions about how finalization works means that those leaves
      	/// will be pruned soon afterwards anyway.
      	pub fn finalize_height(&mut self, number: N) -> FinalizationOutcome<H, N> {
      ```
      
      The previous algorithm relied on the existing block headers to prune
      forks later and to enable block header pruning we need to clear all
      obsolete forks right after the block finalization to not depend on the
      related block headers in the future.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
  2. May 13, 2024
    • Éloïs's avatar
      improve MockValidationDataInherentDataProvider to support async backing (#4442) · 594c3ed5
      Éloïs authored
      Support async backing in `--dev` mode
      
      This PR improve the relay mock `MockValidationDataInherentDataProvider`
      to mach expectations of async backing runtimes.
      
      * Add para_head in the mock relay proof
      * Add relay slot in the mock relay proof 
      
      fix https://github.com/paritytech/polkadot-sdk/issues/4437
    • Alin Dima's avatar
      prospective-parachains rework (#4035) · d36da12e
      Alin Dima authored
      
      Reworks prospective-parachains so that we allow a number of unconnected
      candidates (for which we don't know the parent candidate yet). Needed
      for elastic scaling:
      https://github.com/paritytech/polkadot-sdk/issues/3541. Without this,
      candidate B will not be validated and backed until candidate A (its
      parent) is validated and a backing statement reaches the validator.
      
      Due to the high complexity of the subsystem, I rewrote parts of it so
      that we don't concern ourselves with candidates which form cycles or
      which form parachain forks. We now have "Fragment chains" instead of
      "Fragment trees". This greatly simplifies some of the code and is a
      compromise we can make. We just need to make sure that cycle-producing
      parachains don't brick the relay chain and that fork-producing
      parachains can still make some progress (on one core at least). The only
      forks that are allowed are those on the relay chain, obviously.
      
      Unconnected candidates are kept in the `CandidateStorage` and whenever a
      new candidate is introduced, we try to repopulate the chain with as many
      candidates as we can.
      
      Also fixes https://github.com/paritytech/polkadot-sdk/issues/3219
      
      Guide changes will be done as part of:
      https://github.com/paritytech/polkadot-sdk/issues/3699
      
      TODOs:
      
      - [x] see if we can replace the `Cow` over the candidate commitments
      with an `Arc` over the entire `ProspectiveCandidate`. It's only being
      overwritten in unit tests. We can work around that.
      - [x] finish fragment_chain unit tests
      - [x] add more prospective-parachains subsystem tests
      - [x] test with zombienet what happens if a parachain is creating cycles
      (it should not brick the relay chain).
      - [x] test with zombienet a parachain that is creating forks. it should
      keep producing blocks from time to time (one bad collator should not DOS
      the parachain, even if throughput decreases)
      - [x] add some more logs and metrics
      - [x] add prdoc and remove the "silent" label
      
      ---------
      
      Signed-off-by: default avatarAndrei Sandu <andrei-mihail@parity.io>
      Co-authored-by: default avatarAndrei Sandu <andrei-mihail@parity.io>
    • Sebastian Kunert's avatar
      `CheckWeight` SE: Check for extrinsic length + proof size combined (#4326) · 6d3a6d85
      Sebastian Kunert authored
      Currently the `CheckWeight` `SignedExtension` was tracking the size of
      the proof and the extrinsic length separately. But in reality we need
      one more check that ensures we don't hit the PoV limit with both
      combined.
      
      The rest of the logic remains unchanged. One scenario where the changes
      make a difference is when we enter this branch:
      
      https://github.com/paritytech/polkadot-sdk/blob/f34d8e3c
      
      /substrate/frame/system/src/extensions/check_weight.rs#L185-L198
      
      This was previously allowing to some extrinsics that is exceeding the
      block limit but are withing the reserved area of `BlockWeights`. This
      will now be caught by the later check I introduced. I think the new
      behaviour makes sense, since the proof size dimension is designed for
      parachains and they don't want to go over the limit and get rejected.
      
      
      In the long run we should maybe get rid of `RuntimeBlockLength`
      alltogether, however that would require a deprecation process and can
      come at a later point.
      
      ---------
      
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>
    • Oliver Tale-Yazdi's avatar
      Rococo AH: undeploy trie migration (#4414) · 805d54dd
      Oliver Tale-Yazdi authored
      
      The state-trie migration is completed on Rococo Asset-Hub as
      double-checked
      [here](https://github.com/paritytech/polkadot-sdk/issues/4174#issuecomment-2097895275).
      Undeploying now.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  3. May 12, 2024
  4. May 10, 2024
  5. May 09, 2024
    • Niklas Adolfsson's avatar
      rpc: add option to `whitelist ips` in rate limiting (#3701) · d37719da
      Niklas Adolfsson authored
      This PR adds two new CLI options to disable rate limiting for certain ip
      addresses and whether to trust "proxy header".
      After going back in forth I decided to use ip addr instead host because
      we don't want rely on the host header which can be spoofed but another
      solution is to resolve the ip addr from the socket to host name.
      
      Example:
      
      ```bash
      $ polkadot --rpc-rate-limit 10 --rpc-rate-limit-whitelisted-ips 127.0.0.1/8 --rpc-rate-limit-trust-proxy-headers
      ```
      
      The ip addr is read from the HTTP proxy headers `Forwarded`,
      `X-Forwarded-For` `X-Real-IP` if `--rpc-rate-limit-trust-proxy-headers`
      is enabled if that is not enabled or the headers are not found then the
      ip address is read from the socket.
      
      //cc @BulatSaif can you test this and give some feedback on it?
  6. May 08, 2024
    • gupnik's avatar
    • Dino Pačandi's avatar
      [pallet-balances] `burn_allow_death` extrinsic (#3964) · c3e57c1b
      Dino Pačandi authored
      
      Adds an additional extrinsic call to the `pallet-balances` to _burn_
      tokens.
      Depending on the `keep_alive` flag, the call might or might not reap the
      account.
      
      Required modification of the _fungible's_ `Mutate` trait, `burn_from`
      function to allow the `Preservation` argument.
      
      **TODO**
      - [x] run benchmarks & update weights
      - [x] make sure prdoc is required & properly formatted
      
      Related issue: https://github.com/paritytech/polkadot-sdk/issues/3943
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: command-bot <>
    • Francisco Aguirre's avatar
      XcmDryRunApi - Dry-running extrinsics to get their XCM effects (#3872) · 7213e363
      Francisco Aguirre authored
      
      # Context
      
      Estimating fees for XCM execution and sending has been an area with bad
      UX.
      The addition of the
      [XcmPaymentApi](https://github.com/paritytech/polkadot-sdk/pull/3607)
      exposed the necessary components to be able to estimate XCM fees
      correctly, however, that was not the full story.
      The `XcmPaymentApi` works for estimating fees only if you know the
      specific XCM you want to execute or send.
      This is necessary but most UIs want to estimate the fees for extrinsics,
      they don't necessarily know the XCM program that's executed by them.
      
      # Main addition
      
      A new runtime API is introduced, the `XcmDryRunApi`, that given an
      extrinsic, or an XCM program, returns its effects:
      - Execution result
      - Local XCM (in the case of an extrinsic)
      - Forwarded XCMs
      - List of events
      
      This API can be used on its own for dry-running purposes, for
      double-checking or testing, but it mainly shines when used in
      conjunction with the `XcmPaymentApi`.
      UIs can use these two APIs to estimate transfers.
      
      # How it works
      
      New tests are added to exemplify how to incorporate both APIs.
      There's a mock test just to make sure everything works under
      `xcm-fee-payment-runtime-api`.
      There's a real-world test using Westend and AssetHubWestend under
      `cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/xcm_fee_estimation.rs`.
      Added both a test for a simple teleport between chains and a reserve
      transfer asset between two parachains going through a reserve.
      
      The steps to follow:
      - Use `XcmDryRunApi::dry_run_extrinsic` to get local XCM program and
      forwarded messages
      - For each forwarded message
      - Use `XcmPaymentApi::query_delivery_fee` LOCALLY to get the delivery
      fees
      - Use `XcmPaymentApi::query_xcm_weight` ON THE DESTINATION to get the
      remote execution weight
      - (optional) Use `XcmPaymentApi::query_acceptable_payment_assets` ON THE
      DESTINATION to know on which assets the execution fees can be paid
      - Use `XcmPaymentApi::query_weight_to_asset_fee` ON THE DESTINATION to
      convert weight to the actual remote execution fees
      - Use `XcmDryRunApi::dry_run_xcm` ON THE DESTINATION to know if a new
      message will be forwarded, if so, continue
      
      # Dear reviewer
      
      The changes in this PR are grouped as follows, and in order of
      importance:
      - Addition of new runtime API
      - Definition, mock and simple tests:
      polkadot/xcm/xcm-fee-payment-runtime-api/*
      - Implemented on Westend, Asset Hub Westend and Penpal, will implement
      on every runtime in a following PR
      - Addition of a new config item to the XCM executor for recording xcms
      about to be executed
        - Definition: polkadot/xcm/xcm-executor/*
        - Implementation: polkadot/xcm/pallet-xcm/*
      - had to update all runtime xcm_config.rs files with `type XcmRecorder =
      XcmPallet;`
      - Addition of a new trait for inspecting the messages in queues
        - Definition: polkadot/xcm/xcm-builder/src/routing.rs
        - Implemented it on all routers:
          - ChildParachainRouter: polkadot/runtime/common/src/xcm_sender.rs
      - ParentAsUmp: cumulus/primitives/utility/src/lib.rs (piggybacked on
      implementation in cumulus/pallets/parachain-system/src/lib.rs)
          - XcmpQueue: cumulus/pallets/xcmp-queue/src/lib.rs
          - Bridge: bridges/modules/xcm-bridge-hub-router/src/lib.rs
      - More complicated and useful tests:
      -
      cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/xcm_fee_estimation.rs
      
      ## Next steps
      
      With this PR, Westend, AssetHubWestend, Rococo and AssetHubRococo have
      the new API.
      UIs can test on these runtimes to create better experiences around
      cross-chain operations.
      
      Next:
      - Add XcmDryRunApi to all system parachains
      - Integrate xcm fee estimation in all emulated tests
      - Get this on the fellowship runtimes
      
      ---------
      
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>
  7. May 07, 2024
    • Tsvetomir Dimitrov's avatar
      Update prdoc for 2226 (#4401) · b6dcd1b6
      Tsvetomir Dimitrov authored
      
      Mention that offenders are no longer chilled and suggest node operators
      and nominators to monitor their nodes/nominees closely.
      
      ---------
      
      Co-authored-by: default avatarMaciej <maciej.zyszkiewicz@parity.io>
    • Dónal Murray's avatar
      Add Kusama People Chain genesis chainspec (#4394) · 930b0462
      Dónal Murray authored
      Generated with the script from
      https://github.com/paritytech/polkadot-sdk/pull/2931
      
      Edit: previously linked to a very similar PR
    • Branislav Kontur's avatar
      Add support for versioned notification for HRMP pallet (#4281) · b709dccd
      Branislav Kontur authored
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/4003 (please
      see for the problem description)
      
      ## TODO
      - [x] add more tests covering `WrapVersion` corner cases (e.g. para has
      lower version, ...)
      - [x] regenerate benchmarks `runtime_parachains::hrmp` (fix for Rococo
      is here: https://github.com/paritytech/polkadot-sdk/pull/4332)
      
      ## Questions / possible improvements
      - [ ] A `WrapVersion` implementation for `pallet_xcm` initiates version
      discovery with
      [note_unknown_version](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/pallet-xcm/src/lib.rs#L2527C5-L2527C25),
      there is possibility to avoid this overhead in this HRMP case to create
      new `WrapVersion` adapter for `pallet_xcm` which would not use
      `note_unknown_version`. Is it worth to do it or not?
      - [ ] There's a possibility to decouple XCM functionality from the HRMP
      pallet, allowing any relay chain to generate its own notifications. This
      approach wouldn't restrict notifications solely to the XCM. However,
      it's uncertain whether it's worthwhile or desirable to do so? It means
      making HRMP pallet more generic. E.g. hiding HRMP notifications behind
      some trait:
      	```
      	trait HrmpNotifications {
      
      		fn on_channel_open_request(
      			sender: ParaId,
      			proposed_max_capacity: u32,
      			proposed_max_message_size: u32) -> primitives::DownwardMessage;
      
      fn on_channel_accepted(recipient: ParaId) ->
      primitives::DownwardMessage;
      
      fn on_channel_closing(initiator: ParaId, sender: ParaId, recipient:
      ParaId) -> primitives::DownwardMessage;
      	}
      	```
      and then we could have whatever adapter, `impl HrmpNotifications for
      VersionedXcmHrmpNotifications {...}`,
      	```
      	impl parachains_hrmp::Config for Runtime {
      	..
      		type HrmpNotifications = VersionedXcmHrmpNotifications;
      	..
      	}
      	```
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
  8. May 06, 2024
  9. May 03, 2024
    • Lulu's avatar
      Add validate field to prdoc (#4368) · f45847b8
      Lulu authored
    • cheme's avatar
    • Kris Bitney's avatar
      Fix: dust unbonded for zero existential deposit (#4364) · 51986233
      Kris Bitney authored
      When a staker unbonds and withdraws, it is possible that their stash
      will contain less currency than the existential deposit. If that
      happens, their stash is reaped. But if the existential deposit is zero,
      the reap is not triggered. This PR adjusts `pallet_staking` to reap a
      stash in the special case that the stash value is zero and the
      existential deposit is zero.
      
      This change is important for blockchains built on substrate that require
      an existential deposit of zero, becuase it conserves valued storage
      space.
      
      There are two places in which ledgers are checked to determine if their
      value is less than the existential deposit and they should be reaped: in
      the methods `do_withdraw_unbonded` and `reap_stash`. When the check is
      made, the condition `ledger_total == 0` is also checked. If
      `ledger_total` is zero, then it must be below any existential deposit
      greater than zero and equal to an existential deposit of 0.
      
      I added a new test for each method to confirm the change behaves as
      expected.
      
      Closes https://github.com/paritytech/polkadot-sdk/issues/4340
      
      ---------
      
      Co-authored-by: command-bot <>
  10. May 02, 2024
  11. May 01, 2024
    • Maciej's avatar
      Statement Distribution Per Peer Rate Limit (#3444) · 6d392c7e
      Maciej authored
      - [x] Drop requests from a PeerID that is already being served by us.
      - [x] Don't sent requests to a PeerID if we already are requesting
      something from them at that moment (prioritise other requests or wait).
      - [x] Tests
      - [ ] ~~Add a small rep update for unsolicited requests (same peer
      request)~~ not included in original PR due to potential issues with
      nodes slowly updating
      - [x] Add a metric to track the amount of dropped requests due to peer
      rate limiting
      - [x] Add a metric to track how many time a node reaches the max
      parallel requests limit in v2+
      
      Helps with but does not close yet:
      https://github.com/paritytech-secops/srlabs_findings/issues/303
  12. Apr 30, 2024
  13. Apr 29, 2024
    • Shawn Tabrizi's avatar
      Refactor XCM Simulator Example (#4220) · 4875ea11
      Shawn Tabrizi authored
      
      This PR does a "developer experience" refactor of the XCM Simulator
      Example.
      
      I was looking for existing code / documentation where developers could
      better learn about working with and configuring XCM.
      
      The XCM Simulator was a natural starting point due to the fact that it
      can emulate end to end XCM scenarios, without needing to spawn multiple
      real chains.
      
      However, the XCM Simulator Example was just 3 giant files with a ton of
      configurations, runtime, pallets, and tests mashed together.
      
      This PR breaks down the XCM Simulator Example in a way that I believe is
      more approachable by a new developer who is looking to navigate the
      various components of the end to end example, and modify it themselves.
      
      The basic structure is:
      
      - xcm simulator example
          - lib (tries to only use the xcm simulator macros)
          - tests
          - relay-chain
              - mod (basic runtime that developers should be familiar with)
              - xcm-config
                  - mod (contains the `XcmConfig` type
                  - various files for each custom configuration  
          - parachain
              - mock_msg_queue (custom pallet for simulator example)
              - mod (basic runtime that developers should be familiar with)
              - xcm-config
                  - mod (contains the `XcmConfig` type
                  - various files for each custom configuration
      
      I would like to add more documentation to this too, but I think this is
      a first step to be accepted which will affect how documentation is added
      to the example
      
      ---------
      
      Co-authored-by: default avatarFrancisco Aguirre <franciscoaguirreperez@gmail.com>
      Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
    • Ankan's avatar
      [Staking] Not allow reap stash for virtual stakers (#4311) · 0031d49d
      Ankan authored
      Related to https://github.com/paritytech/polkadot-sdk/pull/3905.
      
      Since virtual stakers does not have a real balance, they should not be
      allowed to be reaped.
      
      The proper reaping for agents slashed will be done in a separate PR.
  14. Apr 28, 2024
    • Ankan's avatar
      [Staking] Runtime api if era rewards are pending to be claimed (#4301) · 73b9a839
      Ankan authored
      closes https://github.com/paritytech/polkadot-sdk/issues/426.
      related to https://github.com/paritytech/polkadot-sdk/pull/1189.
      
      Would help offchain programs to query if there are unclaimed pages of
      rewards for a given era.
      
      The logic could look like below
      
      ```js
      // loop as long as all era pages are claimed.
      while (api.call.stakingApi.pendingRewards(era, validator_stash)) {
        api.tx.staking.payout_stakers(validator_stash, era)
      }
      ```
  15. Apr 26, 2024
    • Ron's avatar
      Snowbridge: deposit extra fee to beneficiary on Asset Hub (#4175) · d893cde2
      Ron authored
      
      Just the upper-stream for
      https://github.com/Snowfork/polkadot-sdk/pull/137 and more context
      there.
      
      ---------
      
      Co-authored-by: default avatarClara van Staden <claravanstaden64@gmail.com>
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>
    • Tsvetomir Dimitrov's avatar
      Implementation of the new validator disabling strategy (#2226) · 988e30f1
      Tsvetomir Dimitrov authored
      Closes https://github.com/paritytech/polkadot-sdk/issues/1966,
      https://github.com/paritytech/polkadot-sdk/issues/1963 and
      https://github.com/paritytech/polkadot-sdk/issues/1962.
      
      Disabling strategy specification
      [here](https://github.com/paritytech/polkadot-sdk/pull/2955). (Updated
      13/02/2024)
      
      Implements:
      * validator disabling for a whole era instead of just a session
      * no more than 1/3 of the validators in the active set are disabled
      Removes:
      * `DisableStrategy` enum - now each validator committing an offence is
      disabled.
      * New era is not forced if too many validators are disabled.
      
      Before this PR not all offenders were disabled. A decision was made
      based on [`enum
      DisableStrategy`](https://github.com/paritytech/polkadot-sdk/blob/bbb66316/substrate/primitives/staking/src/offence.rs#L54).
      Some offenders were disabled for a whole era, some just for a session,
      some were not disabled at all.
      
      This PR changes the disabling behaviour. Now a validator committing an
      offense is disabled immediately till the end of the current era.
      
      Some implementation notes:
      * `OffendingValidators` in pallet session keeps all offenders (this is
      not changed). However its type is changed from `Vec<(u32, bool)>` to
      `Vec<u32>`. The reason is simple - each offender is getting disabled so
      the bool doesn't make sense anymore.
      * When a validator is disabled it is first added to
      `OffendingValidators` and then to `DisabledValidators`. This is done in
      [`add_offending_validator`](https://github.com/paritytech/polkadot-sdk/blob/bbb66316/substrate/frame/staking/src/slashing.rs#L325)
      from staking pallet.
      * In
      [`rotate_session`](https://github.com/paritytech/polkadot-sdk/blob/bdbe9829/substrate/frame/session/src/lib.rs#L623)
      the `end_session` also calls
      [`end_era`](https://github.com/paritytech/polkadot-sdk/blob/bbb66316/substrate/frame/staking/src/pallet/impls.rs#L490)
      when an era ends. In this case `OffendingValidators` are cleared
      **(1)**.
      * Then in
      [`rotate_session`](https://github.com/paritytech/polkadot-sdk/blob/bdbe9829/substrate/frame/session/src/lib.rs#L623)
      `DisabledValidators` are cleared **(2)**
      * And finally (still in `rotate_session`) a call to
      [`start_session`](https://github.com/paritytech/polkadot-sdk/blob/bbb66316
      
      /substrate/frame/staking/src/pallet/impls.rs#L430)
      repopulates the disabled validators **(3)**.
      * The reason for this complication is that session pallet knows nothing
      abut eras. To overcome this on each new session the disabled list is
      repopulated (points 2 and 3). Staking pallet knows when a new era starts
      so with point 1 it ensures that the offenders list is cleared.
      
      ---------
      
      Co-authored-by: default avatarordian <noreply@reusable.software>
      Co-authored-by: default avatarordian <write@reusable.software>
      Co-authored-by: default avatarMaciej <maciej.zyszkiewicz@parity.io>
      Co-authored-by: default avatarGonçalo Pestana <g6pestana@gmail.com>
      Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarAnkan <10196091+Ank4n@users.noreply.github.com>
    • Oliver Tale-Yazdi's avatar
      [balances] Safeguard against consumer ref underflow (#3865) · e8f7c81d
      Oliver Tale-Yazdi authored
      
      There are some accounts that do not have a consumer ref while having a
      reserve.
      This adds a fail-safe mechanism to trigger in the case that
      `does_consume` is true, but the assumption of `consumer>0` is not.
      
      This should prevent those accounts from loosing balance and the TI from
      getting messed up even more, but is not an "ideal" fix. TBH an ideal fix
      is not possible, since on-chain data is in an invalid state.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  16. Apr 25, 2024
    • s0me0ne-unkn0wn's avatar
      Do not re-prepare PVFs if not needed (#4211) · c26cf3f6
      s0me0ne-unkn0wn authored
      Currently, PVFs are re-prepared if any execution environment parameter
      changes. As we've recently seen on Kusama and Polkadot, that may lead to
      a severe finality lag because every validator has to re-prepare every
      PVF. That cannot be avoided altogether; however, we could cease
      re-preparing PVFs when a change in the execution environment can't lead
      to a change in the artifact itself. For example, it's clear that
      changing the execution timeout cannot affect the artifact.
      
      In this PR, I'm introducing a separate hash for the subset of execution
      environment parameters that changes only if a preparation-related
      parameter changes. It introduces some minor code duplication, but
      without that, the scope of changes would be much bigger.
      
      TODO:
      - [x] Add a test to ensure the artifact is not re-prepared if
      non-preparation-related parameter is changed
      - [x] Add a test to ensure the artifact is re-prepared if a
      preparation-related parameter is changed
      - [x] Add comments, warnings, and, possibly, a test to ensure a new
      parameter ever added to the executor environment parameters will be
      evaluated by the author of changes with respect to its artifact
      preparation impact and added to the new hash preimage if needed.
      
      Closes #4132
    • Oliver Tale-Yazdi's avatar
      [XCM] Treat recursion limit error as transient in the MQ (#4202) · 07704178
      Oliver Tale-Yazdi authored
      
      Changes:
      - Add new error variant `ProcessMessageError::StackLimitReached` and
      treat XCM error `ExceedsStackLimit` as such.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: default avatarBranislav Kontur <bkontur@gmail.com>
    • PG Herveou's avatar
      Contracts: Stabilize XCM host fns (#4213) · b801d001
      PG Herveou authored
      See 
      https://github.com/paritytech/ink/pull/1912
      https://github.com/paritytech/ink-docs/pull/338
    • Svyatoslav Nikolsky's avatar
      Bridge: added free headers submission support to the substrate-relay (#4157) · 7e68b2b8
      Svyatoslav Nikolsky authored
      
      Original PR:
      https://github.com/paritytech/parity-bridges-common/pull/2884. Since
      chain-specific code lives in the `parity-bridges-common` repo, some
      parts of original PR will require another PR
      
      ---------
      
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>