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

NoOp Impl Polling Trait #5311

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

Doordashcon
Copy link
Contributor

@Doordashcon Doordashcon commented Aug 10, 2024

Adds NoOp implementation for the Polling trait and updates benchmarks in pallet-ranked-collective.

@Doordashcon Doordashcon marked this pull request as ready for review September 3, 2024 09:30
@Doordashcon Doordashcon requested a review from a team as a code owner September 3, 2024 09:30
@bkchr
Copy link
Member

bkchr commented Sep 3, 2024

@Doordashcon do you have any reasoning for this?

@Doordashcon
Copy link
Contributor Author

Doordashcon commented Sep 3, 2024

@bkchr just a follow up on this?
polkadot-fellows/runtimes#347 (comment)

@bkchr
Copy link
Member

bkchr commented Sep 10, 2024

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

@Doordashcon Doordashcon changed the title No-op Impl Polling Trait NoOp Impl Polling Trait Sep 10, 2024
@Doordashcon
Copy link
Contributor Author

Doordashcon commented Sep 10, 2024

Implemented Polling for () and updated the tests where we have methods unimplemented!().

@bkchr bkchr requested a review from muharem September 10, 2024 20:40
@bkchr bkchr added the T2-pallets This PR/Issue is related to a particular pallet. label Sep 10, 2024
@paritytech-review-bot paritytech-review-bot bot requested a review from a team September 13, 2024 17:56
@Doordashcon
Copy link
Contributor Author

Added Default bound.

please review @muharem @bkchr

@bkchr
Copy link
Member

bkchr commented Sep 14, 2024

@Doordashcon can you please fix it as done in this pr #3049?

@Doordashcon
Copy link
Contributor Author

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`)

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looking good, just some nitpicks

substrate/frame/referenda/src/types.rs Show resolved Hide resolved
substrate/frame/support/src/traits/voting.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
substrate/frame/ranked-collective/src/benchmarking.rs Outdated Show resolved Hide resolved
@paritytech-review-bot paritytech-review-bot bot requested a review from a team September 24, 2024 19:47
@Doordashcon
Copy link
Contributor Author

@bkchr @muharem please review

@Doordashcon
Copy link
Contributor Author

Doordashcon commented Oct 5, 2024

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),
            )));
      };

@bkchr
Copy link
Member

bkchr commented Oct 7, 2024

See this.

@paritytech-review-bot paritytech-review-bot bot requested a review from a team October 12, 2024 20:29
@Doordashcon
Copy link
Contributor Author

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

@muharem muharem self-requested a review October 28, 2024 10:54
@Doordashcon
Copy link
Contributor Author

Doordashcon commented Nov 7, 2024

Hopefully we get to backport the Secretary Collective after this is merged @bkchr @muharem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants