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

Disable logging in runtime when enabling runtime-benchmarks #2901

Closed
wants to merge 2 commits into from

Conversation

athei
Copy link
Member

@athei athei commented Apr 19, 2021

Same PR as paritytech/substrate#8638

This is different from the substrate PR in that here the logs are automatically disabled whenever the runtime-benchmarks feature is supplied. On substrate this is not possible because of tests which parse log output.

@athei athei added A0-please_review Pull request needs code review. 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 Apr 19, 2021
@@ -102,6 +102,7 @@ std = [
"xcm/std",
]
runtime-benchmarks = [
"sp-api/disable-logging",
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we need to enable this in other places as well?

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 common runtime is a dependency of all other runtimes. AFAIK this is the only place where we need to at it. It does not seem to be applicable to bridge and xcm runtimes because those don't depend on sp-api. Maybe someone else can step in with more knowledge about those runtimes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like we could have some kind of test to make sure we don't make this mistake again.

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean having logging enabled during benchmarking by accident?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, but it is probably a PITA

Copy link
Member Author

@athei athei Apr 21, 2021

Choose a reason for hiding this comment

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

I have no idea on how to construct such a test other than some benchmark which looks for regressions. And something like that would be really nice to have anyways. After each benchmarks of the contracts pallet I need to manually look through a ton of benchmarks and scan for regressions. Would be nice to have this automated.

@shawntabrizi
Copy link
Member

shawntabrizi commented Apr 19, 2021

Do we need to re-run any benchmarks?

@athei
Copy link
Member Author

athei commented Apr 19, 2021

Every benchmark which was ran since paritytech/substrate#8128 was merged is potentially flawed when it emits a substantial amount of log messages.

That said, for pallet_contracts only one benchmark was affected.

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.

It would be nice if we could try to enable the disable-logging feature for sp-api in the benchmarking crate, to not having the requirement to add this everywhere

@shawntabrizi
Copy link
Member

@bkchr can we do this by simply adding sp-api to the cargo.toml of the benchmarking stuff?

@bkchr
Copy link
Member

bkchr commented Apr 19, 2021

Yeah, this is what I wanted to express with my message xD

@athei
Copy link
Member Author

athei commented Apr 19, 2021

Ok I got it. Would be more appropriate to discuss this in the substrate version of this PR, though. I will update that one with your suggestion.

@bkchr
Copy link
Member

bkchr commented Apr 19, 2021

I tested it and it doesn't work...

Cargo feature resolution is just the best piece of software I know... :(

@athei
Copy link
Member Author

athei commented Apr 21, 2021

I tested it and it doesn't work...

Cargo feature resolution is just the best piece of software I know... :(

I can confirm that. So we just keep this PR the way it is.

@athei
Copy link
Member Author

athei commented Apr 22, 2021

Superseded by paritytech/substrate#8655

@athei athei closed this Apr 22, 2021
@athei athei deleted the at-disable-logging-on-benchmark branch September 25, 2022 10:04
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.

4 participants