32a699d6a3
Addresses: *a307e4593a (r491966115)
*a307e4593a (r491966634)
Note: This puts everything into a policy package to avoid a dependency cycle between the build package, the miner package, and the types package. This is also why I introduced a GetPreCommitChallengeDelay function and removed the variable.
57 lines
1.9 KiB
Go
57 lines
1.9 KiB
Go
package policy
|
|
|
|
import (
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
|
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
|
)
|
|
|
|
// SetSupportedProofTypes sets supported proof types, across all actor versions.
|
|
// This should only be used for testing.
|
|
func SetSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
|
newTypes := make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
for _, t := range types {
|
|
newTypes[t] = struct{}{}
|
|
}
|
|
// Set for all miner versions.
|
|
miner0.SupportedProofTypes = newTypes
|
|
}
|
|
|
|
// AddSupportedProofTypes sets supported proof types, across all actor versions.
|
|
// This should only be used for testing.
|
|
func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
|
newTypes := make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
for _, t := range types {
|
|
newTypes[t] = struct{}{}
|
|
}
|
|
// Set for all miner versions.
|
|
miner0.SupportedProofTypes = newTypes
|
|
}
|
|
|
|
// SetPreCommitChallengeDelay sets the pre-commit challenge delay across all
|
|
// actors versions. Use for testing.
|
|
func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
|
|
// Set for all miner versions.
|
|
miner0.PreCommitChallengeDelay = delay
|
|
}
|
|
|
|
// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay.
|
|
func GetPreCommitChallengeDelay() abi.ChainEpoch {
|
|
return miner0.PreCommitChallengeDelay
|
|
}
|
|
|
|
// SetConsensusMinerMinPower sets the minimum power of an individual miner must
|
|
// meet for leader election, across all actor versions. This should only be used
|
|
// for testing.
|
|
func SetConsensusMinerMinPower(p abi.StoragePower) {
|
|
power0.ConsensusMinerMinPower = p
|
|
}
|
|
|
|
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
|
|
// only be used for testing.
|
|
func SetMinVerifiedDealSize(size abi.StoragePower) {
|
|
verifreg0.MinVerifiedDealSize = size
|
|
}
|