[Pools] Refactors and runtime apis for DelegateStake (#4537)
## Runtime Apis Introduces the following runtime apis to facilitate dapps and wallets in integrating with the `DelegateStake` functionalities of the pools (related: https://github.com/paritytech/polkadot-sdk/pull/3905). These apis are meant to support pool and member migration, as well as lazy application of pending slashes of pool members. ```rust fn pool_pending_slash(pool_id: PoolId) -> Balance; fn member_pending_slash(member: AccountId) -> Balance; fn pool_needs_delegate_migration(pool_id: PoolId) -> bool; fn member_needs_delegate_migration(member: AccountId) -> bool; ``` ## Refactors - Introduces newtypes for `Agent`, `Delegator`, `Pool` and `[Pool]Member`. And refactors `StakeAdapter` and `DelegationInterface` to accept the above types. This will help make these apis typesafe against using wrong account type. - Fixing `DelegationInterface` apis to return optional (instead of default value if key does not exist). - Rename struct `Agent` that wraps `AgentLedger` to `AgentOuterLedger` which is clearer (naming wise) and different from the newtype `Agent`. - Cleaning up new Pool events (related to `Delegation` feature of pool). --------- Signed-off-by:Matteo Muraca <mmuraca247@gmail.com> Signed-off-by:
Alexandru Gheorghe <alexandru.gheorghe@parity.io> Signed-off-by:
Andrei Sandu <andrei-mihail@parity.io> Signed-off-by:
Adrian Catangiu <adrian@parity.io> Signed-off-by:
Alexandru Vasile <alexandru.vasile@parity.io> Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Signed-off-by:
divdeploy <chenguangxue@outlook.com> Signed-off-by:
dependabot[bot] <support@github.com> Signed-off-by:
hongkuang <liurenhong@outlook.com> Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by:
gemini132 <164285545+gemini132@users.noreply.github.com> Co-authored-by:
Matteo Muraca <56828990+muraca@users.noreply.github.com> Co-authored-by:
Liam Aharon <liam.aharon@hotmail.com> Co-authored-by:
Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by:
Alexandru Gheorghe <49718502+alexggh@users.noreply.github.com> Co-authored-by:
Alessandro Siniscalchi <asiniscalchi@gmail.com> Co-authored-by:
Andrei Sandu <54316454+sandreim@users.noreply.github.com> Co-authored-by:
Ross Bulat <ross@parity.io> Co-authored-by:
Serban Iorga <serban@parity.io> Co-authored-by:
s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com> Co-authored-by:
Sam Johnson <sam@durosoft.com> Co-authored-by:
Adrian Catangiu <adrian@parity.io> Co-authored-by:
Javier Viola <363911+pepoviola@users.noreply.github.com> Co-authored-by:
Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Co-authored-by:
Niklas Adolfsson <niklasadolfsson1@gmail.com> Co-authored-by:
Dastan <88332432+dastansam@users.noreply.github.com> Co-authored-by:
Clara van Staden <claravanstaden64@gmail.com> Co-authored-by:
Ron <yrong1997@gmail.com> Co-authored-by:
Vincent Geddes <vincent@snowfork.com> Co-authored-by:
Svyatoslav Nikolsky <svyatonik@gmail.com> Co-authored-by:
Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Co-authored-by:
Dino Pačandi <3002868+Dinonard@users.noreply.github.com> Co-authored-by:
Andrei Eres <eresav@me.com> Co-authored-by:
Alin Dima <alin@parity.io> Co-authored-by:
Andrei Sandu <andrei-mihail@parity.io> Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Bastian Köcher <info@kchr.de> Co-authored-by:
Branislav Kontur <bkontur@gmail.com> Co-authored-by:
Sebastian Kunert <skunert49@gmail.com> Co-authored-by:
gupnik <nikhilgupta.iitk@gmail.com> Co-authored-by:
Vladimir Istyufeev <vladimir@parity.io> Co-authored-by:
Lulu <morgan@parity.io> Co-authored-by:
Juan Girini <juangirini@gmail.com> Co-authored-by:
Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by:
Dónal Murray <donal.murray@parity.io> Co-authored-by:
Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by:
Kutsal Kaan Bilgin <kutsalbilgin@gmail.com> Co-authored-by:
Ermal Kaleci <ermalkaleci@gmail.com> Co-authored-by:
ordian <write@reusable.software> Co-authored-by:
divdeploy <166095818+divdeploy@users.noreply.github.com> Co-authored-by:
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by:
Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Co-authored-by:
Squirrel <gilescope@gmail.com> Co-authored-by:
HongKuang <166261675+HongKuang@users.noreply.github.com> Co-authored-by:
Tsvetomir Dimitrov <tsvetomir@parity.io> Co-authored-by:
Egor_P <egor@parity.io> Co-authored-by:
Aaro Altonen <48052676+altonen@users.noreply.github.com> Co-authored-by:
Dmitry Markin <dmitry@markin.tech> Co-authored-by:
Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by:
Léa Narzis <78718413+lean-apple@users.noreply.github.com> Co-authored-by:
Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by:
georgepisaltu <52418509+georgepisaltu@users.noreply.github.com> Co-authored-by: command-bot <> Co-authored-by:
PG Herveou <pgherveou@gmail.com> Co-authored-by:
jimwfs <wqq1479787@163.com> Co-authored-by:
jimwfs <169986508+jimwfs@users.noreply.github.com> Co-authored-by:
polka.dom <polkadotdom@gmail.com>
parent
5779ec5b
Showing
- polkadot/runtime/westend/src/lib.rs 16 additions, 0 deletionspolkadot/runtime/westend/src/lib.rs
- prdoc/pr_4537.prdoc 27 additions, 0 deletionsprdoc/pr_4537.prdoc
- substrate/bin/node/runtime/src/lib.rs 16 additions, 0 deletionssubstrate/bin/node/runtime/src/lib.rs
- substrate/frame/delegated-staking/src/impls.rs 35 additions, 40 deletionssubstrate/frame/delegated-staking/src/impls.rs
- substrate/frame/delegated-staking/src/lib.rs 94 additions, 76 deletionssubstrate/frame/delegated-staking/src/lib.rs
- substrate/frame/delegated-staking/src/mock.rs 7 additions, 7 deletionssubstrate/frame/delegated-staking/src/mock.rs
- substrate/frame/delegated-staking/src/tests.rs 110 additions, 51 deletionssubstrate/frame/delegated-staking/src/tests.rs
- substrate/frame/delegated-staking/src/types.rs 11 additions, 8 deletionssubstrate/frame/delegated-staking/src/types.rs
- substrate/frame/nomination-pools/benchmarking/src/inner.rs 46 additions, 45 deletionssubstrate/frame/nomination-pools/benchmarking/src/inner.rs
- substrate/frame/nomination-pools/runtime-api/src/lib.rs 25 additions, 0 deletionssubstrate/frame/nomination-pools/runtime-api/src/lib.rs
- substrate/frame/nomination-pools/src/adapter.rs 128 additions, 79 deletionssubstrate/frame/nomination-pools/src/adapter.rs
- substrate/frame/nomination-pools/src/lib.rs 160 additions, 69 deletionssubstrate/frame/nomination-pools/src/lib.rs
- substrate/frame/nomination-pools/src/migration.rs 12 additions, 10 deletionssubstrate/frame/nomination-pools/src/migration.rs
- substrate/frame/nomination-pools/src/tests.rs 6 additions, 0 deletionssubstrate/frame/nomination-pools/src/tests.rs
- substrate/frame/nomination-pools/test-delegate-stake/src/lib.rs 30 additions, 3 deletions...ate/frame/nomination-pools/test-delegate-stake/src/lib.rs
- substrate/frame/nomination-pools/test-delegate-stake/src/mock.rs 19 additions, 16 deletions...te/frame/nomination-pools/test-delegate-stake/src/mock.rs
- substrate/primitives/staking/src/lib.rs 58 additions, 27 deletionssubstrate/primitives/staking/src/lib.rs
Please register or sign in to comment