Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Fix slashing migration to v10 #11924

Merged
merged 5 commits into from
Jul 28, 2022
Merged

Conversation

kianenigma
Copy link
Contributor

@kianenigma kianenigma commented Jul 27, 2022

A small fix to the migration of #11823

Problem: If some slashes already exist in UnappliedSlashes, they will probably never be triggered in the new logic, since we lookup only a specific key of this map at the beginning of the era.

Solution: Try and apply all pending slashes one last time before going to the new logic.

What I have written now in code is not ideal, but good enough that under normal conditions we survive. If an attacker wants to create more than 512 slash reports or such, it still needs a manual intervention.

@kianenigma kianenigma added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Jul 27, 2022
@github-actions github-actions bot added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Jul 27, 2022
@kianenigma kianenigma marked this pull request as ready for review July 27, 2022 16:44
@kianenigma kianenigma added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jul 27, 2022
@shawntabrizi
Copy link
Member

shawntabrizi commented Jul 27, 2022

In this PR you can also change the default version i caught was behind? In fact you can now use some Default enum stuff?

frame/staking/src/migrations.rs Outdated Show resolved Hide resolved
@kianenigma
Copy link
Contributor Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 782e08e into master Jul 28, 2022
@paritytech-processbot paritytech-processbot bot deleted the kiz-fix-slash-migration branch July 28, 2022 10:44
chevdor added a commit that referenced this pull request Jul 28, 2022
* Fix slashing migration to v10

* add some logs

* Fix default version

* fmt

* Move doc to struct

Co-authored-by: Wilfried Kopp <wilfried@parity.io>
chevdor added a commit that referenced this pull request Jul 28, 2022
* Fix slashing migration to v10

* add some logs

* Fix default version

* fmt

* Move doc to struct

Co-authored-by: Wilfried Kopp <wilfried@parity.io>

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
DaviRain-Su pushed a commit to octopus-network/substrate that referenced this pull request Aug 23, 2022
* Fix slashing migration to v10

* add some logs

* Fix default version

* fmt

* Move doc to struct

Co-authored-by: Wilfried Kopp <wilfried@parity.io>
@louismerlin louismerlin added D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Oct 17, 2022
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Fix slashing migration to v10

* add some logs

* Fix default version

* fmt

* Move doc to struct

Co-authored-by: Wilfried Kopp <wilfried@parity.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants