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

Closed
2 tasks done
tsenovilla opened this issue Dec 27, 2024 · 6 comments · Fixed by #7013
Closed
2 tasks done

Unable to properly benchmark pallet_bounties when ED is 0 #7009

tsenovilla opened this issue Dec 27, 2024 · 6 comments · Fixed by #7013
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
@aurexav
Copy link
Contributor

aurexav 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.

@tsenovilla
Copy link
Contributor Author

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.

Thanks for the reply! We were actually thinking in a such a workaround but did wanna to report it anyway as it should imply a simple fix (which is already on its way 😁)

@luispdm
Copy link

luispdm commented Dec 30, 2024

Hi @bkchr. Just wanted to mention that for the same reason some benchmarks fail in pallet_balances too. Specifically, these ones:

- pallet_balances::burn_allow_death
- pallet_balances::burn_keep_alive
- pallet_balances::force_transfer
- pallet_balances::upgrade_accounts
Error: Input("4 benchmarks failed")

In case you wanna include the fix in your PR or link another PR to this issue.

@aurexav
Copy link
Contributor

aurexav commented Dec 30, 2024

Hi @bkchr. Just wanted to mention that for the same reason some benchmarks fail in pallet_balances too. Specifically, these ones:


- pallet_balances::burn_allow_death

- pallet_balances::burn_keep_alive

- pallet_balances::force_transfer

- pallet_balances::upgrade_accounts

Error: Input("4 benchmarks failed")

In case you wanna include the fix in your PR or link another PR to this issue.

I remember there is already a zero ed feature in pallet balances. You need to enable it.

@bkchr
Copy link
Member

bkchr commented Dec 30, 2024

Yeah for pallet-balances you need to enable the insecure_zero_ed feature to make the benchmarks work properly.

@luispdm
Copy link

luispdm commented Dec 30, 2024

Thanks to both of you @AurevoirXavier @bkchr

github-merge-queue bot pushed a commit that referenced this issue Dec 30, 2024
Closes: #7009

---------

Co-authored-by: command-bot <>
github-actions bot pushed a commit that referenced this issue Dec 30, 2024
Closes: #7009

---------

Co-authored-by: command-bot <>
(cherry picked from commit 997db8e)
dudo50 pushed a commit to paraspell-research/polkadot-sdk that referenced this issue Jan 4, 2025
Closes: paritytech#7009

---------

Co-authored-by: command-bot <>
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

Successfully merging a pull request may close this issue.

4 participants