From 363f575e6cae3d56cb0dd5c916f9fe74e43ff2c2 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Wed, 13 May 2020 13:12:13 -0700 Subject: [PATCH 1/2] properly handle parsing of miner init sector sizes --- cmd/lotus-storage-miner/init.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/lotus-storage-miner/init.go b/cmd/lotus-storage-miner/init.go index 860e76ced..127b90856 100644 --- a/cmd/lotus-storage-miner/init.go +++ b/cmd/lotus-storage-miner/init.go @@ -79,7 +79,7 @@ var initCmd = &cli.Command{ &cli.StringFlag{ Name: "sector-size", Usage: "specify sector size to use", - Value: fmt.Sprint(build.DefaultSectorSize()), + Value: units.BytesSize(float64(build.DefaultSectorSize())), }, &cli.StringSliceFlag{ Name: "pre-sealed-sectors", @@ -603,7 +603,10 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID, return address.Undef, err } - ssize := cctx.Uint64("sector-size") + ssize, err := units.RAMInBytes(cctx.String("sector-size")) + if err != nil { + return address.Undef, fmt.Errorf("failed to parse sector size: %w", err) + } worker := owner if cctx.String("worker") != "" { From e34b20b839605355e01ef5651fc5634505d363ec Mon Sep 17 00:00:00 2001 From: Jeromy Date: Wed, 13 May 2020 13:21:46 -0700 Subject: [PATCH 2/2] fix nondeterminism --- build/params_shared.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/params_shared.go b/build/params_shared.go index a60962ed4..81a9d586a 100644 --- a/build/params_shared.go +++ b/build/params_shared.go @@ -25,7 +25,7 @@ func DefaultSectorSize() abi.SectorSize { } sort.Slice(szs, func(i, j int) bool { - return szs[i] < szs[i] + return szs[i] < szs[j] }) return szs[0]