This document explains the testing architecture for the Zero-Knowledge Anonymous Token Discrete Logarithm (ZK-ATDLOG) implementation in Panurus.
Related Documentation:
- Running Benchmarks - How to run performance benchmarks
- Regression Tests - Backwards compatibility testing
The ZK-ATDLOG tests are organized in a layered architecture that mirrors the code abstraction levels. Each layer represents a different level of the software stack - from low-level cryptographic primitives to high-level service APIs.
Each layer represents a different code abstraction level.
┌─────────────────────────────────────────────────────────────────┐
│ Layer 3: Service Layer (Highest Abstraction) │
├─────────────────────────────────────────────────────────────────┤
│ Transfer Generation Service │
│ Location: token/core/zkatdlog/nogh/v1/ │
│ Tests: - BenchmarkTransferServiceTransfer │
│ - TestParallelBenchmarkTransferServiceTransfer │
│ Purpose: End-to-end transfer operation generation with vault, │
│ audit, and metadata handling │
├─────────────────────────────────────────────────────────────────┤
│ Issue Generation Service │
│ Location: token/core/zkatdlog/nogh/v1/ │
│ Tests: - BenchmarkIssueServiceIssue │
│ - TestParallelBenchmarkIssueServiceIssue │
│ Purpose: End-to-end issue operation: wallet lookup, signer │
│ resolution, ZK proof, audit-info encoding, serialize │
├─────────────────────────────────────────────────────────────────┤
│ Auditor Check Service │
│ Location: token/core/zkatdlog/nogh/v1/ │
│ Tests: - BenchmarkAuditorServiceCheck │
│ - TestParallelBenchmarkAuditorServiceCheck │
│ Purpose: Audit verification: action deserialization and │
│ Pedersen commitment arithmetic │
├─────────────────────────────────────────────────────────────────┤
│ Transfer Validator Service │
│ Location: token/core/zkatdlog/nogh/v1/validator/ │
│ Tests: - BenchmarkValidatorTransfer │
│ - TestParallelBenchmarkValidatorTransfer │
│ Purpose: Transfer validation with signatures, business logic, │
│ and cryptographic verification │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ Layer 2: Action Operations │
├─────────────────────────────────────────────────────────────────┤
│ Transfer Generation (token/core/zkatdlog/nogh/v1/transfer/) │
│ Tests: - BenchmarkSender │
│ - BenchmarkParallelSender │
│ - TestParallelBenchmarkSender │
│ Purpose: Transfer action generation and serialization │
├─────────────────────────────────────────────────────────────────┤
│ Transfer Verification (token/core/zkatdlog/nogh/v1/transfer/) │
│ Tests: - BenchmarkVerificationSenderProof │
│ - BenchmarkVerificationParallelSenderProof │
│ - TestParallelBenchmarkVerificationSenderProof │
│ Purpose: Deserialization and cryptographic format validation │
│ and verification of transfer actions │
├─────────────────────────────────────────────────────────────────┤
│ Issue Generation (token/core/zkatdlog/nogh/v1/issue/) │
│ Tests: - BenchmarkIssuer │
│ Purpose: Issue action generation and serialization │
├─────────────────────────────────────────────────────────────────┤
│ Issue Verification (token/core/zkatdlog/nogh/v1/issue/) │
│ Tests: - BenchmarkProofVerificationIssuer │
│ Purpose: Deserialization and cryptographic verification of │
│ issue actions │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ Layer 1: Core Cryptographic Operations (Lowest Abstraction) │
│ Location: token/core/zkatdlog/nogh/v1/transfer/ │
│ token/core/zkatdlog/nogh/v1/crypto/rp/ │
│ Tests: - BenchmarkTransferProofGeneration │
│ - TestParallelBenchmarkTransferProofGeneration │
│ Purpose: Pure transfer ZK proof generation and serialization │
│ │
│ Range Proof Systems (as of commit 586d4f58): │
│ • Bulletproofs: crypto/rp/bulletproof/ (IPA-based) │
│ • CSP: crypto/rp/csp/ (Compressed Sigma Protocols) │
└─────────────────────────────────────────────────────────────────┘
Location: token/core/zkatdlog/nogh/v1/transfer/ and token/core/zkatdlog/nogh/v1/crypto/rp/
Range Proof Systems: As of commit 586d4f58, two range proof implementations are available:
crypto/rp/bulletproof/): IPA-based range proofscrypto/rp/csp/): Compressed Sigma Protocol range proofs with optimized verificationBenchmarkTransferProofGenerationTestParallelBenchmarkTransferProofGenerationPure zero-knowledge proof generation and serialization for transfer operations. The parallel version runs the same benchmark in multiple goroutines.
cd token/core/zkatdlog/nogh/v1/transfer
go test -bench=BenchmarkTransferProofGeneration -benchtime=10s
go test -run=TestParallelBenchmarkTransferProofGeneration -v
Location: token/core/zkatdlog/nogh/v1/transfer/
BenchmarkSenderBenchmarkParallelSenderTestParallelBenchmarkSenderComplete transfer action creation from inputs to serialized output.
Note: BenchmarkParallelSender is a Go benchmark (uses *testing.B), while TestParallelBenchmarkSender is a test (uses *testing.T) that runs custom benchmarking. Same functionality, different frameworks.
cd token/core/zkatdlog/nogh/v1/transfer
go test -bench=BenchmarkSender -benchtime=10s
go test -bench=BenchmarkParallelSender -benchtime=10s
go test -run=TestParallelBenchmarkSender -v
Location: token/core/zkatdlog/nogh/v1/transfer/
BenchmarkVerificationSenderProofBenchmarkVerificationParallelSenderProofTestParallelBenchmarkVerificationSenderProofDeserialization and cryptographic format validation and verification of transfer actions.
cd token/core/zkatdlog/nogh/v1/transfer
go test -bench=BenchmarkVerificationSenderProof -benchtime=10s
go test -bench=BenchmarkVerificationParallelSenderProof -benchtime=10s
go test -run=TestParallelBenchmarkVerificationSenderProof -v
Location: token/core/zkatdlog/nogh/v1/issue/
BenchmarkIssuerComplete issue action creation from inputs to serialized output.
cd token/core/zkatdlog/nogh/v1/issue
go test -bench=BenchmarkIssuer -benchtime=10s
go test -bench=BenchmarkIssuer -benchmem
go test -bench=BenchmarkIssuer -cpuprofile=cpu.prof
Location: token/core/zkatdlog/nogh/v1/issue/
BenchmarkProofVerificationIssuerDeserialization and cryptographic verification of issue actions.
cd token/core/zkatdlog/nogh/v1/issue
go test -bench=BenchmarkProofVerificationIssuer -benchtime=10s
The Service Layer provides the highest level of abstraction, covering end-to-end operation generation and validation through the high-level service APIs.
Location: token/core/zkatdlog/nogh/v1/
BenchmarkTransferServiceTransferTestParallelBenchmarkTransferServiceTransferComplete end-to-end transfer operation generation through the high-level Transfer Service API.
cd token/core/zkatdlog/nogh/v1
go test -bench=BenchmarkTransferServiceTransfer -benchtime=10s
go test -run=TestParallelBenchmarkTransferServiceTransfer -v
Location: token/core/zkatdlog/nogh/v1/
BenchmarkIssueServiceIssueTestParallelBenchmarkIssueServiceIssueEnd-to-end issue operation generation through the high-level Issue Service API.
cd token/core/zkatdlog/nogh/v1
go test -bench=BenchmarkIssueServiceIssue -benchtime=10s
go test -run=TestParallelBenchmarkIssueServiceIssue -v
Location: token/core/zkatdlog/nogh/v1/
BenchmarkAuditorServiceCheckTestParallelBenchmarkAuditorServiceCheckEnd-to-end audit verification through the high-level Auditor Service API.
cd token/core/zkatdlog/nogh/v1
go test -bench=BenchmarkAuditorServiceCheck -benchtime=10s
go test -run=TestParallelBenchmarkAuditorServiceCheck -v
Location: token/core/zkatdlog/nogh/v1/validator/
BenchmarkValidatorTransferTestParallelBenchmarkValidatorTransferregression_test.go (in validator/regression/)Complete validation pipeline performance, including all cryptographic and business logic checks.
cd token/core/zkatdlog/nogh/v1/validator
go test -bench=BenchmarkValidatorTransfer -benchtime=10s
go test -run=TestParallelBenchmarkValidatorTransfer -v
Each layer tests a different code abstraction level independently:
Prover.Prove())Sender.GenerateZKTransfer(), Verifier.Verify())TransferService.Transfer())IssueService.Issue())AuditorService.AuditorCheck())Validator.VerifyTransfer())The layers do NOT build on each other - they test different parts of the codebase at different abstraction levels.
Most layers include parallel test variants that run benchmarks concurrently:
Benchmark*Parallel: Go’s built-in parallel benchmarking (*testing.B)TestParallelBenchmark*: Custom parallel benchmarking framework (*testing.T)These help identify concurrency issues and measure performance under load.
All benchmarks support various configurations:
Example with specific parameters: ```bash go test -bench=BenchmarkSender/bits_32-curve_BN254-in_2-out_2 -benchtime=10s