diff --git a/Makefile b/Makefile index aa7575698a8..98f9d2f2c35 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,9 @@ debug: lotus lotus-miner lotus-worker lotus-seed 2k: GOFLAGS+=-tags=2k 2k: lotus lotus-miner lotus-worker lotus-seed +calibnet: GOFLAGS+=-tags=calibnet +calibnet: lotus lotus-miner lotus-worker lotus-seed + lotus: $(BUILD_DEPS) rm -f lotus go build $(GOFLAGS) -o lotus ./cmd/lotus diff --git a/build/bootstrap.go b/build/bootstrap.go index 80c1529ff6c..98a3f5b0a22 100644 --- a/build/bootstrap.go +++ b/build/bootstrap.go @@ -2,11 +2,9 @@ package build import ( "context" - "os" "strings" "github.com/filecoin-project/lotus/lib/addrutil" - "golang.org/x/xerrors" rice "github.com/GeertJohan/go.rice" "github.com/libp2p/go-libp2p-core/peer" @@ -17,24 +15,12 @@ func BuiltinBootstrap() ([]peer.AddrInfo, error) { return nil, nil } - var out []peer.AddrInfo - b := rice.MustFindBox("bootstrap") - err := b.Walk("", func(path string, info os.FileInfo, err error) error { - if err != nil { - return xerrors.Errorf("failed to walk box: %w", err) - } - if !strings.HasSuffix(path, ".pi") { - return nil - } - spi := b.MustString(path) - if spi == "" { - return nil - } - pi, err := addrutil.ParseAddresses(context.TODO(), strings.Split(strings.TrimSpace(spi), "\n")) - out = append(out, pi...) - return err - }) - return out, err + spi := b.MustString(BootstrappersFile) + if spi == "" { + return nil, nil + } + + return addrutil.ParseAddresses(context.TODO(), strings.Split(strings.TrimSpace(spi), "\n")) } diff --git a/build/bootstrap/calibnet.pi b/build/bootstrap/calibnet.pi new file mode 100644 index 00000000000..cb3a2efbd1e --- /dev/null +++ b/build/bootstrap/calibnet.pi @@ -0,0 +1,4 @@ +/dns4/bootstrap-0.calibration.fildev.network/tcp/1347/p2p/12D3KooWK1QYsm6iqyhgH7vqsbeoNoKHbT368h1JLHS1qYN36oyc +/dns4/bootstrap-1.calibration.fildev.network/tcp/1347/p2p/12D3KooWKDyJZoPsNak1iYNN1GGmvGnvhyVbWBL6iusYfP3RpgYs +/dns4/bootstrap-2.calibration.fildev.network/tcp/1347/p2p/12D3KooWJRSTnzABB6MYYEBbSTT52phQntVD1PpRTMh1xt9mh6yH +/dns4/bootstrap-3.calibration.fildev.network/tcp/1347/p2p/12D3KooWQLi3kY6HnMYLUtwCe26zWMdNhniFgHVNn1DioQc7NiWv diff --git a/build/bootstrap/bootstrappers.pi b/build/bootstrap/mainnet.pi similarity index 100% rename from build/bootstrap/bootstrappers.pi rename to build/bootstrap/mainnet.pi diff --git a/build/genesis.go b/build/genesis.go index dc4ded27365..812f5a9df67 100644 --- a/build/genesis.go +++ b/build/genesis.go @@ -14,7 +14,7 @@ func MaybeGenesis() []byte { log.Warnf("loading built-in genesis: %s", err) return nil } - genBytes, err := builtinGen.Bytes("devnet.car") + genBytes, err := builtinGen.Bytes(GenesisFile) if err != nil { log.Warnf("loading built-in genesis: %s", err) } diff --git a/build/genesis/calibnet.car b/build/genesis/calibnet.car new file mode 100644 index 00000000000..f8af3987840 Binary files /dev/null and b/build/genesis/calibnet.car differ diff --git a/build/genesis/devnet.car b/build/genesis/mainnet.car similarity index 100% rename from build/genesis/devnet.car rename to build/genesis/mainnet.car diff --git a/build/params_2k.go b/build/params_2k.go index 11267db6f27..ecac8698339 100644 --- a/build/params_2k.go +++ b/build/params_2k.go @@ -7,6 +7,9 @@ import ( "github.com/filecoin-project/lotus/chain/actors/policy" ) +const BootstrappersFile = "" +const GenesisFile = "" + const UpgradeBreezeHeight = -1 const BreezeGasTampingDuration = 0 diff --git a/build/params_calibnet.go b/build/params_calibnet.go new file mode 100644 index 00000000000..28667cfd2c4 --- /dev/null +++ b/build/params_calibnet.go @@ -0,0 +1,64 @@ +// +build calibnet + +package build + +import ( + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/lotus/chain/actors/policy" + builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" +) + +var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ + 0: DrandMainnet, +} + +const BootstrappersFile = "calibnet.pi" +const GenesisFile = "calibnet.car" + +const UpgradeBreezeHeight = -1 +const BreezeGasTampingDuration = 120 + +const UpgradeSmokeHeight = -2 + +const UpgradeIgnitionHeight = -3 +const UpgradeRefuelHeight = -4 + +var UpgradeActorsV2Height = abi.ChainEpoch(30) + +const UpgradeTapeHeight = 60 + +// This signals our tentative epoch for mainnet launch. Can make it later, but not earlier. +// Miners, clients, developers, custodians all need time to prepare. +// We still have upgrades and state changes to do, but can happen after signaling timing here. +const UpgradeLiftoffHeight = -5 + +const UpgradeKumquatHeight = 90 + +const UpgradeCalicoHeight = 92000 +const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 60) + +// 2020-12-17T19:00:00Z +const UpgradeClausHeight = 161386 + +const UpgradeOrangeHeight = 9999999 + +func init() { + policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 30)) + policy.SetSupportedProofTypes( + abi.RegisteredSealProof_StackedDrg512MiBV1, + abi.RegisteredSealProof_StackedDrg32GiBV1, + abi.RegisteredSealProof_StackedDrg64GiBV1, + ) + + SetAddressNetwork(address.Testnet) + + Devnet = true +} + +const BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) + +const PropagationDelaySecs = uint64(6) + +// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start +const BootstrapPeerThreshold = 4 diff --git a/build/params_mainnet.go b/build/params_mainnet.go index 5f23b9b1efe..a4c3ab04ff3 100644 --- a/build/params_mainnet.go +++ b/build/params_mainnet.go @@ -1,6 +1,7 @@ // +build !debug // +build !2k // +build !testground +// +build !calibnet package build @@ -18,7 +19,11 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ UpgradeSmokeHeight: DrandMainnet, } +const BootstrappersFile = "mainnet.pi" +const GenesisFile = "mainnet.car" + const UpgradeBreezeHeight = 41280 + const BreezeGasTampingDuration = 120 const UpgradeSmokeHeight = 51000 diff --git a/build/params_testground.go b/build/params_testground.go index d0e54e3f254..e78545ba840 100644 --- a/build/params_testground.go +++ b/build/params_testground.go @@ -102,6 +102,9 @@ var ( Devnet = true ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a") + + BootstrappersFile = "" + GenesisFile = "" ) const BootstrapPeerThreshold = 1