Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Addresses review comment
  • Loading branch information
gupnik committed Apr 19, 2023
commit a145b7a25ba3a56efeea97177273fd73bee11a1c
22 changes: 11 additions & 11 deletions frame/examples/dev-mode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mod tests;
/// A type alias for the balance type from this pallet's point of view.
type BalanceOf<T> = <T as pallet_balances::Config>::Balance;

// Enable `dev_mode` for this pallet.
/// Enable `dev_mode` for this pallet.
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use super::*;
Expand All @@ -60,7 +60,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
// No need to define a `weight` attribute here because of `dev_mode`.
/// No need to define a `weight` attribute here because of `dev_mode`.
pub fn add_dummy(origin: OriginFor<T>, id: T::AccountId) -> DispatchResult {
ensure_root(origin)?;

Expand All @@ -78,7 +78,7 @@ pub mod pallet {
}

#[pallet::call_index(1)]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think making this optional is also a clear good next step for dev-mode 👍

// No need to define a `weight` attribute here because of `dev_mode`.
/// No need to define a `weight` attribute here because of `dev_mode`.
pub fn set_bar(
origin: OriginFor<T>,
#[pallet::compact] new_value: T::Balance,
Expand All @@ -101,17 +101,17 @@ pub mod pallet {
SetBar { account: T::AccountId, balance: BalanceOf<T> },
}

// The MEL requirement for bounded pallets is skipped by `dev_mode`.
// This means that all storages are marked as unbounded.
// This is equivalent to specifying `#[pallet::unbounded]` on this type definitions.
// When the dev_mode is removed, we would need to implement implement `MaxEncodedLen`.
/// The MEL requirement for bounded pallets is skipped by `dev_mode`.
/// This means that all storages are marked as unbounded.
/// This is equivalent to specifying `#[pallet::unbounded]` on this type definitions.
/// When the dev_mode is removed, we would need to implement implement `MaxEncodedLen`.
#[pallet::storage]
pub type Dummy<T: Config> = StorageValue<_, Vec<T::AccountId>>;

// The Hasher requirement is skipped by `dev_mode`. So, second parameter can be `_`
// and `Blake2_128Concat` is used as a default.
// When the dev_mode is removed, we would need to specify the hasher like so:
// `pub type Bar<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, T::Balance>;`.
/// The Hasher requirement is skipped by `dev_mode`. So, second parameter can be `_`
/// and `Blake2_128Concat` is used as a default.
/// When the dev_mode is removed, we would need to specify the hasher like so:
/// `pub type Bar<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, T::Balance>;`.
#[pallet::storage]
pub type Bar<T: Config> = StorageMap<_, _, T::AccountId, T::Balance>;
}