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

Unable to properly benchmark pallet_bounties when ED is 0 #7009

Open
2 tasks done
tsenovilla opened this issue Dec 27, 2024 · 1 comment
Open
2 tasks done

Unable to properly benchmark pallet_bounties when ED is 0 #7009

tsenovilla opened this issue Dec 27, 2024 · 1 comment
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@tsenovilla
Copy link
Contributor

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

We cannot properly benchmark pallet_bounties in the LAOS runtime, as all the following benchmarks fail:

The following 7 benchmarks failed:
- pallet_bounties::accept_curator
- pallet_bounties::award_bounty
- pallet_bounties::claim_bounty
- pallet_bounties::close_bounty_active
- pallet_bounties::extend_bounty_expiry
- pallet_bounties::propose_curator
- pallet_bounties::unassign_curator
Error: Input("7 benchmarks failed")

Upon investigation, we believe this issue may affect all runtimes where the existential deposit is set to 0, as is our case. This issue in LAOS outlines the root cause of this behavior, but I’ve included the relevant details below for easier tracking.

Concretely, this function is used in benchmarks to fund the treasury account.
If ED is 0, so is T::Currency::minimum_balance(), resulting in the treasury's balance being initialized to 0 before benchmarks that require treasury funding.

As a result, there is no budget available for bounties in the benchmark suite. Consequently, these lines remain unreachable, preventing bounties from getting the Funded status. While not all the failing benchmarks depend directly on the Funded status, they do rely on a flow where the bounty has successfully progressed through that stage, hence the failure.

Steps to reproduce

Set a runtime using pallet_treasury + pallet_bounties as SpendFunds where the existential deposit is 0 and try to benchmark pallet_bounties. LAOS is affected by this issue, so it may be used as reference as well

@tsenovilla tsenovilla added I10-unconfirmed Issue might be valid, but it's not yet known. I2-bug The node fails to follow expected behavior. labels Dec 27, 2024
@tsenovilla tsenovilla changed the title Unable to properly benchmark pallet_bounties in runtimes with existential deposit being 0 Unable to properly benchmark pallet_bounties when ED is 0 Dec 27, 2024
@AurevoirXavier
Copy link
Contributor

AurevoirXavier commented Dec 28, 2024

Generally, I write this code for such issues. (a lot of pallets had such issues in the past)

#[cfg(feature = "runtime-benchmarks")]
const ED = 1;
#[cfg(not(feature = "runtime-benchmarks"))]
const ED = 0;

But it's okay to report such issues and see if we can improve the benchmarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

No branches or pull requests

2 participants