-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Do not make pallet-identity benchmarks signature-dependent #8179
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
Do not make pallet-identity benchmarks signature-dependent #8179
Conversation
substrate/frame/identity/src/lib.rs
Outdated
|
|
||
| #[cfg(feature = "runtime-benchmarks")] | ||
| /// A set of helper functions for benchmarking. | ||
| type Helper: BenchmarkHelper< |
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.
| type Helper: BenchmarkHelper< | |
| type BenchmarkHelper: ::BenchmarkHelper< |
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 do not have a preference at all on how to name this parameter, but in pallet-nfts it's named Helper, so I thought out of consistency it should be named the same. Just to confirm.
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.
BenchmarkHelper is more expressive.
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.
And we also have a lot of other pallets naming it BenchmarkHelper.
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.
Done in 63c1e13.
| description: | | ||
| - Includes a `BenchmarkHelper` configuration item in `pallet-identity` to handle signing operations. | ||
| - Abstracts away the explicit link with Sr25519 schema in the benchmarks, allowing chains with a different one to be able to run them and calculate the weights. | ||
| - Adds a default implementation for the empty tuple that leaves the code equivalent. |
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.
| - Adds a default implementation for the empty tuple that leaves the code equivalent. | |
| - Adds a default implementation for the empty tuple that leaves the code equivalent. | |
| Adding the following to your implementation of the `frame_identity::Config` should be enough: | |
| ```diff | |
| #[cfg(feature = "runtime-benchmarks")] | |
| type BenchmarkHelper = (); | |
| ``` |
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.
Will add once we address my previous comment.
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.
Done in 63c1e13.
substrate/frame/identity/src/lib.rs
Outdated
| fn signer() -> (Public, AccountId); | ||
| fn sign(signer: &Public, message: &[u8]) -> Signature; |
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.
| fn signer() -> (Public, AccountId); | |
| fn sign(signer: &Public, message: &[u8]) -> Signature; | |
| /// Sign the given `message` with a random account. | |
| /// | |
| /// Should return the public key of this random account and the signature. | |
| fn sign_message(message: &[u8]) -> (Public, Signature); |
Just make this one function. In the benchmarking code you can get the AccountId by calling into_account on the public_key.
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 get the intention of reducing the interface to only one function, but still I don't like the idea, mainly because:
- Again it differs from
pallet-nftsequivalent code. - This prevents from signing twice with the exact same account. Not that it's needed now but adds unnecessary constrains that might bite devs in future iterations of the pallet and likely force to revert the changes and introduce extra noise.
Just my two cents. If you still prefer your proposed approach I'll happily change it, but I thought it was worth discussing.
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.
Done in 00e81d4.
|
@bkchr everything addressed. |
bkchr
left a comment
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.
Looks good.
|
@ggwpez just a friendly ping 😄 |
|
@bkchr just another friendly ping 🙏 |
prdoc/pr_8179.prdoc
Outdated
|
|
||
| crates: | ||
| - name: pallet-identity | ||
| bump: patch |
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.
Adding a config item is a breaking change though
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.
Addrressed in 7bb7da3.
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.
The CI says otherwise, by the way.
| type MaxUsernameLength: Get<u32>; | ||
|
|
||
| #[cfg(feature = "runtime-benchmarks")] | ||
| /// A set of helper functions for benchmarking. |
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.
The comment normally goes above the feature gate.
Can you also please include a line what the default config () means?
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.
That was copy-pasted from elsewhere in the repository, so for sure there will be more cases around in other parts not covered in this PR. Just the heads up.
Addressed in 7bb7da3.
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.
Can you also please include a line what the default config () means?
Missed that part. Done in 926e317.
ggwpez
left a comment
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.
Good modulo the comments, thanks.
|
@moliholy ping |
b6e3da0 to
7bb7da3
Compare
6cb6f5b
Similar to #4756 for `pallet-nfts`, the changes proposed in this PR intend to make benchmarks for `pallet-identity` signature-agnostic by the inclusion of a benchmark helper with sane defaults to handle the signing operations.
* master: (62 commits) release/build-macos-binaries: add missing FEATURES argument (#8816) Add XCM Precompile to `pallet-xcm` (#8693) [Release|CI/CD] Exclude test runtimes from the runtimes build (#8820) Add freebsd sysinfo for telemetry (#7985) release-reusable-rc-build: add optional `features` input that can be considered for nodes building (#8755) [Staking] Cleanups and some improvements (#8701) Fix typos in 3 files in Implementers Guide (#8799) Update `RemoteExporter` docs to reflect removal of `forward_id_for` (#8795) Snowbridge: enforce fee when registering Polkadot native asset (#8725) Bump the ci_dependencies group across 1 directory with 7 updates (#8788) Docker hub 'master' image short sha (#8790) [Release|CI/CD] Combine branch-off and RC automation flows (#8754) Move Transaction depth limit checks (#8750) Add genesis presets for remaining runtimes in polkadot-parachain-bin (#8426) Do not make pallet-identity benchmarks signature-dependent (#8179) Introduction of Approval Slashes [Disabling Strategy Stage 4] (#6827) [AHM] Prepare For Westend Cleanup (#8715) Actually use RP offset in YAP parachain (#8745) [AHM] Relax the requirement for RC-Client to receive +1 session reports (#8702) Don't read storage items in logging (#8749) ...
Backport #8179 into stable2412. This is to allow runtimes in `stable2412` that don't use SR25519 to correctly benchmark `pallet-identity` --------- Co-authored-by: Egor_P <[email protected]>
This brings in `stable2506` Polkadot SDK, and integrates many new features. Integrated breaking changes to be verified by the original authors: - [x] ~paritytech/polkadot-sdk#8127 @kianenigma @Ank4n~ This will come in with AHM, and not before. - [x] paritytech/polkadot-sdk#7597 @gui1117 - [x] paritytech/polkadot-sdk#8254 @bkchr - [x] paritytech/polkadot-sdk#7592 @bkontur - [x] paritytech/polkadot-sdk#8382 @UtkarshBhardwaj007 - [x] paritytech/polkadot-sdk#8021 @serban300 - [x] paritytech/polkadot-sdk#8344 @serban300 - [x] paritytech/polkadot-sdk#8262 @athei - [x] paritytech/polkadot-sdk#8584 @athei - [x] paritytech/polkadot-sdk#8299 @skunert - [x] paritytech/polkadot-sdk#8652 @pgherveou - [x] paritytech/polkadot-sdk#8554 @pgherveou - [x] paritytech/polkadot-sdk#8281 @mrshiposha - [x] paritytech/polkadot-sdk#7730 @franciscoaguirre - [x] paritytech/polkadot-sdk#8599 @yrong @claravanstaden - [x] paritytech/polkadot-sdk#8531 @bkontur - [x] paritytech/polkadot-sdk#8409 @kianenigma - [x] paritytech/polkadot-sdk#9137 @franciscoaguirre - [x] paritytech/polkadot-sdk#7944 @bkontur - [x] paritytech/polkadot-sdk#8179 @bkontur - [x] paritytech/polkadot-sdk#8037 @yrong --------- Co-authored-by: GitHub Action <[email protected]> Co-authored-by: claravanstaden <[email protected]> Co-authored-by: Branislav Kontur <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Alain Brenzikofer <[email protected]> Co-authored-by: kianenigma <[email protected]> Co-authored-by: Francisco Aguirre <[email protected]> Co-authored-by: ron <[email protected]> Co-authored-by: joe petrowski <[email protected]> Co-authored-by: Overkillus <[email protected]>
Similar to #4756 for `pallet-nfts`, the changes proposed in this PR intend to make benchmarks for `pallet-identity` signature-agnostic by the inclusion of a benchmark helper with sane defaults to handle the signing operations.
Similar to #4756 for
pallet-nfts, the changes proposed in this PR intend to make benchmarks forpallet-identitysignature-agnostic by the inclusion of a benchmark helper with sane defaults to handle the signing operations.