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

[frame] #[pallet::composite_enum] improved variant count handling + removed pallet_balances's MaxHolds config #2657

Merged
merged 63 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
746732c
Test for MaxHolds
bkontur Dec 7, 2023
d1dba07
wip
bkontur Dec 13, 2023
535a883
Dedicated test for `composite_enum` and variant count
bkontur Dec 22, 2023
2e8a925
Fix `HoldReason` and `FreezeReason` variant count
bkontur Jan 4, 2024
b752f74
Fix macro for no composite enums
bkontur Jan 5, 2024
80c685c
impl `Get<u32>` for RuntimeFreezeReason/RuntimeHoldReason
bkontur Jan 5, 2024
a2b272a
Set all `MaxHolds = RuntimeHoldReason` and `MaxFreezes = RuntimeFreez…
bkontur Jan 5, 2024
694d230
".git/.scripts/commands/fmt/fmt.sh"
Jan 5, 2024
a0dd0a8
Docs fix
bkontur Jan 5, 2024
71156bb
Update substrate/frame/support/procedural/src/lib.rs
bkontur Jan 8, 2024
2f3c31c
Fix other places with Basti's suggestion
bkontur Jan 8, 2024
6d6e75c
Update substrate/frame/support/procedural/src/lib.rs
bkontur Jan 8, 2024
b84cc1b
Update substrate/frame/support/procedural/src/lib.rs
bkontur Jan 8, 2024
4f5c9c8
Update substrate/frame/support/procedural/src/lib.rs
bkontur Jan 8, 2024
b30e17e
fix
bkontur Jan 8, 2024
b38ddb2
Update substrate/frame/support/procedural/src/construct_runtime/expan…
bkontur Jan 8, 2024
8d9bdf0
Update substrate/frame/support/procedural/src/construct_runtime/expan…
bkontur Jan 8, 2024
9bde28f
`pallet::balances` replace `MaxHolds` with `VariantCountOf<T::Runtime…
bkontur Jan 8, 2024
f759563
Removed unnecessery `impl #scrate::traits::Get<u32> for Runtime*Reason`
bkontur Jan 16, 2024
635724e
Removed `MaxHolds` from everywhere
bkontur Jan 17, 2024
a32b0b0
Fix after removed `Get` impl
bkontur Jan 17, 2024
f43412c
Removed derive macro `CompositeEnumVariantCount` and replace with exp…
bkontur Jan 17, 2024
248790a
fmt
bkontur Jan 17, 2024
9faefd8
One more revert for `MaxFreezes`
bkontur Jan 17, 2024
3c81275
Add additional check for composite enums
bkontur Jan 17, 2024
9b8aa8e
Merge remote-tracking branch 'origin/master' into bko-max-holds-integ…
bkontur Jan 17, 2024
32cf3ff
Fix for multi-instance pallets when `InstanceXYZ` is not specified in…
bkontur Jan 18, 2024
3a4a1ce
Merge remote-tracking branch 'origin/master' into bko-max-holds-integ…
bkontur Jan 18, 2024
bccc074
Fix preimage tests
bkontur Jan 18, 2024
ba7df0b
prdoc
bkontur Jan 19, 2024
6778282
Merge remote-tracking branch 'origin/master' into bko-max-holds-integ…
bkontur Jan 19, 2024
0959bea
prdoc - change audience
bkontur Jan 19, 2024
c637145
prdoc one more time
bkontur Jan 19, 2024
9eca694
removed empty line
bkontur Jan 19, 2024
44b0827
Merge remote-tracking branch 'origin/master' into bko-max-holds-integ…
bkontur Jan 19, 2024
f4cfc2c
Hit me, baby, one more time...
bkontur Jan 19, 2024
5a1b161
Merge remote-tracking branch 'origin/master' into bko-max-holds-integ…
bkontur Jan 24, 2024
d557601
Update substrate/frame/support/procedural/src/pallet/expand/mod.rs
bkontur Jan 24, 2024
48c3d37
Update substrate/frame/support/procedural/src/pallet/expand/mod.rs
bkontur Jan 24, 2024
442f3fd
Update prdoc/pr_2657.prdoc
bkontur Jan 24, 2024
abaf487
Update substrate/frame/support/test/tests/composite_enum.rs
bkontur Jan 24, 2024
2358636
Merge remote-tracking branch 'origin/bko-max-holds-integrity-test' in…
bkontur Jan 24, 2024
7d113e9
Removed unnecessary indexes from `construct_runtime`
bkontur Jan 24, 2024
6a0289a
".git/.scripts/commands/fmt/fmt.sh"
Jan 24, 2024
0cb363a
Fmt? struct vs enum?
bkontur Jan 24, 2024
83e64fe
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Jan 24, 2024
4342247
".git/.scripts/commands/bench/bench.sh" --subcommand=runtime --runtim…
Jan 24, 2024
71c55c7
".git/.scripts/commands/bench/bench.sh" --subcommand=runtime --runtim…
Jan 24, 2024
5af90e7
Merge branch 'master' into bko-max-holds-integrity-test
bkontur Jan 24, 2024
464af0c
Update prdoc/pr_2657.prdoc
bkontur Jan 26, 2024
4015ea0
PR review fixes
bkontur Jan 26, 2024
c869313
Merge remote-tracking branch 'origin/master' into bko-max-holds-integ…
bkontur Jan 26, 2024
77066c8
Merge branch 'master' into bko-max-holds-integrity-test
bkontur Jan 30, 2024
5380371
Merge branch 'master' into bko-max-holds-integrity-test
bkontur Jan 30, 2024
01c39bf
Merge remote-tracking branch 'origin/master' into bko-max-holds-integ…
bkontur Jan 30, 2024
0ce9eca
".git/.scripts/commands/bench-all/bench-all.sh" --pallet=pallet_balances
Jan 31, 2024
3aeb0f8
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
Jan 31, 2024
998ed0f
".git/.scripts/commands/bench-all/bench-all.sh" --pallet=pallet_balances
Jan 31, 2024
53b2f44
".git/.scripts/commands/bench-all/bench-all.sh" --pallet=pallet_balances
Jan 31, 2024
e6552cc
".git/.scripts/commands/bench-all/bench-all.sh" --pallet=pallet_balances
Jan 31, 2024
2d6a3c4
".git/.scripts/commands/bench-all/bench-all.sh" --pallet=pallet_balances
Jan 31, 2024
27a5723
".git/.scripts/commands/bench-all/bench-all.sh" --pallet=pallet_balances
Jan 31, 2024
adbcace
".git/.scripts/commands/bench-all/bench-all.sh" --pallet=pallet_balances
Jan 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}

