Finschia / finschia-sdk

A framework for building blockchains based Finschia Mainnet that is forked from cosmos-sdk
Apache License 2.0
61 stars 31 forks source link

fix: add validation for potential slashing evasion during re-delegation #1306

Closed ulbqb closed 8 months ago

ulbqb commented 8 months ago

Description

closes: #XXXX

According to the GHSA-86h5-xcpx-cfqc, an issue was identified in the slashing mechanism that may allow for the evasion of slashing penalties during a slashing event. If a delegation contributed to the byzantine behavior of a validator and the validator has not yet been slashed, it may be possible for that delegation to evade a pending slashing penalty through re-delegation behavior.

Additional validation logic was added to restrict this behavior in below commit in cosmos-sdk. https://github.com/cosmos/cosmos-sdk/commit/d1b5b0c5ae2c51206cc1849e09e4d59986742cc3

Motivation and context

How has this been tested?

Screenshots (if appropriate):

Checklist:

codecov[bot] commented 8 months ago

Codecov Report

Attention: Patch coverage is 6.89655% with 27 lines in your changes are missing coverage. Please review.

Project coverage is 70.41%. Comparing base (e986f03) to head (6afe0d4).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1306/graphs/tree.svg?width=650&height=150&src=pr&token=m16qfzIPO7&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia)](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) ```diff @@ Coverage Diff @@ ## main #1306 +/- ## ========================================== - Coverage 70.42% 70.41% -0.02% ========================================== Files 643 643 Lines 54730 54758 +28 ========================================== + Hits 38546 38560 +14 - Misses 14011 14023 +12 - Partials 2173 2175 +2 ``` | [Files](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1306?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) | Coverage Δ | | |---|---|---| | [simapp/app.go](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-c2ltYXBwL2FwcC5nbw==) | `79.16% <0.00%> (-2.09%)` | :arrow_down: | | [x/staking/keeper/slash.go](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-eC9zdGFraW5nL2tlZXBlci9zbGFzaC5nbw==) | `63.52% <9.52%> (-7.71%)` | :arrow_down: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1306/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia)