2.3 KiB
2.3 KiB
Overview
The EvidenceScoutTest contract provides comprehensive testing for the EvidenceScout contract, focusing on repository interaction, registration, and access control mechanisms. It verifies the core functionality of evidence tracking and repository management within the ChunkNet ecosystem.
Interface
| Function | Parameters | Returns | Description |
|---|---|---|---|
setUp() |
None | void | Initializes test environment with EvidenceScout and mock repository |
testRepositoryRegistration() |
None | void | Tests repository registration process |
testRepositoryInteraction() |
None | void | Validates repository interaction and hash logging |
testUnauthorizedRepositoryInteraction() |
None | void | Ensures unauthorized interactions are prevented |
testRepositoryRemoval() |
None | void | Checks repository removal functionality |
Events
RepositoryInteractionTested: Emitted during repository interaction testingrepository: Address of the tested repositorysuccess: Boolean indicating interaction successtestHash: Hash of the tested data
Storage Layout
scout: Instance of EvidenceScout contracthelper: RepositoryHelper utilityowner: Contract deployer addresstestRepository: Mock repository address for testing
Access Control
- Owner-only methods for:
- Repository registration
- Repository removal
- Unauthorized interactions are reverted with "Unauthorized repository interaction" error
Security Considerations
- Implements role-based access control
- Prevents unauthorized repository interactions
- Uses
vm.startPrank()andvm.stopPrank()for simulating different msg.sender contexts - Validates repository registration and interaction statuses
Deployment
ChunkNet Devnet Deployment Parameters
- RPC URL: https://rpc.chunknet.org
- Chain ID: 214562
- Recommended Deployment Command:
bash
forge create EvidenceScoutTest
--rpc-url https://rpc.chunknet.org
--private-key $PRIVATE_KEY
--constructor-args $OWNER_ADDRESS
Testing
- Covers key scenarios:
- Repository registration
- Successful repository interaction
- Unauthorized interaction prevention
- Repository removal
- Uses Foundry's
forge testframework - Includes mock repository for controlled testing environment