feat(payment-distributor): implement two-step admin role rotation - #417
Open
Stephan-Thomas wants to merge 1 commit into
Open
feat(payment-distributor): implement two-step admin role rotation#417Stephan-Thomas wants to merge 1 commit into
Stephan-Thomas wants to merge 1 commit into
Conversation
|
@Stephan-Thomas Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Description
Implemented a secure two-step admin role rotation flow for the
payment-distributorcontract.The new flow prevents accidental permanent admin lockout by separating admin transfer into two steps:
transfer_adminallows the current admin to nominate aPendingAdmin.accept_adminallows the nominated address to accept the role and become the new admin.This change also adds pending-admin storage helpers, emits an
AdminTransferredevent when the transfer is completed, and introduces authorization tests covering both successful and unauthorized flows.Closes #380
Type of Change
Checklist
Testing
The
payment-distributortest suite was updated to verify the complete two-step admin transfer flow and authorization requirements.How to Test
cargo test -p payment-distributortransfer_adminand that the nominated address is stored as the pending admin.accept_admin, after which the admin role is transferred, the pending admin is cleared, and theAdminTransferredevent is emitted.transfer_adminandaccept_adminfail withError::Unauthorized.Test Coverage
Screenshots (if applicable)
Not applicable — this change affects the Soroban contract logic and test suite rather than a user interface.
Additional Notes
The admin transfer now follows a two-step ownership rotation pattern to reduce the risk of permanently losing administrative access due to an incorrect or unintended address.
PendingAdminis stored separately from the activeAdminand is only promoted after the nominated address explicitly callsaccept_admin.The completed transfer emits an
AdminTransferredevent containing the previous and new admin addresses.For Reviewers
Please focus on:
In particular, review the authorization checks around
transfer_adminandaccept_admin, the pending-admin storage lifecycle, chained transfers, and theAdminTransferredevent emission.