Description
CredenceBond::initialize sets DataKey::Admin once, but there is no way to rotate the admin afterward, and no protection against a fat-fingered transfer to a wrong/zero address. The admin holds slashing and fee-collection authority over real USDC, so admin rotation must exist and must be a deliberate two-step (propose/accept) flow, ideally with a timelock delay. The repo already has a timelock crate that can be leveraged.
Requirements and context
- Secure: add
propose_admin/accept_admin with pending-admin storage; new admin must require_auth to accept; reject zero/identity-equal addresses.
- Optionally integrate the
timelock contract for a delay between propose and accept.
- Tested: only current admin proposes; only pending admin accepts; old admin loses authority after acceptance.
- Documented: update
docs/admin-roles.md and docs/governance.md.
Suggested execution
git checkout -b feature/bond-admin-two-step-transfer
- Add
PendingAdmin to DataKey and the two-step functions in ours.rs.
- Write transfer-flow tests including timelock delay.
- Update docs
docs/admin-roles.md.
- Add
/// doc comments for the transfer flow.
- Validate no single call can hijack admin.
Test and commit
- Run
cargo test.
- Cover edge cases: propose to zero, accept by wrong account, double-accept.
- Include test output and security notes.
Example commit message
feat: add two-step timelocked admin transfer to bond contract
Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
Description
CredenceBond::initializesetsDataKey::Adminonce, but there is no way to rotate the admin afterward, and no protection against a fat-fingered transfer to a wrong/zero address. The admin holds slashing and fee-collection authority over real USDC, so admin rotation must exist and must be a deliberate two-step (propose/accept) flow, ideally with a timelock delay. The repo already has atimelockcrate that can be leveraged.Requirements and context
propose_admin/accept_adminwith pending-admin storage; new admin mustrequire_authto accept; reject zero/identity-equal addresses.timelockcontract for a delay between propose and accept.docs/admin-roles.mdanddocs/governance.md.Suggested execution
git checkout -b feature/bond-admin-two-step-transferPendingAdmintoDataKeyand the two-step functions inours.rs.docs/admin-roles.md.///doc comments for the transfer flow.Test and commit
cargo test.Example commit message
feat: add two-step timelocked admin transfer to bond contractGuidelines