diff --git a/api/test/ccupgrade.go b/api/test/ccupgrade.go index 2518d0ef9..88d3e6ed7 100644 --- a/api/test/ccupgrade.go +++ b/api/test/ccupgrade.go @@ -17,7 +17,7 @@ import ( func TestCCUpgrade(t *testing.T, b APIBuilder, blocktime time.Duration) { for _, height := range []abi.ChainEpoch{ - 1, // before + 2, // before 162, // while sealing 520, // after upgrade deal 5000, // after diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go index 31d83cd3d..b1084bbcd 100644 --- a/chain/actors/policy/policy.go +++ b/chain/actors/policy/policy.go @@ -6,21 +6,28 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/chain/actors" + market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" 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" + builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" - paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych" verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg" + + builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" + market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market" + miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner" + paych3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/paych" + verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg" ) const ( - ChainFinality = miner0.ChainFinality + ChainFinality = miner3.ChainFinality SealRandomnessLookback = ChainFinality - PaychSettleDelay = paych2.SettleDelay + PaychSettleDelay = paych3.SettleDelay ) // SetSupportedProofTypes sets supported proof types, across all actor versions. @@ -31,6 +38,11 @@ func SetSupportedProofTypes(types ...abi.RegisteredSealProof) { miner2.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2) miner2.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + // TODO: need to remove the extra version specs actors. + miner3.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + miner3.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + miner3.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + AddSupportedProofTypes(types...) } @@ -49,6 +61,13 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) { miner2.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} miner2.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} + + miner3.PreCommitSealProofTypesV0[t] = struct{}{} + + miner3.PreCommitSealProofTypesV7[t] = struct{}{} + miner3.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} + + miner3.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} } } @@ -58,6 +77,7 @@ func SetPreCommitChallengeDelay(delay abi.ChainEpoch) { // Set for all miner versions. miner0.PreCommitChallengeDelay = delay miner2.PreCommitChallengeDelay = delay + miner3.PreCommitChallengeDelay = delay } // TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay. @@ -73,6 +93,10 @@ func SetConsensusMinerMinPower(p abi.StoragePower) { for _, policy := range builtin2.SealProofPolicies { policy.ConsensusMinerMinPower = p } + + for _, policy := range builtin3.PoStProofPolicies { + policy.ConsensusMinerMinPower = p + } } // SetMinVerifiedDealSize sets the minimum size of a verified deal. This should @@ -80,6 +104,7 @@ func SetConsensusMinerMinPower(p abi.StoragePower) { func SetMinVerifiedDealSize(size abi.StoragePower) { verifreg0.MinVerifiedDealSize = size verifreg2.MinVerifiedDealSize = size + verifreg3.MinVerifiedDealSize = size } func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) abi.ChainEpoch { @@ -88,6 +113,8 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) ab return miner0.MaxSealDuration[t] case actors.Version2: return miner2.MaxProveCommitDuration[t] + case actors.Version3: + return miner3.MaxProveCommitDuration[t] default: panic("unsupported actors version") } @@ -103,6 +130,8 @@ func DealProviderCollateralBounds( return market0.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil, nwVer) case actors.Version2: return market2.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil) + case actors.Version3: + return market3.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil) default: panic("unsupported network version") } @@ -116,6 +145,10 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) { miner2.WPoStChallengeWindow = period miner2.WPoStProvingPeriod = period * abi.ChainEpoch(miner2.WPoStPeriodDeadlines) + + // TODO: change dispute window as well? This is only used for testing anyways. + miner3.WPoStChallengeWindow = period + miner3.WPoStProvingPeriod = period * abi.ChainEpoch(miner3.WPoStPeriodDeadlines) } func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch { @@ -132,17 +165,17 @@ func GetMaxSectorExpirationExtension() abi.ChainEpoch { // TODO: we'll probably need to abstract over this better in the future. func GetMaxPoStPartitions(p abi.RegisteredPoStProof) (int, error) { - sectorsPerPart, err := builtin2.PoStProofWindowPoStPartitionSectors(p) + sectorsPerPart, err := builtin3.PoStProofWindowPoStPartitionSectors(p) if err != nil { return 0, err } - return int(miner2.AddressedSectorsMax / sectorsPerPart), nil + return int(miner3.AddressedSectorsMax / sectorsPerPart), nil } func GetDefaultSectorSize() abi.SectorSize { // supported sector sizes are the same across versions. - szs := make([]abi.SectorSize, 0, len(miner2.PreCommitSealProofTypesV8)) - for spt := range miner2.PreCommitSealProofTypesV8 { + szs := make([]abi.SectorSize, 0, len(miner3.PreCommitSealProofTypesV8)) + for spt := range miner3.PreCommitSealProofTypesV8 { ss, err := spt.SectorSize() if err != nil { panic(err)