Skip to content

feat: add fee distributor#7

Merged
johnletey merged 4 commits intomainfrom
feat/fee-distributor
Mar 11, 2026
Merged

feat: add fee distributor#7
johnletey merged 4 commits intomainfrom
feat/fee-distributor

Conversation

@johnletey
Copy link
Copy Markdown
Member

@johnletey johnletey commented Mar 5, 2026


Open with Devin

Summary by CodeRabbit

  • New Features
    • Introduced fee distribution system enabling multiple recipients to receive fees based on configurable allocation percentages.
    • Added fee recipient functionality to validators, allowing fee recipient addresses to be set and updated.
    • Implemented fee distribution mechanism that proportionally distributes native balance to recipients with remainder handling for block proposers.

@johnletey johnletey self-assigned this Mar 5, 2026
@johnletey johnletey requested a review from a team as a code owner March 5, 2026 10:30
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

The changes introduce a fee distribution system by adding a FeeDistributor contract address constant, defining a new IFeeDistributor interface for managing fee recipients and distributing native balance proportionally to them, and extending IValidatorManager to support fee recipient configuration per validator.

Changes

Cohort / File(s) Summary
Fee Distributor Infrastructure
src/Constants.sol, src/interfaces/IFeeDistributor.sol
Adds FEE_DISTRIBUTOR_ADDRESS constant and introduces IFeeDistributor interface with recipient management (set/remove/query), distribute function, and supporting structs, events, and errors.
Validator Fee Recipient Support
src/interfaces/IValidatorManager.sol
Extends Validator, ValidatorInfo, and GenesisValidator structs with feeRecipient field; modifies addValidator signature to include feeRecipient parameter; adds setFeeRecipient and getFeeRecipient functions; introduces FeeRecipientUpdated event and Unauthorized error.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • keyleu

Poem

🐰 Hopping through code, a new path we trace,
Fee distributors in their rightful place,
Validators wear their recipient hats,
Sharing the rewards where the balance sits,
A carrot-filled update, crisp and precise! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add fee distributor' directly aligns with the main changes in the pull request, which introduce a new FeeDistributor interface and related functionality across Constants, IFeeDistributor, and IValidatorManager.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/fee-distributor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/interfaces/IFeeDistributor.sol (1)

50-53: Consider documenting zero address behavior.

The interface doesn't specify whether address(0) is a valid recipient. If the implementation should reject zero addresses, consider adding an InvalidRecipient error and documenting this constraint in the NatSpec.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/interfaces/IFeeDistributor.sol` around lines 50 - 53, The interface lacks
guidance on zero-address handling for recipients; add a custom error (e.g.,
InvalidRecipient()) to IFeeDistributor and update the NatSpec on
setRecipient(address recipient, uint16 bps) to state that address(0) is
disallowed, and require implementations to revert with InvalidRecipient when
recipient == address(0); include the error symbol (InvalidRecipient) and the
setRecipient function name in the docs so implementers enforce and emit that
specific revert for invalid (zero) recipients.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/interfaces/IFeeDistributor.sol`:
- Around line 50-53: The interface lacks guidance on zero-address handling for
recipients; add a custom error (e.g., InvalidRecipient()) to IFeeDistributor and
update the NatSpec on setRecipient(address recipient, uint16 bps) to state that
address(0) is disallowed, and require implementations to revert with
InvalidRecipient when recipient == address(0); include the error symbol
(InvalidRecipient) and the setRecipient function name in the docs so
implementers enforce and emit that specific revert for invalid (zero)
recipients.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2a8bfba7-a7ae-4789-ade8-6622fd737cbe

📥 Commits

Reviewing files that changed from the base of the PR and between 9926ad3 and 9bd3f09.

📒 Files selected for processing (3)
  • src/Constants.sol
  • src/interfaces/IFeeDistributor.sol
  • src/interfaces/IValidatorManager.sol

keyleu
keyleu previously approved these changes Mar 5, 2026
@johnletey johnletey merged commit 4f15f82 into main Mar 11, 2026
3 checks passed
@johnletey johnletey deleted the feat/fee-distributor branch March 11, 2026 14:46
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.

3 participants