Merge pull request #4033 from filecoin-project/asr/add-supported-proof
Fix AddSupportedProofTypes
This commit is contained in:
commit
eaf3424938
@ -22,12 +22,10 @@ func SetSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
|||||||
// AddSupportedProofTypes sets supported proof types, across all actor versions.
|
// AddSupportedProofTypes sets supported proof types, across all actor versions.
|
||||||
// This should only be used for testing.
|
// This should only be used for testing.
|
||||||
func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
||||||
newTypes := make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
for _, t := range types {
|
for _, t := range types {
|
||||||
newTypes[t] = struct{}{}
|
|
||||||
}
|
|
||||||
// Set for all miner versions.
|
// Set for all miner versions.
|
||||||
miner0.SupportedProofTypes = newTypes
|
miner0.SupportedProofTypes[t] = struct{}{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPreCommitChallengeDelay sets the pre-commit challenge delay across all
|
// SetPreCommitChallengeDelay sets the pre-commit challenge delay across all
|
||||||
|
36
chain/actors/policy/policy_test.go
Normal file
36
chain/actors/policy/policy_test.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package policy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestSupportedProofTypes(t *testing.T) {
|
||||||
|
var oldTypes []abi.RegisteredSealProof
|
||||||
|
for t := range miner0.SupportedProofTypes {
|
||||||
|
oldTypes = append(oldTypes, t)
|
||||||
|
}
|
||||||
|
t.Cleanup(func() {
|
||||||
|
SetSupportedProofTypes(oldTypes...)
|
||||||
|
})
|
||||||
|
|
||||||
|
SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
|
||||||
|
require.EqualValues(t,
|
||||||
|
miner0.SupportedProofTypes,
|
||||||
|
map[abi.RegisteredSealProof]struct{}{
|
||||||
|
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
AddSupportedProofTypes(abi.RegisteredSealProof_StackedDrg8MiBV1)
|
||||||
|
require.EqualValues(t,
|
||||||
|
miner0.SupportedProofTypes,
|
||||||
|
map[abi.RegisteredSealProof]struct{}{
|
||||||
|
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||||
|
abi.RegisteredSealProof_StackedDrg8MiBV1: {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user