diff options
Diffstat (limited to 'nizk/stage1_test.go')
-rw-r--r-- | nizk/stage1_test.go | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/nizk/stage1_test.go b/nizk/stage1_test.go index a1b7327..516cb12 100644 --- a/nizk/stage1_test.go +++ b/nizk/stage1_test.go @@ -12,19 +12,17 @@ func TestStage1(t *testing.T) { b2 := NewBit(id, false) bc1, _ := b1.Commit() bc2, _ := b2.Commit() - st1 := b1.Stage1() - st2 := b2.Stage1() - c1, pr1 := st1.Commit() - c2, pr2 := st2.Commit() - if !c1.Verify(bc1, pr1) { + _, c1, pr1 := b1.CommitStage1() + _, c2, pr2 := b2.CommitStage1() + if !bc1.VerifyStage1(c1, pr1) { t.Fatal("Could not verify st1 with c1 and pr1, plus=true case") } - if !c2.Verify(bc2, pr2) { + if !bc2.VerifyStage1(c2, pr2) { t.Fatal("Could not verify st2 with c2 and pr2, plus=false case") } // Wrong proof test - if c1.Verify(bc1, pr2) { + if bc1.VerifyStage1(c1, pr2) { t.Fatal("Shouldn't be able to verify c1 with pr2") } } @@ -37,21 +35,19 @@ func TestStage1FromScalars(t *testing.T) { b1 := NewBitFromScalars(id, true, α, β) b2 := NewBitFromScalars(id, false, α, β) - st1 := b1.Stage1FromScalars(x, y, r) - st2 := b2.Stage1FromScalars(x, y, r) - bc1, _ := b1.Commit() bc2, _ := b2.Commit() - c1, pr1 := st1.Commit() - c2, pr2 := st2.Commit() - if !c1.Verify(bc1, pr1) { + + _, c1, pr1 := b1.CommitStage1() + _, c2, pr2 := b2.CommitStage1() + if !bc1.VerifyStage1(c1, pr1) { t.Fatal("Could not verify st1 with c1 and pr1, plus=true case") } - if !c2.Verify(bc2, pr2) { + if !bc2.VerifyStage1(c2, pr2) { t.Fatal("Could not verify st2 with c2 and pr2, plus=false case") } // Wrong proof test - if c1.Verify(bc2, pr2) { + if bc1.VerifyStage1(c2, pr2) { t.Fatal("Shouldn't be able to verify c1 with pr2") } } |