use embeded toml spec for actor bundles

This commit is contained in:
vyzo 2022-05-12 20:53:12 +03:00
parent 37b807278a
commit 515a2dba8f
3 changed files with 37 additions and 3 deletions

View File

@ -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
}
}

View File

@ -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
}

3
build/bundle.toml Normal file
View File

@ -0,0 +1,3 @@
[[bundles]]
version = 8
release = "b71c2ec785aec23d"