aboutsummaryrefslogtreecommitdiff
path: root/nizk/stage1_test.go
diff options
context:
space:
mode:
authorÖzgür Kesim <oec@codeblau.de>2024-11-12 18:48:08 +0100
committerÖzgür Kesim <oec@codeblau.de>2024-11-12 18:48:08 +0100
commit79a53aa896b5fe0532f28dad2823e276433c31d0 (patch)
tree312bf9b46228fabd62408de243881476f900c1e2 /nizk/stage1_test.go
parente71b7a107b5441e7fa05366bf866cf223c649e7a (diff)
refactor bit and stages: common stages type for both statges
Diffstat (limited to 'nizk/stage1_test.go')
-rw-r--r--nizk/stage1_test.go26
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")
}
}