-
Notifications
You must be signed in to change notification settings - Fork 810
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
Add support for feature pallet_balances/insecure_zero_ed
in benchmarks and testing
#7379
Conversation
User @manuelmauro, please sign the CLA here. |
bot bench substrate-pallet --features=insecure_zero_ed --pallet=pallet_balances |
@re-gius https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8112528 was started for your command Comment |
/cmd bench substrate-pallet --features=insecure_zero_ed --pallet=pallet_balances |
Command "bench substrate-pallet --features=insecure_zero_ed --pallet=pallet_balances" has started 🚀 See logs here |
@re-gius Command |
/cmd bench substrate-pallet --pallet=pallet_balances |
Command "bench substrate-pallet --pallet=pallet_balances" has started 🚀 See logs here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Review required! Latest push from author must always be reviewed |
/cmd bench substrate-pallet --pallet=pallet_balances |
Command "bench substrate-pallet --pallet=pallet_balances" has started 🚀 See logs here |
if cfg!(feature = "insecure_zero_ed") { | ||
assert_eq!(Balances::<T, I>::free_balance(&caller), balance - transfer_amount); | ||
} else { | ||
assert_eq!(Balances::<T, I>::free_balance(&caller), Zero::zero()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are not required, since this change: 1c4141a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the linked change was not enough as some benchmarks/tests rely on the side-effect of an account being removed as its balance goes below the ExistentialBalance
threshold.
To reproduce the issue:
cargo test -p pallet-balances --features runtime-benchmarks,insecure_zero_ed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double-checked it on master
and it's right, those tests fail with the insecure_zero_ed
feature flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I forgot the runtime-benchmarks
flag earlier :D
@@ -1136,6 +1136,7 @@ fn operations_on_dead_account_should_not_change_state() { | |||
|
|||
#[test] | |||
#[should_panic = "The existential deposit must be greater than zero!"] | |||
#[cfg(not(feature = "insecure_zero_ed"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this is required.
@manuelmauro I think we should also update I think it is the only thing missing to allow runtimes to use |
Command "bench substrate-pallet --pallet=pallet_balances" has failed ❌! See logs here Command output:✅ Successful benchmarks of runtimes/pallets: |
Command "bench substrate-pallet --features=insecure_zero_ed --pallet=pallet_balances" has failed ❌! See logs here Command output:✅ Successful benchmarks of runtimes/pallets: |
Command "bench substrate-pallet --pallet=pallet_balances" has failed ❌! See logs here Command output:✅ Successful benchmarks of runtimes/pallets: |
Head branch was pushed to by a user without write access
@bkchr just added the missing logic, all calls are now working when |
Head branch was pushed to by a user without write access
80e30ec
* master: Remove warnings by cleaning up the `Cargo.toml` (#7416) [Backport] Version bumps from stable2412-1 + prdocs reorg (#7401) fix pre-dispatch PoV underweight for ParasInherent (#7378) malus-collator: implement malicious collator submitting same collation to all backing groups (#6924) `fatxpool`: use tracing for logging (#6897) Improvements for Weekly bench (#7390) Replace derivative dependency with derive-where (#7324) Add support for feature `pallet_balances/insecure_zero_ed` in benchmarks and testing (#7379) Fix Snowbridge benchmark tests (#7296) Bridges small nits/improvements (#7383) Migrating cumulus-pallet-session-benchmarking to Benchmarking V2 (#6564) [pallet-revive] implement the block author API (#7198) Use checked math in frame-balances named_reserve (#7365) move installation of frame-omni-bencher into a cmd.py itself (#7372) remove old bench & revert the frame-weight-template (#7362) ci: fix workflow permissions (#7366) [net/libp2p] Use raw `Identify` observed addresses to discover external addresses (#7338) Improve `set_validation_data` error message. (#7359) Implement pallet view function queries (#4722)
…rks and testing (paritytech#7379) # Description Currently benchmarks and tests on pallet_balances would fail when the feature insecure_zero_ed is enabled. This PR allows to run such benchmark and tests keeping into account the fact that accounts would not be deleted when their balance goes below a threshold. ## Integration *In depth notes about how this PR should be integrated by downstream projects. This part is mandatory, and should be reviewed by reviewers, if the PR does NOT have the `R0-Silent` label. In case of a `R0-Silent`, it can be ignored.* ## Review Notes *In depth notes about the **implementation** details of your PR. This should be the main guide for reviewers to understand your approach and effectively review it. If too long, use [`<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details)*. *Imagine that someone who is depending on the old code wants to integrate your new code and the only information that they get is this section. It helps to include example usage and default value here, with a `diff` code-block to show possibly integration.* *Include your leftover TODOs, if any, here.* # Checklist * [x] My PR includes a detailed description as outlined in the "Description" and its two subsections above. * [x] My PR follows the [labeling requirements]( https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process ) of this project (at minimum one label for `T` required) * External contributors: ask maintainers to put the right label on your PR. * [x] I have made corresponding changes to the documentation (if applicable) * [x] I have added tests that prove my fix is effective or that my feature works (if applicable) You can remove the "Checklist" section once all have been checked. Thank you for your contribution! ✄ ----------------------------------------------------------------------------- --------- Co-authored-by: Rodrigo Quelhas <[email protected]>
…rks and testing (#7379) # Description Currently benchmarks and tests on pallet_balances would fail when the feature insecure_zero_ed is enabled. This PR allows to run such benchmark and tests keeping into account the fact that accounts would not be deleted when their balance goes below a threshold. ## Integration *In depth notes about how this PR should be integrated by downstream projects. This part is mandatory, and should be reviewed by reviewers, if the PR does NOT have the `R0-Silent` label. In case of a `R0-Silent`, it can be ignored.* ## Review Notes *In depth notes about the **implementation** details of your PR. This should be the main guide for reviewers to understand your approach and effectively review it. If too long, use [`<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details)*. *Imagine that someone who is depending on the old code wants to integrate your new code and the only information that they get is this section. It helps to include example usage and default value here, with a `diff` code-block to show possibly integration.* *Include your leftover TODOs, if any, here.* # Checklist * [x] My PR includes a detailed description as outlined in the "Description" and its two subsections above. * [x] My PR follows the [labeling requirements]( https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process ) of this project (at minimum one label for `T` required) * External contributors: ask maintainers to put the right label on your PR. * [x] I have made corresponding changes to the documentation (if applicable) * [x] I have added tests that prove my fix is effective or that my feature works (if applicable) You can remove the "Checklist" section once all have been checked. Thank you for your contribution! ✄ ----------------------------------------------------------------------------- --------- Co-authored-by: Rodrigo Quelhas <[email protected]>
Description
Currently benchmarks and tests on pallet_balances would fail when the feature insecure_zero_ed is enabled. This PR allows to run such benchmark and tests keeping into account the fact that accounts would not be deleted when their balance goes below a threshold.
Integration
In depth notes about how this PR should be integrated by downstream projects. This part is mandatory, and should be
reviewed by reviewers, if the PR does NOT have the
R0-Silent
label. In case of aR0-Silent
, it can be ignored.Review Notes
In depth notes about the implementation details of your PR. This should be the main guide for reviewers to
understand your approach and effectively review it. If too long, use
<details>
.Imagine that someone who is depending on the old code wants to integrate your new code and the only information that
they get is this section. It helps to include example usage and default value here, with a
diff
code-block to showpossibly integration.
Include your leftover TODOs, if any, here.
Checklist
T
required)You can remove the "Checklist" section once all have been checked. Thank you for your contribution!
✄ -----------------------------------------------------------------------------