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

Adds stake-tracker pallet and integrates with the staking pallet #1933

Open
wants to merge 143 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
5803d69
Adds `stake-tracker` pallet and integrates with the staking pallet
gpestana Oct 18, 2023
c7ad6bf
Comments and other nit fixes
gpestana Oct 18, 2023
cb393b9
Removes the untracked stake
gpestana Nov 1, 2023
84a3b71
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Nov 3, 2023
46f5f2e
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Nov 7, 2023
b9d3f64
Removes completely the untracked stake code
gpestana Nov 7, 2023
b42a160
Fixes to review comments
gpestana Nov 7, 2023
086a183
more improvements
gpestana Nov 7, 2023
7b89e06
fixes comments
gpestana Nov 7, 2023
ad1c49d
nits and more tests
gpestana Nov 8, 2023
2c2256d
nits and more tests
gpestana Nov 8, 2023
e2babf5
Adds more tests
gpestana Nov 8, 2023
cab3568
Adds more testing
gpestana Nov 8, 2023
0152b34
improves testing
gpestana Nov 9, 2023
ae98ed9
Change score typ of target list from voteweight to balance
gpestana Nov 10, 2023
ac4a7af
adds more rebagging and sorting tests to stake-tracker
gpestana Nov 10, 2023
c2d681d
More tests
gpestana Nov 14, 2023
4e06d60
test fixing due to new target list ordering
gpestana Nov 14, 2023
bbc59a5
Adds more staking tests for the stake-tracker integration
gpestana Nov 15, 2023
33a9357
more stake_tracker integration tests
gpestana Nov 15, 2023
01793c5
fixes target score updates when kicking
gpestana Nov 15, 2023
fee0514
Addresses review comments; moves stake-tracker into staking crate
gpestana Nov 17, 2023
30a9c47
Adds more defensives
gpestana Nov 17, 2023
05c40db
ledger.kill will fail if preconditions have not been met
gpestana Nov 19, 2023
77d7762
fixes remaining tests
gpestana Nov 19, 2023
f3e4185
Adds stake-tracker to westend runtime
gpestana Nov 19, 2023
bd2d7e2
nits to make CI happy
gpestana Nov 19, 2023
ed3cc48
Update substrate/frame/staking/src/mock.rs
gpestana Nov 21, 2023
dc141ad
Update substrate/frame/staking/stake-tracker/src/mock.rs
gpestana Nov 21, 2023
bbb5740
Update substrate/frame/staking/stake-tracker/src/lib.rs
gpestana Nov 21, 2023
1d98e7d
Update substrate/frame/staking/stake-tracker/Cargo.toml
gpestana Nov 21, 2023
964413c
Adds try-state checks to stake-tracker pallet; review nits
gpestana Nov 21, 2023
25c97e1
Removes duplicate assert
gpestana Nov 24, 2023
f9c439c
Refactors staking and `stake-tracker` so that target and voter lists …
gpestana Dec 2, 2023
b09f8bc
Addresses review comments
gpestana Dec 5, 2023
062868d
review comments
gpestana Dec 5, 2023
992cff1
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Dec 5, 2023
70ab8c3
".git/.scripts/commands/fmt/fmt.sh"
Dec 5, 2023
ee52b6f
Update documentation
gpestana Dec 5, 2023
a3b0b41
Wraps slash tests on TestExternalities
gpestana Dec 13, 2023
f1526e0
Removes ability to explicitly add moot nominations, as it fails with …
gpestana Dec 14, 2023
2870db3
Keeps approvals even if the validator chills or stash is killed (if t…
gpestana Dec 20, 2023
6713df3
Update docs; VoterList node is removed upon chilling.
gpestana Dec 24, 2023
341e28e
Update substrate/frame/staking/stake-tracker/src/lib.rs
gpestana Dec 26, 2023
dba853b
review nits
gpestana Dec 26, 2023
b316f6f
Refactor `OnStakingUpdate` interface to be safer to use. (#2877)
gpestana Jan 8, 2024
261456e
Fixes fast-unstake test setup
gpestana Jan 8, 2024
27a85fc
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Jan 8, 2024
088783e
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Jan 21, 2024
bf1e043
simplifies do_add_validator
gpestana Jan 21, 2024
c0497b2
Adds prdoc
gpestana Jan 21, 2024
27129fb
fixes clippy
gpestana Jan 22, 2024
f0098d6
Fixes clippy
gpestana Jan 23, 2024
fa94b7f
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Feb 1, 2024
f89a046
after master merge fixes
gpestana Feb 1, 2024
18f11b7
simplify on_remove_* logic
gpestana Feb 1, 2024
0e95378
Adds stake-tracker to benchmarking runtime
gpestana Feb 5, 2024
ff8a64e
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Feb 5, 2024
261e8ab
stake-tracker cargo fix
gpestana Feb 5, 2024
63f43f8
Fixes stake-tracker/no-std
gpestana Feb 5, 2024
bc2f2ce
Fixes feature dependencies
gpestana Feb 5, 2024
50ea3d0
fmt cargo.toml
gpestana Feb 5, 2024
38e6616
fixes westend/stake-tracker runtime config
gpestana Feb 5, 2024
5a5494a
impls max_exposure_page_size for mock (runtime-benchmarks)
gpestana Feb 5, 2024
246c49a
fixes rust docs
gpestana Feb 6, 2024
41a00a3
Adds throughout try-state checks and includes stake-tracker try-state…
gpestana Feb 7, 2024
3ae6d11
Update substrate/frame/staking/src/ledger.rs
gpestana Feb 8, 2024
cf047db
fixes clippy
gpestana Feb 8, 2024
6e5d019
clean up try-state code
gpestana Feb 8, 2024
d12cdc2
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Feb 8, 2024
a1b16c7
clippy nits
gpestana Feb 8, 2024
f48c7de
Add try-runtime gated method in sorted list provider to help with checks
gpestana Feb 8, 2024
4ac7fcf
Adds the callable drop_dangling_nomination to allow permissionless dr…
gpestana Feb 9, 2024
2fdb673
clippy
gpestana Feb 9, 2024
e5ca233
doc fixes
gpestana Feb 9, 2024
786dbf5
simplifies staking imbalance calculation; addresses reviews
gpestana Feb 11, 2024
bfa02dc
Update substrate/frame/staking/stake-tracker/src/lib.rs
gpestana Feb 12, 2024
44f44ef
addresses PR comments & simplifies stake-tracker code
gpestana Feb 12, 2024
ff8ee33
add a couple more checks to try-state when building the approvals map
gpestana Feb 12, 2024
740565b
ensures OnStakingUpdate events are triggered at the correct places an…
gpestana Feb 13, 2024
8c8d004
updates comments; ensures that voter list is also always sorted + tes…
gpestana Feb 13, 2024
d48f823
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Feb 15, 2024
639edaf
nits and address comments
gpestana Feb 15, 2024
9af1122
defensive instead of err in case of killing a stash that is not Idle
gpestana Feb 15, 2024
7dd813b
Adds stake-tracker benchs
gpestana Feb 16, 2024
9ec7759
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Feb 19, 2024
ab802b5
Removes the need for staking to check the state of the target and vot…
gpestana Feb 19, 2024
12fce24
cargo-clippy fix
gpestana Feb 19, 2024
d44f734
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Apr 15, 2024
afeddd2
Update substrate/frame/staking/stake-tracker/src/lib.rs
gpestana Apr 15, 2024
e66d00f
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Apr 19, 2024
56ecb62
starts adding mmb for target list
gpestana Apr 19, 2024
595022e
moves drop_dangling_target extrinsic from stake-tracker to staking
gpestana Apr 20, 2024
fa7edf1
finishes dangling nomination benchs
gpestana Apr 21, 2024
b4f9e90
fixes BadTarget error in benchmarks
gpestana Apr 21, 2024
803f148
Adds v13 mmb migration benchmarks and tests
gpestana Apr 21, 2024
6123e12
refactors benchmarks to use benchmarking::v2
gpestana Apr 22, 2024
25589af
some refactoring on mmb benchmarks
gpestana Apr 22, 2024
7e6db9e
changes mmb strategy -- do nominator-based migrations instead of vali…
gpestana Apr 22, 2024
2864631
Finishes benchmarks and MMB for stake-tracker
gpestana Apr 23, 2024
b01f013
simplifies defensive for tests only
gpestana Apr 28, 2024
ac5df15
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Apr 28, 2024
34c4612
nit
gpestana Apr 28, 2024
6273d4c
nits
gpestana Apr 28, 2024
2096b25
fixes imports
gpestana Apr 29, 2024
1080cc4
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
Apr 29, 2024
c6593dc
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Apr 29, 2024
605e54d
starts sorting mode
gpestana Apr 29, 2024
3fa1601
fixes iter
gpestana Apr 30, 2024
9d335ca
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana May 2, 2024
9e18a84
cargo lock update after merging master
gpestana May 2, 2024
40620e0
Update substrate/frame/staking/stake-tracker/src/lib.rs
gpestana May 2, 2024
97d254e
Update substrate/frame/staking/stake-tracker/src/mock.rs
gpestana May 2, 2024
8624320
nit
gpestana May 2, 2024
6e452e1
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana May 2, 2024
e9218b6
nits
gpestana May 2, 2024
1dd4d38
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana May 8, 2024
628bceb
`stake-tracker` feedback PR (#4411)
gpestana May 10, 2024
52cde8a
Merge branch 'gpestana/stake-tracker_integration' of github.com:parit…
gpestana May 10, 2024
c444174
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana May 10, 2024
d726d0f
fixes zepter
gpestana May 10, 2024
3d4452f
ensures mmb bench checks are deteministic
gpestana May 10, 2024
d225176
clippy nits
gpestana May 10, 2024
a56f765
taplo nit fixes
gpestana May 10, 2024
80895ad
clippy nit
gpestana May 10, 2024
6219b32
Stake tracker improvements (migration and try-state checks OK in Polk…
gpestana Jun 3, 2024
822a945
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Jun 3, 2024
1aa1c80
fixes umbrella runtime and stake-tracker mock after master merge
gpestana Jun 3, 2024
4bf868a
nits
gpestana Jun 3, 2024
3a07d09
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Jun 3, 2024
1445118
docs pass
gpestana Jun 5, 2024
e785621
nit: fix umbrella cargo lint
gpestana Jun 5, 2024
8c685d7
fixes nomination pools benchmarks (validators must exist)
gpestana Jun 5, 2024
c34ede1
adds try-state checks to ensure no duplicate targets in nomination
gpestana Jun 5, 2024
303b4be
fixes tests and mocks in other pallets
gpestana Jun 5, 2024
66290a6
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Jun 5, 2024
cc16579
semver nits
gpestana Jun 5, 2024
fc39f8e
all try-state checks pass for ext pallets; prdoc nits
gpestana Jun 6, 2024
f2613de
nit
gpestana Jun 6, 2024
8caac45
on_add_validator without option
gpestana Jun 6, 2024
b44a4e5
doc improvements; drop dangling target fix; more tests
gpestana Jun 6, 2024
3a68c14
Merge branch 'master' into gpestana/stake-tracker_integration
gpestana Jun 13, 2024
66f8259
addresses review
gpestana Jun 13, 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
22 changes: 22 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 @@ -343,6 +343,7 @@ members = [
"substrate/frame/session",
"substrate/frame/session/benchmarking",
"substrate/frame/society",
"substrate/frame/stake-tracker",
"substrate/frame/staking",
"substrate/frame/staking/reward-curve",
"substrate/frame/staking/reward-fn",
Expand Down
61 changes: 61 additions & 0 deletions substrate/frame/stake-tracker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[package]
name = "pallet-stake-tracker"
version = "0.1.0"
description = "FRAME stake tracker pallet"
authors = ["Parity Technologies <admin@parity.io>"]
homepage = "https://substrate.io"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/paritytech/substrate"

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

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

sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime", features = ["serde"] }
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../primitives/staking", features = ["serde"] }
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }

sp-npos-elections = { version = "4.0.0-dev", path = "../../primitives/npos-elections" }
frame-election-provider-support = { version = "4.0.0-dev", default-features = false, path = "../election-provider-support" }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support"}
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }

[dev-dependencies]
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
sp-core = { version = "21.0.0", path = "../../primitives/core" }
sp-io = { version = "23.0.0", default-features = false, path = "../../primitives/io" }
sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime", features = ["serde"] }
sp-tracing = { version = "10.0.0", path = "../../primitives/tracing" }
pallet-bags-list = { version = "4.0.0-dev", path = "../bags-list" }
pallet-balances = { version = "4.0.0-dev", path = "../balances" }

[features]
default = ["std"]

std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-runtime/std",
"sp-std/std",
]

runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]

try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
]
9 changes: 9 additions & 0 deletions substrate/frame/stake-tracker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Pallet `stake-tracker`

The stake-tracker pallet is listens to staking events through implemeting the
gpestana marked this conversation as resolved.
Show resolved Hide resolved
[`OnStakingUpdate`] trait and forwards those events to one or multiple types (e.g. pallets) that
must be kept up to date with certain updates in staking. The pallet does not expose any
callables and acts as a multiplexer of staking events.

Currently, the stake tracker pallet is used to update the semi-sorted target and voter lists
implemented through bags lists.
Loading
Loading