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

Switch frame-benchmarking to runtime APIs #2888

Open
ggwpez opened this issue Jan 9, 2024 · 0 comments
Open

Switch frame-benchmarking to runtime APIs #2888

ggwpez opened this issue Jan 9, 2024 · 0 comments
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework. T4-runtime_API This PR/Issue is related to runtime APIs. T12-benchmarks This PR/Issue is related to benchmarking and weights.

Comments

@ggwpez
Copy link
Member

ggwpez commented Jan 9, 2024

Currently the ExtrinsicBuilder is passed as CLI argument to the subcommand, instead of being an API on the runtime.

Something like could be enough:

// runtime API:
pub trait BenchmarkExtrinsicBuilder {
	/// List all available extrinsics that can be build with `build_extrinsic`.
	fn list() -> Vec<BenchmarkExtrinsicInfo>;

	/// Try to build an extrinsic and return the encoded extrinsic and the cursor.
	///
	/// The extrinsic is assumed to be dispatchable within the current block.
	///
	/// Cursor can be used to generate multiple extrinsics, in case that the generation is not stateless. One example would be an account nonce. Returning `None` as the next cursor indicates that no further extrinsic can be generated. The benchmarking framework may treat this as error.
	fn build_extrinsic(info: &BenchmarkExtrinsicInfo, cursor: u32) -> (OpaqueExtrinsic, Option<u32>);
}

pub struct BenchmarkExtrinsicInfo {
	pub pallet: RuntimeString,
	pub extrinsic: RuntimeString,
}

Affected are the benchmark extrinsic and benchmark overhead commands.

@ggwpez ggwpez added T1-FRAME This PR/Issue is related to core FRAME, the framework. T4-runtime_API This PR/Issue is related to runtime APIs. T12-benchmarks This PR/Issue is related to benchmarking and weights. labels Jan 9, 2024
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. T4-runtime_API This PR/Issue is related to runtime APIs. T12-benchmarks This PR/Issue is related to benchmarking and weights.
Projects
Development

No branches or pull requests

1 participant