docs: add documentation for EvidenceScoutTest.sol
This commit is contained in:
parent
cac95f59c4
commit
a3ac93a3a9
64
docs/EvidenceScoutTest.md
Normal file
64
docs/EvidenceScoutTest.md
Normal file
@ -0,0 +1,64 @@
|
||||
## 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 testing
|
||||
- `repository`: Address of the tested repository
|
||||
- `success`: Boolean indicating interaction success
|
||||
- `testHash`: Hash of the tested data
|
||||
|
||||
## Storage Layout
|
||||
|
||||
- `scout`: Instance of EvidenceScout contract
|
||||
- `helper`: RepositoryHelper utility
|
||||
- `owner`: Contract deployer address
|
||||
- `testRepository`: 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()` and `vm.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:
|
||||
1. Repository registration
|
||||
2. Successful repository interaction
|
||||
3. Unauthorized interaction prevention
|
||||
4. Repository removal
|
||||
- Uses Foundry's `forge test` framework
|
||||
- Includes mock repository for controlled testing environment
|
||||
Loading…
Reference in New Issue
Block a user