Commit Graph

22 Commits

Author SHA1 Message Date
Ankan 8f7971dca7 add note on usage of twox hash (#13089) 2023-01-09 08:33:29 +01:00
Ankan 9726a10dbb Allow StakingAdmin to set min_commission (#13018)
* staking admin can set min commission

* ".git/.scripts/bench-bot.sh" pallet dev pallet_staking

* fmt

* fix for pr comments

Co-authored-by: command-bot <>
2022-12-26 15:48:40 +00:00
Kian Paimani 70e9f8e920 Fix fast-unstake for accounts with slashing (#12963)
* Fix fast-unstake for accounts with slashing

* ".git/.scripts/fmt.sh" 1

* fmt

* fix

* fix weight tracking

* Adds tests for withdraw_unbonded with slashing

* Removes tests for withdraw_unbonded with slashing

* ".git/.scripts/fmt.sh"

* Adds slash spans calculation test for withdraw_unbonded

Co-authored-by: command-bot <>
Co-authored-by: gpestana <g6pestana@gmail.com>
2022-12-23 07:04:47 +00:00
Bastian Köcher c0c8d6305f Fixup some wrong dependencies (#12899)
* Fixup some wrong dependencies

Dev dependencies should not appear in the feature list. If features are required, they should be
directly enabled for the `dev-dependency`.

* More fixups

* Fix fix

* Remove deprecated feature

* Make all work properly and nice!!

* FMT

* Fix formatting
2022-12-13 22:47:51 +01:00
Oliver Tale-Yazdi 31f5119ecd Use explicit call indices (#12891)
* frame-system: explicit call index

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use explicit call indices

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* pallet-template: explicit call index

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* DNM: Temporarily require call_index

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Revert "DNM: Temporarily require call_index"

This reverts commit c4934e312e12af72ca05a8029d7da753a9c99346.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-12-12 14:32:41 +00:00
Keith Yeung 51db8c77a7 Introduce sensible weight constants (#12868)
* Introduce sensible weight constants

* cargo fmt

* Remove unused import

* Add missing import

* ".git/.scripts/bench-bot.sh" pallet dev pallet_lottery

Co-authored-by: command-bot <>
2022-12-09 01:18:51 +09:00
João Paulo Silva de Souza 8751f88fc7 Implement crate publishing on CI (#12768)
* implement crate publishing from CI

* fix indentation

* use resource_group for job exclusivity

ensure that at most one instance of the publish-crates job is running at any given time to prevent race conditions

* correct publish = false

* Remove YAML anchors as GitLab's `extends:` doesn't need it

* Temporarily force cache upload for the new jobs

* Revert `RUSTY_CACHIER_FORCE_UPLOAD`

* pin libp2p-tcp=0.37.0 for sc-telemetry

* Revert "pin libp2p-tcp=0.37.0 for sc-telemetry"

This reverts commit 29146bfad6c31e8cf0e2f17ad92a71bb81a373af.

* always collect generated crates

* increase timeout for publish-crates-template

* Force upload the new job cache again

* Revert "Force upload the new job cache again"

This reverts commit 5a5feee1b2c51fdef768b25a76be4c3949ec1c99.

* reformat

* improve timeout explanation

* s/usual/average

Co-authored-by: Vladimir Istyufeev <vladimir@parity.io>
2022-12-07 18:08:48 +00:00
Kian Paimani 3e48c4bc02 return error instead of expect in feasibility_check (#12745)
* Update lib.rs

* make defensive

* fmt

* fix batching migration

* fix

* fix

Co-authored-by: parity-processbot <>
2022-11-23 08:38:34 +00:00
Roman Useinov 352fbbc146 [Fix] Deposit for fast-unstake has to be define as pallet::constant (#12729)
Fixes https://github.com/paritytech/substrate/issues/12618
2022-11-17 15:33:39 +00:00
Roman Useinov cac880a7f4 [Cleanup] Remove obsolete event from fast-unstake (#12725)
Trivial, just removing unused code.
2022-11-17 12:19:34 +00:00
Niklas Adolfsson 2b8af8cb1a release sp-core 7.0.0 and sp-runtime 7.0.0 (#12599)
* chore(release): sp-core v7.0.0

* chore(release): sp-runtime v7.0.0

* fix bad merge
2022-11-15 14:54:14 +00:00
Ankan 657d99202c Bound Election and Staking by MaxActiveValidators (#12436)
* bounding election provider with kian

* multi phase implement bounded election provider

* election provider blanket implementation

* staking compiles

* fix test for election provider support

* fmt

* fixing epmp tests, does not compile yet

* fix epmp tests

* fix staking tests

* fmt

* fix runtime tests

* fmt

* remove outdated wip tags

* add enum error

* sort and truncate supports

* comment

* error when unsupported number of election winners

* compiling wip after kian's suggestions

* fix TODOs

* remove,fix tags

* ensure validator count does not exceed maxwinners

* clean up

* some more clean up and todos

* handle too many winners

* rename parameter for mock

* todo

* add sort and truncate rule if there are too many winners

* fmt

* fail, not swallow emergency result bound not met

* remove too many winners resolution as it can be guaranteed to be bounded

* fix benchmark

* give MaxWinners more contextual name

* make ready solution generic over T

* kian feedback

* fix stuff

* Kian's way of solvign this

* comment fix

* fix compile

* remove use of BoundedExecution

* fmt

* comment out failing integrity test

* cap validator count increment to max winners

* dont panic

* add test for bad data provider

* Update frame/staking/src/pallet/impls.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* fix namespace conflict and add test for onchain max winners less than desired targets

* defensive unwrap

* early convert to bounded vec

* fix syntax

* fmt

* fix doc

* fix rustdoc

* fmt

* fix maxwinner count for benchmarking

* add instant election for noelection

* fmt

* fix compile

* pr feedbacks

* always error at validator count exceeding max winners

* add useful error message

* pr comments

* import fix

* add checked_desired_targets

* fmt

* fmt

* fix rust doc

Co-authored-by: parity-processbot <>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2022-11-09 09:11:51 +00:00
Shawn Tabrizi 78cddd7631 New Weights for All Pallets (#12325)
* new weights for everything

* fix

* fmt

* new batch

* fmt

* new batch

* Update run_all_benchmarks.sh

* add headers

* update weights

* Update lib.rs

* block and extrinsic weight
2022-11-08 18:50:28 +00:00
Kian Paimani c42db93312 Add batching to fast-unstake pallet (#12394)
* implement a brand new batch with all tests passing.

* fix benchmarks as well

* make benchmarks more or less work

* fix migration

* add some testing

* Update frame/fast-unstake/src/benchmarking.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* review comments

* some fixes

* fix review comments

* fix build

* fmt

* fix benchmarks

* fmt

* update

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
2022-11-08 16:15:55 +00:00
Roman Useinov 4bc091f4a9 [Enhancement] Convert fast-unstake to use StakingInterface, decouplin… (#12424)
* [Enhancement] Convert fast-unstake to use StakingInterface, decoupling it from Staking

* Update primitives/staking/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update primitives/staking/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* fix validator comment

* remove todo

* ideas from Kian (#12474)

Co-authored-by: kianenigma <kian@parity.io>

* Rename StakingInterface -> Staking for nomination-pools

* Staking fixes

* StakingInterface changes

* fix fast-unstake

* fix nomination-pools

* Fix fast-unstake tests

* Fix benches for fast-unstake

* fix is_unbonding

* fix nomination pools

* fix node code

* add mock comments

* fix imports

* remove todo

* more fixes

* more fixes

* bench fixes

* more fixes

* more fixes

* import fix

* more fixes

* more bench fix

* refix

* refix

* Update primitives/staking/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* is_unbonding returns a result

* fix

* review fixes

* more review fixes

* more fixes

* more fixes

* Update frame/fast-unstake/src/benchmarking.rs

Co-authored-by: Squirrel <gilescope@gmail.com>

* remove redundant CurrencyBalance from nom-pools

* remove CB

* rephrase

* Apply suggestions from code review

* Update frame/nomination-pools/src/tests.rs

* finish damn renamed

* clippy fix

* fix

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: parity-processbot <>
Co-authored-by: Squirrel <gilescope@gmail.com>
2022-10-29 09:22:58 +00:00
Keith Yeung a4fb1d7096 Properly set the max proof size weight on defaults and tests (#12383)
* Properly set the max proof size weight on defaults and tests

* cargo fmt

* Set proper max proof size for contracts pallet tests

* Properly set max proof size for node

* Properly set max proof size for frame system mock

* Update test expectations

* Update test expectations

* Properly set max proof size for balances mock

* Update test expectations

* Update test expectations

* Properly set max proof size for democracy mock

* Properly set max proof size for scheduler mock

* Properly set max proof size for fast unstake mock

* Properly set max proof size for tx payment mock

* Properly set max proof size for elections phragmen mock

* Properly set max proof size for node template
2022-09-29 15:48:10 +00:00
Ankan 6137c8707b bounding staking: BoundedElectionProvider trait (#12362)
* add a bounded election provider trait

* extract common trait election provider base

* fmt

* only bound the outer support vector

* fix tests

* docs

* fix rust docs

* fmt

* fix rustdocs

* docs

* improve docs

* small doc change
2022-09-28 20:52:16 +00:00
Roman Useinov 1f687256fb [Feature] Add deposit to fast-unstake (#12366)
* [Feature] Add deposit to fast-unstake

* disable on ErasToCheckPerBlock == 0

* removed signed ext

* remove obsolete import

* remove some obsolete stuff

* fix some comments

* fixed all the comments

* remove obsolete imports

* fix some tests

* CallNotAllowed tests

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* fix tests

* fix deregister + tests

* more fixes

* make sure we go above existential deposit

* fixed the last test

* some nit fixes

* fix node

* fix bench

* last bench fix

* Update frame/fast-unstake/src/lib.rs

* ".git/.scripts/fmt.sh" 1

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: command-bot <>
2022-09-27 17:31:12 +00:00
Kian Paimani 4dd6fc86e1 export more types from fast-untsake 🤦‍♂️ (#12353)
* export more types from fast-untsake 🤦‍♂️

* make non-test

* fmt
2022-09-27 07:08:14 +00:00
Kian Paimani ea377d0b17 re-export weight file for fast-unstsake pallet (#12352) 2022-09-26 12:08:34 +01:00
Roman Useinov 6fee4cb3f2 [Enhancement] Remove optional Pool subscription from fast-unstake (#12344)
* [Enhancement] Remove optional Pool subscription from fast-unstake

* remove nomination-pools pallet dependency

* fixes

* more fixes

* more fixes

* more fixes
2022-09-26 06:05:05 +00:00
Kian Paimani b56c0e4cb6 Fast Unstake Pallet (#12129)
* add failing test for itamar

* an ugly example of fast unstake

* Revert "add failing test for itamar"

This reverts commit 16c4d8015698a0684c090c54fce8b470a2d2feb2.

* fast unstake wip

* clean it up a bit

* some comments

* on_idle logic

* fix

* comment

* new working version, checks all pass, looking good

* some notes

* add mock boilerplate

* more boilerplate

* simplify the weight stuff

* ExtBuilder for pools

* fmt

* rm bags-list, simplify setup_works

* mock + tests boilerplate

* make some benchmarks work

* mock boilerplate

* tests boilerplate

* run_to_block works

* add Error enums

* add test

* note

* make UnstakeRequest fields pub

* some tests

* fix origin

* fmt

* add fast_unstake_events_since_last_call

* text

* rewrite some benchmes and fix them -- the outcome is still strange

* Fix weights

* cleanup

* Update frame/election-provider-support/solution-type/src/single_page.rs

* fix build

* Fix pools tests

* iterate teset + mock

* test unfinished

* cleanup and add some tests

* add test successful_multi_queue

* comment

* rm Head check

* add TODO

* complete successful_multi_queue

* + test early_exit

* fix a lot of things above the beautiful atlantic ocean 🌊

* seemingly it is finished now

* Fix build

* ".git/.scripts/fmt.sh" 1

* Fix slashing amount as well

* better docs

* abstract types

* rm use

* import

* Update frame/nomination-pools/benchmarking/src/lib.rs

Co-authored-by: Nitwit <47109040+nitwit69@users.noreply.github.com>

* Update frame/fast-unstake/src/types.rs

Co-authored-by: Nitwit <47109040+nitwit69@users.noreply.github.com>

* Fix build

* fmt

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* make bounded

* feedback from code review with Ankan

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update frame/fast-unstake/src/mock.rs

* update to master

* some final review comments

* fmt

* fix clippy

* remove unused

* ".git/.scripts/fmt.sh" 1

* make it all build again

* fmt

* undo fishy change

Co-authored-by: Ross Bulat <ross@jkrbinvestments.com>
Co-authored-by: command-bot <>
Co-authored-by: Nitwit <47109040+nitwit69@users.noreply.github.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
2022-09-23 09:36:33 +00:00