From ddef7081786ed746de47f6c50c5a8da6f5d68905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 11 Oct 2021 22:25:41 +0200 Subject: [PATCH 1/8] Basic inline codegen --- build/params_shared_vals.go | 8 ++++ gen/inline-gen/main.go | 95 +++++++++++++++++++++++++++++++++++++ gen/inlinegen-data.json | 7 +++ 3 files changed, 110 insertions(+) create mode 100644 gen/inline-gen/main.go create mode 100644 gen/inlinegen-data.json diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index 22d1c30e302..f15cbc35cf8 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -28,8 +28,16 @@ const UnixfsLinksPerLevel = 1024 const AllowableClockDriftSecs = uint64(1) // TODO: This is still terrible...What's the impact of updating this before mainnet actually upgrades +/* inline-gen template + +const NewestNetworkVersion = network.Version{{.latestNetworkVersion}} + +inline-gen start */ + const NewestNetworkVersion = network.Version14 +//inline-gen end + // Epochs const ForkLengthThreshold = Finality diff --git a/gen/inline-gen/main.go b/gen/inline-gen/main.go new file mode 100644 index 00000000000..4e669099fd6 --- /dev/null +++ b/gen/inline-gen/main.go @@ -0,0 +1,95 @@ +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "io/fs" + "io/ioutil" + "os" + "path/filepath" + "strings" + "text/template" +) + +const ( + stateGlobal = iota + stateTemplate + stateGen +) + +func main() { + db, err := ioutil.ReadFile(os.Args[2]) + if err != nil { + panic(err) + } + var data map[string]interface{} + if err := json.Unmarshal(db, &data); err != nil { + panic(err) + } + + err = filepath.WalkDir(os.Args[1], func(path string, d fs.DirEntry, err error) error { + if d.IsDir() { + return nil + } + if filepath.Ext(path) != ".go" { + return nil + } + fb, err := ioutil.ReadFile(path) + if err != nil { + return err + } + + lines := strings.Split(string(fb), "\n") + + outLines := make([]string, 0, len(lines)) + var templateLines []string + + state := stateGlobal + + for i, line := range lines { + ln := i+1 + switch state { + case stateGlobal: + outLines = append(outLines, line) + if line == `/* inline-gen template` { + state = stateTemplate + fmt.Printf("template section start %s:%d\n", path, ln) + } + case stateTemplate: + outLines = append(outLines, line) // output all template lines + + if line == `inline-gen start */` { + state = stateGen + fmt.Printf("generated section start %s:%d\n", path, ln) + continue + } + templateLines = append(templateLines, line) + case stateGen: + if line != `//inline-gen end` { + continue + } + state = stateGlobal + fmt.Printf("inline gen:\n") + fmt.Println(strings.Join(templateLines, "\n")) + + tpl, err := template.New("").Parse(strings.Join(templateLines, "\n")) + if err != nil { + fmt.Printf("%s:%d: parsing template: %s\n", path, ln, err) + os.Exit(1) + } + var b bytes.Buffer + err = tpl.Execute(&b, data) + + outLines = append(outLines, strings.Split(b.String(), "\n")...) + fmt.Println("inline gen-ed:\n", b.String()) + + outLines = append(outLines, line) + } + } + return nil + }) + if err != nil { + panic(err) + } +} diff --git a/gen/inlinegen-data.json b/gen/inlinegen-data.json new file mode 100644 index 00000000000..1c8a4ecd8db --- /dev/null +++ b/gen/inlinegen-data.json @@ -0,0 +1,7 @@ +{ + "actorVersions": [0, 2, 3, 4, 5, 6], + "latestActorsVersion": 6, + + "networkVersions": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], + "latestNetworkVersion": 14 +} \ No newline at end of file From 5616dfb1bc50adcba69ee6618e77d2022dc64a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 11 Oct 2021 22:56:29 +0200 Subject: [PATCH 2/8] Some more inline codegen --- chain/consensus/filcns/compute_state.go | 15 +++++++ chain/vm/mkactor.go | 15 +++++++ .../misc/actors_version_checklist.md | 2 - gen/inline-gen/main.go | 40 ++++++++++++++----- gen/inlinegen-data.json | 2 +- 5 files changed, 62 insertions(+), 12 deletions(-) diff --git a/chain/consensus/filcns/compute_state.go b/chain/consensus/filcns/compute_state.go index 927562840d4..6089f227c2f 100644 --- a/chain/consensus/filcns/compute_state.go +++ b/chain/consensus/filcns/compute_state.go @@ -16,6 +16,12 @@ import ( "github.com/filecoin-project/go-state-types/big" blockadt "github.com/filecoin-project/specs-actors/actors/util/adt" + /* inline-gen template + {{range .actorVersions}} + exported{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin/exported"{{end}} + + inline-gen start */ + exported0 "github.com/filecoin-project/specs-actors/actors/builtin/exported" exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported" exported3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/exported" @@ -23,6 +29,8 @@ import ( exported5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/exported" exported6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/exported" + //inline-gen end + "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -39,6 +47,11 @@ func NewActorRegistry() *vm.ActorRegistry { inv := vm.NewActorRegistry() // TODO: define all these properties on the actors themselves, in specs-actors. + /* inline-gen template + {{range .actorVersions}} + inv.Register(vm.ActorsVersionPredicate(actors.Version{{.}}), exported{{.}}.BuiltinActors()...){{end}} + + inline-gen start */ inv.Register(vm.ActorsVersionPredicate(actors.Version0), exported0.BuiltinActors()...) inv.Register(vm.ActorsVersionPredicate(actors.Version2), exported2.BuiltinActors()...) @@ -47,6 +60,8 @@ func NewActorRegistry() *vm.ActorRegistry { inv.Register(vm.ActorsVersionPredicate(actors.Version5), exported5.BuiltinActors()...) inv.Register(vm.ActorsVersionPredicate(actors.Version6), exported6.BuiltinActors()...) + //inline-gen end + return inv } diff --git a/chain/vm/mkactor.go b/chain/vm/mkactor.go index b75f290dccf..19702aa9ce7 100644 --- a/chain/vm/mkactor.go +++ b/chain/vm/mkactor.go @@ -14,6 +14,12 @@ import ( "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" + /* inline-gen template + {{range .actorVersions}} + builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"{{end}} + + inline-gen start */ + builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -21,6 +27,8 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + //inline-gen end + "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/actors/aerrors" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -104,6 +112,12 @@ func newAccountActor(ver actors.Version) *types.Actor { // TODO: ActorsUpgrade use a global actor registry? var code cid.Cid switch ver { + /* inline-gen template + {{range .actorVersions}} + case actors.Version{{.}}: + code = builtin{{.}}.AccountActorCodeID{{end}} + inline-gen start */ + case actors.Version0: code = builtin0.AccountActorCodeID case actors.Version2: @@ -116,6 +130,7 @@ func newAccountActor(ver actors.Version) *types.Actor { code = builtin5.AccountActorCodeID case actors.Version6: code = builtin6.AccountActorCodeID + //inline-gen end default: panic("unsupported actors version") } diff --git a/documentation/misc/actors_version_checklist.md b/documentation/misc/actors_version_checklist.md index 1fae4bd8aa5..92df0fa607b 100644 --- a/documentation/misc/actors_version_checklist.md +++ b/documentation/misc/actors_version_checklist.md @@ -8,12 +8,10 @@ - [ ] Update `chain/actors/policy/policy.go` - [ ] Update `chain/actors/version.go` - [ ] Register in `chain/vm/invoker.go` -- [ ] Register in `chain/vm/mkactor.go` - [ ] Update `chain/types/state.go` - [ ] Update `chain/state/statetree.go` (New / Load) - [ ] Update `chain/stmgr/forks.go` - [ ] Schedule - [ ] Migration - [ ] Update upgrade schedule in `api/test/test.go` and `chain/sync_test.go` -- [ ] Update `NewestNetworkVersion` in `build/params_shared_vals.go` - [ ] Register in init in `chain/stmgr/utils.go` diff --git a/gen/inline-gen/main.go b/gen/inline-gen/main.go index 4e669099fd6..7fee4325335 100644 --- a/gen/inline-gen/main.go +++ b/gen/inline-gen/main.go @@ -47,46 +47,68 @@ func main() { state := stateGlobal + rewrite := false + for i, line := range lines { - ln := i+1 + ln := i + 1 switch state { case stateGlobal: outLines = append(outLines, line) - if line == `/* inline-gen template` { + if strings.TrimSpace(line) == `/* inline-gen template` { state = stateTemplate fmt.Printf("template section start %s:%d\n", path, ln) } case stateTemplate: outLines = append(outLines, line) // output all template lines - if line == `inline-gen start */` { + if strings.TrimSpace(line) == `inline-gen start */` { state = stateGen fmt.Printf("generated section start %s:%d\n", path, ln) continue } templateLines = append(templateLines, line) case stateGen: - if line != `//inline-gen end` { + if strings.TrimSpace(line) != `//inline-gen end` { continue } + fmt.Printf("generated section end %s:%d\n", path, ln) + state = stateGlobal - fmt.Printf("inline gen:\n") - fmt.Println(strings.Join(templateLines, "\n")) + rewrite = true - tpl, err := template.New("").Parse(strings.Join(templateLines, "\n")) + tpl, err := template.New("").Funcs(template.FuncMap{ + "import": func(v float64) string { + if v == 0 { + return "/" + } + return fmt.Sprintf("/v%d/", int(v)) + }, + }).Parse(strings.Join(templateLines, "\n")) if err != nil { fmt.Printf("%s:%d: parsing template: %s\n", path, ln, err) os.Exit(1) } + var b bytes.Buffer err = tpl.Execute(&b, data) + if err != nil { + fmt.Printf("%s:%d: executing template: %s\n", path, ln, err) + os.Exit(1) + } outLines = append(outLines, strings.Split(b.String(), "\n")...) - fmt.Println("inline gen-ed:\n", b.String()) - outLines = append(outLines, line) + templateLines = nil } } + + if rewrite { + fmt.Printf("write %s\n", path) + if err := ioutil.WriteFile(path, []byte(strings.Join(outLines, "\n")), 0664); err != nil { + return err + } + } + return nil }) if err != nil { diff --git a/gen/inlinegen-data.json b/gen/inlinegen-data.json index 1c8a4ecd8db..e26b1b28f7d 100644 --- a/gen/inlinegen-data.json +++ b/gen/inlinegen-data.json @@ -4,4 +4,4 @@ "networkVersions": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "latestNetworkVersion": 14 -} \ No newline at end of file +} From 9606dce425cf9bd357c1afb57fb9fbdd5fafe163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 18 Oct 2021 17:17:54 +0200 Subject: [PATCH 3/8] Add inline-gen to itests --- documentation/misc/actors_version_checklist.md | 2 +- gen/inline-gen/main.go | 3 +++ itests/kit/ensemble_opts_nv.go | 17 ++++++++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/documentation/misc/actors_version_checklist.md b/documentation/misc/actors_version_checklist.md index 92df0fa607b..7a929a792b4 100644 --- a/documentation/misc/actors_version_checklist.md +++ b/documentation/misc/actors_version_checklist.md @@ -13,5 +13,5 @@ - [ ] Update `chain/stmgr/forks.go` - [ ] Schedule - [ ] Migration -- [ ] Update upgrade schedule in `api/test/test.go` and `chain/sync_test.go` +- [ ] Update upgrade schedule in `chain/sync_test.go` - [ ] Register in init in `chain/stmgr/utils.go` diff --git a/gen/inline-gen/main.go b/gen/inline-gen/main.go index 7fee4325335..0084bc2f95b 100644 --- a/gen/inline-gen/main.go +++ b/gen/inline-gen/main.go @@ -83,6 +83,9 @@ func main() { } return fmt.Sprintf("/v%d/", int(v)) }, + "add": func(a, b float64) float64 { + return a + b + }, }).Parse(strings.Join(templateLines, "\n")) if err != nil { fmt.Printf("%s:%d: parsing template: %s\n", path, ln, err) diff --git a/itests/kit/ensemble_opts_nv.go b/itests/kit/ensemble_opts_nv.go index a03e63f4abd..7cdf082ee7a 100644 --- a/itests/kit/ensemble_opts_nv.go +++ b/itests/kit/ensemble_opts_nv.go @@ -38,14 +38,25 @@ func SDRUpgradeAt(calico, persian abi.ChainEpoch) EnsembleOpt { } func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt { + /* inline-gen template + return UpgradeSchedule(stmgr.Upgrade{ + Network: network.Version{{add .latestNetworkVersion -1}}, + Height: -1, + }, stmgr.Upgrade{ + Network: network.Version{{.latestNetworkVersion}}, + Height: upgradeHeight, + Migration: filcns.UpgradeActorsV{{.latestActorsVersion}}, + }) + inline-gen start */ return UpgradeSchedule(stmgr.Upgrade{ - Network: network.Version12, + Network: network.Version13, Height: -1, }, stmgr.Upgrade{ - Network: network.Version13, + Network: network.Version14, Height: upgradeHeight, - Migration: filcns.UpgradeActorsV5, + Migration: filcns.UpgradeActorsV6, }) + //inline-gen end } func TurboUpgradeAt(upgradeHeight abi.ChainEpoch) EnsembleOpt { From 19f52b4541da717e82db0273c5b137c5bd64a545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 18 Oct 2021 17:21:53 +0200 Subject: [PATCH 4/8] inline-gen: Slightly nicer comment format --- build/params_shared_vals.go | 4 ++-- chain/consensus/filcns/compute_state.go | 8 ++++---- chain/vm/mkactor.go | 8 ++++---- gen/inline-gen/main.go | 4 ++-- itests/kit/ensemble_opts_nv.go | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index f15cbc35cf8..0a242f6f211 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -32,11 +32,11 @@ const AllowableClockDriftSecs = uint64(1) const NewestNetworkVersion = network.Version{{.latestNetworkVersion}} -inline-gen start */ +/* inline-gen start */ const NewestNetworkVersion = network.Version14 -//inline-gen end +/* inline-gen end */ // Epochs const ForkLengthThreshold = Finality diff --git a/chain/consensus/filcns/compute_state.go b/chain/consensus/filcns/compute_state.go index 6089f227c2f..3c333298ef9 100644 --- a/chain/consensus/filcns/compute_state.go +++ b/chain/consensus/filcns/compute_state.go @@ -20,7 +20,7 @@ import ( {{range .actorVersions}} exported{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin/exported"{{end}} - inline-gen start */ + /* inline-gen start */ exported0 "github.com/filecoin-project/specs-actors/actors/builtin/exported" exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported" @@ -29,7 +29,7 @@ import ( exported5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/exported" exported6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/exported" - //inline-gen end + /* inline-gen end */ "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" @@ -51,7 +51,7 @@ func NewActorRegistry() *vm.ActorRegistry { {{range .actorVersions}} inv.Register(vm.ActorsVersionPredicate(actors.Version{{.}}), exported{{.}}.BuiltinActors()...){{end}} - inline-gen start */ + /* inline-gen start */ inv.Register(vm.ActorsVersionPredicate(actors.Version0), exported0.BuiltinActors()...) inv.Register(vm.ActorsVersionPredicate(actors.Version2), exported2.BuiltinActors()...) @@ -60,7 +60,7 @@ func NewActorRegistry() *vm.ActorRegistry { inv.Register(vm.ActorsVersionPredicate(actors.Version5), exported5.BuiltinActors()...) inv.Register(vm.ActorsVersionPredicate(actors.Version6), exported6.BuiltinActors()...) - //inline-gen end + /* inline-gen end */ return inv } diff --git a/chain/vm/mkactor.go b/chain/vm/mkactor.go index 19702aa9ce7..b0d6b454d56 100644 --- a/chain/vm/mkactor.go +++ b/chain/vm/mkactor.go @@ -18,7 +18,7 @@ import ( {{range .actorVersions}} builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"{{end}} - inline-gen start */ + /* inline-gen start */ builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -27,7 +27,7 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" - //inline-gen end + /* inline-gen end */ "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/actors/aerrors" @@ -116,7 +116,7 @@ func newAccountActor(ver actors.Version) *types.Actor { {{range .actorVersions}} case actors.Version{{.}}: code = builtin{{.}}.AccountActorCodeID{{end}} - inline-gen start */ + /* inline-gen start */ case actors.Version0: code = builtin0.AccountActorCodeID @@ -130,7 +130,7 @@ func newAccountActor(ver actors.Version) *types.Actor { code = builtin5.AccountActorCodeID case actors.Version6: code = builtin6.AccountActorCodeID - //inline-gen end + /* inline-gen end */ default: panic("unsupported actors version") } diff --git a/gen/inline-gen/main.go b/gen/inline-gen/main.go index 0084bc2f95b..2f87afd799b 100644 --- a/gen/inline-gen/main.go +++ b/gen/inline-gen/main.go @@ -61,14 +61,14 @@ func main() { case stateTemplate: outLines = append(outLines, line) // output all template lines - if strings.TrimSpace(line) == `inline-gen start */` { + if strings.TrimSpace(line) == `/* inline-gen start */` { state = stateGen fmt.Printf("generated section start %s:%d\n", path, ln) continue } templateLines = append(templateLines, line) case stateGen: - if strings.TrimSpace(line) != `//inline-gen end` { + if strings.TrimSpace(line) != `/* inline-gen end */` { continue } fmt.Printf("generated section end %s:%d\n", path, ln) diff --git a/itests/kit/ensemble_opts_nv.go b/itests/kit/ensemble_opts_nv.go index 7cdf082ee7a..0d7d87e6aa5 100644 --- a/itests/kit/ensemble_opts_nv.go +++ b/itests/kit/ensemble_opts_nv.go @@ -47,7 +47,7 @@ func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt { Height: upgradeHeight, Migration: filcns.UpgradeActorsV{{.latestActorsVersion}}, }) - inline-gen start */ + /* inline-gen start */ return UpgradeSchedule(stmgr.Upgrade{ Network: network.Version13, Height: -1, @@ -56,7 +56,7 @@ func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt { Height: upgradeHeight, Migration: filcns.UpgradeActorsV6, }) - //inline-gen end + /* inline-gen end */ } func TurboUpgradeAt(upgradeHeight abi.ChainEpoch) EnsembleOpt { From e493d9e2e362864ada3fb6cb284a946bcccaf886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 18 Oct 2021 17:33:28 +0200 Subject: [PATCH 5/8] make: Run inline-gen --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 587c3c61c3d..f7b13cc188c 100644 --- a/Makefile +++ b/Makefile @@ -291,6 +291,7 @@ method-gen: api-gen (cd ./lotuspond/front/src/chain && $(GOCC) run ./methodgen.go) actors-gen: + $(GOCC) run ./gen/inline-gen . gen/inlinegen-data.json $(GOCC) run ./chain/actors/agen $(GOCC) fmt ./... From 463f55ba13617504217eff468cdf6412628cbd41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 18 Oct 2021 17:46:50 +0200 Subject: [PATCH 6/8] Use more inline-gen --- chain/actors/version.go | 16 +++++++++++++++- chain/state/statetree.go | 9 +++++++++ documentation/misc/actors_version_checklist.md | 12 ++++-------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/chain/actors/version.go b/chain/actors/version.go index 95dd0912681..e42c563c1c4 100644 --- a/chain/actors/version.go +++ b/chain/actors/version.go @@ -8,9 +8,21 @@ import ( type Version int +/* inline-gen template + +var LatestVersion = 6 + +var Versions = []int{ {{range .actorVersions}} {{.}}, {{end}} } + +const ({{range .actorVersions}} + Version{{.}} Version = {{.}}{{end}} +) + +/* inline-gen start */ + var LatestVersion = 6 -var Versions = []int{0, 2, 3, 4, 5, LatestVersion} +var Versions = []int{0, 2, 3, 4, 5, 6} const ( Version0 Version = 0 @@ -21,6 +33,8 @@ const ( Version6 Version = 6 ) +/* inline-gen end */ + // Converts a network version into an actors adt version. func VersionForNetwork(version network.Version) (Version, error) { switch version { diff --git a/chain/state/statetree.go b/chain/state/statetree.go index b4323c04b3f..f230f7faa54 100644 --- a/chain/state/statetree.go +++ b/chain/state/statetree.go @@ -152,7 +152,16 @@ func VersionForNetwork(ver network.Version) (types.StateTreeVersion, error) { return types.StateTreeVersion2, nil case network.Version12: return types.StateTreeVersion3, nil + + /* inline-gen template + {{$lastNv := .latestNetworkVersion}} + case{{range .networkVersions}} {{if (ge . 13.)}} network.Version{{.}}{{if (lt . $lastNv)}},{{end}}{{end}}{{end}}: + + /* inline-gen start */ + case network.Version13, network.Version14: + + /* inline-gen end */ return types.StateTreeVersion4, nil default: panic(fmt.Sprintf("unsupported network version %d", ver)) diff --git a/documentation/misc/actors_version_checklist.md b/documentation/misc/actors_version_checklist.md index 7a929a792b4..be7e2bd92fd 100644 --- a/documentation/misc/actors_version_checklist.md +++ b/documentation/misc/actors_version_checklist.md @@ -3,15 +3,11 @@ - [ ] Import new actors - [ ] Define upgrade heights in `build/params_` - [ ] Generate adapters - - [ ] Add the new version in `chain/actors/agen/main.go` + - [ ] Update `gen/inlinegen-data.json` + - [ ] Update adapter code in `chain/actors/version.go` if needed - [ ] Update adapter code in `chain/actors/builtin` if needed -- [ ] Update `chain/actors/policy/policy.go` -- [ ] Update `chain/actors/version.go` -- [ ] Register in `chain/vm/invoker.go` -- [ ] Update `chain/types/state.go` -- [ ] Update `chain/state/statetree.go` (New / Load) -- [ ] Update `chain/stmgr/forks.go` + - [ ] Run `make actors-gen` +- [ ] Update `chain/consensus/filcns/upgrades.go` - [ ] Schedule - [ ] Migration - [ ] Update upgrade schedule in `chain/sync_test.go` -- [ ] Register in init in `chain/stmgr/utils.go` From 3943c3ae6feeb254c74a4d1147ce8ed85220d21b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 18 Oct 2021 17:50:31 +0200 Subject: [PATCH 7/8] inline-gen: Fix lint --- documentation/misc/actors_version_checklist.md | 2 +- gen/inline-gen/main.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/documentation/misc/actors_version_checklist.md b/documentation/misc/actors_version_checklist.md index be7e2bd92fd..5e6038c2b02 100644 --- a/documentation/misc/actors_version_checklist.md +++ b/documentation/misc/actors_version_checklist.md @@ -4,7 +4,7 @@ - [ ] Define upgrade heights in `build/params_` - [ ] Generate adapters - [ ] Update `gen/inlinegen-data.json` - - [ ] Update adapter code in `chain/actors/version.go` if needed + - [ ] Update `chain/actors/version.go` - [ ] Update adapter code in `chain/actors/builtin` if needed - [ ] Run `make actors-gen` - [ ] Update `chain/consensus/filcns/upgrades.go` diff --git a/gen/inline-gen/main.go b/gen/inline-gen/main.go index 2f87afd799b..d97134cdd32 100644 --- a/gen/inline-gen/main.go +++ b/gen/inline-gen/main.go @@ -29,6 +29,9 @@ func main() { } err = filepath.WalkDir(os.Args[1], func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } if d.IsDir() { return nil } From 1d8a9c75d459ecf4c11787e3327869a3a570f8ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 19 Oct 2021 11:05:14 +0200 Subject: [PATCH 8/8] Use .latestActorsVersion in actors/version.go --- chain/actors/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chain/actors/version.go b/chain/actors/version.go index e42c563c1c4..7b7a6393a44 100644 --- a/chain/actors/version.go +++ b/chain/actors/version.go @@ -10,7 +10,7 @@ type Version int /* inline-gen template -var LatestVersion = 6 +var LatestVersion = {{.latestActorsVersion}} var Versions = []int{ {{range .actorVersions}} {{.}}, {{end}} }