-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Migrate pallet-balances to pallet attribute macro #7936
Conversation
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.
LGTM. We need a polkadot companion, though.
Companion PR needs approving for CI to pass: paritytech/polkadot#2331 Done ✔️ |
Just waiting for a second approval, @thiolliere @dvdplm |
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.
LGTM but I'd feel more comfortable if @thiolliere gave thumbs up as well, this being a pretty important pallet...
i haven't review yet, but would have prefered to fix #7949 first, as with the incoming next release of substrate, user pallets can start failing due to their pallet info being |
Ok we will wait until #7949 is fully complete before merging (is there an appropriate label for that?). I'll migrate some more tests this afternoon. |
on-ice can be appopriate |
type AccountStore: StoredMap<Self::AccountId, AccountData<Self::Balance>>; | ||
#[pallet::pallet] | ||
#[pallet::generate_store(pub(super) trait Store)] | ||
pub struct Pallet<T, I=()>(PhantomData<(T, I)>); |
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.
@thiolliere this feels a bit boilerplatey. can we have the macro automatically do the PhantomData
dance if we just use a _
here?
pub struct Pallet<T, I=()>(PhantomData<(T, I)>); | |
pub struct Pallet<T, I=()>(_); |
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.
On the other hand it would go against the idea of the new syntax being valid Rust.
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.
yes, here is the PR #8091
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.
On the other hand it would go against the idea of the new syntax being valid Rust.
it is true, but at least this syntax is accepted by syn
crate thus we have a relatively good syntax parser.
Hopefully, the expansion is documented enough not to confuse too much.
And it is same logic as in #[pallet::storage]
: _
is a type to be replaced by macro.
# Conflicts: # frame/contracts/src/tests.rs
#7949 now done, so ready for a look @thiolliere |
bot merge |
Trying merge. |
Part of #7882.
Converts the
Balances
pallet to the new pallet attribute macro introduced in #6877.Following the upgrade guidelines here: https://crates.parity.io/frame_support/attr.pallet.html#upgrade-guidelines.
From https://crates.parity.io/frame_support/attr.pallet.html#checking-upgrade-guidelines
So users of the
Balances
pallet must be careful about the name they used inconstruct_runtime!
. Hence theruntime-migration
label, which might not be needed depending on the configuration of theBalances
pallet.polkadot companion: paritytech/polkadot#2331