Feature/test revoke nonexistent validator - #147
Open
johnsaviour56-ship-it wants to merge 5 commits into
Open
Conversation
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
Adds dedicated test to verify set_progress_contract stores the progress contract address correctly in instance storage. Changes: - Add test_set_progress_contract_stores_address() test - Verifies address is stored in DataKey::ProgressContract - Asserts stored address equals the one passed to set_progress_contract - Uses env.as_contract() to access instance storage directly Acceptance Criteria: ✓ Test exists and passes ✓ Asserts stored address equals input address
Adds test to verify revoke_validator returns ValidatorNotFound error when attempting to revoke a validator that is not registered. Changes: - Add test_revoke_nonexistent_validator_fails() test with #[should_panic] - Verifies error path for unknown wallet addresses - Ensures ValidatorNotFound error is properly returned Acceptance Criteria: ✓ Test exists and passes
|
@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! 🚀 |
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.
Added unit test coverage for the validator revocation failure path when attempting to revoke a non-existent validator.
Summary
Testing
Notes
Closes #65