-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Moved] Enable governance for Nomination Pool members #2680
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
216 commits
Select commit
Hold shift + click to select a range
90d1586
traits for delegation based staking
Ank4n e3baa64
pallet init
Ank4n 874c134
impl interfaces with todos
Ank4n af14ddf
compiles with copy impl from old branch
Ank4n e1ec9b2
build it as a wrapper over core staking
Ank4n 7f91869
refactor
Ank4n 7a9f4de
finish refactoring delegatee
Ank4n 4f52e49
refactor migrate functions
Ank4n 666c50a
fmt
Ank4n ba5b06e
bootstrap mock
Ank4n db7ede2
first test
Ank4n 7478f98
empty genesis block
Ank4n 990f38a
fmt
Ank4n 1195919
empty tests and stake balance provider
Ank4n beb5d1d
Staking implements StakeBalanceProvider
Ank4n 46e03fd
refactor to allow partial withdraw from unlocking chunks
Ank4n aeca6df
add fallback balance provider to delegated staking
Ank4n cdbd166
setup mocks with one validator and 2 nominators at genesis
Ank4n 30a790a
do try state for pallet-delegated-staking
Ank4n 90b3b07
return type of stake balance
Ank4n c31c085
failing tests
Ank4n 41d0ee0
fmt
Ank4n c1ad5b6
green tests
Ank4n 918233e
refactor
Ank4n 883d62c
fmt
Ank4n 26da4ce
green create_multiple_delegators test
Ank4n 215718d
Reward destincation checker
Ank4n 8cf31b9
refactor reward acc restricter in delegation support trait
Ank4n 7d7ce78
fmt
Ank4n 59f285d
explicitly set Staking to have NoDelegation impl
Ank4n 1441013
fix delegated staking and refactor
Ank4n 2a7376d
bond test
Ank4n 8b2d641
check stake
Ank4n e072a83
test refactor
Ank4n 5b881f7
test fix
Ank4n 171c4d9
new fn in Staking Interface partial_withdraw_unbond
Ank4n cc4aae2
move to delegation module
Ank4n b8bed53
compiles after refactor
Ank4n 51cfa26
incomplete withdraw test
Ank4n 4a5659c
introduce withdraw_exact, test failing
Ank4n 6e4ea51
tests for withdraw
Ank4n 9ce869f
rearrange
Ank4n bba90d1
test to impl
Ank4n 1b28825
impl Staking Interface for Delegated Staking
Ank4n 8f8b1d6
fmt
Ank4n dd21409
merge delegatee and delegator in one
Ank4n 54bebb3
rename traits
Ank4n 50f051a
add events for delegated and withdrawn
Ank4n c159d10
fmt
Ank4n 8cb22c7
migrate delegator docs
Ank4n 39f435f
empty tests
Ank4n 3172da6
refactor and additional tests
Ank4n d469759
add todos in tests
Ank4n 430fb6b
reward destination restriction test
Ank4n 6ba4f82
more tests
Ank4n 071450c
add migration test
Ank4n 6cf4a35
fmt
Ank4n b1249e0
todo
Ank4n 066cdec
is_delegatee for non_tests
Ank4n 1e38b9b
staking as orchestrator and everything passes
Ank4n 22155c0
fix test and refactor delegated staking
Ank4n b16ec42
report slash
Ank4n 360d516
partial implement onslash, need to add more tests and integrations
Ank4n 6cfa252
doc
Ank4n 468f569
fmt
Ank4n a151a01
update register
Ank4n 3668097
add dependencies to test staking
Ank4n 27e5940
refactor from feedbacks
Ank4n 199bb72
fmt
Ank4n 6f4d150
remove staking hold provider
Ank4n cb4d3ce
some todos for NP integration
Ank4n 4d99c71
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 26ea2da
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 2d61dd4
fix compile after rebase with master
Ank4n 3137480
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 873b702
update dep
Ank4n 1a6ce99
fix conflicts
Ank4n b6709f9
new contruct runtime syntax
Ank4n 05206ce
conflict compile fix
Ank4n ee75c05
rough np integration works
Ank4n 5482c96
restore doc
Ank4n 7d90157
rename delegatee to delegate
Ank4n 075e793
create pot accounts
Ank4n b4918e7
add call signatures
Ank4n a635f1d
return correct error
Ank4n 309ddf5
call register as delegate
Ank4n ea5d777
add mod for types
Ank4n 259b3a7
move all public impls of traits to its own module
Ank4n 71c9fff
add delegation struct
Ank4n 5caba07
impl delegate
Ank4n 0ec2965
remove the key
Ank4n 4a60902
fix test
Ank4n 6eb298c
fix unclaim withdraw to be a field and not sub account
Ank4n ddb7963
impl release
Ank4n e6656a6
cleanup
Ank4n 8002ef0
cargo fmt
Ank4n 4e42c6c
remove transactional
Ank4n a4e0ee2
refactor but some test failing
Ank4n 20c3fce
fix migration test
Ank4n bbc39b6
impl delegation
Ank4n 7634a58
fix one test and leave a todo note for the other
Ank4n b05ff80
moved some to use dispatch fn directly
Ank4n cf18750
add Delegator type
Ank4n 2f9819a
compiles
Ank4n 50da2ac
test passes
Ank4n 2f00fb0
remove update hold
Ank4n 833eadb
remove commented code
Ank4n c67e66e
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 9fe70fe
nomination pool revert
Ank4n bdc3b12
fix np tests
Ank4n 949c5d5
refactor test
Ank4n f31cee2
create np direct stake adapter
Ank4n 141004f
all test pass
Ank4n 13b4a82
rename DirectStake to NoDelegation to keep its name similar to Stakin…
Ank4n bed9c4c
fmt
Ank4n 54acfb7
move adapter logic local to pool
Ank4n ea78f16
Revert "move adapter logic local to pool"
Ank4n a324442
quick basic impl of Delegation adapter for pool
Ank4n 10fadcd
add np to delegate pallet mock runtime
Ank4n 9cafa0e
fmt
Ank4n f10e589
tests skeleton
Ank4n b11ea7a
use balance type u128 so np pot accounts are unique
Ank4n 8029e2e
create pool
Ank4n f283207
increment provider on pool account
Ank4n a30d3c3
join pool works
Ank4n 7e09ebe
get actual pool id
Ank4n e981994
bond extra test
Ank4n 8b0d4ae
fix bug of adding surplus amount to delegate
Ank4n f0cbafe
claim reward incomplete
Ank4n 8a83abd
more checks in try state. Some old test fails, to be fixed
Ank4n bf6916b
fmt
Ank4n bdc8c28
remove unused fn
Ank4n 6edaf75
fix tests
Ank4n e59821b
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 74ec97d
withdraw test passes
Ank4n e33cc20
withdraw pool works
Ank4n 24e7cf3
updated tests
Ank4n cc365e7
update withdraw unbonded signature
Ank4n 83fa01b
refactored release
Ank4n e953cc3
stash killed managed while withdraw
Ank4n 8bac693
all test pass
Ank4n 9bc3040
small test refactor
Ank4n f3a3e62
slash is posted correctly
Ank4n ff300ef
failing slash test
Ank4n c19bf20
add slash call
Ank4n 66c190e
fmt
Ank4n 9af4ae1
slash extrinsic in np
Ank4n 2049a7c
fmt
Ank4n 1d31384
slash works
Ank4n 7c276ab
fmt
Ank4n 086d2f6
finish test for slashing
Ank4n afc0821
few more fixmes
Ank4n fb1eba4
add crate docs
Ank4n a714f72
fix docs
Ank4n f337a9d
limitations
Ank4n bccb01e
small edit
Ank4n 72ee3e4
minor doc fixes
Ank4n 278225e
rename block delegation
Ank4n b32dced
add slash call
Ank4n 03efe85
fmt
Ank4n 9807c51
minor refactors
Ank4n dbde286
minor refactors
Ank4n 0ccd901
fmt
Ank4n 814d2a5
refactor types
Ank4n 4e68197
minor refactor
Ank4n 97ba0c4
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 8d00bdf
improve np diff
Ank4n e360267
missed semicolon
Ank4n 05e7ba6
clean diff
Ank4n 95e3ca0
doc fix
Ank4n 89dd29b
rename to transferable
Ank4n 8a41c86
stake adapter
Ank4n 318eaba
add delegation related functions to staking interface
Ank4n aaa3cbc
staking interface impl updated
Ank4n d807979
compiles but potentially buggy
Ank4n 2668e78
one test failing
Ank4n c8fc6a1
all test passes
Ank4n d41fa53
rename trait method
Ank4n c408581
minor refactors
Ank4n d95a6fe
rename delegate to delegatee
Ank4n b68bb9d
fmt
Ank4n a340949
name changes
Ank4n 7a40b18
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n de8f875
doc update
Ank4n fd27cd5
rename to delegatee (missed ones)
Ank4n 1f12032
minor refactors
Ank4n 9c2bb9e
doc updates
Ank4n 244df22
Stake Adapter refactor (#3502)
Ank4n df13e49
small doc update
Ank4n 11bb084
reorder methods
Ank4n 78ea6ae
minor
Ank4n ef3b3e7
Update substrate/frame/delegated-staking/Cargo.toml
Ank4n b4ef397
fix pr feedbacks
Ank4n 2877d0e
rename delegator balance
Ank4n 3de4c4a
add to docs
Ank4n 57e8992
rename error
Ank4n e95d800
refactor types
Ank4n 25edbde
refactor
Ank4n 639985d
fmt
Ank4n fa1465e
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 56aa42a
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 7387321
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 8568261
fix imports
Ank4n 452db6a
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n a8e56d2
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 2b861f4
merge from master
Ank4n c7855fb
add virtual nominator storage
Ank4n 71e7947
add StakingUnsafe
Ank4n 9ad65b3
impl bond_extra
Ank4n d884c47
report slash via event listener
Ank4n 500ac8f
get rid of delegatee support
Ank4n a8fc385
fix tests
Ank4n 81c0c78
add update payee to Staking Interface
Ank4n 5ebc35a
get rid of fixme
Ank4n b9f6392
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 6269251
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n 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
refactor migrate functions
- Loading branch information
commit 4f52e4916a3a9c5eb8b0abb8abdd193160dbc678
There are no files selected for viewing
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 |
|---|---|---|
|
|
@@ -17,23 +17,21 @@ | |
|
|
||
| use codec::{FullCodec, MaxEncodedLen}; | ||
| use scale_info::TypeInfo; | ||
| use sp_runtime::{ | ||
| DispatchResult, Saturating, | ||
| }; | ||
| use sp_std::{ops::Sub}; | ||
| use sp_runtime::{DispatchResult, Saturating}; | ||
| use sp_std::ops::Sub; | ||
|
|
||
| /// Allows an account to accept stake delegations and manage its operations. | ||
| pub trait Delegatee { | ||
| /// Balance type used by the staking system. | ||
| type Balance: Sub<Output = Self::Balance> | ||
| + Ord | ||
| + PartialEq | ||
| + Default | ||
| + Copy | ||
| + MaxEncodedLen | ||
| + FullCodec | ||
| + TypeInfo | ||
| + Saturating; | ||
| + Ord | ||
| + PartialEq | ||
| + Default | ||
| + Copy | ||
| + MaxEncodedLen | ||
| + FullCodec | ||
| + TypeInfo | ||
| + Saturating; | ||
|
|
||
| /// AccountId type used by the staking system. | ||
| type AccountId: Clone + sp_std::fmt::Debug; | ||
|
|
@@ -45,9 +43,6 @@ pub trait Delegatee { | |
| fn accept_delegations(delegatee: &Self::AccountId, payee: &Self::AccountId) -> DispatchResult; | ||
|
|
||
| /// Stop accepting new delegations on this account. | ||
| /// | ||
| /// The account would continue to be a delegatee until all delegations to this account has been | ||
| /// withdrawn. | ||
| fn block_delegations(delegatee: &Self::AccountId) -> DispatchResult; | ||
|
|
||
| /// Remove oneself as Delegatee. | ||
|
|
@@ -58,6 +53,13 @@ pub trait Delegatee { | |
| /// Update bond whenever there is a new delegate funds that are not staked. | ||
| fn update_bond(delegatee: &Self::AccountId) -> DispatchResult; | ||
|
|
||
| /// Request removal of delegated stake. | ||
| fn withdraw( | ||
| delegatee: &Self::AccountId, | ||
| delegator: &Self::AccountId, | ||
| value: Self::Balance, | ||
| ) -> DispatchResult; | ||
|
|
||
| /// Applies a pending slash on delegatee by passing a delegator account who should be slashed | ||
| /// and the value to be slashed. Optionally also takes a reporter account who will be rewarded | ||
| /// from part of the slash imbalance. | ||
|
|
@@ -83,20 +85,19 @@ pub trait Delegatee { | |
| proxy_delegator: &Self::AccountId, | ||
| payee: &Self::AccountId, | ||
| ) -> DispatchResult; | ||
|
|
||
| } | ||
|
|
||
| /// Allows an account to delegate their stakes to a delegatee. | ||
| pub trait Delegator { | ||
| type Balance: Sub<Output = Self::Balance> | ||
| + Ord | ||
| + PartialEq | ||
| + Default | ||
| + Copy | ||
| + MaxEncodedLen | ||
| + FullCodec | ||
| + TypeInfo | ||
| + Saturating; | ||
| + Ord | ||
| + PartialEq | ||
| + Default | ||
| + Copy | ||
| + MaxEncodedLen | ||
| + FullCodec | ||
| + TypeInfo | ||
| + Saturating; | ||
|
|
||
| /// AccountId type used by the staking system. | ||
| type AccountId: Clone + sp_std::fmt::Debug; | ||
|
|
@@ -115,13 +116,6 @@ pub trait Delegator { | |
| value: Self::Balance, | ||
| ) -> DispatchResult; | ||
|
|
||
| /// Request removal of delegated stake. | ||
| fn withdraw ( | ||
| delegator: &Self::AccountId, | ||
| delegatee: &Self::AccountId, | ||
| value: Self::Balance, | ||
| ) -> DispatchResult; | ||
|
|
||
| /// Swap a delegated `value` from `delegator_from` to `delegator_to`, with delegatee remaining | ||
| /// the same. | ||
| /// | ||
|
|
@@ -135,4 +129,4 @@ pub trait Delegator { | |
| delegatee: &Self::AccountId, | ||
| value: Self::Balance, | ||
| ) -> DispatchResult; | ||
| } | ||
| } | ||
|
Contributor
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. First glance, I think this file is the foundation of the entire PR and it is not very well explained. Please consider the following:
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
And then remove the
unblock_delegationsand re-use the methodfn accept_delegationsabove again? This would keep the interface cleaner, if possible to do.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of maybe use this pair instead:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I could try to remove unblock. I think the reason was a little nuance that at the point of
accept_delegations, the account is not a delegatee, but the account that callsunblock_delegationsneed to be a delegatee. But I will see if I can simplify/combine them.