From c05df6dc1de1c8fe1b168655929eb30c7ef97ba8 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 18 Jan 2021 17:44:16 -0800 Subject: [PATCH] fix: use the correct proof type in winning proofs --- chain/stmgr/utils.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index ce0384842..f7ed4c2e3 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -212,7 +212,24 @@ func GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv ffiwra return nil, xerrors.Errorf("getting miner ID: %w", err) } - ids, err := pv.GenerateWinningPoStSectorChallenge(ctx, info.WindowPoStProofType, abi.ActorID(mid), rand, numProvSect) + // TODO: move this to somewhere in specs-actors or the state types. + var proofType abi.RegisteredPoStProof + switch info.WindowPoStProofType { + case abi.RegisteredPoStProof_StackedDrgWinning2KiBV1: + proofType = abi.RegisteredPoStProof_StackedDrgWindow2KiBV1 + case abi.RegisteredPoStProof_StackedDrgWinning8MiBV1: + proofType = abi.RegisteredPoStProof_StackedDrgWindow8MiBV1 + case abi.RegisteredPoStProof_StackedDrgWinning512MiBV1: + proofType = abi.RegisteredPoStProof_StackedDrgWindow512MiBV1 + case abi.RegisteredPoStProof_StackedDrgWinning32GiBV1: + proofType = abi.RegisteredPoStProof_StackedDrgWindow32GiBV1 + case abi.RegisteredPoStProof_StackedDrgWinning64GiBV1: + proofType = abi.RegisteredPoStProof_StackedDrgWindow64GiBV1 + default: + return nil, xerrors.Errorf("unknown proof type %d", info.WindowPoStProofType) + } + + ids, err := pv.GenerateWinningPoStSectorChallenge(ctx, proofType, abi.ActorID(mid), rand, numProvSect) if err != nil { return nil, xerrors.Errorf("generating winning post challenges: %w", err) }