From 1f91e7267d19b81fa35a1e1cd24e98bdd75ef6f1 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 6 Nov 2020 21:05:16 -0800 Subject: [PATCH] correctly set seal proof types from tests --- chain/actors/policy/policy.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go index 492be79e9..a19a43aaa 100644 --- a/chain/actors/policy/policy.go +++ b/chain/actors/policy/policy.go @@ -26,26 +26,29 @@ const ( // 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 - miner2.PreCommitSealProofTypesV0 = newTypes - miner2.PreCommitSealProofTypesV7 = newTypes - miner2.PreCommitSealProofTypesV8 = newTypes + miner0.SupportedProofTypes = make(map[abi.RegisteredSealProof]struct{}, len(types)) + miner2.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + miner2.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + miner2.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + + AddSupportedProofTypes(types...) } // 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 { + if t >= abi.RegisteredSealProof_StackedDrg2KiBV1_1 { + panic("must specify v1 proof types only") + } // Set for all miner versions. miner0.SupportedProofTypes[t] = struct{}{} miner2.PreCommitSealProofTypesV0[t] = struct{}{} + miner2.PreCommitSealProofTypesV7[t] = struct{}{} - miner2.PreCommitSealProofTypesV8[t] = struct{}{} + miner2.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} + + miner2.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} } }