Conversation
…uction Adds the admin-only InitializeRewardsIntegration instruction which registers an external program as a rewards integration by creating a RewardsIntegration PDA seeded by [b"rewards_integration", program_id]. This is the registration primitive that DistributeIntegrationRewards will later use to verify that a CPI caller is authorized to drive contributor reward payouts.
karl-dz
reviewed
Apr 16, 2026
karl-dz
reviewed
Apr 16, 2026
karl-dz
reviewed
Apr 16, 2026
karl-dz
reviewed
Apr 16, 2026
karl-dz
reviewed
Apr 16, 2026
karl-dz
reviewed
Apr 16, 2026
karl-dz
approved these changes
Apr 16, 2026
Contributor
karl-dz
left a comment
There was a problem hiding this comment.
Didn't mean to be confusing about the Custom(0) comment in the test. All I meant was we can match exactly to that error variant because that's what the system program reverts with for an already-created account
Contributor
|
Can revisit removing the logic for checking an already-created account in a subsequent PR |
karl-dz
pushed a commit
that referenced
this pull request
Apr 16, 2026
Follow-up to #113 (malbeclabs/infra#1031) addressing post-merge review feedback. ## Summary - Drops the redundant `owner == &ID` pre-check in `try_initialize_rewards_integration`. Re-registration attempts already fail via the system program's `AccountAlreadyInUse` revert inside `try_create_account`, so the explicit check was duplicative. - Tightens the double-registration test to assert exactly `InstructionError::Custom(0)` — the serialized form of `SystemError::AccountAlreadyInUse` — instead of the broader wildcard match. ## Lines of Code | Section | Added | Removed | |---------|-------|---------| | Core logic | +0 | -10 | | SDKs | +0 | -0 | | Tests | +3 | -3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: malbeclabs/infra#1031
Summary
RewardsIntegrationPDA (seeded by[b"rewards_integration", integration_program_id]) that records the integration program's pubkey.InitializeRewardsIntegrationinstruction, which validates the integration program account is executable before writing the record.Lines of Code
Testing Verification
initialize_rewards_integration_test.rscovers happy path, unauthorized signer, non-executable integration program, wrong PDA seeds, and double-registration.