polkadot-sdk
polkadot-sdk copied to clipboard
NoOp Impl Polling Trait
Adds NoOp implementation for the Polling trait and updates benchmarks in pallet-ranked-collective.
@Doordashcon do you have any reasoning for this?
@bkchr just a follow up on this? https://github.com/polkadot-fellows/runtimes/pull/347#discussion_r1709679890
@bkchr just a follow up on this? polkadot-fellows/runtimes#347 (comment)
The comment is saying that this no-op should be implemented on () or some special NoOp struct.
Implemented Polling for () and updated the tests where we have methods unimplemented!().
Added Default bound.
please review @muharem @bkchr
@Doordashcon can you please fix it as done in this pr https://github.com/paritytech/polkadot-sdk/pull/3049?
frame-omni-bencher results on the Secretary Collective.
Pallet: "pallet_ranked_collective", Extrinsic: "vote", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: `SecretaryCollective::Members` (r:1 w:0)
Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
....
Pallet: "pallet_ranked_collective", Extrinsic: "cleanup_poll", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: `SecretaryCollective::VotingCleanup` (r:1 w:0)
Proof: `SecretaryCollective::VotingCleanup` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`)
@bkchr @muharem please review
It is known that both extrinsics each involve a single read operation. This can be manually accounted for, rather than relying on the default value for a non existent class. Would you agree with this approach @bkchr?
let class_exists = T::Polls::classes().into_iter().next().is_some();
let class = if class_exists {
T::Polls::classes().into_iter().next().unwrap() // Assuming there's at least one class here
} else {
return Err(BenchmarkError::Override(BenchmarkResult::from_weight(
T::DbWeight::get().reads(1),
)));
};
See this.
please review @bkchr
I saw no other way to create an invalid poll for a NoOp Poll than adding From<u8> bound to the Index type
Hopefully we get to backport the Secretary Collective after this is merged @bkchr @muharem
Thanks for the benchmarking tip @ggwpez should be ready to merge now!
@bkchr wondering if there is anything more I can do here?
Successfully created backport PR for stable2407:
- #6804
Successfully created backport PR for stable2409:
- #6805
Successfully created backport PR for stable2412:
- #6806