aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nizk/stage1_test.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/nizk/stage1_test.go b/nizk/stage1_test.go
index 516cb12..5fbf147 100644
--- a/nizk/stage1_test.go
+++ b/nizk/stage1_test.go
@@ -28,8 +28,8 @@ func TestStage1(t *testing.T) {
}
func TestStage1FromScalars(t *testing.T) {
- var id, x, y, r, α, β *Scalar
- for _, s := range []**Scalar{&id, &x, &y, &r, &α, &β} {
+ var id, α, β, x, y, r *Scalar
+ for _, s := range []**Scalar{&id, &α, &β, &x, &y, &r} {
*s = Curve.RandomScalar()
}
@@ -38,8 +38,8 @@ func TestStage1FromScalars(t *testing.T) {
bc1, _ := b1.Commit()
bc2, _ := b2.Commit()
- _, c1, pr1 := b1.CommitStage1()
- _, c2, pr2 := b2.CommitStage1()
+ _, c1, pr1 := b1.CommitStage1FromScalars(r, x, y)
+ _, c2, pr2 := b2.CommitStage1FromScalars(y, r, x)
if !bc1.VerifyStage1(c1, pr1) {
t.Fatal("Could not verify st1 with c1 and pr1, plus=true case")
}
@@ -47,7 +47,10 @@ func TestStage1FromScalars(t *testing.T) {
t.Fatal("Could not verify st2 with c2 and pr2, plus=false case")
}
// Wrong proof test
- if bc1.VerifyStage1(c2, pr2) {
- t.Fatal("Shouldn't be able to verify c1 with pr2")
+ if bc1.VerifyStage1(c1, pr2) ||
+ bc1.VerifyStage1(c2, pr2) ||
+ bc2.VerifyStage1(c1, pr2) ||
+ bc2.VerifyStage1(c2, pr1) {
+ t.Fatal("Shouldn't be able to verify bc_i with c_j or pr_j")
}
}