-
Notifications
You must be signed in to change notification settings - Fork 186
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
Updated all pallets documentation #484
base: master
Are you sure you want to change the base?
Conversation
@JoshOrndorff Can you please take a look to this PR thnx. |
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 basically good. Thanks for all the work on this.
My only requests are:
- Get the CI passing. There are some broken links that need fixed.
- Follow up about clippy.
@@ -1,5 +1,5 @@ | |||
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service. | |||
|
|||
#![allow(clippy::needless_borrow)] |
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.
Why do we need this? If it is in our code, we should remove the borrow. If this code comes from a Substrate macro, I'm fine with overriding adding this for now. But we should make an upstream PR to make the macro better. Here's an example of one I've done in the past paritytech/substrate#9053
@@ -1,86 +1,111 @@ | |||
#![cfg_attr(not(feature = "std"), no_std)] | |||
#![allow(clippy::unused_unit)] |
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.
Same comment
#[pallet::config] | ||
pub trait Config: frame_system::Config { | ||
/// The overarching event type. | ||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>; |
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.
Oh wow, I didn't realize there were pallets actually using the old decl_ macros still. Good catch.
ensure!( | ||
members.len() < MAX_MEMBERS, | ||
Error::<T>::MembershipLimitReached | ||
); | ||
|
||
// We don't want to add duplicate members, so we check whether the potential new | ||
// member is already present in the list. Because the list is always ordered, we can | ||
// leverage the binary search which makes this check O(log n). | ||
match members.binary_search(&new_member) { | ||
// If the search succeeds, the caller is already a member, so just return | ||
Ok(_) => Err(Error::<T>::AlreadyMember.into()), | ||
// If the search fails, the caller is not a member and we learned the index where | ||
// they should be inserted | ||
Err(index) => { | ||
members.insert(index, new_member.clone()); | ||
Members::<T>::put(members); | ||
Self::deposit_event(Event::MemberAdded(new_member)); | ||
Ok(().into()) | ||
} | ||
} | ||
} |
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.
Is the formatting right here? The syntax highlighting is confusing github. Not sure why though. Maybe this is just fine.
Some time ago all the pallets have been updated from v1 to v2 but the document files were not updated. In this PR I have updated them.
@JoshOrndorff Please take a look and let me know.