Skip to content
Snippets Groups Projects
  1. Feb 07, 2025
    • Przemek Rzad's avatar
      Ensure license headers match the Cargo manifest licenses (#5776) · 3726493d
      Przemek Rzad authored
      
      - Closes https://github.com/paritytech/license-scanner/issues/44
      - Silent because only comments are changed in the crates.
      
      ## What's inside
      
      First, we change the file traversal mechanism from shell globbing to
      walking through files which happens inside the `license-scanner` - so it
      has knowledge about directory structure and can correlate files with
      corresponding Cargo manifest.
      
      Next, added `MIT-0` and `Unlicense` to the allowed list of licenses.
      `Unlicense` appears only once across {Substrate,Cumulus,Polkadot} - in
      `penpal-runtime`.
      
      Finally, updated headers in files that do not match the corresponding
      manifest license.
      
      ---------
      
      Co-authored-by: Yuri Volkov's avatarcornholio <0@mcornholio.ru>
      3726493d
    • dharjeezy's avatar
      Update Pallet Referenda to support Block Number Provider (#6338) · f08bf1a1
      dharjeezy authored
      
      This PR introduces BlockNumberProvider config for the referenda pallet.
      closes part of https://github.com/paritytech/polkadot-sdk/issues/6297
      
      Polkadot address: 12GyGD3QhT4i2JJpNzvMf96sxxBLWymz4RdGCxRH5Rj5agKW
      
      ---------
      
      Co-authored-by: default avatarmuharem <ismailov.m.h@gmail.com>
      f08bf1a1
  2. Feb 06, 2025
    • PG Herveou's avatar
      [pallet-revive] tx fee fixes (#7463) · 917052e5
      PG Herveou authored
      
      Apply some fixes to properly estimate ethereum tx fees:
      
      - Set the `extension_weight` on the dispatch_info to properly calculate
      the fee with pallet_transaction_payment
      - Expose the gas_price through Runtime API, just in case we decide to
      tweak the value in future updates, it should be read from the chain
      rather than be a shared constant exposed by the crate
      - add a `evm_gas_to_fee` utility function to properly convert gas to
      substrate fee
      - Fix some minor gas encoding for edge cases
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      917052e5
  3. Feb 05, 2025
  4. Feb 04, 2025
    • Alexander Theißen's avatar
      revive: Include immutable storage deposit into the contracts `storage_base_deposit` (#7230) · 4c28354b
      Alexander Theißen authored
      
      This PR is centered around a main fix regarding the base deposit and a
      bunch of drive by or related fixtures that make sense to resolve in one
      go. It could be broken down more but I am constantly rebasing this PR
      and would appreciate getting those fixes in as-one.
      
      **This adds a multi block migration to Westend AssetHub that wipes the
      pallet state clean. This is necessary because of the changes to the
      `ContractInfo` storage item. It will not delete the child storage
      though. This will leave a tiny bit of garbage behind but won't cause any
      problems. They will just be orphaned.**
      
      ## Record the deposit for immutable data into the `storage_base_deposit`
      
      The `storage_base_deposit` are all the deposit a contract has to pay for
      existing. It included the deposit for its own metadata and a deposit
      proportional (< 1.0x) to the size of its code. However, the immutable
      code size was not recorded there. This would lead to the situation where
      on terminate this portion wouldn't be refunded staying locked into the
      contract. It would also make the calculation of the deposit changes on
      `set_code_hash` more complicated when it updates the immutable data (to
      be done in #6985). Reason is because it didn't know how much was payed
      before since the storage prices could have changed in the mean time.
      
      In order for this solution to work I needed to delay the deposit
      calculation for a new contract for after the contract is done executing
      is constructor as only then we know the immutable data size. Before, we
      just charged this eagerly in `charge_instantiate` before we execute the
      constructor. Now, we merely send the ED as free balance before the
      constructor in order to create the account. After the constructor is
      done we calculate the contract base deposit and charge it. This will
      make `set_code_hash` much easier to implement.
      
      As a side effect it is now legal to call `set_immutable_data` multiple
      times per constructor (even though I see no reason to do so). It simply
      overrides the immutable data with the new value. The deposit accounting
      will be done after the constructor returns (as mentioned above) instead
      of when setting the immutable data.
      
      ## Don't pre-charge for reading immutable data
      
      I noticed that we were pre-charging weight for the max allowable
      immutable data when reading those values and then refunding after read.
      This is not necessary as we know its length without reading the storage
      as we store it out of band in contract metadata. This makes reading it
      free. Less pre-charging less problems.
      
      ## Remove delegate locking
      
      Fixes #7092
      
      This is also in the spirit of making #6985 easier to implement. The
      locking complicates `set_code_hash` as we might need to block settings
      the code hash when locks exist. Check #7092 for further rationale.
      
      ## Enforce "no terminate in constructor" eagerly
      
      We used to enforce this rule after the contract execution returned. Now
      we error out early in the host call. This makes it easier to be sure to
      argue that a contract info still exists (wasn't terminated) when a
      constructor successfully returns. All around this his just much simpler
      than dealing this check.
      
      ## Moved refcount functions to `CodeInfo`
      
      They never really made sense to exist on `Stack`. But now with the
      locking gone this makes even less sense. The refcount is stored inside
      `CodeInfo` to lets just move them there.
      
      ## Set `CodeHashLockupDepositPercent` for test runtime
      
      The test runtime was setting `CodeHashLockupDepositPercent` to zero.
      This was trivializing many code paths and excluded them from testing. I
      set it to `30%` which is our default value and fixed up all the tests
      that broke. This should give us confidence that the lockup doeposit
      collections properly works.
      
      ## Reworked the `MockExecutable` to have both a `deploy` and a `call`
      entry point
      
      This type used for testing could only have either entry points but not
      both. In order to fix the `immutable_data_set_overrides` I needed to a
      new function `add_both` to `MockExecutable` that allows to have both
      entry points. Make sure to make use of it in the future :)
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarPG Herveou <pgherveou@gmail.com>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      4c28354b
  5. Jan 29, 2025
  6. Jan 27, 2025
    • Ron's avatar
      xcm: fix for DenyThenTry Barrier (#7169) · b30aa319
      Ron authored
      
      Resolves (partially):
      https://github.com/paritytech/polkadot-sdk/issues/7148 (see _Problem 1 -
      `ShouldExecute` tuple implementation and `Deny` filter tuple_)
      
      This PR changes the behavior of `DenyThenTry` from the pattern
      `DenyIfAllMatch` to `DenyIfAnyMatch` for the tuple.
      
      I would expect the latter is the right behavior so make the fix in
      place, but we can also add a dedicated Impl with the legacy one
      untouched.
      
      ## TODO
      - [x] add unit-test for `DenyReserveTransferToRelayChain`
      - [x] add test and investigate/check `DenyThenTry` as discussed
      [here](https://github.com/paritytech/polkadot-sdk/pull/6838#discussion_r1914553990)
      and update documentation if needed
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <bkontur@gmail.com>
      Co-authored-by: default avatarFrancisco Aguirre <franciscoaguirreperez@gmail.com>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarClara van Staden <claravanstaden64@gmail.com>
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>
      b30aa319
  7. Jan 26, 2025
  8. Jan 24, 2025
  9. Jan 23, 2025
    • Branislav Kontur's avatar
      Bridges small nits/improvements (#7307) · 085da479
      Branislav Kontur authored
      This PR contains small fixes identified during work on the larger PR:
      https://github.com/paritytech/polkadot-sdk/issues/6906.
      
      ---------
      
      Co-authored-by: command-bot <>
      085da479
    • runcomet's avatar
      Balances: Configurable Number of Genesis Accounts with Specified Balances for Benchmarking (#6267) · 04847d51
      runcomet authored
      
      # Derived Dev Accounts
      
      Resolves https://github.com/paritytech/polkadot-sdk/issues/6040
      
      ## Description
      This update introduces support for creating an arbitrary number of
      developer accounts at the genesis block based on a specified derivation
      path. This functionality is gated by the runtime-benchmarks feature,
      ensuring it is only enabled during benchmarking scenarios.
      
      ### Key Features
      - Arbitrary Dev Accounts at Genesis: Developers can now specify any
      number of accounts to be generated at genesis using a hard derivation
      path.
      
      - Default Derivation Path: If no derivation path is provided (i.e., when
      `Option<dev_accounts: (..., None)>` is set to `Some` at genesis), the
      system will default to the path `//Sender//{}`.
      
      - No Impact on Total Token Issuance: Developer accounts are excluded
      from the total issuance of the token supply at genesis, ensuring they do
      not affect the overall balance or token distribution.
      
      polkadot address: 14SRqZTC1d8rfxL8W1tBTnfUBPU23ACFVPzp61FyGf4ftUFg
      
      ---------
      
      Co-authored-by: default avatarSebastian Kunert <skunert49@gmail.com>
      04847d51
    • PG Herveou's avatar
      [pallet-revive] fee estimation fixes (#7281) · 5772b9db
      PG Herveou authored
      - Fix the EVM fee cost estimation.
      The estimation shown in EVM wallet was using Native instead of EVM
      decimals
      - Remove the precise code length estimation in dry run call.
      Over-estimating is fine, since extra gas is refunded anyway.
      - Ensure that the estimated fee calculated from gas_price x gas use the
      encoded weight & deposit limit instead of the exact one calculated by
      the dry-run. Else we can end up with a fee that is lower than the actual
      fee paid by the user
      
      ---------
      
      Co-authored-by: command-bot <>
      5772b9db
  10. Jan 20, 2025
  11. Jan 17, 2025
  12. Jan 16, 2025
    • Liam Aharon's avatar
      Implement `pallet-asset-rewards` (#3926) · be2404cc
      Liam Aharon authored
      
      Closes #3149 
      
      ## Description
      
      This PR introduces `pallet-asset-rewards`, which allows accounts to be
      rewarded for freezing `fungible` tokens. The motivation for creating
      this pallet is to allow incentivising LPs.
      
      See the pallet docs for more info about the pallet.
      
      ## Runtime changes
      
      The pallet has been added to
      - `asset-hub-rococo`
      - `asset-hub-westend`
      
      The `NativeAndAssets` `fungibles` Union did not contain `PoolAssets`, so
      it has been renamed `NativeAndNonPoolAssets`
      
      A new `fungibles` Union `NativeAndAllAssets` was created to encompass
      all assets and the native token.
      
      ## TODO
      - [x] Emulation tests
      - [x] Fill in Freeze logic (blocked
      https://github.com/paritytech/polkadot-sdk/issues/3342) and re-run
      benchmarks
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: default avatarmuharem <ismailov.m.h@gmail.com>
      Co-authored-by: default avatarGuillaume Thiolliere <gui.thiolliere@gmail.com>
      be2404cc
  13. Jan 15, 2025
  14. Jan 14, 2025
    • Sebastian Kunert's avatar
      Parachains: Use relay chain slot for velocity measurement (#6825) · d5539aa6
      Sebastian Kunert authored
      
      closes #3967 
      
      ## Changes
      We now use relay chain slots to measure velocity on chain. Previously we
      were storing the current parachain slot. Then in `on_state_proof` of the
      `ConsensusHook` we were checking how many blocks were athored in the
      current parachain slot. This works well when the parachain slot time and
      relay chain slot time is the same. With elastic scaling, we can have
      parachain slot times lower than that of the relay chain. In these cases
      we want to measure velocity in relation to the relay chain. This PR
      adjusts that.
      
      
      ##  Migration
      This PR includes a migration. Storage item `SlotInfo` of pallet
      `aura-ext` is renamed to `RelaySlotInfo` to better reflect its new
      content. A migration has been added that just kills the old storage
      item. `RelaySlotInfo` will be `None` initially but its value will be
      adjusted after one new relay chain slot arrives.
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarBastian Köcher <git@kchr...>
      d5539aa6
  15. Jan 13, 2025
    • PG Herveou's avatar
      [pallet-revive] Update gas encoding (#6689) · ba572ae8
      PG Herveou authored
      
      Update the current approach to attach the `ref_time`, `pov` and
      `deposit` parameters to an Ethereum transaction.
      Previously we will pass these 3 parameters along with the signed
      payload, and check that the fees resulting from `gas x gas_price` match
      the actual fees paid by the user for the extrinsic.
      
      This approach unfortunately can be attacked. A malicious actor could
      force such a transaction to fail by injecting low values for some of
      these extra parameters as they are not part of the signed payload.
      
      The new approach encodes these 3 extra parameters in the lower digits of
      the transaction gas, approximating the the log2 of the actual values to
      encode each components on 2 digits
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
      Co-authored-by: command-bot <>
      ba572ae8
  16. Jan 10, 2025
  17. Jan 06, 2025
  18. Jan 05, 2025
    • thiolliere's avatar
      Implement cumulus StorageWeightReclaim as wrapping transaction extension +... · 63c73bf6
      thiolliere authored
      Implement cumulus StorageWeightReclaim as wrapping transaction extension + frame system ReclaimWeight (#6140)
      
      (rebasing of https://github.com/paritytech/polkadot-sdk/pull/5234)
      
      ## Issues:
      
      * Transaction extensions have weights and refund weight. So the
      reclaiming of unused weight must happen last in the transaction
      extension pipeline. Currently it is inside `CheckWeight`.
      * cumulus storage weight reclaim transaction extension misses the proof
      size of logic happening prior to itself.
      
      ## Done:
      
      * a new storage `ExtrinsicWeightReclaimed` in frame-system. Any logic
      which attempts to do some reclaim must use this storage to avoid double
      reclaim.
      * a new function `reclaim_weight` in frame-system pallet: info and post
      info in arguments, read the already reclaimed weight, calculate the new
      unused weight from info and post info. do the more accurate reclaim if
      higher.
      * `CheckWeight` is unchanged and still reclaim the weight in post
      dispatch
      * `ReclaimWeight` is a new transaction extension in frame system. For
      s...
      63c73bf6
  19. Jan 03, 2025
  20. Dec 21, 2024
    • Dónal Murray's avatar
      [pallet-broker] add extrinsic to reserve a system core without having to wait... · f9cdf41a
      Dónal Murray authored
      [pallet-broker] add extrinsic to reserve a system core without having to wait two sale boundaries (#4273)
      
      When calling the reserve extrinsic after sales have started, the
      assignment will be reserved, but two sale period boundaries must pass
      before the core is actually assigned.
      
      Since this can take between 28 and 56 days on production networks, a new
      extrinsic is introduced to shorten the timeline.
      
      This essentially performs three actions:
      1. Reserve it (applies after two sale boundaries)
      2. Add it to the Workplan for the next sale period
      3. Add it to the Workplan for the rest of the current sale period from
      the next timeslice to be commmitted.
      
      The caller must ensure that a core is first added, with most relay chain
      implementations having a delay of two session boundaries until it comes
      into effect.
      
      Alternatively the extrinsic can be called on a core whose workload can
      be clobbered from now until the reservation kicks in (the sale period
      after the next). Any workplan entries for that core at other timeslices
      should be first removed by the caller.
      
      ---------
      
      Co-authored-by: command-bot <>
      f9cdf41a
  21. Dec 20, 2024
    • Xavier Lau's avatar
      Reorder dependencies' keys (#6967) · a843d15e
      Xavier Lau authored
      
      It doesn't make sense to only reorder the features array.
      
      For example:
      
      This makes it hard for me to compare the dependencies and features,
      especially some crates have a really really long dependencies list.
      ```toml​
      [dependencies]
      c = "*"
      a = "*"
      b = "*"
      
      [features]
      std = [
        "a",
        "b",
        "c",
      ]
      ```
      
      This makes my life easier.
      ```toml​
      [dependencies]
      a = "*"
      b = "*"
      c = "*"
      
      [features]
      std = [
        "a",
        "b",
        "c",
      ]
      ```
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: command-bot <>
      a843d15e
  22. Dec 19, 2024
  23. Dec 18, 2024
  24. Dec 12, 2024
  25. Dec 11, 2024
    • Francisco Aguirre's avatar
      Add aliasers to westend chains (#6814) · 48c6574b
      Francisco Aguirre authored
      
      `InitiateTransfer`, the new instruction introduced in XCMv5, allows
      preserving the origin after a cross-chain transfer via the usage of the
      `AliasOrigin` instruction. The receiving chain needs to be configured to
      allow such this instruction to have its intended effect and not just
      throw an error.
      
      In this PR, I add the alias rules specified in the [RFC for origin
      preservation](https://github.com/polkadot-fellows/RFCs/blob/main/text/0122-alias-origin-on-asset-transfers.md)
      to westend chains so we can test these scenarios in the testnet.
      
      The new scenarios include:
      - Sending a cross-chain transfer from one system chain to another and
      doing a Transact on the same message (1 hop)
      - Sending a reserve asset transfer from one chain to another going
      through asset hub and doing Transact on the same message (2 hops)
      
      The updated chains are:
      - Relay: added `AliasChildLocation`
      - Collectives: added `AliasChildLocation` and
      `AliasOriginRootUsingFilter<AssetHubLocation, Everything>`
      - People: added `AliasChildLocation` and
      `AliasOriginRootUsingFilter<AssetHubLocation, Everything>`
      - Coretime: added `AliasChildLocation` and
      `AliasOriginRootUsingFilter<AssetHubLocation, Everything>`
      
      AssetHub already has `AliasChildLocation` and doesn't need the other
      config item.
      BridgeHub is not intended to be used by end users so I didn't add any
      config item.
      Only added `AliasChildOrigin` to the relay since we intend for it to be
      used less.
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
      Co-authored-by: command-bot <>
      48c6574b
  26. Dec 10, 2024
    • Joseph Zhao's avatar
      Remove AccountKeyring everywhere (#5899) · 311ea438
      Joseph Zhao authored
      
      Close: #5858
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      311ea438
    • Branislav Kontur's avatar
      Bridges - revert-back congestion mechanism (#6781) · 8f4b99cf
      Branislav Kontur authored
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/5551
      
      ## Description
      
      With [permissionless lanes
      PR#4949](https://github.com/paritytech/polkadot-sdk/pull/4949), the
      congestion mechanism based on sending
      `Transact(report_bridge_status(is_congested))` from
      `pallet-xcm-bridge-hub` to `pallet-xcm-bridge-hub-router` was replaced
      with a congestion mechanism that relied on monitoring XCMP queues.
      However, this approach could cause issues, such as suspending the entire
      XCMP queue instead of isolating the affected bridge. This PR reverts
      back to using `report_bridge_status` as before.
      
      ## TODO
      - [x] benchmarks
      - [x] prdoc
      
      ## Follow-up
      
      https://github.com/paritytech/polkadot-sdk/pull/6231
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>
      8f4b99cf
  27. Dec 08, 2024
  28. Dec 05, 2024
    • Francisco Aguirre's avatar
      Added fallback_max_weight to Transact for sending messages to V4 chains (#6643) · f31c70aa
      Francisco Aguirre authored
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/6585
      
      Removing the `require_weight_at_most` parameter in V5 Transact had only
      one problem. Converting a message from V5 to V4 to send to chains that
      didn't upgrade yet. The conversion would not know what weight to give to
      the Transact, since V4 and below require it.
      
      To fix this, I added back the weight in the form of an `Option<Weight>`
      called `fallback_max_weight`. This can be set to `None` if you don't
      intend to deal with a chain that hasn't upgraded yet. If you set it to
      `Some(_)`, the behaviour is the same. The plan is to totally remove this
      in V6 since there will be a good conversion path from V6 to V5.
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>
      f31c70aa
  29. Dec 03, 2024