* Trivial adjustments to beefy and grandpa pallets
* Introduce offence report system to beefy pallet
* Minor adjustments
* Fix beefy-mmr mock
* Apply suggestions from code review
Co-authored-by: Anton <anton.kalyaev@gmail.com>
---------
Co-authored-by: Anton <anton.kalyaev@gmail.com>
* Experiments with common equivocation trait
* Improved equivocation trait
* Fix grandpa equivocation implementation
* Remove some cruft
* Remove some more cruft
* More generic naming
* Simplification of offences manipilation
* More refactory
* Some prograss with the encapsulation of offence report system
* Finally unit type works as a universal null report system
* Align substrate node code
* Further simplification
* Fix test utils
* Remove not required associated type
* Fix benches
* Rollback to prev field name
* Box big params
* Fix typo
* Remove new tag computation
* Remove default implementations
* Better docs
* Return 'Result' instead of bool
* Change offence report system return types
* Some renaming and documentation
* Improve documentation
* More abstract offence report system
* Rename 'consume_evidence' to 'process_evidence'
* Further docs refinements
* Doc for dummy offence report
* Fix rustdoc
* Fix after master merge
* Apply code review suggestions
* Improve docs
* Change copyright year to 2023 from 2022
* Fix incorrect update of copyright year
* Remove years from copy right header
* Fix remaining files
* Fix typo in a header and remove update-copyright.sh
* pallet-offences-benchmarking: Box events in verify
Events in frame are represented by an enum in the pallet and the runtime. The size of an enum in
Rust depends on the size of biggest variant. This means we always need to allocate memory for the
biggest variant when allocating memory for an event. The offences benchmarking is verifying the
benchmarking results by checking the events. To check the events it is generating all the expected
events. With the recent changes in Polkadot the events are too big and lead to issues when running
this verify functions. The solution is to box each event, as the vector holding all the events will
then only need to hold fat pointers * expected events, instead of size_of(event) * expected events.
This issue isn't a problem in production, as we never read the events on chain. When we are reading
the events, it is done in an offchain context and they are only decoded one by one.
Besides that this also enables the benchmarking verification for everyone running these benchmarks.
* FMT
* Disable checking again
* 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 <>
* 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>
* replace pallet level unboundedness to individual storage items
* bound structs
* bounding history depth
* defensive error
* use the era history depth from config
* clean up history depth from storage in v11
* keep the name HistoryDepth for the new configuration value
* use u32 for history depth in node runtime
* improve doc comments
* add HistoryDepth to mock runtimes with pallet-staking
* rustfmt
* refactor and doc improve
* apply re-benchmarked weight for staking
* pr feedback improvements
* test for claimed rewards following the expected bounds
* refactor test to calculate first and last reward era programmatically
* verify previous eras cannot be claimed
* add migration v12
* ".git/.scripts/bench-bot.sh" pallet dev pallet_staking
* fix compiler error
* corrupting history depth does not lead to catastrophic issue
* fix new line
* remove unused import
* fmt
* add test to document scenario where history depth is reduced without migration
* fmt
* Update frame/staking/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Update frame/staking/src/migrations.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* doc for all storage items bounded by HistoryDepth
* Update frame/staking/src/pallet/mod.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Update frame/staking/src/tests.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* pr feedback fixes
* Update frame/staking/src/tests.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* remove extra checks
* fix merge
* fmt
Co-authored-by: command-bot <>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: kianenigma <kian@parity.io>
* BREAKING: Rename Origin
* more renaming
* a bit more renaming
* fix
* more fixing
* fix in frame_support
* even more fixes
* fix
* small fix
* ...
* update .stderr
* docs
* update docs
* update docs
* docs
* update api
* update
* remove unused
* remove `one` api
* fix unused
* fmt
* add saturating accrue
* remove `Weight::new()`
* use some macros
* div makes no sense
* Update weight_v2.rs
* missed some
* more patch
* fixes
* more fixes
* more fix
* more fix
* Update frame/support/src/weights/weight_v2.rs
* not needed
* fix weight file
* Fix benchmarks and adds CI to test them
Instead of waiting for benchmarks failing in Polkadot CI, we also can just test them in Substrate :P
* Do not overflow
* Update UI test output for rust 1.62.1
* switch ci to staging image to check that everything works
* fix artifacts node-bench-regression-guard
* Imeplement `scale_info::TypeInfo` manually to silence aggressive rust warning
* Fix more clippy lints
* Make clippy happy by relying on auto-deref were possible
* Add tracking issue to the comments
* pin ci image
Co-authored-by: alvicsam <alvicsam@gmail.com>
* generate_storage_alias: Rewrite as proc macro attribute
This rewrites the `generate_storage_alias!` declarative macro as proc-macro attribute. While doing
this the name is changed to `storage_alias`. The prefix can now also be the name of a pallet. This
makes storage aliases work in migrations for all kind of chains and not just for the ones that use
predefined prefixes.
* Fix compilation and FMT
* Moare fixes
* 🤦
* ......
* Rework the syntax and support instancing
* FMT
* Prefix variants with `Storage`
* Make it compile
* Fix where clause on rust stable
* staking: Proportional ledger slashing
* Some comment cleanup
* Update frame/staking/src/pallet/mod.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Fix benchmarks
* FMT
* Try fill in all staking configs
* round of feedback and imp from kian
* demonstrate per_thing usage
* Update some tests
* FMT
* Test that era offset works correctly
* Update mocks
* Remove unnescary docs
* Remove unlock_era
* Update frame/staking/src/lib.rs
* Adjust tests to account for only remove when < ED
* Remove stale TODOs
* Remove dupe test
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: kianenigma <kian@parity.io>
* Allow `pallet-election-provider` to accept smaller
solutions, issue #9478
* Fixing a typo
* Adding some more tests
Removing a seemingly outdated comment
* making it a URL
* Updating test name as per suggestion
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Updating documentation to be more explicit
And to follow the general guidelines
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Fixing formatting
* `Fallback` now of type `InstantElectionProvider`
Some cleanups
* Allow `pallet-election-provider` to accept smaller
solutions, issue #9478
* Fixing a typo
* Adding some more tests
Removing a seemingly outdated comment
* making it a URL
* Updating test name as per suggestion
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Updating documentation to be more explicit
And to follow the general guidelines
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Fixing formatting
* `Fallback` now of type `InstantElectionProvider`
Some cleanups
* Merging types into one type with generics
* Removing `ConstUSize` and use `ConstU32`
* cleaning up the code
* deprecating `OnChainSequentialPhragmen`
Renaming it to `UnboundedSequentialPhragmen` which should only be used
at genesis and for testing.
Use preferrably `BoundedOnChainSequentialPhragmen`
* Amending docs
* Adding some explicit imports
* Implementing generic `BoundedOnchainExecution`
Removing the deprecated `OnChainSequentialPhragmen`
* Use the right Balancing strategy
* Refactoring `onchain::Config`
Creating `onchain::ExecutionConfig`
* Merge master
* fmt
* Name cleanups after review suggestions
* cosmetics
* renaming `instant_elect` to `elect_with_bounds`
Other corresponding changes as per @kianenigma feedback
* `BoundedOnchainExecution` -> `BoundedExecution`
And `UnboundedOnchainExecution` -> `UnboundedExecution`
* feedback from kian
* fmt + unneeded import
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: kianenigma <kian@parity.io>
* Upgraded dependencies
* Adapting code to scale v3
* Empty commit to trigger CI
* Triggering CI
* Fixing UI test
* Remove superfluous dev-dep added by #9228
* Cryout for CI
* Use proper bounded vector type for nominations
* add docs and tweak chill_other for cleanup purposes
* Fix the build
* remove TODO
* add a bit more doc
* even more docs
gushc
* Update frame/staking/src/pallet/mod.rs
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
* Update frame/staking/src/pallet/mod.rs
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
* Fix the nasty bug
* also bound the Snapshot type
* fix doc test
* document bounded_vec
* self-review
* remove unused
* Fix build
* frame-support: repetition overload for bounded_vec
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* fix
* remove the need to allocate into unbounded voters etc etc
* Don't expect
* unbreal the build again
* handle macro a bit better
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Remove all stale on_runtime_upgrade hooks in the runtime
* add docs
* cleanup
* fix warn
* fix more warnings
* fix offence test
* overwrite the damn UItest