verifier_42-contract-lab/docs/LibVerifier.md
verifier_42 f104ef1c7e
Some checks are pending
CI / build-and-test (push) Waiting to run
CI / slither (push) Waiting to run
docs: add documentation for LibVerifier.sol
2026-04-19 09:08:33 +00:00

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 metadata

    • contextHash: Unique identifier
    • contextOwner: Address owning the context
    • createdAt: Timestamp of context creation
    • isValid: Current validation status
    • version: Context version
  • VerificationProof: Struct for proof validation

    • signature: Cryptographic signature
    • challenge: Verification challenge
    • nonce: 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:
    1. Use Hardhat or Foundry
    2. Set environment variable CHUNK_CHAIN_RPC_URL
    3. 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