Skip to content

Commit

Permalink
bench: Accept sector nums in simple post
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed May 30, 2022
1 parent 1960a77 commit 580bafb
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions cmd/lotus-bench/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ var simpleWindowPost = &cli.Command{
Value: "t01000",
},
},
ArgsUsage: "[sealed] [cache] [comm R]",
ArgsUsage: "[sealed] [cache] [comm R] [sector num]",
Action: func(cctx *cli.Context) error {
maddr, err := address.NewFromString(cctx.String("miner-addr"))
if err != nil {
Expand Down Expand Up @@ -310,7 +310,13 @@ var simpleWindowPost = &cli.Command{
return err
}

ch, err := ffi.GeneratePoStFallbackSectorChallenges(wpt, mid, rand[:], []abi.SectorNumber{1})
snum, err := strconv.ParseUint(cctx.Args().Get(3), 10, 64)
if err != nil {
return xerrors.Errorf("parsing sector num: %w", err)
}
sn := abi.SectorNumber(snum)

ch, err := ffi.GeneratePoStFallbackSectorChallenges(wpt, mid, rand[:], []abi.SectorNumber{sn})
if err != nil {
return xerrors.Errorf("generating challenges: %w", err)
}
Expand All @@ -320,13 +326,13 @@ var simpleWindowPost = &cli.Command{
vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{
SectorInfo: prf.SectorInfo{
SealProof: spt(sectorSize),
SectorNumber: 1,
SectorNumber: sn,
SealedCID: commr,
},
CacheDirPath: cctx.Args().Get(1),
PoStProofType: wpt,
SealedSectorPath: cctx.Args().Get(0),
}, ch.Challenges[1])
}, ch.Challenges[sn])
if err != nil {
return err
}
Expand Down Expand Up @@ -361,7 +367,7 @@ var simpleWinningPost = &cli.Command{
Value: "t01000",
},
},
ArgsUsage: "[sealed] [cache] [comm R]",
ArgsUsage: "[sealed] [cache] [comm R] [sector num]",
Action: func(cctx *cli.Context) error {
maddr, err := address.NewFromString(cctx.String("miner-addr"))
if err != nil {
Expand Down Expand Up @@ -391,7 +397,13 @@ var simpleWinningPost = &cli.Command{
return err
}

ch, err := ffi.GeneratePoStFallbackSectorChallenges(wpt, mid, rand[:], []abi.SectorNumber{1})
snum, err := strconv.ParseUint(cctx.Args().Get(3), 10, 64)
if err != nil {
return xerrors.Errorf("parsing sector num: %w", err)
}
sn := abi.SectorNumber(snum)

ch, err := ffi.GeneratePoStFallbackSectorChallenges(wpt, mid, rand[:], []abi.SectorNumber{sn})
if err != nil {
return xerrors.Errorf("generating challenges: %w", err)
}
Expand All @@ -401,13 +413,13 @@ var simpleWinningPost = &cli.Command{
vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{
SectorInfo: prf.SectorInfo{
SealProof: spt(sectorSize),
SectorNumber: 1,
SectorNumber: sn,
SealedCID: commr,
},
CacheDirPath: cctx.Args().Get(1),
PoStProofType: wpt,
SealedSectorPath: cctx.Args().Get(0),
}, ch.Challenges[1])
}, ch.Challenges[sn])
if err != nil {
return err
}
Expand Down

0 comments on commit 580bafb

Please sign in to comment.