Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Nomination Pools #10694

Merged
merged 336 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
336 commits
Select commit Hold shift + click to select a range
44ee49e
Update frame/nomination-pools/src/lib.rs
emostov Feb 8, 2022
e6fb3f5
Add admin roles and make some calls permissionless
emostov Feb 8, 2022
2b6db6a
Merge orign
emostov Feb 8, 2022
7c22d80
Merge remote-tracking branch 'origin' into zeke-staking-pools
emostov Feb 8, 2022
4e1280f
Destroy pool in withdraw unbonded
emostov Feb 9, 2022
6388075
Add docs on pool admin
emostov Feb 9, 2022
3e52026
Fixup tests
emostov Feb 10, 2022
1605718
Test unbond_other permissionless scenarios
emostov Feb 10, 2022
9313dfe
Test withdraw unbonded permissionless
emostov Feb 10, 2022
d0461ff
Test only can join open pools
emostov Feb 10, 2022
6915433
Move unsafe set state to mock
emostov Feb 10, 2022
2a0b068
Test: nominate_works
emostov Feb 10, 2022
eded4bd
Add bounds: MinJoinBond, MinCreateBond, MaxPools
emostov Feb 11, 2022
d936321
Test MinCreateBond, MinJoinBond, MaxPools
emostov Feb 11, 2022
532cebe
Add post checks to tests
emostov Feb 11, 2022
03d37d5
Remove some TODOs
emostov Feb 11, 2022
b2e66f9
Setup weight infrastructure
emostov Feb 11, 2022
08e4417
Benchmark claim_payout
emostov Feb 11, 2022
ba9b078
Benchmark create
emostov Feb 11, 2022
ef69609
Benchmark nominate
emostov Feb 11, 2022
fe935fb
Benchmark join
emostov Feb 11, 2022
72fc7af
Benchmark unbond_other
emostov Feb 16, 2022
0298ddc
Refactor join benchmark to use scenario setup
emostov Feb 16, 2022
87bb277
Clean up and address warnings
emostov Feb 16, 2022
f6a438b
Basic withdraw unbonded benchmarks
emostov Feb 16, 2022
7065664
Refactor nominate benchmark
emostov Feb 16, 2022
d817c7d
Refactor claim payout
emostov Feb 16, 2022
ae07079
Add feature sp-staking/runtime-benchmarks
emostov Feb 16, 2022
da82bbc
Get node runtime to compile
emostov Feb 16, 2022
f4a5844
Get node to run
emostov Feb 16, 2022
a4b2661
Make claim_payout bench work with node
emostov Feb 18, 2022
efbc119
Make pool_withdraw_unbonded bench work with node
emostov Feb 18, 2022
5ad8272
Make withdraw_unbonded_other work with node runtime'
emostov Feb 18, 2022
6fce548
Make create benchmark work with node
emostov Feb 18, 2022
e25f221
Make nominate benchmark work with node runtime
emostov Feb 18, 2022
43f4805
Merge origin master
emostov Feb 18, 2022
e5915cf
WiP new benchmark crate
emostov Feb 19, 2022
f915390
Implement initial mock for benchmarks
emostov Feb 21, 2022
f688a91
Establish benchmark setup logic
emostov Feb 21, 2022
c7ad805
Get claim payout and nominate benchmarks working
emostov Feb 21, 2022
118d9cf
Remove pool bench utils; make struct fields pub insteaad
emostov Feb 21, 2022
7c97d65
Get more benchmarks to work; trim interface trait
emostov Feb 22, 2022
00d50b9
Some more top level docs
emostov Feb 22, 2022
3ad4313
Finish tranistion benchmarks to crate
emostov Feb 22, 2022
8f4dffc
Hook up benchmark pallet to node runtime
emostov Feb 22, 2022
ed1936f
Get benches to work with node runtime
emostov Feb 23, 2022
f53193d
Merge branch 'master' of https://github.com/paritytech/substrate into…
Feb 23, 2022
a5b52c8
cargo run --quiet --profile=production --features=runtime-benchmarks…
Feb 23, 2022
5b33fbb
Benchmark withdraw_unbonded_other_kill
emostov Feb 23, 2022
3b0ace6
Merge branch 'zeke-staking-pools' of https://github.com/paritytech/su…
emostov Feb 23, 2022
a8828de
Delete old benchmarking files
emostov Feb 23, 2022
d8cdbf2
Refunds for withdraw_unbonded
emostov Feb 23, 2022
6aa5463
Remove some TODOs
emostov Feb 23, 2022
ad033c0
'Don't return an option for the current_era'
emostov Feb 24, 2022
61a1da1
Streamline extrinsic docs
emostov Feb 24, 2022
0cb35f6
small docs tweaks
emostov Feb 24, 2022
ad575b7
Refactor ledger::slash
emostov Feb 24, 2022
fe6b089
Add on_slash impl for nomination pools
emostov Feb 25, 2022
06bce1a
slash refactor wip
emostov Feb 25, 2022
4bb4850
WIP slash working
emostov Feb 25, 2022
370d468
DRY Ledger::stash
emostov Feb 25, 2022
d39e459
Fix slash saturation
emostov Feb 25, 2022
85d6c43
Remove unused param from slash
emostov Feb 25, 2022
727be7b
Docs and warnings
emostov Feb 25, 2022
a993390
Test ledger::slash
emostov Feb 26, 2022
1a30c10
save progress
emostov Mar 1, 2022
106a885
Introduce counter for delegators
emostov Mar 2, 2022
5a556fb
Add tests for max delegator errors
emostov Mar 3, 2022
9674077
Reproducible account ids
emostov Mar 3, 2022
8084e3a
Adapt tests to new account id format
emostov Mar 3, 2022
f53c825
Simplify create_accounts api
emostov Mar 3, 2022
5b5ec9d
Try merge origin master
emostov Mar 3, 2022
283e06a
Fix staking tests
emostov Mar 4, 2022
94f6c52
Save PerBill slash impl before removing
emostov Mar 4, 2022
d37c6e0
Rever ledger slash test
emostov Mar 4, 2022
7c5ff10
Get node runtime to work
emostov Mar 4, 2022
1663506
Organize sub pools by unbond era, not curren era
emostov Mar 4, 2022
9642ad4
staking: Proportional ledger slashing
emostov Mar 4, 2022
2a3609d
Some comment cleanup
emostov Mar 4, 2022
33e6f48
Add more test post checks
emostov Mar 6, 2022
f071b2d
Update frame/staking/src/pallet/mod.rs
emostov Mar 6, 2022
11a5524
Tests: account for storing unbond era
emostov Mar 6, 2022
81aae81
Improve docs for staking interface
emostov Mar 6, 2022
c2a5103
Add events Created, Destroyed
emostov Mar 7, 2022
c002428
withdraw_unbonded: Remove useless withdraw dust check
emostov Mar 7, 2022
eb3cbc6
Test: withdraw_unbonded_other_handles_faulty_sub_pool_accounting
emostov Mar 7, 2022
719496c
Add extrinsics: set_state_other, set_metadata
emostov Mar 7, 2022
9bcf271
Test: set_state_other_works
emostov Mar 7, 2022
1d5f42b
Test: set_metadata_works
emostov Mar 7, 2022
32e1038
Add benchmarks for set_state_other, set_metadata
emostov Mar 7, 2022
b5598a4
Fix benchmarks
emostov Mar 7, 2022
f3f1d1b
Add weight info for new extrinsics
emostov Mar 7, 2022
5f53698
Some feedback
emostov Mar 10, 2022
db98c88
duo feedback
kianenigma Mar 10, 2022
540baef
Incorporate some more feedback
emostov Mar 10, 2022
f1817f4
Try merge origin
emostov Mar 10, 2022
7c647e5
integrate more kian feedback
emostov Mar 10, 2022
c7aa880
integrate more kian feedback
emostov Mar 10, 2022
488d38f
More improvements
emostov Mar 10, 2022
54abbd6
Add destroying_mul
emostov Mar 11, 2022
5068c69
Make do_reward_payout take refs
emostov Mar 11, 2022
cbdeafa
Remove some TODOs
emostov Mar 11, 2022
5de46f7
Add test for saturating
emostov Mar 11, 2022
4acd856
feedback
kianenigma Mar 12, 2022
4554224
Merge branch 'kiz-feedback-zeke-staking-pool' of https://github.com/p…
emostov Mar 14, 2022
9721dd1
Fix join test
emostov Mar 14, 2022
3b30c36
use `inner` for nested types in nomination pools (#11030)
kianenigma Mar 15, 2022
abda764
nomination-pools: update benches for new account format (#11033)
emostov Mar 15, 2022
f113a6c
Add extrinsic set_configs (#11038)
emostov Mar 15, 2022
15fb066
Better sanity checks for nomination pools (#11042)
kianenigma Mar 15, 2022
ad7421a
nomination-pools: Fix state event regression + benches (#11045)
emostov Mar 15, 2022
4418482
Merge remote-tracking branch 'origin' into zeke-proportional-ledger-s…
emostov Mar 15, 2022
738b7bb
FMT
emostov Mar 15, 2022
ad551f3
Try fill in all staking configs
emostov Mar 15, 2022
d244b03
Master.into()
kianenigma Mar 16, 2022
49de965
Fix build
kianenigma Mar 16, 2022
e0a09e0
More changes to nomination pools (#11050)
kianenigma Mar 16, 2022
bde07d5
Remove sanity module and some TODOs
emostov Mar 16, 2022
3b97534
round of feedback and imp from kian
kianenigma Mar 16, 2022
d739887
Add TODO for ED QoL at reward pool creation
emostov Mar 16, 2022
850cb3e
Make sure reward pool never gets dusted
emostov Mar 16, 2022
f48cd37
Improve error type
emostov Mar 16, 2022
9ee8268
demonstrate per_thing usage
kianenigma Mar 16, 2022
cdc2a32
Update sanity check & fix create_works
emostov Mar 17, 2022
b410010
Improve test ext pool creation & fix some more tests
emostov Mar 17, 2022
a6d1c9b
Try revert
emostov Mar 17, 2022
f3024c1
Revert "Try revert"
emostov Mar 17, 2022
074ecd0
Revert "Improve test ext pool creation & fix some more tests"
emostov Mar 17, 2022
f7fb166
Revert "Update sanity check & fix create_works"
emostov Mar 17, 2022
b994b64
Revert "Improve error type"
emostov Mar 17, 2022
e42fce6
Revert "Make sure reward pool never gets dusted"
emostov Mar 17, 2022
6c62233
Update some tests
emostov Mar 21, 2022
7839954
Merge remote-tracking branch 'origin' into zeke-proportional-ledger-s…
emostov Mar 21, 2022
35a3077
FMT
emostov Mar 21, 2022
7c3ca1e
Test that era offset works correctly
emostov Mar 21, 2022
4a9e8aa
Update mocks
emostov Mar 21, 2022
7e953dc
Remove unnescary docs
emostov Mar 22, 2022
01020d9
Doc updates
emostov Mar 22, 2022
8c2c214
Update calculate_delegator_payout_works_with_a_pool_of_1
emostov Mar 22, 2022
f8fe93f
Fix test: claim_payout_works
emostov Mar 22, 2022
bd61389
do_reward_payout_correctly_sets_pool_state_to_destroying
emostov Mar 22, 2022
cd2c8ea
Remove test do_reward_payout_errors_correctly
emostov Mar 22, 2022
4c652a8
Fix test: do_reward_payout_works
emostov Mar 22, 2022
664cfd9
Fix test: create_errors_correctly
emostov Mar 22, 2022
8c6b577
Fix test: create works
emostov Mar 22, 2022
61ea446
Fix test: unbond_other_of_3_works
emostov Mar 22, 2022
a0c7fbe
Ensure that ED is transferred into reward pool upon creation
emostov Mar 23, 2022
77f6ef8
WIP pool lifecycle test
emostov Mar 23, 2022
ff973be
Fix benchmarks
emostov Mar 23, 2022
0c5e23c
Add sanity check for ED + reward pools
emostov Mar 23, 2022
28178e9
`bond_extra` for nomination pools (#11100)
kianenigma Mar 29, 2022
c98c136
Try merge origin master
emostov Mar 29, 2022
eb943ed
FMT
emostov Mar 29, 2022
07a6a67
Update frame/nomination-pools/src/lib.rs
emostov Apr 5, 2022
c194f47
Update frame/nomination-pools/src/lib.rs
emostov Apr 5, 2022
ea27a8a
Update frame/nomination-pools/src/lib.rs
emostov Apr 5, 2022
68ef858
Update frame/nomination-pools/src/lib.rs
emostov Apr 5, 2022
b4edcb3
make it compile end to end
kianenigma Apr 5, 2022
e64f379
Update some type viz
emostov Apr 5, 2022
9d613cc
Update kick terminology
emostov Apr 5, 2022
3db567b
Update frame/nomination-pools/src/lib.rs
emostov Apr 5, 2022
50328d0
Merge branch 'zeke-staking-pools' of https://github.com/paritytech/su…
emostov Apr 5, 2022
a8c6a1e
Update frame/nomination-pools/src/lib.rs
emostov Apr 5, 2022
6b4cea3
Cache bonded account when creating pool
emostov Apr 6, 2022
cddec4d
Merge branch 'zeke-staking-pools' of https://github.com/paritytech/su…
emostov Apr 6, 2022
4546e44
Add bond extra weight stuff
emostov Apr 6, 2022
0dbb348
Update frame/nomination-pools/src/lib.rs
emostov Apr 6, 2022
2855e73
Update docs for pool withdraw unbonded
emostov Apr 6, 2022
cd03699
Update docs for unbond
emostov Apr 6, 2022
1a46619
Improve Doc
emostov Apr 6, 2022
7439442
Update frame/nomination-pools/src/lib.rs
emostov Apr 6, 2022
78a4bb0
Update frame/nomination-pools/Cargo.toml
emostov Apr 6, 2022
3e6c8d3
Update frame/nomination-pools/src/lib.rs
emostov Apr 6, 2022
e44ca53
Update frame/nomination-pools/src/lib.rs
emostov Apr 6, 2022
3fc8c79
Update frame/nomination-pools/src/lib.rs
emostov Apr 6, 2022
cfeaa13
Improve Docs
emostov Apr 7, 2022
a6b4587
Some docs improvements
emostov Apr 7, 2022
bd8ceaf
fmt
emostov Apr 7, 2022
3ba68c7
Remove unlock_era
emostov Apr 7, 2022
485458b
Try merge origin master
emostov Apr 7, 2022
2c355d2
Merge remote-tracking branch 'origin' into zeke-staking-pools
emostov Apr 7, 2022
4d4b104
Merge remote-tracking branch 'origin' into zeke-staking-pools
emostov Apr 8, 2022
dc43401
Fix accidental frame-support regression
emostov Apr 8, 2022
24c1850
Fix issue with transactions in tests
emostov Apr 8, 2022
5e2938d
Fix doc links
emostov Apr 8, 2022
8a1dc50
Make sure result in test is used
emostov Apr 10, 2022
e03e607
Merge remote-tracking branch 'origin' into zeke-staking-pools
emostov Apr 10, 2022
bcbea4e
Update frame/nomination-pools/src/lib.rs
emostov Apr 11, 2022
91178a6
Fix can toggle state
emostov Apr 11, 2022
937b9a8
Merge branch 'zeke-staking-pools' of https://github.com/paritytech/su…
emostov Apr 11, 2022
a0052b7
Account for new_funds in ok to be open
emostov Apr 11, 2022
4c71c4b
Update docs: ok_to_withdraw_unbonded_other_with
emostov Apr 11, 2022
7af61f8
Update frame/nomination-pools/src/lib.rs
emostov Apr 11, 2022
4baa7c8
Update frame/nomination-pools/src/lib.rs
emostov Apr 11, 2022
630370d
Remove some staking comments
emostov Apr 11, 2022
25128fe
Merge branch 'zeke-staking-pools' of https://github.com/paritytech/su…
emostov Apr 11, 2022
7ba88a3
Merge remote-tracking branch 'origin' into zeke-staking-pools
emostov Apr 11, 2022
0985fa2
Rename SubPoolsWithEra to UnbondingPoolsWithEra
emostov Apr 11, 2022
9190415
Use validators length for benchmarks
emostov Apr 11, 2022
d31afbf
Use metadata length for benchmarks
emostov Apr 11, 2022
fd907c6
Remove debug assert eq
emostov Apr 11, 2022
8c2e5e1
docs
emostov Apr 11, 2022
fea5f78
Fix test: withdraw_unbonded_other_errors_correctly
emostov Apr 13, 2022
d78b16a
Fix check for having enough balance to create the pool
emostov Apr 13, 2022
66c5c49
Bond event for pool creation
emostov Apr 13, 2022
e6f19b8
Ok to be open
emostov Apr 14, 2022
8639dbf
FMT
emostov Apr 14, 2022
a770204
Remove _other postfix
emostov Apr 14, 2022
7b9f974
Update frame/staking/src/lib.rs
emostov Apr 15, 2022
21202e6
Adjust tests to account for only remove when < ED
emostov Apr 15, 2022
1b9e895
Merge remote-tracking branch 'origin' into zeke-proportional-ledger-s…
emostov Apr 15, 2022
52728c0
Remove stale TODOs
emostov Apr 15, 2022
d3ef3b4
Remove dupe test
emostov Apr 15, 2022
243888c
Try merge proportional slash
emostov Apr 15, 2022
fa70ade
Fix build
emostov Apr 15, 2022
9def21a
Make sure to convert to u256 so we don't saturate
emostov Apr 15, 2022
9a35ad6
Refund depositor with reward pool fee
emostov Apr 15, 2022
7efaee8
FMT
emostov Apr 15, 2022
d06b49c
Remove reachable defensive
emostov Apr 15, 2022
3975eca
Use compact encoding for relevant extrinsics
emostov Apr 15, 2022
7b46bdd
Remove unnescary make_free_be for cleaning reward account
emostov Apr 15, 2022
5e183c1
Add not to maintainers for reward account accounting
emostov Apr 15, 2022
d33253c
Remove note to maintainers from public doc
emostov Apr 15, 2022
1cd80f3
Make sure all configs have currency balance
emostov Apr 18, 2022
87085a4
Merge remote-tracking branch 'origin' into zeke-staking-pools
emostov Apr 18, 2022
844f42f
Avoid saturation in balance_to_unbond
emostov Apr 19, 2022
781fb6e
Partial Unbonding for Nomination Pools (#11212)
kianenigma Apr 20, 2022
e76e45e
Merge remote-tracking branch 'origin' into zeke-staking-pools
emostov Apr 20, 2022
97bfcac
Try merge origin master
emostov Apr 21, 2022
3d2a751
Try merge origin master
emostov Apr 21, 2022
8d3dd4d
Merge branch 'zeke-proportional-ledger-slash' into zeke-staking-pools
emostov Apr 21, 2022
3d293a9
Update Cargo.lock
shawntabrizi Apr 21, 2022
7aa9f43
Rename Delegator to PoolMember
emostov Apr 21, 2022
79ed79d
Merge branch 'zeke-staking-pools' of https://github.com/paritytech/su…
emostov Apr 21, 2022
1e50f3d
fmt
emostov Apr 21, 2022
5ebede6
Try merge origin master
emostov Apr 21, 2022
200611e
Get runtime to build with runtime-benchmarks feature
emostov Apr 22, 2022
ea019ba
Update Cargo.lock
emostov Apr 22, 2022
f77dfc8
Fix asserts to work in more scenarios
emostov Apr 22, 2022
562a1be
gte not gt
emostov Apr 22, 2022
3905a66
cargo run --quiet --profile=production --features=runtime-benchmarks…
Apr 22, 2022
33e0eb5
Update frame/staking/src/mock.rs
emostov Apr 22, 2022
af52ec4
Update frame/nomination-pools/src/lib.rs
emostov Apr 22, 2022
4d7c98c
Update frame/staking/src/slashing.rs
emostov Apr 22, 2022
42ef1d8
Apply suggestions from code review
emostov Apr 22, 2022
e4c4b28
fmt
emostov Apr 22, 2022
8454959
Merge branch 'master' of github.com:paritytech/substrate into zeke-st…
kianenigma Apr 25, 2022
c38d934
Merge branch 'master' of github.com:paritytech/substrate into zeke-st…
kianenigma Apr 26, 2022
3431cfa
Fix some tests
kianenigma Apr 26, 2022
3b12053
Merge branch 'master' of github.com:paritytech/substrate into zeke-st…
kianenigma Apr 27, 2022
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
42 changes: 42 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ members = [
"frame/offences",
"frame/preimage",
"frame/proxy",
"frame/nomination-pools",
"frame/nomination-pools/benchmarking",
"frame/randomness-collective-flip",
"frame/recovery",
"frame/referenda",
Expand Down
1 change: 1 addition & 0 deletions bin/node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ pub fn testnet_genesis(
gilt: Default::default(),
transaction_storage: Default::default(),
transaction_payment: Default::default(),
nomination_pools: Default::default(),
}
}

Expand Down
4 changes: 4 additions & 0 deletions bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ pallet-lottery = { version = "4.0.0-dev", default-features = false, path = "../.
pallet-membership = { version = "4.0.0-dev", default-features = false, path = "../../../frame/membership" }
pallet-mmr = { version = "4.0.0-dev", default-features = false, path = "../../../frame/merkle-mountain-range" }
pallet-multisig = { version = "4.0.0-dev", default-features = false, path = "../../../frame/multisig" }
pallet-nomination-pools = { version = "1.0.0", default-features = false, path = "../../../frame/nomination-pools"}
pallet-nomination-pools-benchmarking = { version = "1.0.0", default-features = false, optional = true, path = "../../../frame/nomination-pools/benchmarking" }
pallet-offences = { version = "4.0.0-dev", default-features = false, path = "../../../frame/offences" }
pallet-offences-benchmarking = { version = "4.0.0-dev", path = "../../../frame/offences/benchmarking", default-features = false, optional = true }
pallet-preimage = { version = "4.0.0-dev", default-features = false, path = "../../../frame/preimage" }
Expand Down Expand Up @@ -140,6 +142,7 @@ std = [
"pallet-membership/std",
"pallet-mmr/std",
"pallet-multisig/std",
"pallet-nomination-pools/std",
"pallet-identity/std",
"pallet-scheduler/std",
"node-primitives/std",
Expand Down Expand Up @@ -210,6 +213,7 @@ runtime-benchmarks = [
"pallet-membership/runtime-benchmarks",
"pallet-mmr/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nomination-pools-benchmarking",
"pallet-offences-benchmarking",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
Expand Down
39 changes: 38 additions & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ impl pallet_staking::Config for Runtime {
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type VoterList = BagsList;
type MaxUnlockingChunks = ConstU32<32>;
type OnStakerSlash = ();
type OnStakerSlash = NominationPools;
type WeightInfo = pallet_staking::weights::SubstrateWeight<Runtime>;
type BenchmarkingConfig = StakingBenchmarkingConfig;
}
Expand Down Expand Up @@ -705,6 +705,38 @@ impl pallet_bags_list::Config for Runtime {
type Score = VoteWeight;
}

parameter_types! {
pub const PostUnbondPoolsWindow: u32 = 4;
pub const NominationPoolsPalletId: PalletId = PalletId(*b"py/npols");
}

use sp_runtime::traits::Convert;
pub struct BalanceToU256;
impl Convert<Balance, sp_core::U256> for BalanceToU256 {
fn convert(balance: Balance) -> sp_core::U256 {
sp_core::U256::from(balance)
}
}
pub struct U256ToBalance;
impl Convert<sp_core::U256, Balance> for U256ToBalance {
fn convert(n: sp_core::U256) -> Balance {
n.try_into().unwrap_or(Balance::max_value())
emostov marked this conversation as resolved.
Show resolved Hide resolved
}
}

impl pallet_nomination_pools::Config for Runtime {
type WeightInfo = ();
type Event = Event;
type Currency = Balances;
type BalanceToU256 = BalanceToU256;
emostov marked this conversation as resolved.
Show resolved Hide resolved
type U256ToBalance = U256ToBalance;
type StakingInterface = pallet_staking::Pallet<Self>;
type PostUnbondingPoolsWindow = PostUnbondPoolsWindow;
type MaxMetadataLen = ConstU32<256>;
type MaxUnbonding = ConstU32<8>;
type PalletId = NominationPoolsPalletId;
}

parameter_types! {
pub const VoteLockingPeriod: BlockNumber = 30 * DAYS;
}
Expand Down Expand Up @@ -1470,6 +1502,7 @@ construct_runtime!(
Remark: pallet_remark,
ConvictionVoting: pallet_conviction_voting,
Whitelist: pallet_whitelist,
NominationPools: pallet_nomination_pools,
}
);

Expand Down Expand Up @@ -1554,6 +1587,7 @@ mod benches {
[pallet_membership, TechnicalMembership]
[pallet_mmr, Mmr]
[pallet_multisig, Multisig]
[pallet_nomination_pools, NominationPoolsBench::<Runtime>]
[pallet_offences, OffencesBench::<Runtime>]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
Expand Down Expand Up @@ -1869,6 +1903,7 @@ impl_runtime_apis! {
use pallet_election_provider_support_benchmarking::Pallet as EPSBench;
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;

let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);
Expand All @@ -1891,12 +1926,14 @@ impl_runtime_apis! {
use pallet_election_provider_support_benchmarking::Pallet as EPSBench;
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;

impl pallet_session_benchmarking::Config for Runtime {}
impl pallet_offences_benchmarking::Config for Runtime {}
impl pallet_election_provider_support_benchmarking::Config for Runtime {}
impl frame_system_benchmarking::Config for Runtime {}
impl baseline::Config for Runtime {}
impl pallet_nomination_pools_benchmarking::Config for Runtime {}

let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number
Expand Down
1 change: 1 addition & 0 deletions bin/node/testing/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec<AccountId>) -> Gen
gilt: Default::default(),
transaction_storage: Default::default(),
transaction_payment: Default::default(),
nomination_pools: Default::default(),
}
}
12 changes: 6 additions & 6 deletions frame/bags-list/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ frame_benchmarking::benchmarks! {
vec![heavier, lighter, heavier_prev, heavier_next]
)
}
}

frame_benchmarking::impl_benchmark_test_suite!(
Pallet,
crate::mock::ExtBuilder::default().skip_genesis_ids().build(),
crate::mock::Runtime
);
impl_benchmark_test_suite!(
Pallet,
crate::mock::ExtBuilder::default().skip_genesis_ids().build(),
crate::mock::Runtime
);
}
44 changes: 44 additions & 0 deletions frame/nomination-pools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "pallet-nomination-pools"
version = "1.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how we want handle versioning here

authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "FRAME nomination pools pallet"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
# parity
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }

# FRAME
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
sp-runtime = { version = "6.0.0", default-features = false, path = "../../primitives/runtime" }
sp-std = { version = "4.0.0", default-features = false, path = "../../primitives/std" }
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../primitives/staking" }
sp-core = { version = "6.0.0", default-features = false, path = "../../primitives/core" }

[dev-dependencies]
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
sp-io = { version = "6.0.0", path = "../../primitives/io" }
sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" }

[features]
runtime-benchmarks = []
default = ["std"]
std = [
"codec/std",
"scale-info/std",
"frame-support/std",
"frame-system/std",
"sp-runtime/std",
"sp-std/std",
"sp-staking/std",
"sp-core/std",
]
55 changes: 55 additions & 0 deletions frame/nomination-pools/benchmarking/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[package]
name = "pallet-nomination-pools-benchmarking"
version = "1.0.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "FRAME nomination pools pallet benchmarking"
readme = "README.md"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
# parity
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }

# FRAME
frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../benchmarking" }
frame-election-provider-support = { version = "4.0.0-dev", default-features = false, path = "../../election-provider-support" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
pallet-bags-list = { version = "4.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../bags-list" }
pallet-staking = { version = "4.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" }
pallet-nomination-pools = { version = "1.0.0", default-features = false, path = "../", features = ["runtime-benchmarks"] }

# Substrate Primitives
sp-runtime = { version = "6.0.0", default-features = false, path = "../../../primitives/runtime" }
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/staking" }
sp-std = { version = "4.0.0", default-features = false, path = "../../../primitives/std" }

[dev-dependencies]
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../balances" }
pallet-timestamp = { version = "4.0.0-dev", path = "../../timestamp" }
pallet-staking-reward-curve = { version = "4.0.0-dev", path = "../../staking/reward-curve" }
sp-core = { version = "6.0.0", path = "../../../primitives/core" }
sp-io = { version = "6.0.0", path = "../../../primitives/io" }

[features]
default = ["std"]
std = [
"frame-benchmarking/std",
"frame-election-provider-support/std",
"frame-support/std",
"frame-system/std",
"pallet-bags-list/std",
"pallet-staking/std",
"pallet-nomination-pools/std",
"sp-runtime/std",
"sp-staking/std",
"sp-std/std",
"pallet-balances/std",
]
Empty file.
Loading