Skip to content

Conversation

@ussyalfaks
Copy link

@ussyalfaks ussyalfaks commented Jan 22, 2026

🧠 SkillSphere Pull Request 🌐

  • Closes Implement "Add Expert" Feature #1
  • Added tests (if necessary)
  • Ran cargo test (All tests passed)
  • Evidence attached (Screenshots, Logs, or Transaction Hashes)
  • Commented the code

📌 Type of Change

  • 📚 Documentation (updates to README, docs, or comments)
  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ Enhancement (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🏗️ Refactor (code improvement/cleanup without logical changes)

📝 Changes Description

Overview

This PR implements the core expert verification functionality, establishing the Admin as the gatekeeper for whitelisting expert addresses on the SkillSphere platform.

What Changed

  • Expert Verification Logic (src/contract.rs): Implemented verify_expert(env, expert)

    • Retrieves Admin from storage and enforces authentication via require_auth()
    • Returns NotInitialized if Admin not configured
    • Prevents duplicate verification with RegistryError::AlreadyVerified
    • Updates expert status to Verified in persistent storage
    • Emits ExpertStatusChanged event on success
  • Public Interface (src/lib.rs): Exposed add_expert(env, expert) for contract interaction

  • Test Suite (src/test.rs): Implemented test_add_expert

    • Initializes contract with Admin
    • Validates Admin can successfully verify experts
    • Rejects non-admin verification attempts with panic
    • Confirms ExpertStatusChanged event emission

Impact on Storage & Gas

  • Adds one storage record per expert verification (ExpertStatus::Verified)
  • Minimal gas impact: Single auth check + storage write + event emission
  • No breaking changes to existing storage schema

Acceptance Criteria Met

  • Function fails if caller is not the Admin
  • Expert status updates to Verified in persistent storage
  • ExpertStatusChanged event emitted on successful verification
  • Returns NotInitialized if Admin not set
  • Returns RegistryError::AlreadyVerified for duplicate verification
  • All unit tests pass (auth, rejection, event validation)

📸 Evidence

Screenshot 2026-01-22 at 9 49 43 AM

Thank you for contributing to SkillSphere! 🌍

We are glad you have chosen to help us democratize access to knowledge on the Stellar network. Your contribution brings us one step closer to a trustless, peer-to-peer consulting economy. Let's build the future together! 🚀

Summary by CodeRabbit

  • New Features

    • Administrators can now add experts to the identity registry with verification
    • Status change events are emitted to track expert verifications
  • Tests

    • Comprehensive test coverage added for expert addition, authorization workflows, and status change event tracking

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

This PR introduces expert verification functionality, adding a new verify_expert function restricted to admins that updates an expert's status to Verified and emits a status change event. The feature is exposed via a public add_expert API method and covered by comprehensive unit tests for authorization and event verification.

Changes

Cohort / File(s) Summary
Core Expert Verification Logic
contracts/identity-registry-contract/src/contract.rs
Added verify_expert() function that enforces admin authentication, reads current expert status, prevents re-verification, updates status to Verified, and emits a status_change event with previous/new statuses.
Public API Exposure
contracts/identity-registry-contract/src/lib.rs
Added add_expert() public method to IdentityRegistryContract that delegates to verify_expert() for admin-only expert whitelisting.
Test Coverage
contracts/identity-registry-contract/src/test.rs
Added three new test cases: test_add_expert() verifies authorized invocation, test_add_expert_unauthorized() validates authorization enforcement, and test_expert_status_changed_event() confirms event emission. Expanded imports to support authorization and event testing utilities.

Possibly related issues

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A hop, a skip, experts now shine bright,
Admin whispers "verified" with all their might,
Status updates bloom, events take flight,
Tests confirm the logic—all checks in sight! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: implementing expert verification as an admin-controlled whitelist gatekeeper function.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description follows the repository template with all required sections completed: checkboxes marked, type of change specified, comprehensive changes description, acceptance criteria validation, and evidence provided.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Bosun-Josh121 Bosun-Josh121 merged commit 6a5e953 into LightForgeHub:main Jan 22, 2026
2 checks passed
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.

Implement "Add Expert" Feature

2 participants