Skip to content

IIP50 slash unqualified candidates #4678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

CoderZhi
Copy link
Collaborator

@CoderZhi CoderZhi commented Jul 18, 2025

slash in epoch reward grant action handling

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

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

@CoderZhi CoderZhi requested a review from a team as a code owner July 18, 2025 00:30
@CoderZhi CoderZhi force-pushed the slash_self_staking branch from ab43c26 to 3794c6e Compare July 22, 2025 16:27
Comment on lines 197 to 204
filteredCandidates := make([]*state.Candidate, 0)
for _, candidate := range candidates {
if _, ok := exemptAddrs[candidate.Address]; ok {
continue
}
filteredCandidates = append(filteredCandidates, candidate)
}
candidates = filteredCandidates
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it also included in hard fork?

return errors.Wrap(err, "failed to fetch bucket")
}
prevWeightedVotes := p.calculateVoteWeight(bucket, true)
bucket.StakedAmount.Sub(bucket.StakedAmount, amount)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a negative check of the bucket amount for safety

}
candidates = filteredCandidates
// TODO: add hardfork
slashAmount, err := p.slashUqd(ctx, sm, candidates, a.blockReward, uqdMap)
Copy link
Member

@envestcc envestcc Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transfer slash amount to rewarding pool, and new a TransactionLog for it

@CoderZhi CoderZhi force-pushed the slash_self_staking branch from b26a0ee to 4d14ae8 Compare July 25, 2025 03:12
@CoderZhi CoderZhi force-pushed the slash_self_staking branch 3 times, most recently from 0b45a05 to 155905c Compare July 26, 2025 02:23
@CoderZhi CoderZhi force-pushed the slash_self_staking branch from 155905c to 09c6ea3 Compare July 26, 2025 04:45
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants