Skip to content

Commit f7269f3

Browse files
committed
Fix lint issues
Signed-off-by: AkramBitar <akram@il.ibm.com>
1 parent d988edc commit f7269f3

4 files changed

Lines changed: 146 additions & 2 deletions

File tree

docs/benchmark/benchmark.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
- [ZKAT DLog No Graph-Hiding Benchmarks](core/dlognogh/dlognogh.md) - How to run benchmarks
1515
- [ZKAT DLog Testing Architecture](core/dlognogh/dlognogh_architecture.md) - Understanding the test layers
16+
- [ZKAT DLog Regression Tests](core/dlognogh/dlognogh_regression.md) - Backwards compatibility testing
1617

1718
### Services
1819

docs/benchmark/core/dlognogh/dlognogh.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# ZKAT DLog No Graph Hiding Benchmarks
22

33
> **Related Documentation:**
4-
> For understanding the testing architecture and layers, see [dlognogh_architecture.md](./dlognogh_architecture.md)
4+
> - [Testing Architecture](./dlognogh_architecture.md) - Understanding the test layers
5+
> - [Regression Tests](./dlognogh_regression.md) - Backwards compatibility testing
56
67
Packages with benchmark tests:
78

docs/benchmark/core/dlognogh/dlognogh_architecture.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
This document explains the testing architecture for the Zero-Knowledge Anonymous Token Discrete Logarithm (ZK-ATDLOG) implementation in the Fabric Token SDK.
44

55
> **Related Documentation:**
6-
> For detailed instructions on how to run these benchmarks, see [dlognogh.md](./dlognogh.md)
6+
> - [Running Benchmarks](./dlognogh.md) - How to run performance benchmarks
7+
> - [Regression Tests](./dlognogh_regression.md) - Backwards compatibility testing
78
89
## Overview
910

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# ZK-ATDLOG Regression Tests
2+
3+
This document explains the regression testing for the Zero-Knowledge Anonymous Token Discrete Logarithm (ZK-ATDLOG) validator implementation.
4+
5+
> **Related Documentation:**
6+
> - [Testing Architecture](./dlognogh_architecture.md) - Understanding the test layers
7+
> - [Running Benchmarks](./dlognogh.md) - How to run performance benchmarks
8+
9+
## Overview
10+
11+
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.
12+
13+
**Location:** `token/core/zkatdlog/nogh/v1/validator/regression/`
14+
15+
## Purpose
16+
17+
- **Backwards Compatibility**: Ensure new code changes don't break validation of existing token requests
18+
- **Protocol Stability**: Verify that the cryptographic protocol remains consistent across versions
19+
- **Change Detection**: Identify when modifications require regenerating test data
20+
21+
## Test Structure
22+
23+
### Test Data Organization
24+
25+
```
26+
testdata/
27+
├── 32-BLS12_381_BBS_GURVY/ # 32-bit range proofs, BLS12_381 curve
28+
│ ├── params.txt # Base64-encoded public parameters
29+
│ ├── transfers_i1_o1/ # Transfer: 1 input, 1 output
30+
│ │ ├── output.0.json
31+
│ │ ├── output.1.json
32+
│ │ └── ... (64 files)
33+
│ ├── transfers_i1_o2/ # Transfer: 1 input, 2 outputs
34+
│ ├── transfers_i2_o1/ # Transfer: 2 inputs, 1 output
35+
│ ├── transfers_i2_o2/ # Transfer: 2 inputs, 2 outputs
36+
│ ├── issues_i1_o1/ # Issue operations
37+
│ ├── redeems_i1_o1/ # Redeem operations
38+
│ └── swaps_i1_o1/ # Swap operations
39+
├── 32-BN254/ # 32-bit range proofs, BN254 curve
40+
├── 64-BLS12_381_BBS_GURVY/ # 64-bit range proofs, BLS12_381 curve
41+
└── 64-BN254/ # 64-bit range proofs, BN254 curve
42+
```
43+
44+
### Test Vector Format
45+
46+
Each `output.N.json` file contains:
47+
```json
48+
{
49+
"req_raw": "<base64-encoded token request>",
50+
"txid": "<transaction ID>"
51+
}
52+
```
53+
54+
## Running Regression Tests
55+
56+
### Run All Tests
57+
58+
```bash
59+
cd token/core/zkatdlog/nogh/v1/validator/regression
60+
go test -v
61+
```
62+
63+
### Run Specific Configuration
64+
65+
```bash
66+
# Run only 32-bit BLS12_381 tests
67+
go test -v -run "TestRegression/testdata/32-BLS12_381_BBS_GURVY"
68+
69+
# Run only transfer tests
70+
go test -v -run "TestRegression.*transfers"
71+
72+
# Run specific input/output combination
73+
go test -v -run "TestRegression.*transfers_i2_o2"
74+
```
75+
76+
### Parallel Execution
77+
78+
The tests run in parallel by default. To control parallelism:
79+
80+
```bash
81+
# Run with specific number of parallel tests
82+
go test -v -parallel 4
83+
```
84+
85+
## Test Coverage
86+
87+
The regression suite tests:
88+
89+
- **4 Action Types**: transfers, issues, redeems, swaps
90+
- **4 Input/Output Combinations**: i1_o1, i1_o2, i2_o1, i2_o2
91+
- **4 Configurations**: 2 bit sizes (32, 64) × 2 curves (BLS12_381, BN254)
92+
- **64 Vectors per Configuration**: Total of 4,096 test vectors
93+
94+
## Generating New Test Data
95+
96+
When code changes require regenerating test vectors:
97+
98+
### 1. Use the Generator
99+
100+
```bash
101+
cd token/core/zkatdlog/nogh/v1/validator/regression/testdata/generator
102+
go run main.go
103+
```
104+
105+
### 2. Document the Change
106+
107+
Update `changes.md` with:
108+
- Commit hash where change occurred
109+
- Description of what changed
110+
- Reason for regeneration
111+
112+
Example:
113+
```markdown
114+
## With respect to commit `<commit-hash>`
115+
116+
Description of the change that required test data regeneration.
117+
```
118+
119+
### 3. Commit New Test Data
120+
121+
```bash
122+
git add testdata/
123+
git add changes.md
124+
git commit -m "Regenerate regression test data: <reason>"
125+
```
126+
127+
## When to Regenerate Test Data
128+
129+
Regenerate test vectors when:
130+
131+
- **Serialization format changes**: Any modification to how token requests are serialized
132+
- **Cryptographic changes**: Updates to proof generation or verification algorithms
133+
- **Protocol updates**: Changes to the token protocol itself
134+
- **Bug fixes**: Corrections that affect the output format
135+
136+
## Related Tests
137+
138+
- **Layer 3 Validator Benchmarks**: Performance testing of the same validation logic
139+
- `BenchmarkValidatorTransfer`
140+
- `TestParallelBenchmarkValidatorTransfer`
141+
- See [dlognogh_architecture.md](./dlognogh_architecture.md) for the complete testing architecture

0 commit comments

Comments
 (0)