From 496799f8673259e5c16461d5e716b9d2d39b9cb1 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 24 May 2022 09:33:57 -0700 Subject: [PATCH] build: set NetworkBundle in params file Otherwise, we end up overriding the ldflags. fixes #8684 --- Makefile | 5 ----- build/bundle.go | 17 ----------------- build/params_2k.go | 1 + build/params_butterfly.go | 1 + build/params_calibnet.go | 1 + build/params_interop.go | 1 + build/params_mainnet.go | 1 + build/params_testground.go | 1 + node/bundle/manifest.go | 2 +- node/modules/builtin_actors.go | 2 +- 10 files changed, 8 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index dcd2d281e..ae81a8a2c 100644 --- a/Makefile +++ b/Makefile @@ -68,23 +68,18 @@ build-devnets: build lotus-seed lotus-shed lotus-wallet lotus-gateway lotus-foun .PHONY: build-devnets debug: GOFLAGS+=-tags=debug -debug: GOFLAGS+=-ldflags=-X=github.com/filecoin-project/lotus/build.NetworkBundle=devnet debug: build-devnets 2k: GOFLAGS+=-tags=2k -2k: GOFLAGS+=-ldflags=-X=github.com/filecoin-project/lotus/build.NetworkBundle=devnet 2k: build-devnets calibnet: GOFLAGS+=-tags=calibnet -calibnet: GOFLAGS+=-ldflags=-X=github.com/filecoin-project/lotus/build.NetworkBundle=calibnet calibnet: build-devnets butterflynet: GOFLAGS+=-tags=butterflynet -butterflynet: GOFLAGS+=-ldflags=-X=github.com/filecoin-project/lotus/build.NetworkBundle=butterflynet butterflynet: build-devnets interopnet: GOFLAGS+=-tags=interopnet -interopnet: GOFLAGS+=-ldflags=-X=github.com/filecoin-project/lotus/build.NetworkBundle=interopnet interopnet: build-devnets lotus: $(BUILD_DEPS) diff --git a/build/bundle.go b/build/bundle.go index dc2faff24..9f685a3c1 100644 --- a/build/bundle.go +++ b/build/bundle.go @@ -6,23 +6,6 @@ import ( "github.com/filecoin-project/lotus/chain/actors" ) -var NetworkBundle string - -func GetNetworkBundle() string { - switch NetworkBundle { - case "devnet": - return "devnet" - case "calibnet", "calibrationnet": - return "calibrationnet" - case "butterflynet": - return "butterflynet" - case "interopnet", "caterpillarnet": - return "caterpillarnet" - default: - return "mainnet" - } -} - //go:embed bundles.toml var BuiltinActorBundles []byte diff --git a/build/params_2k.go b/build/params_2k.go index 19d70282b..9a59ab4db 100644 --- a/build/params_2k.go +++ b/build/params_2k.go @@ -16,6 +16,7 @@ import ( const BootstrappersFile = "" const GenesisFile = "" +const NetworkBundle = "devnet" const GenesisNetworkVersion = network.Version15 diff --git a/build/params_butterfly.go b/build/params_butterfly.go index 2fe758e72..3cc508004 100644 --- a/build/params_butterfly.go +++ b/build/params_butterfly.go @@ -18,6 +18,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ const GenesisNetworkVersion = network.Version14 +const NetworkBundle = "butterflynet" const BootstrappersFile = "butterflynet.pi" const GenesisFile = "butterflynet.car" diff --git a/build/params_calibnet.go b/build/params_calibnet.go index 462e03de1..7d21a9626 100644 --- a/build/params_calibnet.go +++ b/build/params_calibnet.go @@ -18,6 +18,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ const GenesisNetworkVersion = network.Version0 +const NetworkBundle = "calibrationnet" const BootstrappersFile = "calibnet.pi" const GenesisFile = "calibnet.car" diff --git a/build/params_interop.go b/build/params_interop.go index ace11e33d..a120683e2 100644 --- a/build/params_interop.go +++ b/build/params_interop.go @@ -15,6 +15,7 @@ import ( "github.com/ipfs/go-cid" ) +const NetworkBundle = "caterpillarnet" const BootstrappersFile = "interopnet.pi" const GenesisFile = "interopnet.car" diff --git a/build/params_mainnet.go b/build/params_mainnet.go index 80051e0d1..8fcdd6bc9 100644 --- a/build/params_mainnet.go +++ b/build/params_mainnet.go @@ -19,6 +19,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ UpgradeSmokeHeight: DrandMainnet, } +const NetworkBundle = "mainnet" const GenesisNetworkVersion = network.Version0 const BootstrappersFile = "mainnet.pi" diff --git a/build/params_testground.go b/build/params_testground.go index 6718053e6..d10063bd2 100644 --- a/build/params_testground.go +++ b/build/params_testground.go @@ -107,6 +107,7 @@ var ( } GenesisNetworkVersion = network.Version0 + NetworkBundle = "devnet" NewestNetworkVersion = network.Version15 ActorUpgradeNetworkVersion = network.Version15 diff --git a/node/bundle/manifest.go b/node/bundle/manifest.go index d726b0260..2693ceab0 100644 --- a/node/bundle/manifest.go +++ b/node/bundle/manifest.go @@ -72,7 +72,7 @@ func LoadBundle(ctx context.Context, bs blockstore.Blockstore, path string, av a // utility for blanket loading outside DI func FetchAndLoadBundles(ctx context.Context, bs blockstore.Blockstore, bar map[actors.Version]build.Bundle) error { - netw := build.GetNetworkBundle() + netw := build.NetworkBundle path := os.Getenv("LOTUS_PATH") if path == "" { diff --git a/node/modules/builtin_actors.go b/node/modules/builtin_actors.go index 4384bb3f3..2e451fafe 100644 --- a/node/modules/builtin_actors.go +++ b/node/modules/builtin_actors.go @@ -25,7 +25,7 @@ func LoadBuiltinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.LockedRe // We can't put it as a dep in inputs causes a stack overflow in DI from circular dependency // So we pass it through ldflags instead - netw := build.GetNetworkBundle() + netw := build.NetworkBundle for av, bd := range build.BuiltinActorReleases { // first check to see if we know this release