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

Migrate pallet-preimage to benchmark v2 #6277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AurevoirXavier
Copy link
Contributor

#[benchmark]
fn request_preimage() {
let o = T::ManagerOrigin::try_successful_origin()
.expect("ManagerOrigin has no successful origin required for the benchmark");
Copy link
Member

Choose a reason for hiding this comment

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

Why is this an expect now? The pallet is also usable without manager origin.
It returned BenchmarkError::Weightless before.

Copy link
Contributor Author

@AurevoirXavier AurevoirXavier Oct 30, 2024

Choose a reason for hiding this comment

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

I think that error is meaningless.

Same as:

let origin =
T::SpendOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let beneficiary = T::Lookup::lookup(beneficiary_lookup.clone()).unwrap();
#[extrinsic_call]
_(origin as T::RuntimeOrigin, value, beneficiary_lookup);

It was not part of the benchmark(#[extrinsic_call]) code block. Additionally, I believe the original .expect message is more readable. So I reuse it.

What do you suggest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also can be found here

.expect("ManagerOrigin has no successful origin required for the benchmark");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants