2020-09-24 00:01:40 +00:00
|
|
|
package actors
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/go-state-types/network"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Version int
|
|
|
|
|
2021-05-27 10:27:47 +00:00
|
|
|
var LatestVersion = 5
|
2021-05-15 01:11:23 +00:00
|
|
|
|
2021-05-27 10:27:47 +00:00
|
|
|
var Versions = []int{0, 2, 3, 4, LatestVersion}
|
2021-05-15 01:11:23 +00:00
|
|
|
|
2020-09-24 00:01:40 +00:00
|
|
|
const (
|
2020-10-07 00:51:43 +00:00
|
|
|
Version0 Version = 0
|
|
|
|
Version2 Version = 2
|
2021-01-16 04:12:31 +00:00
|
|
|
Version3 Version = 3
|
2021-04-23 12:29:46 +00:00
|
|
|
Version4 Version = 4
|
2021-05-06 05:44:11 +00:00
|
|
|
Version5 Version = 5
|
2020-09-24 00:01:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Converts a network version into an actors adt version.
|
2021-08-09 10:17:54 +00:00
|
|
|
func VersionForNetwork(version network.Version) (Version, error) {
|
2020-09-24 00:01:40 +00:00
|
|
|
switch version {
|
2020-09-28 19:53:40 +00:00
|
|
|
case network.Version0, network.Version1, network.Version2, network.Version3:
|
2021-08-09 10:17:54 +00:00
|
|
|
return Version0, nil
|
2021-07-15 18:24:08 +00:00
|
|
|
case network.Version4, network.Version5, network.Version6, network.Version6AndAHalf, network.Version7, network.Version8, network.Version9:
|
2021-08-09 10:17:54 +00:00
|
|
|
return Version2, nil
|
2021-03-29 22:48:43 +00:00
|
|
|
case network.Version10, network.Version11:
|
2021-08-09 10:17:54 +00:00
|
|
|
return Version3, nil
|
2021-04-23 12:29:46 +00:00
|
|
|
case network.Version12:
|
2021-08-09 10:17:54 +00:00
|
|
|
return Version4, nil
|
2021-05-06 05:44:11 +00:00
|
|
|
case network.Version13:
|
2021-08-09 10:17:54 +00:00
|
|
|
return Version5, nil
|
2020-09-24 00:01:40 +00:00
|
|
|
default:
|
2021-08-09 10:17:54 +00:00
|
|
|
return -1, fmt.Errorf("unsupported network version %d", version)
|
2020-09-24 00:01:40 +00:00
|
|
|
}
|
|
|
|
}
|