This document explains the regression testing for the Zero-Knowledge Anonymous Token Discrete Logarithm (ZK-ATDLOG) validator implementation.
Related Documentation:
- Testing Architecture - Understanding the test layers
- Running Benchmarks - How to run performance benchmarks
Regression tests ensure backwards compatibility of the ZK-ATDLOG validator by verifying that previously generated token requests remain valid across code changes. These tests use pre-recorded test vectors containing serialized token requests that must continue to validate correctly.
Location: token/core/zkatdlog/nogh/v1/validator/regression/
testdata/
└── zero/
├── 32-BLS12_381_BBS_GURVY/ # 32-bit range proofs, BLS12_381 curve
│ ├── params.txt # Base64-encoded public parameters
│ └── testdata.json # All test cases for this configuration
├── 32-BN254/ # 32-bit range proofs, BN254 curve
│ ├── params.txt
│ └── testdata.json
├── 64-BLS12_381_BBS_GURVY/ # 64-bit range proofs, BLS12_381 curve
│ ├── params.txt
│ └── testdata.json
└── 64-BN254/ # 64-bit range proofs, BN254 curve
├── params.txt
└── testdata.json
Each testdata.json file contains all test cases for a configuration with labeled keys:
{
"transfers_i1_o1_0": {
"req_raw": "<base64-encoded token request>",
"txid": "<transaction ID>",
"metadata": "<base64-encoded metadata>",
"inputs": [[<serialized-token-bytes>], [...]]
},
"transfers_i1_o1_1": { ... },
...
"transfers_i1_o1_63": { ... },
"transfers_i1_o2_0": { ... },
...
"issues_i1_o1_0": { ... },
...
"redeems_i2_o2_63": { ... },
"swaps_i2_o2_63": { ... }
}
Key Format: <action>_i<inputs>_o<outputs>_<index>
action: One of transfers, issues, redeems, swapsinputs: Number of input tokens (1 or 2)outputs: Number of output tokens (1 or 2)index: Test case number (0-63)Fields:
req_raw: Base64-encoded serialized token requesttxid: Transaction ID for the requestmetadata: Base64-encoded token request metadata (for auditor validation)inputs: Nested array of serialized input tokens (for auditor validation)cd token/core/zkatdlog/nogh/v1/validator/regression
go test -v
# Run only 32-bit BLS12_381 tests
go test -v -run "TestRegression/testdata/32-BLS12_381_BBS_GURVY"
# Run only transfer tests
go test -v -run "TestRegression.*transfers"
# Run specific input/output combination
go test -v -run "TestRegression.*transfers_i2_o2"
The tests run in parallel by default. To control parallelism:
# Run with specific number of parallel tests
go test -v -parallel 4
The regression suite tests:
When code changes require regenerating test vectors:
cd token/core/zkatdlog/nogh/v1/regression/testdata/zero/generator
go generate
This will generate testdata.json files in each configuration directory, with each file containing all 64 test cases in an aggregated format.
Update changes.md with:
Example:
## With respect to commit `<commit-hash>`
Description of the change that required test data regeneration.
git add token/core/zkatdlog/nogh/v1/regression/testdata/
git commit -m "Regenerate regression test data: <reason>"
Regenerate test vectors when:
BenchmarkValidatorTransferTestParallelBenchmarkValidatorTransfer