Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .srs fetching for proof aggregation #13

Merged
merged 1 commit into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion paramfetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func getParamDir() string {
return os.Getenv(dirEnv)
}

func GetParams(ctx context.Context, paramBytes []byte, storageSize uint64) error {
func GetParams(ctx context.Context, paramBytes []byte, srsBytes []byte, storageSize uint64) error {
if err := os.Mkdir(getParamDir(), 0755); err != nil && !os.IsExist(err) {
return err
}
Expand All @@ -71,6 +71,16 @@ func GetParams(ctx context.Context, paramBytes []byte, storageSize uint64) error
ft.maybeFetchAsync(ctx, name, info)
}

var srs map[string]paramFile

if err := json.Unmarshal(srsBytes, &srs); err != nil {
return err
}

for name, info := range srs {
ft.maybeFetchAsync(ctx, name, info)
}

return ft.wait(ctx)
}

Expand Down
6 changes: 5 additions & 1 deletion paramfetch/paramfetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@ func cancelOnSignal(ctx context.Context, sig ...os.Signal) context.Context {
func main() {
sectorSize := os.Args[1]
paramsJsonPath := os.Args[2]
srsJsonPath := os.Args[2]

n, err := strconv.ParseUint(sectorSize, 10, 64)
check(err)

dat, err := ioutil.ReadFile(paramsJsonPath)
check(err)

datSrs, err := ioutil.ReadFile(srsJsonPath)
check(err)

ctx := cancelOnSignal(context.TODO(), syscall.SIGTERM, syscall.SIGINT, syscall.SIGHUP)

err = build.GetParams(ctx, dat, n)
err = build.GetParams(ctx, dat, datSrs, n)
check(err)
}