-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
78 lines (64 loc) · 1.75 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main
import (
"encoding/json"
"fmt"
"log"
"os"
gnark_nimue "github.com/reilabs/gnark-nimue"
go_ark_serialize "github.com/reilabs/go-ark-serialize"
)
type KeccakDigest struct {
KeccakDigest [32]uint8
}
type Fp256 struct {
Limbs [4]uint64
}
type MultiPath[Digest any] struct {
LeafSiblingHashes []Digest
AuthPathsPrefixLengths []uint64
AuthPathsSuffixes [][]Digest
LeafIndexes []uint64
}
type ProofElement struct {
A MultiPath[KeccakDigest]
B [][]Fp256
}
type Config struct {
NRounds int `json:"n_rounds"`
NVars int `json:"n_vars"`
FoldingFactor int `json:"folding_factor"`
OODSamples []int `json:"ood_samples"`
NumQueries []int `json:"num_queries"`
PowBits []int `json:"pow_bits"`
FinalQueries int `json:"final_queries"`
FinalPowBits int `json:"final_pow_bits"`
FinalFoldingPowBits int `json:"final_folding_pow_bits"`
DomainGenerator string `json:"domain_generator"`
IOPattern string `json:"io_pattern"`
Transcript []byte `json:"transcript"`
TranscriptLen int `json:"transcript_len"`
}
func main() {
f, err := os.Open("../whir/proof")
if err != nil {
fmt.Println(err)
return
}
defer f.Close()
params, err := os.ReadFile("../whir/params")
if err != nil {
fmt.Println(err)
return
}
var cfg Config
if err := json.Unmarshal(params, &cfg); err != nil {
log.Fatalf("Error unmarshalling JSON: %v\n", err)
}
fmt.Printf("Parsed configuration:\n%+v\n", cfg)
var x []ProofElement
_, err = go_ark_serialize.CanonicalDeserializeWithMode(f, &x, false, false)
io := gnark_nimue.IOPattern{}
_ = io.Parse([]byte(cfg.IOPattern))
fmt.Printf("io: %s\n", io.PPrint())
verify_circuit(x, cfg)
}