sourcekeeper_42-contract-lab/docs/ILabRegistry.md

2.4 KiB

Overview

The ILabRegistry interface defines a comprehensive system for managing and tracking research laboratory entities on the ChunkNet blockchain. It provides mechanisms for registering, updating, and managing lab metadata, researchers, and lifecycle states.

Interface

Function Visibility Description Parameters Returns
registerLab External Register a new lab name, description, metadataHash labId
updateLabDetails External Update existing lab metadata labId, newName, newDescription, newMetadataHash -
addResearcher External Add authorized researcher labId, researcherAddress -
removeResearcher External Remove authorized researcher labId, researcherAddress -
getLab External View Retrieve lab details labId LabEntity
isAuthorizedResearcher External View Check researcher authorization labId, researcherAddress bool
deactivateLab External Disable lab modifications labId -

Events

  • LabRegistered: Triggered when a new lab is registered
  • LabUpdated: Emitted when lab details are modified

Storage Layout

  • LabEntity struct contains:
    • owner: Lab owner's address
    • name: Lab name
    • description: Lab description
    • metadataHash: Content/IPFS hash
    • registrationTimestamp: Creation timestamp
    • isActive: Current lab status
    • authorizedResearchers: List of permitted researchers

Access Control

  • Lab registration requires unique naming
  • Only lab owners can modify lab details
  • Researcher addition/removal restricted to lab owner
  • Deactivation prevents further modifications

Security Considerations

  • Use input validation for lab names and descriptions
  • Implement access control checks in implementation
  • Consider rate limiting for registration
  • Validate researcher addresses
  • Use cryptographic hashing for metadata integrity

Deployment

  • RPC URL: https://rpc.chunknet.org
  • Chain ID: 214562
  • Recommended Deployment Steps:
    1. Compile with Solidity 0.8.19
    2. Use ChunkNet deployment scripts
    3. Set initial owner/admin
    4. Verify contract on explorer

Testing

  • Unit test lab registration workflow
  • Test researcher authorization mechanisms
  • Validate metadata update restrictions
  • Check deactivation behavior
  • Perform boundary testing on input parameters
  • Simulate edge cases in researcher management