Skip to content

Commit ed8958e

Browse files
[stable2409] Backport #5311 (#6805)
Backport #5311 into `stable2409` from Doordashcon. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> Co-authored-by: Doordashcon <jesse.chejieh@gmail.com>
1 parent 8107ab0 commit ed8958e

File tree

6 files changed

+282
-156
lines changed

6 files changed

+282
-156
lines changed

prdoc/pr_5311.prdoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
title: No-op Impl Polling Trait
2+
3+
doc:
4+
- audience: Runtime Dev
5+
description: |
6+
Provide a NoOp implementation of the Polling trait for unit where the trait is defined and skiping benchmarks that necessitate it's definition.
7+
8+
crates:
9+
- name: pallet-core-fellowship
10+
bump: minor
11+
- name: pallet-ranked-collective
12+
bump: minor
13+
- name: pallet-salary
14+
bump: minor
15+
- name: frame-support
16+
bump: minor

substrate/frame/core-fellowship/src/tests/integration.rs

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ use frame_support::{
2121
assert_noop, assert_ok, derive_impl, hypothetically, ord_parameter_types,
2222
pallet_prelude::Weight,
2323
parameter_types,
24-
traits::{ConstU16, EitherOf, IsInVec, MapSuccess, PollStatus, Polling, TryMapSuccess},
24+
traits::{ConstU16, EitherOf, IsInVec, MapSuccess, NoOpPoll, TryMapSuccess},
2525
};
2626
use frame_system::EnsureSignedBy;
27-
use pallet_ranked_collective::{EnsureRanked, Geometric, Rank, TallyOf, Votes};
27+
use pallet_ranked_collective::{EnsureRanked, Geometric, Rank};
2828
use sp_core::{ConstU32, Get};
2929
use sp_runtime::{
3030
bounded_vec,
3131
traits::{Convert, ReduceBy, ReplaceWithDefault, TryMorphInto},
32-
BuildStorage, DispatchError,
32+
BuildStorage,
3333
};
3434
type Class = Rank;
3535

@@ -83,45 +83,6 @@ impl Config for Test {
8383
type MaxRank = ConstU32<9>;
8484
}
8585

86-
pub struct TestPolls;
87-
impl Polling<TallyOf<Test>> for TestPolls {
88-
type Index = u8;
89-
type Votes = Votes;
90-
type Moment = u64;
91-
type Class = Class;
92-
93-
fn classes() -> Vec<Self::Class> {
94-
unimplemented!()
95-
}
96-
fn as_ongoing(_: u8) -> Option<(TallyOf<Test>, Self::Class)> {
97-
unimplemented!()
98-
}
99-
fn access_poll<R>(
100-
_: Self::Index,
101-
_: impl FnOnce(PollStatus<&mut TallyOf<Test>, Self::Moment, Self::Class>) -> R,
102-
) -> R {
103-
unimplemented!()
104-
}
105-
fn try_access_poll<R>(
106-
_: Self::Index,
107-
_: impl FnOnce(
108-
PollStatus<&mut TallyOf<Test>, Self::Moment, Self::Class>,
109-
) -> Result<R, DispatchError>,
110-
) -> Result<R, DispatchError> {
111-
unimplemented!()
112-
}
113-
114-
#[cfg(feature = "runtime-benchmarks")]
115-
fn create_ongoing(_: Self::Class) -> Result<Self::Index, ()> {
116-
unimplemented!()
117-
}
118-
119-
#[cfg(feature = "runtime-benchmarks")]
120-
fn end_ongoing(_: Self::Index, _: bool) -> Result<(), ()> {
121-
unimplemented!()
122-
}
123-
}
124-
12586
/// Convert the tally class into the minimum rank required to vote on the poll.
12687
/// MinRank(Class) = Class - Delta
12788
pub struct MinRankOfClass<Delta>(PhantomData<Delta>);
@@ -154,7 +115,7 @@ impl pallet_ranked_collective::Config for Test {
154115
// Members can exchange up to the rank of 2 below them.
155116
MapSuccess<EnsureRanked<Test, (), 2>, ReduceBy<ConstU16<2>>>,
156117
>;
157-
type Polls = TestPolls;
118+
type Polls = NoOpPoll;
158119
type MinRankOfClass = MinRankOfClass<MinRankOfClassDelta>;
159120
type MemberSwappedHandler = CoreFellowship;
160121
type VoteWeight = Geometric;

0 commit comments

Comments
 (0)