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