Skip to content
Snippets Groups Projects
  1. Feb 12, 2025
  2. Feb 11, 2025
  3. Feb 10, 2025
  4. Feb 09, 2025
    • StackOverflowExcept1on's avatar
      feat(wasm-builder): add support for new `wasm32v1-none` target (#7008) · 2970ab15
      StackOverflowExcept1on authored
      
      # Description
      
      Resolves #5777
      
      Previously `wasm-builder` used hacks such as `-Zbuild-std` (required
      `rust-src` component) and `RUSTC_BOOTSTRAP=1` to build WASM runtime
      without WASM features: `sign-ext`, `multivalue` and `reference-types`,
      but since Rust 1.84 (will be stable on 9 January, 2025) the situation
      has improved as there is new
      [`wasm32v1-none`](https://doc.rust-lang.org/beta/rustc/platform-support/wasm32v1-none.html)
      target that disables all "post-MVP" WASM features except
      `mutable-globals`.
      
      Previously, your `rust-toolchain.toml` looked like this:
      
      ```toml
      [toolchain]
      channel = "stable"
      components = ["rust-src"]
      targets = ["wasm32-unknown-unknown"]
      profile = "default"
      ```
      
      It should now be updated to something like this:
      
      ```toml
      [toolchain]
      channel = "stable"
      targets = ["wasm32v1-none"]
      profile = "default"
      ```
      
      To build the runtime:
      
      ```bash
      cargo build --package minimal-template-runtime --release
      ```
      
      ## Integration
      
      If you are using Rust 1.84 and above, then install the `wasm32v1-none`
      target instead of `wasm32-unknown-unknown` as shown above. You can also
      remove the unnecessary `rust-src` component.
      
      Also note the slight differences in conditional compilation:
      - `wasm32-unknown-unknown`: `#[cfg(all(target_family = "wasm", target_os
      = "unknown"))]`
      - `wasm32v1-none`: `#[cfg(all(target_family = "wasm", target_os =
      "none"))]`
      
      Avoid using `target_os = "unknown"` in `#[cfg(...)]` or
      `#[cfg_attr(...)]` and instead use `target_family = "wasm"` or
      `target_arch = "wasm32"` in the runtime code.
      
      ## Review Notes
      
      Wasm builder requires the following prerequisites for building the WASM
      binary:
      - Rust >= 1.68 and Rust < 1.84:
        - `wasm32-unknown-unknown` target
        - `rust-src` component
      - Rust >= 1.84:
        - `wasm32v1-none` target
      - no more `-Zbuild-std` and `RUSTC_BOOTSTRAP=1` hacks and `rust-src`
      component requirements!
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: default avatarBastian Köcher <info@kchr.de>
  5. Feb 08, 2025
  6. Feb 07, 2025
  7. Feb 06, 2025
  8. Feb 05, 2025
    • Iulian Barbu's avatar
      omni-node: add offchain worker (#7479) · 87f4f3f0
      Iulian Barbu authored
      
      # Description
      
      Copy pasted the `parachain-template-node` offchain worker setup to
      omni-node-lib for both aura and manual seal nodes.
      
      Closes #7447 
      
      ## Integration
      
      Enabled offchain workers for both `polkadot-omni-node` and
      `polkadot-parachain` nodes. This would allow executing offchain logic in
      the runtime and considering it on the node side.
      
      ---------
      
      Signed-off-by: default avatarIulian Barbu <iulian.barbu@parity.io>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Sebastian Kunert's avatar
      omni-node: Adjust manual seal parameters (#7451) · 9c474d54
      Sebastian Kunert authored
      This PR will make omni-node dev-mode once again compatible with older
      runtimes.
      
      The changes introduced in
      https://github.com/paritytech/polkadot-sdk/pull/6825 changed constraints
      that are enforced in the runtime. For normal chains this should work
      fine, since we have real parameters there, like relay chain slots and
      parachain slots.
      
      For these manual seal parameters we need to respect the constraints,
      while faking all the parameters. This PR should fix manual seal in
      omni-node to work with runtime build before and after
      https://github.com/paritytech/polkadot-sdk/pull/6825 (I tested that).
      
      In the future, we should look into improving the parameterization here,
      possibly by introducing proper aura pre-digests so that the parachain
      slot moves forward. This will require quite a bit of refactoring on the
      manual seal node side however. Issue:
      https://github.com/paritytech/polkadot-sdk/issues/7453
      
      Also, the dev chain spec in parachain template is updated. This m...
    • Alexander Theißen's avatar
      Remove pallet_revive benchmarks from Westend AssetHub (#7454) · 31abe611
      Alexander Theißen authored
      We are using the substrate weights on the test net. Removing the benches
      so that they are not generated by accident and then not used.
  9. 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>
    • Alexandre R. Baldé's avatar
      Add missing events to nomination pool extrinsincs (#7377) · a8834759
      Alexandre R. Baldé authored
      
      Found via
      https://github.com/open-web3-stack/polkadot-ecosystem-tests/pull/165.
      
      Closes #7370 .
      
      # Description
      
      Some extrinsics from `pallet_nomination_pools` were not emitting events:
      * `set_configs`
      * `set_claim_permission`
      * `set_metadata`
      * `chill`
      * `nominate`
      
      ## Integration
      
      N/A
      
      ## Review Notes
      
      N/A
      
      ---------
      
      Co-authored-by: default avatarAnkan <10196091+Ank4n@users.noreply.github.com>
    • Clara van Staden's avatar
      Snowbridge: Remove fee amount check from tests (#7436) · 8834a9bf
      Clara van Staden authored
      Remove the specific fee amount checks in integration tests, since it
      changes every time weights are regenerated.
    • Michal Kucharczyk's avatar
      `fatxpool`: do not use individual transaction listeners (#7316) · aa42debe
      Michal Kucharczyk authored
      #### Description
      During 2s block investigation it turned out that
      [ForkAwareTxPool::register_listeners](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1036)
      call takes significant amount of time.
      ```
      register_listeners: at HashAndNumber { number: 12, hash: 0xe9a1...0b1d2 } took 200.041933ms
      register_listeners: at HashAndNumber { number: 13, hash: 0x5eb8...a87c6 } took 264.487414ms
      register_listeners: at HashAndNumber { number: 14, hash: 0x30cb...2e6ec } took 340.525566ms
      register_listeners: at HashAndNumber { number: 15, hash: 0x0450...4f05c } took 405.686659ms
      register_listeners: at HashAndNumber { number: 16, hash: 0xfa6f...16c20 } took 477.977836ms
      register_listeners: at HashAndNumber { number: 17, hash: 0x5474...5d0c1 } took 483.046029ms
      register_listeners: at HashAndNumber { number: 18, hash: 0x3ca5...37b78 } took 482.715468ms
      register_listeners: at HashAndNumber { number: 19, hash: 0xbfcc...df254 } took 484.206999ms
      register_listeners: at HashAndNumber { number: 20, hash: 0xd748...7f027 } took 414.635236ms
      register_listeners: at HashAndNumber { number: 21, hash: 0x2baa...f66b5 } took 418.015897ms
      register_listeners: at HashAndNumber { number: 22, hash: 0x5f1d...282b5 } took 423.342397ms
      register_listeners: at HashAndNumber { number: 23, hash: 0x7a18...f2d03 } took 472.742939ms
      register_listeners: at HashAndNumber { number: 24, hash: 0xc381...3fd07 } took 489.625557ms
      ```
      
      This PR implements the idea outlined in #7071. Instead of having a
      separate listener for every transaction in each view, we now use a
      single stream of aggregated events per view, with each stream providing
      events for all transactions in that view. Each event is represented as a
      tuple: (transaction-hash, transaction-status). This significantly reduce
      the time required for `maintain`.
      
      #### Review Notes
      - single aggregated stream, provided by the individual view delivers
      events in form of `(transaction-hash, transaction-status)`,
      - `MultiViewListener` now has a task. This task is responsible for:
      - polling the stream map (which consists of individual view's aggregated
      streams) and the `controller_receiver` which provides side-channel
      [commands](https://github.com/paritytech/polkadot-sdk/blob/2b18e080
      
      /substrate/client/transaction-pool/src/fork_aware_txpool/multi_view_listener.rs#L68-L95)
      (like `AddView` or `FinalizeTransaction`) sent from the _transaction
      pool_.
      - dispatching individual transaction statuses and control commands into
      the external (created via API, e.g. over RPC) listeners of individual
      transactions,
      - external listener is responsible for status handling _logic_ (e.g.
      deduplication of events, or ignoring some of them) and triggering
      statuses to external world (_this was not changed_).
      - level of debug messages was adjusted (per-tx messages shall be
      _trace_),
      
      Closes #7071
      
      ---------
      
      Co-authored-by: default avatarSebastian Kunert <skunert49@gmail.com>
    • Serban Iorga's avatar
      Fix duplicate codec indexes (#7446) · 37446fcb
      Serban Iorga authored
      Related to https://github.com/paritytech/polkadot-sdk/issues/7400 and
      https://github.com/paritytech/polkadot-sdk/pull/7417
      
      We need this in order to be able to update `parity-scale-codec` to the
      latest version after it's released. That's because `parity-scale-codec`
      added support for checking for duplicate indexes at compile time.
    • Serban Iorga's avatar
      Fix Message codec indexes (#7437) · d6aa1578
      Serban Iorga authored
      Fixes https://github.com/paritytech/polkadot-sdk/issues/7400