move winning post proof type logic into a helper
This commit is contained in:
parent
03cd3760bb
commit
bf48728875
@ -186,6 +186,23 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredPoStProof, error) {
|
||||||
|
switch proof {
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
||||||
|
return abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
||||||
|
return abi.RegisteredPoStProof_StackedDrgWinning8MiBV1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
||||||
|
return abi.RegisteredPoStProof_StackedDrgWinning512MiBV1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
||||||
|
return abi.RegisteredPoStProof_StackedDrgWinning32GiBV1, nil
|
||||||
|
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
||||||
|
return abi.RegisteredPoStProof_StackedDrgWinning64GiBV1, nil
|
||||||
|
default:
|
||||||
|
return -1, xerrors.Errorf("unknown proof type %d", proof)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type MinerInfo struct {
|
type MinerInfo struct {
|
||||||
Owner address.Address // Must be an ID-address.
|
Owner address.Address // Must be an ID-address.
|
||||||
Worker address.Address // Must be an ID-address.
|
Worker address.Address // Must be an ID-address.
|
||||||
|
@ -212,21 +212,9 @@ func GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv ffiwra
|
|||||||
return nil, xerrors.Errorf("getting miner ID: %w", err)
|
return nil, xerrors.Errorf("getting miner ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move this to somewhere in specs-actors or the state types.
|
proofType, err := miner.WinningPoStProofTypeFromWindowPoStProofType(nv, info.WindowPoStProofType)
|
||||||
var proofType abi.RegisteredPoStProof
|
if err != nil {
|
||||||
switch info.WindowPoStProofType {
|
return nil, xerrors.Errorf("determining winning post proof type: %w", err)
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
|
||||||
proofType = abi.RegisteredPoStProof_StackedDrgWinning2KiBV1
|
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
|
||||||
proofType = abi.RegisteredPoStProof_StackedDrgWinning8MiBV1
|
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
|
||||||
proofType = abi.RegisteredPoStProof_StackedDrgWinning512MiBV1
|
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
|
||||||
proofType = abi.RegisteredPoStProof_StackedDrgWinning32GiBV1
|
|
||||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
|
||||||
proofType = abi.RegisteredPoStProof_StackedDrgWinning64GiBV1
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown proof type %d", info.WindowPoStProofType)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ids, err := pv.GenerateWinningPoStSectorChallenge(ctx, proofType, abi.ActorID(mid), rand, numProvSect)
|
ids, err := pv.GenerateWinningPoStSectorChallenge(ctx, proofType, abi.ActorID(mid), rand, numProvSect)
|
||||||
|
Loading…
Reference in New Issue
Block a user