2020-09-12 03:07:52 +00:00
|
|
|
package builtin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2020-09-22 04:12:07 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
2020-09-23 04:48:35 +00:00
|
|
|
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
2020-09-22 04:12:07 +00:00
|
|
|
|
2020-09-20 21:53:46 +00:00
|
|
|
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
|
2020-09-15 23:47:58 +00:00
|
|
|
|
2020-09-19 04:30:24 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/network"
|
2020-09-12 03:07:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Version int
|
|
|
|
|
|
|
|
const (
|
|
|
|
Version0 = iota
|
|
|
|
)
|
|
|
|
|
|
|
|
// Converts a network version into a specs-actors version.
|
|
|
|
func VersionForNetwork(version network.Version) Version {
|
|
|
|
switch version {
|
2020-09-24 21:30:11 +00:00
|
|
|
case network.Version0, network.Version1, network.Version2, network.Version3:
|
2020-09-14 11:14:06 +00:00
|
|
|
return Version0
|
2020-09-12 03:07:52 +00:00
|
|
|
default:
|
|
|
|
panic(fmt.Sprintf("unsupported network version %d", version))
|
|
|
|
}
|
|
|
|
}
|
2020-09-15 23:47:58 +00:00
|
|
|
|
2020-09-19 04:30:24 +00:00
|
|
|
// TODO: Why does actors have 2 different versions of this?
|
2020-09-23 04:48:35 +00:00
|
|
|
type SectorInfo = proof0.SectorInfo
|
|
|
|
type PoStProof = proof0.PoStProof
|
2020-09-20 21:53:46 +00:00
|
|
|
type FilterEstimate = smoothing0.FilterEstimate
|
|
|
|
|
|
|
|
func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate {
|
|
|
|
return (FilterEstimate)(v0)
|
2020-09-19 04:30:24 +00:00
|
|
|
}
|
2020-09-22 04:12:07 +00:00
|
|
|
|
|
|
|
// Doesn't change between actors v0 and v1
|
|
|
|
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
|
|
|
|
return miner0.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
|
|
|
|
}
|