Skip to content

Commit

Permalink
cargo +nightly fmt, add prdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
bennethxyz committed Nov 24, 2024
1 parent aaf788a commit 7c3419a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 33 deletions.
14 changes: 14 additions & 0 deletions prdoc/pr_6514.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: migrate pallet-whitelist to umbrella crate

doc:
- audience: Runtime Dev
description: |
This pull request adapts the frame umbrella crate into pallet-whitelist
by importing existing system into the pallet.

crates:
- name: pallet-whitelist
bump: minor
6 changes: 1 addition & 5 deletions substrate/frame/whitelist/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@
#![cfg(feature = "runtime-benchmarks")]

use super::*;
/*
use frame_benchmarking::v2::*;
use frame_support::traits::EnsureOrigin;
*/
use frame::benchmarking::prelude::*;
#[cfg(test)]
use crate::Pallet as Whitelist;
use frame::benchmarking::prelude::*;

#[benchmarks]
mod benchmarks {
Expand Down
16 changes: 3 additions & 13 deletions substrate/frame/whitelist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,18 @@ extern crate alloc;

use alloc::boxed::Box;
use codec::{DecodeLimit, Encode, FullCodec};
/*
use frame_support::{
dispatch::{GetDispatchInfo, PostDispatchInfo},
ensure,
use frame::{
deps::sp_api,
prelude::*,
traits::{QueryPreimage, StorePreimage},
weights::Weight,
};
*/
use scale_info::TypeInfo;
// use sp_runtime::traits::{Dispatchable, Hash};
use frame::{prelude::*, traits::{QueryPreimage, StorePreimage}, deps::sp_api};

pub use pallet::*;

// #[frame_support::pallet]
#[frame::pallet]
pub mod pallet {
use super::*;
/*
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
*/

#[pallet::config]
pub trait Config: frame_system::Config {
Expand Down
7 changes: 1 addition & 6 deletions substrate/frame/whitelist/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@

use crate as pallet_whitelist;

/*
use frame_support::{construct_runtime, derive_impl};
use frame_system::EnsureRoot;
use sp_runtime::BuildStorage;
*/
use frame::{testing_prelude::*, pallet_macros::derive_impl};
use frame::{pallet_macros::derive_impl, testing_prelude::*};
type Block = frame_system::mocking::MockBlock<Test>;

construct_runtime!(
Expand Down
10 changes: 2 additions & 8 deletions substrate/frame/whitelist/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@

use crate::mock::*;
use codec::Encode;
/*
use frame_support::{
assert_noop, assert_ok,
dispatch::GetDispatchInfo,
use frame::{
testing_prelude::*,
traits::{QueryPreimage, StorePreimage},
weights::Weight,
};
use sp_runtime::{traits::Hash, DispatchError};
*/
use frame::{testing_prelude::*, traits::{StorePreimage, QueryPreimage}};

#[test]
fn test_whitelist_call_and_remove() {
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/whitelist/src/weights.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7c3419a

Please sign in to comment.