Skip to content

Feature/update validator credentials - #145

Open
johnsaviour56-ship-it wants to merge 3 commits into
scout-off:mainfrom
johnsaviour56-ship-it:feature/update-validator-credentials
Open

Feature/update validator credentials#145
johnsaviour56-ship-it wants to merge 3 commits into
scout-off:mainfrom
johnsaviour56-ship-it:feature/update-validator-credentials

Conversation

@johnsaviour56-ship-it

@johnsaviour56-ship-it johnsaviour56-ship-it commented May 28, 2026

Copy link
Copy Markdown
Contributor

Implemented admin-controlled validator credential updates to allow registered validators to refresh on-chain credential information without re-registration.

Summary

  • Added update_validator_credentials(env, wallet, new_credentials) -> Result<(), VerificationError>
  • Restricted credential updates to admin-only access
  • Added validation to enforce new_credentials length ≤ 256 bytes
  • Implemented validator_credentials_updated event emission on successful updates
  • Returns ValidatorNotFound when attempting to update an unregistered validator

Testing

  • Added unit tests covering:
    • successful credential updates by admin
    • unauthorized access attempts by non-admin accounts
    • update attempts for non-existent validators
    • credential length validation behavior
    • event emission verification

Notes

  • Preserves existing validator registration flow while enabling credential maintenance
  • Improves long-term validator profile management for license or certification upgrades
  • No breaking changes to current contract interfaces or storage layout

Closes #63

Prevents Admin, Initialized, Paused, and ProgressContract keys from expiring in instance storage.

Changes:
- Add INSTANCE_TTL_MIN (100) and INSTANCE_TTL_MAX (500) constants to all contracts
- Call env.storage().instance().extend_ttl() at the start of every public function
- Add unit tests verifying contracts remain functional after ledger advancement

Contracts updated:
- progress: initialize, pause_contract, unpause_contract, transfer_admin, advance_level
- registration: initialize, pause_contract, unpause_contract, register_player, update_profile, register_scout
- verification: initialize, set_progress_contract, pause_contract, unpause_contract, approve_milestone
- scout_access: initialize, update_fee_config, withdraw_fees, pause_contract, unpause_contract, subscribe, pay_to_contact, log_trial_offer

Acceptance Criteria:
✓ Every public function extends instance TTL
✓ Unit tests verify contract functionality after simulated ledger advancement
Allows admins to update validator credentials on-chain, enabling validators to reflect license upgrades.

Changes:
- Add update_validator_credentials(env, wallet, new_credentials) function (admin only)
- Validate new_credentials length ≤ 256 bytes
- Emit validator_credentials_updated event
- Return ValidatorNotFound if wallet not registered
- Preserve other validator fields (registered_at, active status, wallet)

Tests:
✓ Admin can update credentials
✓ Non-admin call returns Unauthorized
✓ ValidatorNotFound error when wallet not registered
✓ InvalidInput error when credentials exceed 256 bytes
✓ Success with exactly 256 bytes
✓ Other validator fields are preserved after update
✓ Event is emitted on successful update
@drips-wave

drips-wave Bot commented May 28, 2026

Copy link
Copy Markdown

@johnsaviour56-ship-it 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! 🚀

Learn more about application limits

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.

Add update_validator_credentials function for credential updates

1 participant