Skip to content

[benchmarking] Reset to genesis storage after each run#5655

Merged
bkontur merged 22 commits into
masterfrom
oty-omni-bencher-fix
Sep 22, 2024
Merged

[benchmarking] Reset to genesis storage after each run#5655
bkontur merged 22 commits into
masterfrom
oty-omni-bencher-fix

Conversation

@ggwpez

@ggwpez ggwpez commented Sep 9, 2024

Copy link
Copy Markdown
Member

The genesis state is currently partially provided via OverlayedChanges, but these changes are reset by the runtime after the first repetition, causing the second repitition to use an invalid genesis state.

Changes:

  • Provide the genesis state as a Storage without any OverlayedChanges to make it work correctly with repetitions.
  • Add --genesis-builder-preset option to use different genesis preset names.
  • Improve error messages.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez marked this pull request as draft September 9, 2024 17:37
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Sep 9, 2024
@ggwpez ggwpez marked this pull request as ready for review September 9, 2024 18:10
@ggwpez ggwpez requested a review from a team as a code owner September 9, 2024 18:10
@ggwpez ggwpez requested a review from bkontur September 9, 2024 19:30
Comment thread substrate/utils/frame/benchmarking-cli/src/pallet/mod.rs Outdated

@bkontur bkontur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

I will rebase #5327 tomorrow.
There is commit with enabling of the new short benchmarking CI with frame-omni-bencher, so BridgeHubRococo with frame-omni-bencher fails there, so after rebase it should work.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez requested review from a team as code owners September 10, 2024 17:10
Comment thread prdoc/pr_5655.prdoc
doc:
- audience: Runtime Dev
description: |-
The genesis state is currently partially provided via `OverlayedChanges`, but these changes are reset by the runtime after the first repetition, causing the second repitition to use an invalid genesis state.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

but these changes are reset by the runtime after the first repetition

You mean here that this was overridden and not reset?

Comment thread substrate/utils/frame/benchmarking-cli/src/pallet/command.rs

@skunert skunert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay this is funny, did not see this PR but had similar thoughts today: #5694

While at it, should we fix issue 2a from the linked issue too?

}

/// Convert some overlayed changes to a storage.
fn changes_to_storage<H: Hash>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not get rid of all of this and genesis_from_runtime and just use GenesisConfigBuilderRuntimeCaller? It has all the machinery ready and we get rid of the manual json merging stuff too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd also try using GenesisConfigBuilderRuntimeCaller to have genesis storage building in one place. If something is missing it can be adjusted / reworked.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I changed it now.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez requested a review from skunert September 13, 2024 17:14
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>
github-merge-queue Bot pushed a commit that referenced this pull request Sep 22, 2024
It is a first step for switching to the `frame-omni-bencher` for CI.

This PR includes several changes related to generating chain specs plus:

- [x] pallet `assigned_slots` fix missing `#[serde(skip)]` for phantom
- [x] pallet `paras_inherent` benchmark fix - cherry-picked from
#5688
- [x] migrates `get_preset` to the relevant runtimes
- [x] fixes Rococo genesis presets - does not work
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7317249
- [x] fixes Rococo benchmarks for CI 
- [x] migrate westend genesis
- [x] remove wococo stuff

Closes: #5680

## Follow-ups
- Fix for frame-omni-bencher
#5655
- Enable new short-benchmarking CI -
#5706
- Remove gitlab pipelines for short benchmarking
- refactor all Cumulus runtimes to use `get_preset` -
#5704
- #5705
- #5700
- [ ] Backport to the stable

---------

Co-authored-by: command-bot <>
Co-authored-by: ordian <noreply@reusable.software>
bkontur added a commit that referenced this pull request Sep 22, 2024
It is a first step for switching to the `frame-omni-bencher` for CI.

This PR includes several changes related to generating chain specs plus:

- [x] pallet `assigned_slots` fix missing `#[serde(skip)]` for phantom
- [x] pallet `paras_inherent` benchmark fix - cherry-picked from
#5688
- [x] migrates `get_preset` to the relevant runtimes
- [x] fixes Rococo genesis presets - does not work
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7317249
- [x] fixes Rococo benchmarks for CI
- [x] migrate westend genesis
- [x] remove wococo stuff

Closes: #5680

- Fix for frame-omni-bencher
#5655
- Enable new short-benchmarking CI -
#5706
- Remove gitlab pipelines for short benchmarking
- refactor all Cumulus runtimes to use `get_preset` -
#5704
- #5705
- #5700
- [ ] Backport to the stable

---------

Co-authored-by: command-bot <>
Co-authored-by: ordian <noreply@reusable.software>
(cherry picked from commit 8735c66)
Comment thread prdoc/pr_5655.prdoc Outdated
@bkontur

bkontur commented Sep 22, 2024

Copy link
Copy Markdown
Contributor

@bkontur bkontur enabled auto-merge September 22, 2024 21:56
@bkontur bkontur added this pull request to the merge queue Sep 22, 2024
Merged via the queue into master with commit 2e4e5bf Sep 22, 2024
@bkontur bkontur deleted the oty-omni-bencher-fix branch September 22, 2024 23:03
@paritytech-cmd-bot-polkadot-sdk

Copy link
Copy Markdown
Contributor

Created backport PR for stable2407:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-5655-to-stable2407
git worktree add --checkout .worktree/backport-5655-to-stable2407 backport-5655-to-stable2407
cd .worktree/backport-5655-to-stable2407
git reset --hard HEAD^
git cherry-pick -x 2e4e5bf2fd0ae19fa38951c7e5f495dd1453b2bb
git push --force-with-lease

github-actions Bot pushed a commit that referenced this pull request Sep 22, 2024
The genesis state is currently partially provided via
`OverlayedChanges`, but these changes are reset by the runtime after the
first repetition, causing the second repitition to use an invalid
genesis state.

Changes:
- Provide the genesis state as a `Storage` without any
`OverlayedChanges` to make it work correctly with repetitions.
- Add `--genesis-builder-preset` option to use different genesis preset
names.
- Improve error messages.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: ggwpez <ggwpez@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
(cherry picked from commit 2e4e5bf)
@paritytech-cmd-bot-polkadot-sdk

Copy link
Copy Markdown
Contributor

Successfully created backport PR for stable2409:

ggwpez added a commit that referenced this pull request Sep 24, 2024
Backport #5655 into `stable2409` from ggwpez.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

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

bkontur commented Sep 30, 2024

Copy link
Copy Markdown
Contributor

@ggwpez Oliver, we probably didn’t realize this earlier, but with this PR, frame-omni-bencher now requires get_preset("development") from the runtime. Otherwise, the benchmarking fails. This creates a problem for runtimes that do not implement get_preset, e.g., Kitchensink is missing it, and several testnet runtimes are now failing: #5706 — due to the missing get_preset("development"). Here's the issue to address this. The question is, should omni-bencher be this strict, or should it work with a get_preset -> None result?

cc: @mordamax

@ggwpez

ggwpez commented Nov 25, 2024

Copy link
Copy Markdown
Member Author

We have a flag to make it run with None, but the benchmarks themselves are possibly not written in a way that this would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T1-FRAME This PR/Issue is related to core FRAME, the framework.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants