Skip to content
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

Migrate pallet-recovery to umbrella crate #6894

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
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
7 changes: 1 addition & 6 deletions Cargo.lock

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

24 changes: 4 additions & 20 deletions substrate/frame/recovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,24 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
frame = { workspace = true, features = ["experimental", "runtime"] }

[dev-dependencies]
pallet-balances = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }

[features]
default = ["std"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
'frame-benchmarking',
"frame/runtime-benchmarks",
]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"frame/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame/try-runtime",
"pallet-balances/try-runtime",
"sp-runtime/try-runtime",
]
5 changes: 1 addition & 4 deletions substrate/frame/recovery/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ use super::*;

use crate::Pallet;
use alloc::{boxed::Box, vec, vec::Vec};
use frame_benchmarking::v2::*;
use frame_support::traits::{Currency, Get};
use frame_system::RawOrigin;
use sp_runtime::traits::Bounded;
use frame::{benchmarking::prelude::*, traits::Currency};

const SEED: u32 = 0;
const DEFAULT_DELAY: u32 = 0;
Expand Down
18 changes: 7 additions & 11 deletions substrate/frame/recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,11 @@ extern crate alloc;
use alloc::{boxed::Box, vec::Vec};
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{CheckedAdd, CheckedMul, Dispatchable, SaturatedConversion, StaticLookup},
RuntimeDebug,
};

use frame_support::{
dispatch::{GetDispatchInfo, PostDispatchInfo},
use frame::{
arithmetic::ArithmeticError,
prelude::*,
traits::{BalanceStatus, Currency, ReservableCurrency},
BoundedVec,
};

pub use pallet::*;
Expand Down Expand Up @@ -211,12 +207,12 @@ pub struct RecoveryConfig<BlockNumber, Balance, Friends> {
threshold: u16,
}

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

#[pallet::pallet]
pub struct Pallet<T>(_);
Expand Down
9 changes: 2 additions & 7 deletions substrate/frame/recovery/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@
//! Test utilities

use super::*;

use crate as recovery;
use frame_support::{
derive_impl, parameter_types,
traits::{OnFinalize, OnInitialize},
};
use sp_runtime::BuildStorage;
use frame::{deps::sp_io, testing_prelude::*};

type Block = frame_system::mocking::MockBlock<Test>;

frame_support::construct_runtime!(
construct_runtime!(
pub enum Test
{
System: frame_system,
Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/recovery/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
//! Tests for the module.

use super::*;
use frame_support::{assert_noop, assert_ok, traits::Currency};
use mock::{

use crate::mock::{
new_test_ext, run_to_block, Balances, BalancesCall, MaxFriends, Recovery, RecoveryCall,
RuntimeCall, RuntimeOrigin, Test,
};
use sp_runtime::{bounded_vec, traits::BadOrigin};
use frame::{testing_prelude::*, traits::BadOrigin};

#[test]
fn basic_setup_works() {
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/recovery/src/weights.rs

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

2 changes: 2 additions & 0 deletions substrate/frame/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ pub mod testing_prelude {
pub use sp_io::TestExternalities;

pub use sp_io::TestExternalities as TestState;

pub use sp_runtime::bounded_vec;
}

/// All of the types and tools needed to build FRAME-based runtimes.
Expand Down
Loading