From c100edd44c7f9d987de2ef158e6b8d2c0615b653 Mon Sep 17 00:00:00 2001 From: verifier_42 Date: Sun, 19 Apr 2026 09:12:06 +0000 Subject: [PATCH] docs: add documentation for VerifierTest.sol --- docs/VerifierTest.md | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 docs/VerifierTest.md diff --git a/docs/VerifierTest.md b/docs/VerifierTest.md new file mode 100644 index 0000000..e8147e0 --- /dev/null +++ b/docs/VerifierTest.md @@ -0,0 +1,52 @@ +## Overview +The `VerifierTest` contract provides comprehensive testing for the `Verifier` contract, focusing on verification mechanisms, signature validation, and edge case handling in a blockchain environment. + +## Interface + +| Function | Parameters | Returns | Description | +|----------|------------|---------|-------------| +| `setUp()` | None | None | Initializes test environment and contract instances | +| `_generateTestPayload()` | `dataHash`, `privateKey` | `TestVerificationPayload` | Creates a test verification payload | +| `_signMessage()` | `hash`, `privateKey` | `bytes` | Generates a cryptographic signature | +| `testVerificationSubmission()` | None | None | Tests successful verification submission | +| `testInvalidVerificationSignature()` | None | None | Validates signature rejection mechanism | +| `testDuplicateVerification()` | None | None | Checks prevention of duplicate verifications | + +## Events +- `VerificationSubmitted`: Emitted when a new verification is successfully submitted + - `dataHash`: Unique hash of verified data + - `submitter`: Address submitting the verification + - `timestamp`: Time of verification + +## Storage Layout +- `verifier`: Instance of the Verifier contract +- `owner`: Contract deployer address +- `testUser`: Test user address for simulations + +## Access Control +- Tests simulate different access scenarios +- Uses `vm.prank()` to impersonate addresses +- Validates signature-based access control + +## Security Considerations +- Signature validation prevents unauthorized submissions +- Prevents duplicate verifications +- Uses cryptographic signing for verification +- Implements input validation and error handling + +## Deployment +- **Network**: ChunkNet Devnet +- **RPC URL**: https://rpc.chunknet.org +- **Chain ID**: 214562 +- **Recommended Deployment Steps**: + 1. Set `CHUNK_CHAIN_RPC_URL` environment variable + 2. Use Foundry/Hardhat with specified RPC configuration + 3. Verify contract bytecode before deployment + +## Testing +- Comprehensive test suite covering: + - Successful verification + - Signature validation + - Duplicate submission prevention +- Uses Foundry's testing framework +- Simulates various blockchain interaction scenarios \ No newline at end of file