Skip to content

Commit

Permalink
Refactor pallet-state-trie-migration to fungible::* traits (#1801)
Browse files Browse the repository at this point in the history
## Summary

This PR consolidates `pallet-state-trie-migration` as a part of
#226 /
#171:

`pallet-state-trie-migration`:
- [x] replace `Currency` with `fungible` traits
- [x] run benchmarks
- [x] refactor to `DefaultConfig`

`pallet_nicks`:
- [x]  remove

others:
- [x] remove `as Fn*` or `asFun*` stuff based on discussion
[here](#226 (comment))

---------

Co-authored-by: Richard Melkonian <[email protected]>
Co-authored-by: command-bot <>
  • Loading branch information
bkontur and 0xmovses committed Jan 24, 2024
1 parent a989ddf commit 4374b5d
Show file tree
Hide file tree
Showing 17 changed files with 312 additions and 789 deletions.
15 changes: 0 additions & 15 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ members = [
"substrate/frame/nft-fractionalization",
"substrate/frame/nfts",
"substrate/frame/nfts/runtime-api",
"substrate/frame/nicks",
"substrate/frame/nis",
"substrate/frame/node-authorization",
"substrate/frame/nomination-pools",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ impl pallet_balances::Config for Runtime {
type FreezeIdentifier = ();
// We allow each account to have holds on it from:
// - `NftFractionalization`: 1
type MaxHolds = ConstU32<1>;
// - `StateTrieMigration`: 1
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -1674,6 +1675,7 @@ parameter_types! {
impl pallet_state_trie_migration::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type RuntimeHoldReason = RuntimeHoldReason;
type SignedDepositPerItem = MigrationSignedDepositPerItem;
type SignedDepositBase = MigrationSignedDepositBase;
// An origin that can control the whole pallet: should be Root, or a part of your council.
Expand Down
5 changes: 3 additions & 2 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ConstU32<2>;
type MaxHolds = ConstU32<3>;
}

parameter_types! {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<2>;
type MaxHolds = ConstU32<3>;
type MaxFreezes = ConstU32<1>;
}

Expand Down Expand Up @@ -1689,6 +1689,7 @@ parameter_types! {
impl pallet_state_trie_migration::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type RuntimeHoldReason = RuntimeHoldReason;
type SignedDepositPerItem = MigrationSignedDepositPerItem;
type SignedDepositBase = MigrationSignedDepositBase;
type ControlOrigin = EnsureRoot<AccountId>;
Expand Down
3 changes: 2 additions & 1 deletion substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = ConstU32<1>;
type MaxHolds = ConstU32<6>;
type MaxHolds = ConstU32<7>;
}

parameter_types! {
Expand Down Expand Up @@ -1901,6 +1901,7 @@ impl pallet_state_trie_migration::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ControlOrigin = EnsureRoot<AccountId>;
type Currency = Balances;
type RuntimeHoldReason = RuntimeHoldReason;
type MaxKeyLen = MigrationMaxKeyLen;
type SignedDepositPerItem = MigrationSignedDepositPerItem;
type SignedDepositBase = MigrationSignedDepositBase;
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/alliance/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ parameter_types! {
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type Block = Block;
type AccountData = pallet_balances::AccountData<AccountId>;
type AccountData = pallet_balances::AccountData<u64>;
}

parameter_types! {
Expand Down
49 changes: 0 additions & 49 deletions substrate/frame/nicks/Cargo.toml

This file was deleted.

25 changes: 0 additions & 25 deletions substrate/frame/nicks/README.md

This file was deleted.

Loading

0 comments on commit 4374b5d

Please sign in to comment.