use embeded toml spec for actor bundles
This commit is contained in:
parent
37b807278a
commit
515a2dba8f
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
3
build/bundle.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[[bundles]]
|
||||
version = 8
|
||||
release = "b71c2ec785aec23d"
|
Loading…
Reference in New Issue
Block a user