-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.go
78 lines (70 loc) · 1.69 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 (
"fmt"
"os"
"github.com/urfave/cli/v2"
deserializer "github.com/worldcoin/ptau-deserializer/deserialize"
)
func main() {
app := &cli.App{
Name: "ptau-deserialize",
Usage: "Deserialize .ptau files into gnark's .ph1 format",
Action: func(*cli.Context) error {
return nil
},
Commands: []*cli.Command{
{
Name: "convert",
Aliases: []string{"c"},
Usage: "Deserialize .ptau file into .ph1 format and write to `OUTPUT`",
Action: func(cCtx *cli.Context) error {
ptauFilePath := cCtx.String("input")
outputFilePath := cCtx.String("output")
file, err := deserializer.InitPtau(ptauFilePath)
if err != nil {
panic(err)
}
err = deserializer.WritePhase1FromPtauFile(file, outputFilePath)
if err != nil {
panic(err)
}
//ptau, err := deserializer.ReadPtau(ptauFilePath)
//if err != nil {
// return err
//}
//
//phase1, err := deserializer.ConvertPtauToPhase1(ptau)
//
//if err != nil {
// return err
//}
//
//// Write phase1 to file
//err = deserializer.WritePhase1(phase1, uint8(ptau.Header.Power), outputFilePath)
//
//if err != nil {
// return err
//}
return nil
},
Flags: []cli.Flag{
&cli.StringFlag{
Name: "input",
Aliases: []string{"i"},
Usage: "Load `FILE`.ptau to convert to .ph1",
Required: true,
},
&cli.StringFlag{
Name: "output",
Aliases: []string{"o"},
Usage: "File output for the phase 1 conversion (`FILE`.ph1)",
Required: true,
},
},
},
},
}
if err := app.Run(os.Args); err != nil {
fmt.Printf("%s", err)
}
}