Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Integrate benchmark-overhead command #5137

Merged
merged 17 commits into from
Apr 1, 2022
Merged

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Mar 16, 2022

PS: Integration note for para-chains
Please consider the following MRs when integrating this change: #5270 and paritytech/substrate#12147.

Integrate the benchmark-overhead command from paritytech/substrate#10977 to benchmark the per-block and per-extrinsic execution overhead.

  • Add with_signed_payload! macro which creates SignedPayload for each relay-runtime
  • Add benchmark_inherent_data which creates inherent data for all relay-runtime
  • Integrate benchmark-overhead for each relay-runtime
  • Add test for each relay- and relay-dev-runtime ✨

The only problem that I currently have here is that it prints CurrentBlockRandomness did not provide entropy for every extrinsic or block, I don't know.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez added the A3-in_progress Pull request is in progress. No review needed at this stage. label Mar 16, 2022
@github-actions github-actions bot added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Mar 16, 2022
@ggwpez ggwpez added B1-releasenotes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. labels Mar 16, 2022
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez changed the title Co #10977: Integrate benchmark-overhead command Integrate benchmark-overhead command Mar 17, 2022
@ggwpez
Copy link
Member Author

ggwpez commented Mar 23, 2022

bot rebase

@paritytech-processbot
Copy link

Rebasing

parity-processbot and others added 6 commits March 23, 2022 21:23
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
node/client/src/lib.rs Outdated Show resolved Hide resolved
///
/// This is not done as a trait function since the return type depends on the runtime.
/// This macro therefore uses the same approach as [`with_client!`].
macro_rules! with_raw_payload {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a macro for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is that every runtime has their own SignedExtra and SignedPayload.
These types do not share any trait, so I cannot use a trait instead.
The with_client macro was done for a similar reason which did not work with a trait.

I personally don't like it but did not see an easier solution.

runtime/kusama/src/lib.rs Outdated Show resolved Hide resolved
tests/benchmark_overhead_works.rs Show resolved Hide resolved
tests/benchmark_overhead_works.rs Outdated Show resolved Hide resolved
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Comment on lines 686 to 693
let $extra: runtime::SignedExtra = (
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
frame_system::CheckGenesis::<runtime::Runtime>::new(),
frame_system::CheckMortality::<runtime::Runtime>::from(sp_runtime::generic::Era::mortal(
$period,
$current_block,
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a lot of duplicate code that can continue to be macro-ized?

Copy link
Member Author

@ggwpez ggwpez Mar 29, 2022

Choose a reason for hiding this comment

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

The SignedExtras are slightly different for Polkadot, since they have one more entry. But I can sum up the other three ones, which would make the macro a bit more complicated though.

PS: Shortened it.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez
Copy link
Member Author

ggwpez commented Mar 31, 2022

bot rebase

@paritytech-processbot
Copy link

Rebasing

@ggwpez
Copy link
Member Author

ggwpez commented Apr 1, 2022

I will merge this as-is and then think about a better structure for the commands and how to use them from polkadot.
With the current state we already got the results that we were looking for, so I think its worth it.

@ggwpez
Copy link
Member Author

ggwpez commented Apr 1, 2022

bot merge

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants