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

Can benchmarking functionality have used externalities extensions? #381

Open
kianenigma opened this issue Oct 31, 2022 · 3 comments
Open
Labels
I5-enhancement An additional feature request.

Comments

@kianenigma
Copy link
Contributor

Having a talk with @cheme about externalities, it appears that a lot of the optional host functions that can be used in some context and not others are declared as:

#[cfg(feature = "std")]
sp_externalities::decl_extension! {
	/// An externalities extension to submit transactions to the pool.
	pub struct TransactionPoolExt(Box<dyn TransactionPool + Send>);
}

But it seems like the benchmarking code is declared right into the main trait Externalities.

Why is this? could it have been done otherwise?

@bkchr
Copy link
Member

bkchr commented Nov 1, 2022

No. It currently could not. The problem is that you need access to the overlay and that overlay is already part of the object that implements the externalities crate. However, if we move everything over to just use extensions, we probably could do the switch for benchmarking to have their own extension and I would like this.

@ggwpez
Copy link
Member

ggwpez commented Nov 2, 2022

You are talking specifically about these functions here?
https://github.com/paritytech/substrate/blob/c8653447fc8ef8d95a92fe164c96dffb37919e85/primitives/externalities/src/lib.rs#L282-L287

We could try feature gating them at least. But that would introduce the runtime-benchmarks feature into some crates which normally dont have it, like sp-state-machine.
Do you think its worth it?

@bkchr
Copy link
Member

bkchr commented Nov 2, 2022

I don't think it is wort it. I would like to solve it as I pointed it out above.

@juangirini juangirini transferred this issue from paritytech/substrate Aug 24, 2023
@the-right-joyce the-right-joyce added I5-enhancement An additional feature request. and removed J0-enhancement labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request.
Projects
Development

No branches or pull requests

4 participants