55 lines
1.8 KiB
Go
55 lines
1.8 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) {
|
|
for _, t := range types {
|
|
// Set for all miner versions.
|
|
miner0.SupportedProofTypes[t] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// 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
|
|
}
|