diff --git a/build/builtin_actors.go b/build/builtin_actors.go index e62b3fa21..e65ebabf9 100644 --- a/build/builtin_actors.go +++ b/build/builtin_actors.go @@ -1,14 +1,27 @@ package build import ( + "bytes" + "github.com/filecoin-project/lotus/chain/actors" + + "github.com/BurntSushi/toml" ) -// TODO a nicer interface would be to embed (and parse) a toml file containing the releases var BuiltinActorReleases map[actors.Version]string func init() { - BuiltinActorReleases = map[actors.Version]string{ - actors.Version8: "b71c2ec785aec23d", + BuiltinActorReleases = make(map[actors.Version]string) + + spec := BundleSpec{} + + r := bytes.NewReader(BuiltinActorBundles) + _, err := toml.DecodeReader(r, &spec) + if err != nil { + panic(err) + } + + for _, b := range spec.Bundles { + BuiltinActorReleases[b.Version] = b.Release } } diff --git a/build/bundle.go b/build/bundle.go index 67c4906df..4038aa7e9 100644 --- a/build/bundle.go +++ b/build/bundle.go @@ -1,3 +1,21 @@ package build +import ( + _ "embed" + + "github.com/filecoin-project/lotus/chain/actors" +) + var NetworkBundle string + +//go:embed bundle.toml +var BuiltinActorBundles []byte + +type BundleSpec struct { + Bundles []Bundle +} + +type Bundle struct { + Version actors.Version + Release string +} diff --git a/build/bundle.toml b/build/bundle.toml new file mode 100644 index 000000000..a3ef18414 --- /dev/null +++ b/build/bundle.toml @@ -0,0 +1,3 @@ +[[bundles]] +version = 8 +release = "b71c2ec785aec23d"