-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3975 from filecoin-project/steb/abstract-actor-po…
…licy Add some actors policy setters for testing
- Loading branch information
Showing
15 changed files
with
121 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.