Skip to content

feat(Karma): add minimum karma tier requirement for slashing#178

Open
0x-r4bbit wants to merge 1 commit into
developfrom
feat/min-karma-tier-requirement
Open

feat(Karma): add minimum karma tier requirement for slashing#178
0x-r4bbit wants to merge 1 commit into
developfrom
feat/min-karma-tier-requirement

Conversation

@0x-r4bbit
Copy link
Copy Markdown
Member

Introduce a configurable tier gate on Karma.slash() so that only slashers holding a sufficient karma tier can execute a slash.

  • Add IKarmaTiers interface and wire karmaTiers + slashTierRequirement state variables into Karma (packed into one storage slot; gap reduced from 30 to 29)
  • Add setKarmaTiers() and setSlashTierRequirement() admin setters with corresponding events
  • Add internal _checkSlashTierRequirement() — skipped when karmaTiers is address(0); applies uniformly to all callers including admins
  • Add slash(account, rewardRecipient, slasher) overload for intermediary contracts (e.g. RLN) that act on behalf of a human initiator; the original two-argument signature is unchanged
  • Update RLN.slashReveal() to use the new overload, passing msg.sender so the tier check runs against the human who committed the slash
  • Add tests covering tier enforcement, admin parity, zero-address bypass, and event emission
  • Wire karma.setKarmaTiers() into DeployProtocol and add a deployment test asserting the link is established
  • Update docs (karma.md, admin-guide.md, rln.md)

Introduce a configurable tier gate on Karma.slash() so that only
slashers holding a sufficient karma tier can execute a slash.

- Add IKarmaTiers interface and wire karmaTiers + slashTierRequirement
  state variables into Karma (packed into one storage slot; gap reduced
  from 30 to 29)
- Add setKarmaTiers() and setSlashTierRequirement() admin setters with
  corresponding events
- Add internal _checkSlashTierRequirement() — skipped when karmaTiers
  is address(0); applies uniformly to all callers including admins
- Add slash(account, rewardRecipient, slasher) overload for intermediary
  contracts (e.g. RLN) that act on behalf of a human initiator; the
  original two-argument signature is unchanged
- Update RLN.slashReveal() to use the new overload, passing msg.sender
  so the tier check runs against the human who committed the slash
- Add tests covering tier enforcement, admin parity, zero-address bypass,
  and event emission
- Wire karma.setKarmaTiers() into DeployProtocol and add a deployment
  test asserting the link is established
- Update docs (karma.md, admin-guide.md, rln.md)
@0x-r4bbit 0x-r4bbit requested review from 3esmit and gravityblast April 7, 2026 13:45
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