parameter_types! {
Expand Down
1 change: 0 additions & 1 deletion bridges/snowbridge/parachain/pallets/system/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}

impl pallet_xcm_origin::Config for Test {
Expand Down
1 change: 0 additions & 1 deletion cumulus/pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion cumulus/pallets/xcmp-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion cumulus/parachain-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion cumulus/parachains/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
// We allow each account to have holds on it from:
// - `NftFractionalization`: 1
// - `StateTrieMigration`: 1
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
// We allow each account to have holds on it from:
// - `NftFractionalization`: 1
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion cumulus/test/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/assigned_slots/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/auctions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/crowdloan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/paras_registrar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/common/src/slots/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
4 changes: 1 addition & 3 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,9 @@ impl pallet_balances::Config for Runtime {
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ConstU32<3>;
type MaxFreezes = ConstU32<1>;
}

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

Expand Down
1 change: 0 additions & 1 deletion polkadot/runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
2 changes: 1 addition & 1 deletion polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = RuntimeFreezeReason;

type MaxFreezes = ConstU32<1>;
type MaxHolds = ConstU32<1>;
}

parameter_types! {
Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-builder/src/tests/pay/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-builder/tests/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-simulator/example/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-simulator/example/src/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-simulator/fuzzer/src/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

Expand Down
28 changes: 28 additions & 0 deletions prdoc/pr_2657.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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: "[frame] `#[pallet::composite_enum]` improved variant count handling + removed `pallet_balances`'s `MaxHolds` config"

doc:
- audience: Runtime Dev
description: |
The implementation of `VariantCount` trait for the result composite enums
bkontur marked this conversation as resolved.
Show resolved Hide resolved
like `RuntimeHoldReason` and `RuntimeFreezeReason` was fixed
and is now calculated as the sum of the `VariantCount::VARIANT_COUNT` of all corresponding `#[pallet::composite_enum]`s.
The Balances pallet's `Config` item `type MaxHolds` was removed
and `type Holds` are now bounded to the composite enum `RuntimeHoldReason` variant count,
so the runtime does not need to consider setting correct value for `MaxHolds`.

The implementation of the `VariantCount` trait for resulting composite enums,
bkontur marked this conversation as resolved.
Show resolved Hide resolved
such as `RuntimeHoldReason` and `RuntimeFreezeReason`, has been fixed.
It is now calculated as the sum of `VariantCount::VARIANT_COUNT` for all corresponding `#[pallet::composite_enum]`.
The `Balances` pallet's `Config` item `type MaxHolds` has been removed,
and `type Holds` is now bound to the variant count of the composite enum `RuntimeHoldReason`.
Consequently, the runtime does not need to consider setting the correct value for `MaxHolds`.

notes:
- Remove `type MaxHolds` from the `impl pallet_balances::Config for Runtime` in the runtime.
- When holds are expected to be used, ensure that `type RuntimeHoldReason = RuntimeHoldReason` is set for `impl pallet_balances::Config for Runtime`.

crates:
- name: pallet-balances
1 change: 0 additions & 1 deletion substrate/bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}

parameter_types! {
Expand Down
1 change: 0 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,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = ConstU32<1>;
type MaxHolds = ConstU32<7>;
}

parameter_types! {
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/alliance/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}

const MOTION_DURATION_IN_BLOCKS: BlockNumber = 3;
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/asset-conversion/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}

impl pallet_assets::Config<Instance1> for Test {
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/asset-rate/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
}

Expand Down
Loading
Loading