Skip to content

Conversation

Dodecahedr0x
Copy link

@Dodecahedr0x Dodecahedr0x commented Sep 15, 2025

⚠️ NOTE: This PR changes the account structure for the Program Config

The set_fees_receiver migrates the Program Config and must be run immediately after the update to prevent blocking other instructions. Although the migration itself is tested, the behavior of all affected instructions is not tested with the old structure.

Status Type ⚠️ Core Change Issue
Ready Feature Yes #89

Problem

Enable permissionless protocol fee claiming.

Solution

Stores the fee receiver in the ProgramConfig. Remove admin checks for claiming. Send protocol fees to the stored fee receiver.

Deploy Notes

The set_fees_receiver instruction must be called by the admin when deploying this PR as other methods relying on the ProgramConfig would fail otherwise.

Greptile Summary

Updated On: 2025-09-15 16:53:17 UTC

This PR implements configurable fees receiver functionality that enables permissionless protocol fee claiming. The core change modifies the ProgramConfig struct to include a new fees_receiver field, allowing protocol fees to be sent to a designated address instead of always going to the program update authority.

Key architectural changes include:

Account Structure Changes:

  • Extended ProgramConfig with a fees_receiver: Pubkey field (+32 bytes)
  • Updated size calculations and serialization logic across the codebase
  • Implemented migration logic in process_set_fees_receiver to handle existing accounts

Protocol Fee Claiming Refactor:

  • Removed admin authorization requirements from protocol_claim_fees
  • Changed function signature from protocol_claim_fees(admin: Pubkey) to protocol_claim_fees(fees_receiver: Pubkey, program: Pubkey)
  • Updated account structure to include program config and fees receiver accounts
  • Fees now transfer to the configured receiver instead of the program authority

New Instruction Implementation:

  • Added SetFeesReceiver discriminator (value 16) and corresponding processor
  • Created SetFeesReceiverArgs struct to pass the new fees receiver address
  • Implemented admin-only set_fees_receiver instruction that migrates existing configs

Integration Changes:

  • Updated test fixtures and integration tests to support the new account structure
  • Switched from local file dependencies to published npm packages (@magicblock-labs/ephemeral-rollups-sdk v0.2.10)
  • Modified test delegation programs to explicitly specify validators

The change enables automatic fee distribution systems and makes the protocol more adaptable for staking program integration. The migration mechanism ensures backward compatibility during deployment by detecting old account formats and upgrading them with default values.

Confidence score: 3/5

  • This PR introduces significant breaking changes that require careful deployment and immediate migration to prevent blocking other instructions
  • Score reflects the complexity of account structure migration and the critical nature of fee handling logic changes
  • Pay close attention to migration logic in src/processor/set_fees_receiver.rs and the updated fee claiming mechanism in src/processor/protocol_claim_fees.rs

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

20 files reviewed, 3 comments

Edit Code Review Bot Settings | Greptile

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.

1 participant