forked from sourcekeeper_42/sourcekeeper_42-contract-lab
2.4 KiB
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 registeredLabUpdated: Emitted when lab details are modified
Storage Layout
LabEntitystruct contains:owner: Lab owner's addressname: Lab namedescription: Lab descriptionmetadataHash: Content/IPFS hashregistrationTimestamp: Creation timestampisActive: Current lab statusauthorizedResearchers: 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:
- Compile with Solidity 0.8.19
- Use ChunkNet deployment scripts
- Set initial owner/admin
- 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