Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PVF: Add worker check during tests and benches #1771

Merged
merged 16 commits into from
Oct 24, 2023

Conversation

mrcnski
Copy link
Contributor

@mrcnski mrcnski commented Oct 2, 2023

Improves test ergonomics. Please see #1724.

Also:

  • Use an env var for the node version to avoid unnecessary dependencies on polkadot-cli.
  • Add a benchmark for preparation through the host (I needed this bench and had to fix these issues when writing it.)
  • Some random minor fixes.

Related

Closes #1724

@mrcnski mrcnski added the T0-node This PR/Issue is related to the topic “node”. label Oct 2, 2023
@mrcnski mrcnski self-assigned this Oct 2, 2023
@paritytech-ci paritytech-ci requested review from a team October 2, 2023 11:51
.cargo/config.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@s0me0ne-unkn0wn s0me0ne-unkn0wn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, it's an impressive amount of checks for dev-only code! Nothing has caught my eye, looks good!

@mrcnski mrcnski requested a review from ordian October 5, 2023 10:27
panic!("ERROR: Workers do not exist or are not executable. Workers directory: {:?}", workers_path);
}

let node_version = env!("POLKADOT_NODE_VERSION");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is now the reason the version is put into an env variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yessir.


// We don't want to check against the commit hash because we'd have to always rebuild
// the calling crate on every commit.
eprintln!("WARNING: Workers match the node version, but may have changed in recent commits. Please rebuild them if anything funny happens. Workers path: {workers_path:?}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already print this here. So, this doesn't really make any sense to compare the version. If you really want to make it more "safe", you can call here cargo build to ensure the worker are there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this warning won't show up unless -- --nocapture is passed. I left it because it's better than nothing I guess. I think it's still useful to separately check for worker existence and that they're on the same version.

If you really want to make it more "safe", you can call here cargo build to ensure the worker are there.

You mean cargo build in build.rs, every time the version changes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I mean this function does this at "runtime". This is only being used for testing stuff. So, it could ensure that the workers are up to date. It would also make testing easier, as people would not be required to first run cargo build after finding out that the workers are not there.

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would still like that get_and_check_worker_paths just calls cargo build to provide some better UX for tests. However, this isn't a real blocker as the current behavior isn't changed.

@mrcnski
Copy link
Contributor Author

mrcnski commented Oct 20, 2023

I'm considering removing the benches in favor of the one here: https://github.com/paritytech/polkadot-sdk/pull/1192/files#diff-50fee62320022788db79b0efec4a3dd9e9c7060efbcb6af6a4ce27f31392a395. For the measurement I want to get (time of an execution job), it would be better to add a metric and get it by running zombienet. Because right now execution always returns early due to an invalid candidate so I don't get an accurate stat. Edit: oh, we already have such a metric (time_execution).

…ing-tests' into mrcnski/pvf-add-worker-check-during-tests
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: check-tracing
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4063424

@mrcnski mrcnski merged commit e39253c into master Oct 24, 2023
109 of 111 checks passed
@mrcnski mrcnski deleted the mrcnski/pvf-add-worker-check-during-tests branch October 24, 2023 14:22
ordian added a commit that referenced this pull request Oct 26, 2023
* tsv-disabling: (36 commits)
  Removed TODO from test-case for hard-coded delivery fee estimation (#2042)
  Expose collection attributes from `Inspect` trait (#1914)
  `polkadot-parachain-primitives` should not depend on `frame-support`. (#1897)
  [testnet] Align testnet system parachain runtimes using `RelayTreasuryLocation` and `SystemParachains` in the same way (#2023)
  Sort the benchmarks before listing them (#2026)
  publish pallet-root-testing (#2017)
  Contracts: Add benchmarks to include files (#2022)
  Small optimisation to `--profile dev` wasm builds (#1851)
  basic-authorship: Improve time recording and logging (#2010)
  Application Crypto and BEEFY Support for paired (ECDSA,BLS) crypto (#1815)
  [ci] Run check-rust-feature-propagation in pr and master (#2012)
  Improve features dev-ex (#1831)
  Remove obsolete comment. (#2008)
  Refactor candidates test in paras_inherent (#2004)
  PVF: Add worker check during tests and benches (#1771)
  Bump actions/setup-node from 3.8.1 to 4.0.0 (#1997)
  polkadot: enable tikv-jemallocator/unprefixed_malloc_on_supported_platforms (#2002)
  Make `IdentityInfo` generic in `pallet-identity` (#1661)
  Ensure correct variant count in `Runtime[Hold/Freeze]Reason` (#1900)
  `CheckWeight`: Add more logging (#1996)
  ...
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Mar 26, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Mar 27, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T0-node This PR/Issue is related to the topic “node”.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PVF: improve test ergonomics
5 participants