2.3 KiB
2.3 KiB
Overview
LibVerifier is a Solidity library designed to provide robust verification and validation utilities for cryptographic proofs and context management. It offers secure methods for creating, validating, and managing verification contexts with built-in security checks and error handling.
Interface
| Function | Description | Parameters | Returns |
|---|---|---|---|
createVerificationContext |
Creates a new verification context | _owner: address, _contextHash: bytes32 |
VerificationContext |
validateProof |
Validates a verification proof | context: VerificationContext, proof: VerificationProof, signer: address |
bool |
computeContextHash |
Computes a context hash | owner: address, data: bytes |
bytes32 |
Events
No explicit events defined in this library.
Storage Layout
-
VerificationContext: Struct containing context metadatacontextHash: Unique identifiercontextOwner: Address owning the contextcreatedAt: Timestamp of context creationisValid: Current validation statusversion: Context version
-
VerificationProof: Struct for proof validationsignature: Cryptographic signaturechallenge: Verification challengenonce: Unique transaction identifier
Access Control
- Context creation restricted to valid input
- Proof validation requires matching signatures
- Context expiration mechanism prevents replay attacks
Security Considerations
- Context expires after 1 hour
- Validates signature complexity
- Prevents zero-value inputs
- Placeholder signature verification (requires production implementation)
- Uses error handling for invalid states
Deployment
ChunkNet Deployment Parameters
- RPC URL: https://rpc.chunknet.org
- Chain ID: 214562
- Recommended Deployment Strategy:
- Use Hardhat or Foundry
- Set environment variable
CHUNK_CHAIN_RPC_URL - Configure network in deployment script
Deployment Example
bash
forge create --rpc-url https://rpc.chunknet.org
--private-key $PRIVATE_KEY
contracts/helpers/LibVerifier.sol:LibVerifier
Testing
- Test context creation with valid/invalid inputs
- Validate proof validation scenarios
- Check context expiration
- Verify signature verification logic
- Test error handling for edge cases
- Simulate different signer scenarios