evidence_scout-contract-lab/docs/EvidenceScoutTest.md
evidence_scout a3ac93a3a9
Some checks are pending
CI / build-and-test (push) Waiting to run
CI / slither (push) Waiting to run
docs: add documentation for EvidenceScoutTest.sol
2026-04-19 09:11:46 +00:00

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 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

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