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

[Moved] Enable governance for Nomination Pool members #2680

Closed
wants to merge 216 commits into from
Closed
Show file tree
Hide file tree
Changes from 170 commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
90d1586
traits for delegation based staking
Ank4n Nov 23, 2023
e3baa64
pallet init
Ank4n Nov 23, 2023
874c134
impl interfaces with todos
Ank4n Nov 25, 2023
af14ddf
compiles with copy impl from old branch
Ank4n Nov 25, 2023
e1ec9b2
build it as a wrapper over core staking
Ank4n Nov 25, 2023
7f91869
refactor
Ank4n Nov 25, 2023
7a9f4de
finish refactoring delegatee
Ank4n Nov 25, 2023
4f52e49
refactor migrate functions
Ank4n Nov 25, 2023
666c50a
fmt
Ank4n Nov 25, 2023
ba5b06e
bootstrap mock
Ank4n Nov 25, 2023
db7ede2
first test
Ank4n Dec 2, 2023
7478f98
empty genesis block
Ank4n Dec 2, 2023
990f38a
fmt
Ank4n Dec 2, 2023
1195919
empty tests and stake balance provider
Ank4n Dec 2, 2023
beb5d1d
Staking implements StakeBalanceProvider
Ank4n Dec 2, 2023
46e03fd
refactor to allow partial withdraw from unlocking chunks
Ank4n Dec 2, 2023
aeca6df
add fallback balance provider to delegated staking
Ank4n Dec 2, 2023
cdbd166
setup mocks with one validator and 2 nominators at genesis
Ank4n Dec 3, 2023
30a790a
do try state for pallet-delegated-staking
Ank4n Dec 3, 2023
90b3b07
return type of stake balance
Ank4n Dec 3, 2023
c31c085
failing tests
Ank4n Dec 3, 2023
41d0ee0
fmt
Ank4n Dec 3, 2023
c1ad5b6
green tests
Ank4n Dec 3, 2023
918233e
refactor
Ank4n Dec 3, 2023
883d62c
fmt
Ank4n Dec 3, 2023
26da4ce
green create_multiple_delegators test
Ank4n Dec 3, 2023
215718d
Reward destincation checker
Ank4n Dec 3, 2023
8cf31b9
refactor reward acc restricter in delegation support trait
Ank4n Dec 3, 2023
7d7ce78
fmt
Ank4n Dec 3, 2023
59f285d
explicitly set Staking to have NoDelegation impl
Ank4n Dec 3, 2023
1441013
fix delegated staking and refactor
Ank4n Dec 3, 2023
2a7376d
bond test
Ank4n Dec 3, 2023
8b2d641
check stake
Ank4n Dec 3, 2023
e072a83
test refactor
Ank4n Dec 3, 2023
5b881f7
test fix
Ank4n Dec 3, 2023
171c4d9
new fn in Staking Interface partial_withdraw_unbond
Ank4n Dec 3, 2023
cc4aae2
move to delegation module
Ank4n Dec 4, 2023
b8bed53
compiles after refactor
Ank4n Dec 4, 2023
51cfa26
incomplete withdraw test
Ank4n Dec 6, 2023
4a5659c
introduce withdraw_exact, test failing
Ank4n Dec 6, 2023
6e4ea51
tests for withdraw
Ank4n Dec 6, 2023
9ce869f
rearrange
Ank4n Dec 6, 2023
bba90d1
test to impl
Ank4n Dec 6, 2023
1b28825
impl Staking Interface for Delegated Staking
Ank4n Dec 6, 2023
8f8b1d6
fmt
Ank4n Dec 6, 2023
dd21409
merge delegatee and delegator in one
Ank4n Dec 6, 2023
54bebb3
rename traits
Ank4n Dec 6, 2023
50f051a
add events for delegated and withdrawn
Ank4n Dec 6, 2023
c159d10
fmt
Ank4n Dec 6, 2023
8cb22c7
migrate delegator docs
Ank4n Dec 6, 2023
39f435f
empty tests
Ank4n Dec 6, 2023
3172da6
refactor and additional tests
Ank4n Dec 8, 2023
d469759
add todos in tests
Ank4n Dec 8, 2023
430fb6b
reward destination restriction test
Ank4n Dec 8, 2023
6ba4f82
more tests
Ank4n Dec 8, 2023
071450c
add migration test
Ank4n Dec 8, 2023
6cf4a35
fmt
Ank4n Dec 8, 2023
b1249e0
todo
Ank4n Dec 8, 2023
066cdec
is_delegatee for non_tests
Ank4n Dec 13, 2023
1e38b9b
staking as orchestrator and everything passes
Ank4n Dec 14, 2023
22155c0
fix test and refactor delegated staking
Ank4n Dec 14, 2023
b16ec42
report slash
Ank4n Dec 14, 2023
360d516
partial implement onslash, need to add more tests and integrations
Ank4n Dec 14, 2023
6cfa252
doc
Ank4n Dec 14, 2023
468f569
fmt
Ank4n Dec 14, 2023
a151a01
update register
Ank4n Dec 14, 2023
3668097
add dependencies to test staking
Ank4n Dec 14, 2023
27e5940
refactor from feedbacks
Ank4n Dec 14, 2023
199bb72
fmt
Ank4n Dec 14, 2023
6f4d150
remove staking hold provider
Ank4n Dec 14, 2023
cb4d3ce
some todos for NP integration
Ank4n Dec 15, 2023
4d99c71
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Jan 5, 2024
26ea2da
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Feb 12, 2024
2d61dd4
fix compile after rebase with master
Ank4n Feb 12, 2024
3137480
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Feb 12, 2024
873b702
update dep
Ank4n Feb 15, 2024
1a6ce99
fix conflicts
Ank4n Feb 15, 2024
b6709f9
new contruct runtime syntax
Ank4n Feb 15, 2024
05206ce
conflict compile fix
Ank4n Feb 15, 2024
ee75c05
rough np integration works
Ank4n Feb 16, 2024
5482c96
restore doc
Ank4n Feb 17, 2024
7d90157
rename delegatee to delegate
Ank4n Feb 17, 2024
075e793
create pot accounts
Ank4n Feb 17, 2024
b4918e7
add call signatures
Ank4n Feb 17, 2024
a635f1d
return correct error
Ank4n Feb 17, 2024
309ddf5
call register as delegate
Ank4n Feb 17, 2024
ea5d777
add mod for types
Ank4n Feb 17, 2024
259b3a7
move all public impls of traits to its own module
Ank4n Feb 17, 2024
71c9fff
add delegation struct
Ank4n Feb 17, 2024
5caba07
impl delegate
Ank4n Feb 17, 2024
0ec2965
remove the key
Ank4n Feb 17, 2024
4a60902
fix test
Ank4n Feb 17, 2024
6eb298c
fix unclaim withdraw to be a field and not sub account
Ank4n Feb 17, 2024
ddb7963
impl release
Ank4n Feb 17, 2024
e6656a6
cleanup
Ank4n Feb 17, 2024
8002ef0
cargo fmt
Ank4n Feb 17, 2024
4e42c6c
remove transactional
Ank4n Feb 17, 2024
a4e0ee2
refactor but some test failing
Ank4n Feb 18, 2024
20c3fce
fix migration test
Ank4n Feb 18, 2024
bbc39b6
impl delegation
Ank4n Feb 18, 2024
7634a58
fix one test and leave a todo note for the other
Ank4n Feb 18, 2024
b05ff80
moved some to use dispatch fn directly
Ank4n Feb 18, 2024
cf18750
add Delegator type
Ank4n Feb 18, 2024
2f9819a
compiles
Ank4n Feb 18, 2024
50da2ac
test passes
Ank4n Feb 18, 2024
2f00fb0
remove update hold
Ank4n Feb 18, 2024
833eadb
remove commented code
Ank4n Feb 18, 2024
c67e66e
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Feb 18, 2024
9fe70fe
nomination pool revert
Ank4n Feb 18, 2024
bdc3b12
fix np tests
Ank4n Feb 18, 2024
949c5d5
refactor test
Ank4n Feb 18, 2024
f31cee2
create np direct stake adapter
Ank4n Feb 18, 2024
141004f
all test pass
Ank4n Feb 19, 2024
13b4a82
rename DirectStake to NoDelegation to keep its name similar to Stakin…
Ank4n Feb 19, 2024
bed9c4c
fmt
Ank4n Feb 19, 2024
54acfb7
move adapter logic local to pool
Ank4n Feb 19, 2024
ea78f16
Revert "move adapter logic local to pool"
Ank4n Feb 19, 2024
a324442
quick basic impl of Delegation adapter for pool
Ank4n Feb 19, 2024
10fadcd
add np to delegate pallet mock runtime
Ank4n Feb 21, 2024
9cafa0e
fmt
Ank4n Feb 21, 2024
f10e589
tests skeleton
Ank4n Feb 21, 2024
b11ea7a
use balance type u128 so np pot accounts are unique
Ank4n Feb 21, 2024
8029e2e
create pool
Ank4n Feb 21, 2024
f283207
increment provider on pool account
Ank4n Feb 21, 2024
a30d3c3
join pool works
Ank4n Feb 21, 2024
7e09ebe
get actual pool id
Ank4n Feb 21, 2024
e981994
bond extra test
Ank4n Feb 21, 2024
8b0d4ae
fix bug of adding surplus amount to delegate
Ank4n Feb 22, 2024
f0cbafe
claim reward incomplete
Ank4n Feb 22, 2024
8a83abd
more checks in try state. Some old test fails, to be fixed
Ank4n Feb 22, 2024
bf6916b
fmt
Ank4n Feb 22, 2024
bdc8c28
remove unused fn
Ank4n Feb 22, 2024
6edaf75
fix tests
Ank4n Feb 22, 2024
e59821b
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Feb 23, 2024
74ec97d
withdraw test passes
Ank4n Feb 23, 2024
e33cc20
withdraw pool works
Ank4n Feb 23, 2024
24e7cf3
updated tests
Ank4n Feb 23, 2024
cc365e7
update withdraw unbonded signature
Ank4n Feb 23, 2024
83fa01b
refactored release
Ank4n Feb 23, 2024
e953cc3
stash killed managed while withdraw
Ank4n Feb 23, 2024
8bac693
all test pass
Ank4n Feb 23, 2024
9bc3040
small test refactor
Ank4n Feb 23, 2024
f3a3e62
slash is posted correctly
Ank4n Feb 23, 2024
ff300ef
failing slash test
Ank4n Feb 23, 2024
c19bf20
add slash call
Ank4n Feb 23, 2024
66c190e
fmt
Ank4n Feb 23, 2024
9af4ae1
slash extrinsic in np
Ank4n Feb 24, 2024
2049a7c
fmt
Ank4n Feb 24, 2024
1d31384
slash works
Ank4n Feb 24, 2024
7c276ab
fmt
Ank4n Feb 24, 2024
086d2f6
finish test for slashing
Ank4n Feb 24, 2024
afc0821
few more fixmes
Ank4n Feb 24, 2024
fb1eba4
add crate docs
Ank4n Feb 24, 2024
a714f72
fix docs
Ank4n Feb 24, 2024
f337a9d
limitations
Ank4n Feb 25, 2024
bccb01e
small edit
Ank4n Feb 25, 2024
72ee3e4
minor doc fixes
Ank4n Feb 25, 2024
278225e
rename block delegation
Ank4n Feb 25, 2024
b32dced
add slash call
Ank4n Feb 25, 2024
03efe85
fmt
Ank4n Feb 25, 2024
9807c51
minor refactors
Ank4n Feb 25, 2024
dbde286
minor refactors
Ank4n Feb 25, 2024
0ccd901
fmt
Ank4n Feb 25, 2024
814d2a5
refactor types
Ank4n Feb 25, 2024
4e68197
minor refactor
Ank4n Feb 25, 2024
97ba0c4
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Feb 25, 2024
8d00bdf
improve np diff
Ank4n Feb 25, 2024
e360267
missed semicolon
Ank4n Feb 25, 2024
05e7ba6
clean diff
Ank4n Feb 25, 2024
95e3ca0
doc fix
Ank4n Feb 25, 2024
89dd29b
rename to transferable
Ank4n Feb 26, 2024
8a41c86
stake adapter
Ank4n Feb 26, 2024
318eaba
add delegation related functions to staking interface
Ank4n Feb 26, 2024
aaa3cbc
staking interface impl updated
Ank4n Feb 26, 2024
d807979
compiles but potentially buggy
Ank4n Feb 27, 2024
2668e78
one test failing
Ank4n Feb 27, 2024
c8fc6a1
all test passes
Ank4n Feb 27, 2024
d41fa53
rename trait method
Ank4n Feb 27, 2024
c408581
minor refactors
Ank4n Feb 27, 2024
d95a6fe
rename delegate to delegatee
Ank4n Feb 27, 2024
b68bb9d
fmt
Ank4n Feb 27, 2024
a340949
name changes
Ank4n Feb 27, 2024
7a40b18
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Feb 27, 2024
de8f875
doc update
Ank4n Feb 27, 2024
fd27cd5
rename to delegatee (missed ones)
Ank4n Feb 27, 2024
1f12032
minor refactors
Ank4n Feb 27, 2024
9c2bb9e
doc updates
Ank4n Feb 27, 2024
244df22
Stake Adapter refactor (#3502)
Ank4n Feb 28, 2024
df13e49
small doc update
Ank4n Feb 28, 2024
11bb084
reorder methods
Ank4n Feb 28, 2024
78ea6ae
minor
Ank4n Feb 28, 2024
ef3b3e7
Update substrate/frame/delegated-staking/Cargo.toml
Ank4n Feb 29, 2024
b4ef397
fix pr feedbacks
Ank4n Feb 29, 2024
2877d0e
rename delegator balance
Ank4n Feb 29, 2024
3de4c4a
add to docs
Ank4n Feb 29, 2024
57e8992
rename error
Ank4n Mar 1, 2024
e95d800
refactor types
Ank4n Mar 1, 2024
25edbde
refactor
Ank4n Mar 1, 2024
639985d
fmt
Ank4n Mar 1, 2024
fa1465e
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Mar 6, 2024
56aa42a
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Mar 12, 2024
7387321
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Mar 21, 2024
8568261
fix imports
Ank4n Mar 21, 2024
452db6a
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Mar 24, 2024
a8e56d2
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Mar 26, 2024
2b861f4
merge from master
Ank4n Mar 28, 2024
c7855fb
add virtual nominator storage
Ank4n Mar 28, 2024
71e7947
add StakingUnsafe
Ank4n Mar 29, 2024
9ad65b3
impl bond_extra
Ank4n Mar 29, 2024
d884c47
report slash via event listener
Ank4n Mar 29, 2024
500ac8f
get rid of delegatee support
Ank4n Mar 29, 2024
a8fc385
fix tests
Ank4n Mar 29, 2024
81c0c78
add update payee to Staking Interface
Ank4n Mar 29, 2024
5ebc35a
get rid of fixme
Ank4n Mar 29, 2024
b9f6392
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Mar 29, 2024
6269251
Merge branch 'master' into ankan/staking-delegate-pallet
Ank4n Mar 29, 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
23 changes: 23 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ members = [
"substrate/frame/staking/reward-curve",
"substrate/frame/staking/reward-fn",
"substrate/frame/staking/runtime-api",
"substrate/frame/delegated-staking",
"substrate/frame/state-trie-migration",
"substrate/frame/statement",
"substrate/frame/sudo",
Expand Down
70 changes: 70 additions & 0 deletions substrate/frame/delegated-staking/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[package]
name = "pallet-delegated-staking"
version = "4.0.0-dev"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
homepage = "https://substrate.io"
repository.workspace = true
description = "FRAME safe-mode pallet"
Ank4n marked this conversation as resolved.
Show resolved Hide resolved

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

[dependencies]
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] }
frame-support = { path = "../support", default-features = false}
frame-system = { path = "../system", default-features = false}
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
sp-std = { path = "../../primitives/std", default-features = false}
sp-runtime = { path = "../../primitives/runtime", default-features = false}
sp-staking = { path = "../../primitives/staking", default-features = false }

[dev-dependencies]
sp-core = { path = "../../primitives/core" }
sp-io = { path = "../../primitives/io" }
substrate-test-utils = { path = "../../test-utils" }
sp-tracing = { path = "../../primitives/tracing" }
pallet-staking = { path = "../staking" }
pallet-nomination-pools = { path = "../nomination-pools" }
pallet-balances = { path = "../balances" }
pallet-timestamp = { path = "../timestamp" }
pallet-staking-reward-curve = { path = "../staking/reward-curve" }
frame-election-provider-support = { path = "../election-provider-support", default-features = false}

[features]
default = [ "std" ]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-std/std",
"sp-runtime/std",
"sp-staking/std",
"pallet-balances/std",
"pallet-staking/std",
"pallet-timestamp/std",
"frame-election-provider-support/std",
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"frame-election-provider-support/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
"pallet-balances/try-runtime",
"pallet-staking/try-runtime",
"pallet-timestamp/try-runtime",
"frame-election-provider-support/try-runtime",
]
20 changes: 20 additions & 0 deletions substrate/frame/delegated-staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This file is part of Substrate.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Benchmarking for pallet-delegated-staking.

#![cfg(feature = "runtime-benchmarks")]
Loading
Loading