Skip to content
  1. May 29, 2024
    • Kian Paimani's avatar
      Publish `chain-spec-builder` (#4518) · dfcfa4ab
      Kian Paimani authored
      
      
      marking it as release-able, attaching the same version number that is
      attached to other binaries such as `polkadot` and `polkadot-parachain`.
      
      I have more thoughts about the version number, though. The chain-spec
      builder is mainly a user of the `sp-genesis-builder` api. So the
      versioning should be such that it helps users know give a version of
      `sp-genesis-builder` in their runtime, which version of
      `chain-spec-builder` should they use?
      
      With this, we can possibly alter the version number to always match
      `sp-genesis-builder`.
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/4352
      
      - [x] Add to release artifacts ~~similar to
      https://github.com/paritytech/polkadot-sdk/pull/4405~~ done here:
      https://github.com/paritytech/polkadot-sdk/pull/4557
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      dfcfa4ab
    • Egor_P's avatar
      Add omni bencher & chain-spec-builder bins to release (#4557) · 89604daa
      Egor_P authored
      
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/4354
      
      This PR adds the steps to build and attach `frame-omni-bencher` and
      `chain-spec-builder` binaries to the release draft
      
      ## TODO
      - [x] add also chain-spec-builder binary
      - [ ] ~~check/investigate Kian's comment: `chain spec builder. Ideally I
      want it to match the version of the sp-genesis-builder crate`~~ see
      [comment](https://github.com/paritytech/polkadot-sdk/pull/4518#issuecomment-2134731355)
      - [ ] Backport to `[email protected]` release, so we can use it for next
      fellows release: https://github.com/polkadot-fellows/runtimes/pull/324
      - [ ] Backport to `[email protected]` release
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      89604daa
    • gupnik's avatar
      Moves runtime macro out of experimental flag (#4249) · 5f68c930
      gupnik authored
      
      
      Step in https://github.com/paritytech/polkadot-sdk/issues/3688
      
      Now that the `runtime` macro (Construct Runtime V2) has been
      successfully deployed on Westend, this PR moves it out of the
      experimental feature flag and makes it generally available for runtime
      devs.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      5f68c930
  2. May 28, 2024
    • Przemek Rzad's avatar
      Filter workspace dependencies in the templates (#4599) · d6cf147c
      Przemek Rzad authored
      This detaches the templates from monorepo's workspace dependencies.
      
      Currently the templates [re-use the monorepo's
      dependencies](https://github.com/paritytech/polkadot-sdk-minimal-template/blob/bd8afe66ec566d61f36b0e3d731145741a9e9e19/Cargo.toml#L45-L58),
      most of which are not needed.
      
      The simplest approach is to specify versions directly and not use
      workspace dependencies in the templates.
      
      Another approach would be to programmatically filter dependencies that
      are actually needed - but not sure if it's worth it, given that it would
      complicate the synchronization job.
      
      cc @Kianenigma @gupnik
      d6cf147c
    • Bastian Köcher's avatar
      parachain-inherent: Make `para_id` more prominent (#4555) · 2b1c606a
      Bastian Köcher authored
      This should make it more obvious that at instantiation of the
      `MockValidationDataInherentDataProvider` the `para_id` needs to be
      passed.
      2b1c606a
    • Alexandru Gheorghe's avatar
      Add metric to measure the time it takes to gather enough assignments (#4587) · ad22fa6e
      Alexandru Gheorghe authored
      
      
      To understand with high granularity how many assignment tranches are
      triggered before we concur that we have enough assignments.
      
      This metric is important because the triggering of an assignment creates
      a lot of work in the system for approving the candidate and gossiping
      the necessary messages.
      
      ---------
      
      Signed-off-by: default avatarAlexandru Gheorghe <[email protected]>
      Co-authored-by: default avatarordian <[email protected]>
      ad22fa6e
    • Bolaji Ahmad's avatar
      Improve On_demand_assigner events (#4339) · 650b124f
      Bolaji Ahmad authored
      
      
      title: Improving `on_demand_assigner` emitted events
      
      doc:
        - audience: Rutime User
      description: OnDemandOrderPlaced event that is useful for indexers to
      save data related to on demand orders. Check [discussion
      here](https://substrate.stackexchange.com/questions/11366/ondemandassignmentprovider-ondemandorderplaced-event-was-removed/11389#11389).
      
      Closes #4254 
      
      crates: [ 'runtime-parachain]
      
      ---------
      
      Co-authored-by: default avatarMaciej <[email protected]>
      650b124f
    • Eugen Snitko's avatar
      Conditional `required` checks (#4544) · ea46ad55
      Eugen Snitko authored
      Workaround for skipped but `required` github checks. The idea is to
      trigger the workflow but filter out unaffected jobs or steps. See [ci_cd
      998](https://github.com/paritytech/ci_cd/issues/988) for details
      
      In `.github/workflows/check-changed-files.yml` there is a reusable
      workflow thad does all the checks and publishes results as outputs.
      Example usage:
      ```
      jobs:
        changes:
          permissions:
            pull-requests: read
          uses: ./.github/workflows/check-changed-files.yml
        some-job:
          needs: changes
          if: ${{ needs.changes.outputs.rust }}
       ....... 
       ```
      ea46ad55
    • Oliver Tale-Yazdi's avatar
      [CI] Deny adding git deps (#4572) · 6ed02003
      Oliver Tale-Yazdi authored
      
      
      Adds a small CI check to match the existing Git deps agains a known-bad
      list.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      6ed02003
    • Andrei Eres's avatar
      [subsytem-bench] Remove redundant banchmark_name param (#4540) · 3bf283ff
      Andrei Eres authored
      Fixes https://github.com/paritytech/polkadot-sdk/issues/3601
      
      Since we print benchmark results manually, we don't need to save
      benchmark_name anywhere, better just put the name inside `println!`.
      3bf283ff
    • Alin Dima's avatar
      Add availability-recovery from systematic chunks (#1644) · 523e6256
      Alin Dima authored
      **Don't look at the commit history, it's confusing, as this branch is
      based on another branch that was merged**
      
      Fixes #598 
      Also implements [RFC
      #47](https://github.com/polkadot-fellows/RFCs/pull/47)
      
      ## Description
      
      - Availability-recovery now first attempts to request the systematic
      chunks for large POVs (which are the first ~n/3 chunks, which can
      recover the full data without doing the costly reed-solomon decoding
      process). This has a fallback of recovering from all chunks, if for some
      reason the process fails. Additionally, backers are also used as a
      backup for requesting the systematic chunks if the assigned validator is
      not offering the chunk (each backer is only used for one systematic
      chunk, to not overload them).
      - Quite obviously, recovering from systematic chunks is much faster than
      recovering from regular chunks (4000% faster as measured on my apple M2
      Pro).
      - Introduces a `ValidatorIndex` -> `ChunkIndex` mapping which is
      different for ...
      523e6256
    • Przemek Rzad's avatar
      Remove workspace lints from templates (#4598) · 09f07d54
      Przemek Rzad authored
      This detaches the templates from monorepo's workspace lints, so the
      lints for the templates can evolve separately as needed.
      
      Currently the templates [re-use the monorepo's
      lints](https://github.com/paritytech/polkadot-sdk-minimal-template/blob/bd8afe66ec566d61f36b0e3d731145741a9e9e19/Cargo.toml#L16-L43)
      which looks weird.
      
      cc @Kianenigma @gupnik
      09f07d54
  3. May 27, 2024
    • Michal Kucharczyk's avatar
      `sc-chain-spec`: deprecated code removed (#4410) · 2d3a6932
      Michal Kucharczyk authored
      This PR removes deprecated code:
      - The `RuntimeGenesisConfig` generic type parameter in
      `GenericChainSpec` struct.
      - `ChainSpec::from_genesis` method allowing to create chain-spec using
      closure providing runtime genesis struct
      - `GenesisSource::Factory` variant together with no longer needed
      `GenesisSource`'s generic parameter `G` (which was intended to be a
      runtime genesis struct).
      
      
      https://github.com/paritytech/polkadot-sdk/blob/17b56fae/substrate/client/chain-spec/src/chain_spec.rs#L559-L563
      2d3a6932
    • Andrei Eres's avatar
      [subsystem-benchmarks] Add statement-distribution benchmarks (#3863) · a7097681
      Andrei Eres authored
      Fixes https://github.com/paritytech/polkadot-sdk/issues/3748
      
      Adds a subsystem benchmark for statements-distribution subsystem.
      
      Results in CI (reference hw):
      ```
      $ cargo bench -p polkadot-statement-distribution --bench statement-distribution-regression-bench --features subsystem-benchmarks
      
      [Sent to peers] standart_deviation 0.07%
      [Received from peers] standart_deviation 0.00%
      [statement-distribution] standart_deviation 0.97%
      [test-environment] standart_deviation 1.03%
      
      Network usage, KiB                     total   per block
      Received from peers                1088.0000    108.8000
      Sent to peers                      1238.1800    123.8180
      
      CPU usage, seconds                     total   per block
      statement-distribution                0.3897      0.0390
      test-environment                      0.4715      0.0472
      ```
      a7097681
    • Sebastian Kunert's avatar
      check-weight: Disable total pov size check for mandatory extrinsics (#4571) · 70dd67a5
      Sebastian Kunert authored
      So in some pallets we like
      [here](https://github.com/paritytech/polkadot-sdk/blob/5dc522d0/substrate/frame/session/src/lib.rs#L556)
      we use `max_block` as return value for `on_initialize` (ideally we would
      not).
      
      This means the block is already full when we try to apply the inherents,
      which lead to the error seen in #4559 because we are unable to include
      the required inherents. This was not erroring before #4326 because we
      were running into this branch:
      
      https://github.com/paritytech/polkadot-sdk/blob/e4b89cc5/substrate/frame/system/src/extensions/check_weight.rs#L222-L224
      
      The inherents are of `DispatchClass::Mandatory` and therefore have a
      `reserved` value of `None` in all runtimes I have inspected. So they
      will always pass the normal check.
      
      So in this PR I adjust the `check_combined_proof_size` to return an
      early `Ok(())` for mandatory extrinsics.
      
      If we agree on this PR I will backport it to the 1.12.0 branch.
      
      closes #4559
      
      ---------
      
      Co-authored-by: command-bot <>
      70dd67a5
    • Michal Kucharczyk's avatar
      chain-spec-builder: help updated (#4597) · 16887b6f
      Michal Kucharczyk authored
      Added some clarification on output file.
      16887b6f
    • Alexandru Vasile's avatar
      network: Update litep2p to v0.5.0 (#4570) · ce3e9b7c
      Alexandru Vasile authored
      
      
      ## [0.5.0] - 2023-05-24
      
      This is a small patch release that makes the `FindNode` command a bit
      more robst:
      
      - The `FindNode` command now retains the K (replication factor) best
      results.
      - The `FindNode` command has been updated to handle errors and
      unexpected states without panicking.
      
      ### Changed
      
      - kad: Refactor FindNode query, keep K best results and add tests
      ([#114](https://github.com/paritytech/litep2p/pull/114))
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <[email protected]>
      ce3e9b7c
    • Sebastian Kunert's avatar
      Make markdown lint CI job pass (#4593) · 23529827
      Sebastian Kunert authored
      Was constantly failing, so here a fix.
      23529827
    • Przemek Rzad's avatar
      Add release version to commits and branch names of template synchronization job (#4353) · e0edb062
      Przemek Rzad authored
      Just to have some information what is the release number that was used
      to push a particular commit or PR in the templates repositories.
      e0edb062
    • omahs's avatar
      chore: fix typos (#4590) · 89b67bc6
      omahs authored
      chore: fix typos
      89b67bc6
    • Svyatoslav Nikolsky's avatar
      Bridge: add subcommand to relay messages delivery confirmation (#4453) · 0a752afa
      Svyatoslav Nikolsky authored
      related to
      https://github.com/paritytech/parity-bridges-common/issues/2962
      on top of #4383
      
      Example:
      ```sh
      RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
              ./target/release/substrate-relay relay-messages-delivery-confirmation bridge-hub-rococo-to-bridge-hub-westend \
              --source-host localhost \
              --source-port 8943 \
              --source-version-mode Auto \
              --source-signer //Eve \
              --source-transactions-mortality 4 \
              --target-host localhost \
              --target-port 8945 \
              --target-version-mode Auto \
              --lane 00000002 \
              --at-target-block 49
      ```
      0a752afa
    • Svyatoslav Nikolsky's avatar
      Bridge: check submit_finality_proof limits before submission (#4549) · f6cca7ee
      Svyatoslav Nikolsky authored
      closes https://github.com/paritytech/parity-bridges-common/issues/2982
      closes https://github.com/paritytech/parity-bridges-common/issues/2730
      
      The main change is in the
      bridges/relays/lib-substrate-relay/src/finality/target.rs, changes in
      other files are just moving the code
      
      ~I haven't been able to run zn tests locally - don't know why, but it
      keeps failing for me locally with: `
      Error running script:
      /home/svyatonik/dev/polkadot-sdk/bridges/testing/framework/js-helpers/wait-hrmp-channel-opened.js
      Error: Timeout(300), "custom-js
      /home/svyatonik/dev/polkadot-sdk/bridges/testing/framework/js-helpers/wait-hrmp-channel-opened.js
      within 300 secs" didn't complete on time.`~ The issue was an obsolete
      `polkadot-js-api` binary - did `yarn global upgrade` and it is ok now
      f6cca7ee
    • Francisco Aguirre's avatar
      Deprecate XCMv2 (#4131) · 9201f9ab
      Francisco Aguirre authored
      
      
      Marked XCMv2 as deprecated now that we have XCMv4.
      It will be removed sometime around June 2024.
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      9201f9ab
  4. May 24, 2024
    • Branislav Kontur's avatar
    • Andrei Sandu's avatar
      availability-recovery: bump chunk fetch threshold to 1MB for Polkadot and 4MB... · f469fbfb
      Andrei Sandu authored
      
      availability-recovery: bump chunk fetch threshold to 1MB for Polkadot and 4MB for Kusama + testnets (#4399)
      
      Doing this change ensures that we minimize the CPU usage we spend in
      reed-solomon by only doing the re-encoding into chunks if PoV size is
      less than 4MB (which means all PoVs right now)
       
      Based on susbystem benchmark results we concluded that it is safe to
      bump this number higher. At worst case scenario the network pressure for
      a backing group of 5 is around 25% of the network bandwidth in hw specs.
      
      Assuming 6s block times (max_candidate_depth 3) and needed_approvals 30
      the amount of bandwidth usage of a backing group used would hover above
      `30 * 4 * 3 = 360MB` per relay chain block. Given a backing group of 5
      that gives 72MB per block per validator -> 12 MB/s.
      
      <details>
      <summary>Reality check on Kusama PoV sizes (click for chart)</summary>
      <br>
      <img width="697" alt="Screenshot 2024-05-07 at 14 30 38"
      src="https://github.com/paritytech/polkadot-sdk/assets/54316454/bfed32d4-8623-48b0-9ec0-8b95dd2a9d8c">
      </details>
      
      ---------
      
      Signed-off-by: default avatarAndrei Sandu <[email protected]>
      f469fbfb
    • Oliver Tale-Yazdi's avatar
      Polkadot-SDK Umbrella Crate (#3935) · 1c7a1a58
      Oliver Tale-Yazdi authored
      
      
      # Umbrella Crate
      
      The Polkadot-SDK "umbrella" is a crate that re-exports all other
      published crates. This makes it
      possible to have a very small `Cargo.toml` file that only has one
      dependency, the umbrella
      crate. This helps with selecting the right combination of crate
      versions, since otherwise 3rd
      party tools are needed to select a compatible set of versions.
      
      ## Features
      
      The umbrella crate supports no-std builds and can therefore be used in
      the runtime and node.
      There are two main features: `runtime` and `node`. The `runtime` feature
      enables all `no-std`
      crates, while the `node` feature enables all `std` crates. It should be
      used like any other
      crate in the repo, with `default-features = false`.
      
      For more fine-grained control, additionally, each crate can be enabled
      selectively. The umbrella
      exposes one feature per dependency. For example, if you only want to use
      the `frame-support`
      crate, you can enable the `frame-support` feature.
      
      The umbrella exposes a few more general features:
      - `tuples-96`: Needs to be enabled for runtimes that have more than 64
      pallets.
      - `serde`: Specifically enable `serde` en/decoding support.
      - `experimental`: Experimental enable experimental features - should not
      yet used in production.
      - `with-tracing`: Enable tracing support.
      - `try-runtime`, `runtime-benchmarks` and `std`: These follow the
      standard conventions.
      - `runtime`: As described above, enable all `no-std` crates.
      - `node`: As described above, enable all `std` crates.
      - There does *not* exist a dedicated docs feature. To generate docs,
      enable the `runtime` and
      `node` feature. For docs.rs the manifest contains specific configuration
      to make it show up
        all re-exports.
      
      There is a specific `zepter` check in place to ensure that the features
      of the umbrella are
      correctly configured. This check is run in CI and locally when running
      `zepter`.
      
      ## Generation
      
      The umbrella crate needs to be updated every time when a new crate is
      added or removed from the
      workspace. It is checked in CI by calling its generation script. The
      generation script is
      located in `./scripts/generate-umbrella.py` and needs dependency
      `cargo_workspace`.
      
      Example: `python3 scripts/generate-umbrella.py --sdk . --version 1.9.0`
      
      ## Usage
      
      > Note: You can see a live example in the `staging-node-cli` and
      `kitchensink-runtime` crates.
      
      The umbrella crate can be added to your runtime crate like this:
      
      `polkadot-sdk = { path = "../../../../umbrella", features = ["runtime"],
      default-features =
      false}`
      
      or for a node:
      
      `polkadot-sdk = { path = "../../../../umbrella", features = ["node"],
      default-features = false
      }`
      
      In the code, it is then possible to bring all dependencies into scope
      via:
      
      `use polkadot_sdk::*;`
      
      ### Known Issues
      
      The only known issue so far is the fact that the `use` statement brings
      the dependencies only
      into the outer module scope - not the global crate scope. For example,
      the following code would
      need to be adjusted:
      
      ```rust
      use polkadot_sdk::*;
      
      mod foo {
         // This does sadly not compile:
         frame_support::parameter_types! { }
      
         // Instead, we need to do this (or add an equivalent `use` statement):
         polkadot_sdk::frame_support::parameter_types! { }
      }
      ```
      
      Apart from this, no issues are known. There could be some bugs with how
      macros locate their own
      re-exports. Please compile issues that arise from using this crate.
      
      ## Dependencies
      
      The umbrella crate re-exports all published crates, with a few
      exceptions:
      - Runtime crates like `rococo-runtime` etc are not exported. This
      otherwise leads to very weird
        compile errors and should not be needed anyway.
      - Example and fuzzing crates are not exported. This is currently
      detected by checking the name
      of the crate for these magic words. In the future, it will utilize
      custom metadata, as it is
        done in the `rococo-runtime` crate.
      - The umbrella crate itself. Should be obvious :)
      
      ## Follow Ups
      - [ ] Re-writing the generator in Rust - the python script is at its
      limit.
      - [ ] Using custom metadata to exclude some crates instead of filtering
      by names.
      - [ ] Finding a way to setting the version properly. Currently its
      locked in the CI script.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      1c7a1a58
    • Oliver Tale-Yazdi's avatar
      Remove litep2p git dependency (#4560) · 49bd6a6e
      Oliver Tale-Yazdi authored
      @serban300
      
       could you please do the same for the MMR crate? Am not sure
      what commit was released since there are no release tags in the repo.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      49bd6a6e
    • Branislav Kontur's avatar
      Attempt to avoid specifying `BlockHashCount` for different... · ef144b1a
      Branislav Kontur authored
      Attempt to avoid specifying `BlockHashCount` for different `mocking::{MockBlock, MockBlockU32, MockBlockU128}` (#4543)
      
      While doing some migration/rebase I came in to the situation, where I
      needed to change `mocking::MockBlock` to `mocking::MockBlockU32`:
      ```
      #[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
      impl frame_system::Config for TestRuntime {
      	type Block = frame_system::mocking::MockBlockU32<TestRuntime>;
      	type AccountData = pallet_balances::AccountData<ThisChainBalance>;
      }
      ```
      But actual `TestDefaultConfig` for `frame_system` is using `ConstU64`
      for `type BlockHashCount = frame_support::traits::ConstU64<10>;`
      [here](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/system/src/lib.rs#L303).
      Because of this, it force me to specify and add override for `type
      BlockHashCount = ConstU32<10>`.
      
      This PR tries to fix this with `TestBlockHashCount` implementation for
      `TestDefaultConfig` which supports `u32`, `u64` and `u128` as a
      `BlockNumber`.
      
      ### How to simulate error
      Just by removing `type BlockHashCount = ConstU32<250>;`
      [here](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/multisig/src/tests.rs#L44)
      ```
      :~/parity/olkadot-sdk$ cargo test -p pallet-multisig
         Compiling pallet-multisig v28.0.0 (/home/bparity/parity/aaa/polkadot-sdk/substrate/frame/multisig)
      error[E0277]: the trait bound `ConstU64<10>: frame_support::traits::Get<u32>` is not satisfied
         --> substrate/frame/multisig/src/tests.rs:41:1
          |
      41  | #[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
          | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_support::traits::Get<u32>` is not implemented for `ConstU64<10>`
          |
          = help: the following other types implement trait `frame_support::traits::Get<T>`:
                    <ConstU64<T> as frame_support::traits::Get<u64>>
                    <ConstU64<T> as frame_support::traits::Get<std::option::Option<u64>>>
      note: required by a bound in `frame_system::Config::BlockHashCount`
         --> /home/bparity/parity/aaa/polkadot-sdk/substrate/frame/system/src/lib.rs:535:24
          |
      535 |         type BlockHashCount: Get<BlockNumberFor<Self>>;
          |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Config::BlockHashCount`
          = note: this error originates in the attribute macro `derive_impl` which comes from the expansion of the macro `frame_support::macro_magic::forward_tokens_verbatim` (in Nightly builds, run with -Z macro-backtrace for more info)
      
      For more information about this error, try `rustc --explain E0277`.
      error: could not compile `pallet-multisig` (lib test) due to 1 previous error 
      ```
      
      
      
      
      ## For reviewers:
      
      (If there is a better solution, please let me know!)
      
      The first commit contains actual attempt to fix the problem:
      https://github.com/paritytech/polkadot-sdk/commit/3c5499e5
      
      .
      The second commit is just removal of `BlockHashCount` from all other
      places where not needed by default.
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/1657
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      ef144b1a
    • Serban Iorga's avatar
      Use polkadot-ckb-merkle-mountain-range dependency (#4562) · 700d5910
      Serban Iorga authored
      We need to use the `polkadot-ckb-merkle-mountain-range` dependency
      published on `crates.io` in order to unblock the release of the
      `sp-mmr-primitives` crate
      700d5910
  5. May 23, 2024
    • Francisco Aguirre's avatar
      Mention new XCM docs in sdk docs (#4558) · 48d4f654
      Francisco Aguirre authored
      The XCM docs were pretty much moved to the new rust docs format in
      https://github.com/paritytech/polkadot-sdk/pull/2633, with the addition
      of the XCM cookbook, which I plan to add more examples to shortly.
      
      These docs were not mentioned in the polkadot-sdk rust docs, this PR
      just mentions them there, so people can actually find them.
      48d4f654
    • Serban Iorga's avatar
      Define `OpaqueValue` (#4550) · 03bbc17e
      Serban Iorga authored
      
      
      Define `OpaqueValue` and use it instead of
      `grandpa::OpaqueKeyOwnershipProof` and `beefy:OpaqueKeyOwnershipProof`
      
      Related to
      https://github.com/paritytech/polkadot-sdk/pull/4522#discussion_r1608278279
      
      We'll need to introduce a runtime API method that calls the
      `report_fork_voting_unsigned()` extrinsic. This method will need to
      receive the ancestry proof as a paramater. I'm still not sure, but there
      is a chance that we'll send the ancestry proof as an opaque type.
      
      So let's introduce this `OpaqueValue`. We can already use it to replace
      `grandpa::OpaqueKeyOwnershipProof` and `beefy:OpaqueKeyOwnershipProof`
      and maybe we'll need it for the ancestry proof as well.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      03bbc17e
    • PG Herveou's avatar
      Contracts: Rework host fn benchmarks (#4233) · 493ba5e2
      PG Herveou authored
      
      
      fix https://github.com/paritytech/polkadot-sdk/issues/4163
      
      This PR does the following:
      Update to pallet-contracts-proc-macro: 
      - Parse #[cfg] so we can add a dummy noop host function for benchmark.
      - Generate BenchEnv::<host_fn> so we can call host functions directly in
      the benchmark.
      - Add the weight of the noop host function before calling the host
      function itself
      
      Update benchmarks:
      - Update all host function benchmark, a host function benchmark now
      simply call the host function, instead of invoking the function n times
      from within a contract.
      - Refactor RuntimeCosts & Schedule, for most host functions, we can now
      use the generated weight function directly instead of computing the diff
      with the cost! macro
      
      ```rust
      // Before
      #[benchmark(pov_mode = Measured)]
      fn seal_input(r: Linear<0, API_BENCHMARK_RUNS>) {
          let code = WasmModule::<T>::from(ModuleDefinition {
              memory: Some(ImportedMemory::max::<T>()),
              imported_functions: vec![ImportedFunction {
                  module: "seal0",
                  name: "seal_input",
                  params: vec![ValueType::I32, ValueType::I32],
                  return_type: None,
              }],
              data_segments: vec![DataSegment { offset: 0, value: 0u32.to_le_bytes().to_vec() }],
              call_body: Some(body::repeated(
                  r,
                  &[
                      Instruction::I32Const(4), // ptr where to store output
                      Instruction::I32Const(0), // ptr to length
                      Instruction::Call(0),
                  ],
              )),
              ..Default::default()
          });
      
          call_builder!(func, code);
      
          let res;
          #[block]
          {
              res = func.call();
          }
          assert_eq!(res.did_revert(), false);
      }
      ```
      
      ```rust
      // After
      fn seal_input(n: Linear<0, { code::max_pages::<T>() * 64 * 1024 - 4 }>) {
          let mut setup = CallSetup::<T>::default();
          let (mut ext, _) = setup.ext();
          let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![42u8; n as usize]);
          let mut memory = memory!(n.to_le_bytes(), vec![0u8; n as usize],);
          let result;
          #[block]
          {
              result = BenchEnv::seal0_input(&mut runtime, &mut memory, 4, 0)
          }
          assert_ok!(result);
          assert_eq!(&memory[4..], &vec![42u8; n as usize]);
      }
      ``` 
      
      [Weights
      compare](https://weights.tasty.limo/compare?unit=weight&ignore_errors=true&threshold=10&method=asymptotic&repo=polkadot-sdk&old=master&new=pg%2Frework-host-benchs&path_pattern=substrate%2Fframe%2Fcontracts%2Fsrc%2Fweights.rs%2Cpolkadot%2Fruntime%2F*%2Fsrc%2Fweights%2F**%2F*.rs%2Cpolkadot%2Fbridges%2Fmodules%2F*%2Fsrc%2Fweights.rs%2Ccumulus%2F**%2Fweights%2F*.rs%2Ccumulus%2F**%2Fweights%2Fxcm%2F*.rs%2Ccumulus%2F**%2Fsrc%2Fweights.rs)
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      493ba5e2
    • Branislav Kontur's avatar
      Fix bridges grandpa benchmarks (#2577) (#4548) · a823d18f
      Branislav Kontur authored
      
      
      Cherry-picked fix from upcoming
      https://github.com/paritytech/polkadot-sdk/pull/4494
      
      ---------
      
      Co-authored-by: default avatarSvyatoslav Nikolsky <[email protected]>
      Co-authored-by: command-bot <>
      a823d18f
    • Kian Paimani's avatar
      Fix README.md Logo URL (#4546) · fd161917
      Kian Paimani authored
      This one also works and it is easier.
      fd161917
  6. May 22, 2024