Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

pallet-collective | port to frame v2 #8151

Closed

Conversation

shamb0
Copy link
Contributor

@shamb0 shamb0 commented Feb 18, 2021

Plz kindly ignore this,

Changes moved to #8193

#8193


pallet-collective | port to frame v2

related #7882

⚠️ Breaking Change ⚠️

From https://crates.parity.io/frame_support/attr.pallet.html#checking-upgrade-guidelines

storages now use PalletInfo for module_prefix instead of the one given to decl_storage: Thus any use of this pallet in construct_runtime! should be careful to update name in order not to break storage or to upgrade storage (moreover for instantiable pallet). If pallet is published, make sure to warn about this breaking change.

So users of the collective pallet must be careful about the name they used in construct_runtime!. Hence the runtime-migration label, which might not be needed depending on the configuration of the collective pallet.

@shamb0
Copy link
Contributor Author

shamb0 commented Feb 20, 2021

Hello @thiolliere ,

I hope Frame v2 migration is done,
& ready for review.

Unit test & Benchmarking are passed.

Refactored the Unit test, similar to file structure used in pallet-balance.

Please kindly share your suggestions & comments.

@shamb0 shamb0 marked this pull request as ready for review February 20, 2021 13:14
@bkchr bkchr requested review from gui1117 and ascjones February 22, 2021 12:14
@gui1117 gui1117 added A0-please_review Pull request needs code review. B3-apinoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Feb 22, 2021
@gui1117
Copy link
Contributor

gui1117 commented Feb 22, 2021

related #7882

It will need a polkadot companion or a migration because the pallet prefix used by storage is changing (in general)
also can you add this message to the top comment ?

⚠️ Breaking Change ⚠️

From https://crates.parity.io/frame_support/attr.pallet.html#checking-upgrade-guidelines

storages now use PalletInfo for module_prefix instead of the one given to decl_storage: Thus any use of this pallet in construct_runtime! should be careful to update name in order not to break storage or to upgrade storage (moreover for instantiable pallet). If pallet is published, make sure to warn about this breaking change.

So users of the collective pallet must be careful about the name they used in construct_runtime!. Hence the runtime-migration label, which might not be needed depending on the configuration of the collective pallet.

#![cfg(test)]

#[macro_export]
macro_rules! decl_tests {
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need to wrap test in a macro.
pallet-balance do that in order to run test on 2 different configuration, but here we have only one, thus it is not needed.

}

#[cfg(test)]
mod tests {
Copy link
Contributor

Choose a reason for hiding this comment

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

just to be sure, only trivial change were made in the test isn't it ?

Copy link
Contributor

Choose a reason for hiding this comment

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

at some point I would prefer not to do the refactor in this PR, so it is easier to review

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assumed even pallet file structure needs to be refactored, sorry for my bad assumption 👍 ,

Shall I move the test back to lib.rs ? May be as suggested, will take file restructure part of another PR

let events = System::<T>::events();
let system_event: <T as frame_system::Config>::Event = generic_event.into();
// compare to the last event record
let EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
}

benchmarks_instance! {
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you change this to benchmark ?

NOTE: I think pallet-balance should make use of benchmarks_instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok it is not supported, waiting on #8190

Comment on lines +551 to +553
/// Old name generated by `decl_event`.
// TODO :: Have to re-check is "Note message" required ?
// #[deprecated(note = "use `Event` instead")]
Copy link
Contributor

Choose a reason for hiding this comment

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

better to make it deprecated IMO

ensure!(
!<ProposalOf<T, I>>::contains_key(proposal_hash),
<Error<T, I>>::DuplicateProposal
);
Copy link
Contributor

Choose a reason for hiding this comment

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

these refactor should be done in another PR

Copy link
Contributor

@gui1117 gui1117 Feb 24, 2021

Choose a reason for hiding this comment

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

actually this refactor is fine to me, sorry for having been too nitpicking

shamb0 and others added 7 commits February 24, 2021 10:31
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
…m/paritytech/substrate into shamb0-br1-collective-port-frame-v2

gui-benchmark-pallet-instantiable updates
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants