iotex-core icon indicating copy to clipboard operation
iotex-core copied to clipboard

[staking] Replace ContainsSelfStakingBucket with isSelfStakeBucket

Open envestcc opened this issue 1 year ago • 2 comments

Description

Due to the introduction of endorsement, the SelfStakeBucketIndex field of the Candidate will not be reset between expiration and the next bucket action. Therefore, the ContainsSelfStakingBucket function returns true no longer to indicate whether the bucket is a valid self-stake bucket. As a result, this PR introduces a new private function isSelfStakeBucket to achieve this functionality.

Type of change

Please delete options that are not relevant.

  • [x] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

envestcc avatar Feb 08 '24 08:02 envestcc

Codecov Report

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

Project coverage is 76.37%. Comparing base (e1f0636) to head (ce73bda). Report is 181 commits behind head on master.

Files Patch % Lines
action/protocol/staking/handlers.go 55.81% 12 Missing and 7 partials :warning:
action/protocol/staking/bucket_validation.go 42.85% 3 Missing and 1 partial :warning:
.../protocol/staking/handler_candidate_endorsement.go 80.00% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4139      +/-   ##
==========================================
+ Coverage   75.38%   76.37%   +0.99%     
==========================================
  Files         303      339      +36     
  Lines       25923    28936    +3013     
==========================================
+ Hits        19541    22101    +2560     
- Misses       5360     5729     +369     
- Partials     1022     1106      +84     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 08 '24 08:02 codecov[bot]

Quality Gate Failed Quality Gate failed

Failed conditions
4.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Mar 05 '24 07:03 sonarqubecloud[bot]