Commit Graph

39 Commits

Author SHA1 Message Date
Oliver Tale-Yazdi 9543d31474 [FRAME] Runtime Omni Bencher (#3512)
This MR contains two major changes and some maintenance cleanup.  

## 1. Free Standing Pallet Benchmark Runner

Closes https://github.com/paritytech/polkadot-sdk/issues/3045, depends
on your runtime exposing the `GenesisBuilderApi` (like
https://github.com/paritytech/polkadot-sdk/pull/1492).

Introduces a new binary crate: `frame-omni-bencher`.  
It allows to directly benchmark a WASM blob - without needing a node or
chain spec.

This makes it much easier to generate pallet weights and should allow us
to remove bloaty code from the node.
It should work for all FRAME runtimes that dont use 3rd party host calls
or non `BlakeTwo256` block hashing (basically all polkadot parachains
should work).

It is 100% backwards compatible with the old CLI args, when the `v1`
compatibility command is used. This is done to allow for forwards
compatible addition of new commands.

### Example (full example in the Rust docs)

Installing the CLI:
```sh
cargo install --locked --path substrate/utils/frame/omni-bencher
frame-omni-bencher --help
```

Building the Westend runtime:
```sh
cargo build -p westend-runtime --release --features runtime-benchmarks
```

Benchmarking the runtime:
```sh
frame-omni-bencher v1 benchmark pallet --runtime target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm --all
```

## 2. Building the Benchmark Genesis State in the Runtime

Closes https://github.com/paritytech/polkadot-sdk/issues/2664

This adds `--runtime` and `--genesis-builder=none|runtime|spec`
arguments to the `benchmark pallet` command to make it possible to
generate the genesis storage by the runtime. This can be used with both
the node and the freestanding benchmark runners. It utilizes the new
`GenesisBuilder` RA and depends on having
https://github.com/paritytech/polkadot-sdk/pull/3412 deployed.

## 3. Simpler args for `PalletCmd::run`

You can do three things here to integrate the changes into your node:
- nothing: old code keeps working as before but emits a deprecated
warning
- delete: remove the pallet benchmarking code from your node and use the
omni-bencher instead
- patch: apply the patch below and keep using as currently. This emits a
deprecated warning at runtime, since it uses the old way to generate a
genesis state, but is the smallest change.

```patch
runner.sync_run(|config| cmd
-    .run::<HashingFor<Block>, ReclaimHostFunctions>(config)
+    .run_with_spec::<HashingFor<Block>, ReclaimHostFunctions>(Some(config.chain_spec))
)
```

## 4. Maintenance Change
- `pallet-nis` get a `BenchmarkSetup` config item to prepare its
counterparty asset.
- Add percent progress print when running benchmarks.
- Dont immediately exit on benchmark error but try to run as many as
possible and print errors last.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
2024-04-08 16:03:56 +00:00
Vladimir Istyufeev ebdca15c19 Convince GitLab not to crop collapsed multiline strings (#3971)
Use of `- >` instead of `- |` workarounds GitLab quirk when it crops
collapsed multiline `script:` section commands in its CI job logs.
This PR also fixes `- |` based `script:` steps to behave properly after
`- >` conversion.

Resolves https://github.com/paritytech/ci_cd/issues/972.
2024-04-04 08:22:18 +00:00
Andrei Eres 665e3654ce Remove nextest filtration (#3885)
Fixes
https://github.com/paritytech/polkadot-sdk/issues/3884#issuecomment-2026058687

After moving regression tests to benchmarks
(https://github.com/paritytech/polkadot-sdk/pull/3741) we don't need to
filter tests anymore.

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
Co-authored-by: Alin Dima <alin@parity.io>
Co-authored-by: Andrei Sandu <andrei-mihail@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Javier Viola <363911+pepoviola@users.noreply.github.com>
Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: Clara van Staden <claravanstaden64@gmail.com>
Co-authored-by: Ron <yrong1997@gmail.com>
Co-authored-by: Vincent Geddes <vincent@snowfork.com>
Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
2024-04-02 19:27:11 +00:00
Alexander Samusev 374aefa4f2 [ci] Fix publish benchmarks job (#3864)
Few fixes in CI to publish benchmarks jobs.

cc https://github.com/paritytech/ci_cd/issues/934
2024-03-27 16:03:53 +00:00
Alexander Samusev 25af0adf78 [ci] Collect subsystem-benchmarks results and add graphs for them (#3853)
PR adds CI jobs that collect subsystem-benchmarks results and publishes
them to gh-pages.

cc https://github.com/paritytech/ci_cd/issues/934
cc @AndreiEres
2024-03-27 11:50:03 +00:00
Andrei Eres cc1e6ac301 [subsystem-benchmarks] Fix availability-write regression tests (#3698)
Adds availability-write regression tests.
The results for the `availability-distribution` subsystem are volatile,
so I had to reduce the precision of the test.
2024-03-25 15:57:46 +00:00
Bastian Köcher 430ad2f561 Make availability-recovery-regression-bench a benchmark (#3741)
Closes: https://github.com/paritytech/polkadot-sdk/issues/3704
2024-03-19 08:27:51 +00:00
Andrei Eres 256546b7b9 Add subsystems regression tests to CI (#3527)
Fixes https://github.com/paritytech/polkadot-sdk/issues/3530
2024-03-13 16:54:41 +00:00
Andrei Eres f0e589d72e subsystem-bench: add regression tests for availability read and write (#3311)
### What's been done
- `subsystem-bench` has been split into two parts: a cli benchmark
runner and a library.
- The cli runner is quite simple. It just allows us to run `.yaml` based
test sequences. Now it should only be used to run benchmarks during
development.
- The library is used in the cli runner and in regression tests. Some
code is changed to make the library independent of the runner.
- Added first regression tests for availability read and write that
replicate existing test sequences.

### How we run regression tests
- Regression tests are simply rust integration tests without the
harnesses.
- They should only be compiled under the `subsystem-benchmarks` feature
to prevent them from running with other tests.
- This doesn't work when running tests with `nextest` in CI, so
additional filters have been added to the `nextest` runs.
- Each benchmark run takes a different time in the beginning, so we
"warm up" the tests until their CPU usage differs by only 1%.
- After the warm-up, we run the benchmarks a few more times and compare
the average with the exception using a precision.

### What is still wrong?
- I haven't managed to set up approval voting tests. The spread of their
results is too large and can't be narrowed down in a reasonable amount
of time in the warm-up phase.
- The tests start an unconfigurable prometheus endpoint inside, which
causes errors because they use the same 9999 port. I disable it with a
flag, but I think it's better to extract the endpoint launching outside
the test, as we already do with `valgrind` and `pyroscope`. But we still
use `prometheus` inside the tests.

### Future work
* https://github.com/paritytech/polkadot-sdk/issues/3528
* https://github.com/paritytech/polkadot-sdk/issues/3529
* https://github.com/paritytech/polkadot-sdk/issues/3530
* https://github.com/paritytech/polkadot-sdk/issues/3531

---------

Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
2024-03-01 14:30:43 +00:00
Vladimir Istyufeev d05f8c57fb Limit max execution time for test-linux-stable CI jobs (#3483)
Tests run as part of the `test-linux-stable` jobs could hang as shown
[here](https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5341393).
This PR adds a failsafe for such cases.
2024-02-26 21:40:02 +04:00
Evgeny Snitko edd95b3749 Add forklift to remaining jobs (#3236)
Add [forklift
caching](https://gitlab.parity.io/parity/infrastructure/ci_cd/forklift/forklift)
to remainig jobs

by .sh and .py scripts:
- cargo-check-each-crate x6 (`.gitlab/check-each-crate.py`)
- build-linux-stable (`polkadot/scripts/build-only-wasm.sh`)

by before_script:
- build-linux-substrate
- build-subkey-linux (with `.build-subkey` job)
- cargo-check-benches x2

**To disable feature set FORKLIFT_BYPASS variable to true in [project
settings in
gitlab](https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/settings/ci_cd)**
(forklift now handles FORKLIFT_BYPASS by itself)
2024-02-09 12:40:19 +00:00
Alexander Samusev 2bdf5dca67 [ci] Remove unused jobs (#2502)
<del>PR custom review is deprecated. Now `review-bot` performs these
functions.</del>
PR removes unused ci jobs and adjusts zombienet jobs for merge queues

cc @Bullrich
2024-01-11 11:30:17 +00:00
PG Herveou 5daef5d086 Contracts rename riscv-experimental and enable ci tests (#2879)
- Keep feature name short s/riscv-experimental/riscv
- Add to feature to CI build

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
2024-01-08 14:11:31 +01:00
André Silva 9a27b53e8e core-fellowship: allow infinite demotion period (#2828) 2023-12-31 19:12:36 +01:00
Alexander Samusev f93f461acc [ci] Fix node-bench-regression-guard job (#2732)
After GitLab update it started to remove artifacts from master if PR has
more than 20 commits. PR fixes this for `node-bench-regression-guard`
job

cc https://github.com/paritytech/ci_cd/issues/915
2023-12-18 16:17:52 +01:00
Branislav Kontur d18a682bf7 [ci] Add -D warnings for cargo-check-each-crate job to fail on warnings (#2670)
## Summary

This PR turns on `-D warnings` for `cargo-check-each-crate job` job to
fail on warnings e.g. like this:
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4673130

Before this PR, there was a warning and `cargo-check-each-crate` job did
not fail:
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4641444
```
warning: unused import: `ToTokens`
  --> substrate/primitives/api/proc-macro/src/utils.rs:22:34
   |
22 | use quote::{format_ident, quote, ToTokens};
   |                                  ^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default
warning: `sp-api-proc-macro` (lib) generated 1 warning (run `cargo fix --lib -p sp-api-proc-macro` to apply 1 suggestion)
```

Fixes on the way:
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4641444
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4673265
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4673410
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4673681
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4673836
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4673941
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4674256
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4679328



## Questions
- [ ] why does this check triggers only `cargo check --locked`?
`--all-features` or `--all-targets` are not needed? Or aren't they
avoided intentionally?

---------

Co-authored-by: command-bot <>
2023-12-12 21:01:36 +01:00
Juan Girini a310df263d Move developer-hub to polkadot-sdk-docs (#2598)
This PR is a continuation of
https://github.com/paritytech/polkadot-sdk/pull/2102 and part of an
initiative started here https://hackmd.io/@romanp/rJ318ZCEp
What has been done:
- The content under `docs/*` (with the exception of `docs/mermaid`) has
been moved to `docs/contributor/`
- Developer Hub has been renamed to Polkadot SDK Docs, and the crate has
been renamed from `developer-hub` to `polkadot-sdk-docs`
- The content under `developer-hub/*` has been moved to `docs/sdk`

---
Original PR https://github.com/paritytech/polkadot-sdk/pull/2565, it has
been close due to too many rebase conflicts

---------

Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
Co-authored-by: Egor_P <egor@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
2023-12-05 10:23:24 +01:00
Vladimir Istyufeev eb46b99b29 Disable trace-level logging from the test-linux-stable-int (#2546) 2023-11-29 19:20:05 +02:00
Vladimir Istyufeev 6a417eb9c2 Increase cargo-check-each-crate-macos timeout (#2519) 2023-11-28 13:02:10 +02:00
Marcin S cfa19c37e6 PVF: remove audit log access (#2461) 2023-11-25 18:03:58 +02:00
Marcin S 408af9b32d PVF: Fix unshare "no such file or directory" error (#2426) 2023-11-22 15:45:52 +01:00
Lulu 495d24d730 Add ci check for parity-publish and fix current check issues (#1887)
Co-authored-by: Sergejs Kostjucenko <85877331+sergejparity@users.noreply.github.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
2023-10-31 18:04:31 +00:00
Marcin S a1171e6e81 PVF worker: Maintain lists of used syscalls (#1663)
Co-authored-by: Mira Ressel <mira@parity.io>
2023-10-17 13:58:49 +02:00
Mira Ressel b14018fe48 ci: remove obsolete allow_failure annotations (#1886)
These two jobs are now required by github branch protection settings.
2023-10-17 13:22:02 +03:00
Mira Ressel 447e753323 ci: bump ci image to rust 1.73.0 (#1830)
Co-authored-by: command-bot <>
2023-10-11 19:49:59 +02:00
Bastian Köcher bf90cb0b73 Remove kusama and polkadot runtime crates (#1731)
This pull request is removing the Kusama and Polkadot runtime crates. As
still some crates dependent on the runtime crates, this pull request is
doing some more changes.

- It removes the `hostperfcheck` CLI command. This CLI command could
compare the current node against the standard hardware by doing some
checks. Later we added the hardware benchmark feature to Substrate. This
hardware benchmark is running on every node startup and prints a warning
if the current node is too slow. This makes this CLI command a duplicate
that was also depending on the kusama runtime.

- The pull request is removing the emulated integration tests that were
requiring the Kusama or Polkadot runtime crates.
2023-09-29 09:54:11 +02:00
Maksym H 3d9f5e8bfc update contributing guide and ui-tests scripts (#1668)
- Updated ./docs/CONTRIBUTION.md to clarify how to use command bot and
update ui-tests locally or in PR
- Moved update-ui-tests.sh to a root of project to run them along for
substrate and polkadot together

---------

Co-authored-by: Mira Ressel <mira@parity.io>
2023-09-22 22:48:38 +01:00
Alexander Samusev a414ea7515 [ci] Move additional tests back to test-linux-stable (#1466)
* [ci] Move additional tests back to test-linux-stable

* run slow tests with all tests

* check if test upgrade_version_checks_should_work works

* rm comment
2023-09-11 13:44:42 +02:00
s0me0ne-unkn0wn 9bfb6529d1 Introduce default-members to the workspace root (#1420) 2023-09-09 11:35:26 +02:00
Alexander Samusev 09503b1d2d [ci] Return publish-rustdoc (#1402)
* [WIP][ci] Return publish-rustdoc

* rm files

* fix ref

* add build doc

* add comment

* move test-deterministic-wasm to test stage

* rm test-deterministic-wasm from root

* test publish

* enable pipeline

* add test_deterministic_wasm.sh for resolving conflicts

* rm unused bash script
2023-09-07 13:39:53 +03:00
Alexander Samusev 1346143194 [ci] Enable flacky collector for tests (#1439) 2023-09-07 11:31:18 +02:00
Alexander Samusev ddab7156b4 [ci] Remove runtime-benchmarks from tests (#1335)
* [ci] Remove runtime-benchmarks from tests

* Update .gitlab/pipeline/test.yml

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove ing

* move benchmark tests to additional tests

* rm -q option

* try release profile

* use testnet profile

* move to a separate job

* rm dup

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-09-04 17:58:32 +03:00
Oliver Tale-Yazdi 7768b77d53 Remove old UI test (#1289)
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
2023-08-30 11:32:34 +02:00
Bastian Köcher cbd745c846 Fix node-metrics test (#1287) 2023-08-30 09:48:29 +02:00
Alexander Samusev d81c8cbaa7 [ci] Fix buildah and reorder test-doc dag (#1275) 2023-08-30 09:37:13 +02:00
Alexander Samusev b13a3187f2 [ci] Add DAG (#1244)
* [ci] Add DAG

* add dag

* add more dag and disable deny

* test cancel pipeline

* fix clippy
2023-08-29 17:00:17 +03:00
Alexander Samusev 6e394f84f8 [ci] Add missing components to CI (#1201)
* [ci] Add missing components to CI

* add timestamp

* add pipeline-stopper-artifacts to jobs

* break clippy

* mv definition

* fix clippy

* comment timestamp, rm verbose

* commen cancel

* rm --verbose from build jobs

* disable rusty-cachier before_script

* enable timestamp back

* rollback .gitignore

* rollback .gitignore

* rollback .gitignore
2023-08-28 21:33:16 +03:00
Alexander Samusev 48415ce2a7 [ci] Add experimental feature in tests and cargo check (#1173)
* [ci] Add experimental feature in tests and cargo check

* fix labels GHA

* disable D-labels

* add check license

* add auto-label-issues

* fix CHECK_SPECS for labels

* rm useless commands

* Update .github/workflows/check-labels.yml

* fix

* Fudge license scanner

* remove spellcheck job

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-08-26 17:26:12 +03:00
Alexander Samusev e49493442a Add CI for monorepo (#1145)
* Add CI for monorepo

* fix frame tests

* Format features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add note for skipping tests and disable test-linux-stable-all

* Fix tests and compile issues (#1152)

* Fix feature dependant import

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Bump test timeout

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove feature gate

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add resolver 2

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove old lockfile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Format features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix check-dependency-rules

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* rm test-runtime

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Actually fix script

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* enable cargo-check-each-crate-macos

* Run check-each-crate on 6 machines (#1163)

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-08-25 16:35:22 +02:00