Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[skip changelog] chore: types: buildconstants split post-cleanup #12246

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/filecoin-project/lotus/api"
apitypes "github.com/filecoin-project/lotus/api/types"
"github.com/filecoin-project/lotus/api/v0api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/build/buildconstants"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/types/ethtypes"
Expand Down Expand Up @@ -123,7 +123,7 @@ func init() {
addExample(time.Minute)

addExample(network.ReachabilityPublic)
addExample(build.TestNetworkVersion)
addExample(buildconstants.TestNetworkVersion)
allocationId := verifreg.AllocationId(0)
addExample(allocationId)
addExample(&allocationId)
Expand Down
4 changes: 2 additions & 2 deletions blockstore/splitstore/splitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"

bstore "github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/stmgr"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/metrics"
Expand Down Expand Up @@ -59,7 +59,7 @@ var (
enableDebugLogWriteTraces = false

// upgradeBoundary is the boundary before and after an upgrade where we suppress compaction
upgradeBoundary = build.Finality
upgradeBoundary = policy.ChainFinality
)

type CompactType int
Expand Down
8 changes: 4 additions & 4 deletions blockstore/splitstore/splitstore_compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/filecoin-project/go-state-types/abi"

"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/metrics"
)
Expand All @@ -39,11 +39,11 @@ var (
// === :: cold (already archived)
// ≡≡≡ :: to be archived in this compaction
// --- :: hot
CompactionThreshold = 5 * build.Finality
CompactionThreshold = 5 * policy.ChainFinality

// CompactionBoundary is the number of epochs from the current epoch at which
// we will walk the chain for live objects.
CompactionBoundary = 4 * build.Finality
CompactionBoundary = 4 * policy.ChainFinality

// SyncGapTime is the time delay from a tipset's min timestamp before we decide
// there is a sync gap
Expand Down Expand Up @@ -551,7 +551,7 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
boundaryEpoch := currentEpoch - CompactionBoundary

var inclMsgsEpoch abi.ChainEpoch
inclMsgsRange := abi.ChainEpoch(s.cfg.HotStoreMessageRetention) * build.Finality
inclMsgsRange := abi.ChainEpoch(s.cfg.HotStoreMessageRetention) * policy.ChainFinality
if inclMsgsRange < boundaryEpoch {
inclMsgsEpoch = boundaryEpoch - inclMsgsRange
}
Expand Down
6 changes: 3 additions & 3 deletions blockstore/splitstore/splitstore_prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/filecoin-project/lotus/api"
bstore "github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/metrics"
)
Expand Down Expand Up @@ -44,7 +44,7 @@ var (

// PruneThreshold is the number of epochs that need to have elapsed
// from the previously pruned epoch to trigger a new prune
PruneThreshold = 7 * build.Finality
PruneThreshold = 7 * policy.ChainFinality
)

// GCHotStore runs online GC on the chain state in the hotstore according the to options specified
Expand Down Expand Up @@ -79,7 +79,7 @@ func (s *SplitStore) PruneChain(opts api.PruneOpts) error {
switch {
case retainState > 0:
retainStateP = func(depth int64) bool {
return depth <= int64(CompactionBoundary)+retainState*int64(build.Finality)
return depth <= int64(CompactionBoundary)+retainState*int64(policy.ChainFinality)
}
case retainState < 0:
retainStateP = func(_ int64) bool { return true }
Expand Down
4 changes: 2 additions & 2 deletions blockstore/splitstore/splitstore_warmup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (

"github.com/filecoin-project/go-state-types/abi"

"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
)

var (
// WarmupBoundary is the number of epochs to load state during warmup.
WarmupBoundary = build.Finality
WarmupBoundary = policy.ChainFinality
)

// warmup acquires the compaction lock and spawns a goroutine to warm up the hotstore;
Expand Down
94 changes: 94 additions & 0 deletions build/buildconstants/drand.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package buildconstants

import (
"sort"

"github.com/filecoin-project/go-state-types/abi"
)

type DrandEnum int

const (
Expand All @@ -10,3 +16,91 @@ const (
DrandIncentinet
DrandQuicknet
)

type DrandConfig struct {
aarshkshah1992 marked this conversation as resolved.
Show resolved Hide resolved
Servers []string
Relays []string
ChainInfoJSON string
IsChained bool // Prior to Drand quicknet, beacons form a chain, post quicknet they do not (FIP-0063)
}

type DrandPoint struct {
Start abi.ChainEpoch
Config DrandConfig
}

var DrandConfigs = map[DrandEnum]DrandConfig{
DrandMainnet: {
Servers: []string{
"https://api.drand.sh",
"https://api2.drand.sh",
"https://api3.drand.sh",
"https://drand.cloudflare.com",
"https://api.drand.secureweb3.com:6875", // Storswift
},
Relays: []string{
"/dnsaddr/api.drand.sh/",
"/dnsaddr/api2.drand.sh/",
"/dnsaddr/api3.drand.sh/",
},
IsChained: true,
ChainInfoJSON: `{"public_key":"868f005eb8e6e4ca0a47c8a77ceaa5309a47978a7c71bc5cce96366b5d7a569937c529eeda66c7293784a9402801af31","period":30,"genesis_time":1595431050,"hash":"8990e7a9aaed2ffed73dbd7092123d6f289930540d7651336225dc172e51b2ce","groupHash":"176f93498eac9ca337150b46d21dd58673ea4e3581185f869672e59fa4cb390a"}`,
},
DrandQuicknet: {
Servers: []string{
"https://api.drand.sh",
"https://api2.drand.sh",
"https://api3.drand.sh",
"https://drand.cloudflare.com",
"https://api.drand.secureweb3.com:6875", // Storswift
},
Relays: []string{
"/dnsaddr/api.drand.sh/",
"/dnsaddr/api2.drand.sh/",
"/dnsaddr/api3.drand.sh/",
},
IsChained: false,
ChainInfoJSON: `{"public_key":"83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a","period":3,"genesis_time":1692803367,"hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","groupHash":"f477d5c89f21a17c863a7f937c6a6d15859414d2be09cd448d4279af331c5d3e","schemeID":"bls-unchained-g1-rfc9380","metadata":{"beaconID":"quicknet"}}`,
},
DrandTestnet: {
Servers: []string{
"https://pl-eu.testnet.drand.sh",
"https://pl-us.testnet.drand.sh",
},
Relays: []string{
"/dnsaddr/pl-eu.testnet.drand.sh/",
"/dnsaddr/pl-us.testnet.drand.sh/",
},
IsChained: true,
ChainInfoJSON: `{"public_key":"922a2e93828ff83345bae533f5172669a26c02dc76d6bf59c80892e12ab1455c229211886f35bb56af6d5bea981024df","period":25,"genesis_time":1590445175,"hash":"84b2234fb34e835dccd048255d7ad3194b81af7d978c3bf157e3469592ae4e02","groupHash":"4dd408e5fdff9323c76a9b6f087ba8fdc5a6da907bd9217d9d10f2287d081957"}`,
},
DrandDevnet: {
Servers: []string{
"https://dev1.drand.sh",
"https://dev2.drand.sh",
},
Relays: []string{
"/dnsaddr/dev1.drand.sh/",
"/dnsaddr/dev2.drand.sh/",
},
IsChained: true,
ChainInfoJSON: `{"public_key":"8cda589f88914aa728fd183f383980b35789ce81b274e5daee1f338b77d02566ef4d3fb0098af1f844f10f9c803c1827","period":25,"genesis_time":1595348225,"hash":"e73b7dc3c4f6a236378220c0dd6aa110eb16eed26c11259606e07ee122838d4f","groupHash":"567d4785122a5a3e75a9bc9911d7ea807dd85ff76b78dc4ff06b075712898607"}`,
},
DrandIncentinet: {
IsChained: true,
ChainInfoJSON: `{"public_key":"8cad0c72c606ab27d36ee06de1d5b2db1faf92e447025ca37575ab3a8aac2eaae83192f846fc9e158bc738423753d000","period":30,"genesis_time":1595873820,"hash":"80c8b872c714f4c00fdd3daa465d5514049f457f01f85a4caf68cdcd394ba039","groupHash":"d9406aaed487f7af71851b4399448e311f2328923d454e971536c05398ce2d9b"}`,
},
}

func DrandConfigSchedule() []DrandPoint {
out := make([]DrandPoint, 0, len(DrandSchedule))
for start, network := range DrandSchedule {
out = append(out, DrandPoint{Start: start, Config: DrandConfigs[network]})
}

sort.Slice(out, func(i, j int) bool {
return out[i].Start < out[j].Start
})

return out
}
40 changes: 31 additions & 9 deletions build/buildconstants/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,40 @@ package buildconstants

import "github.com/filecoin-project/go-state-types/network"

var BuildType int

const (
BuildDefault = 0
BuildMainnet = 0x1
Build2k = 0x2
BuildDebug = 0x3
BuildCalibnet = 0x4
BuildInteropnet = 0x5
BuildButterflynet = 0x7
BuildDefault = iota
BuildMainnet
Build2k
BuildDebug
BuildCalibnet
BuildInteropnet
unused1
aarshkshah1992 marked this conversation as resolved.
Show resolved Hide resolved
BuildButterflynet
)

var BuildType int

func BuildTypeString() string {
switch BuildType {
case BuildDefault:
return ""
case BuildMainnet:
return "+mainnet"
case Build2k:
return "+2k"
case BuildDebug:
return "+debug"
case BuildCalibnet:
return "+calibnet"
case BuildInteropnet:
return "+interopnet"
case BuildButterflynet:
return "+butterflynet"
default:
return "+huh?"
}
}

var Devnet = true

// Used by tests and some obscure tooling
Expand Down
62 changes: 31 additions & 31 deletions build/buildconstants/params_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,89 +32,89 @@ const GenesisNetworkVersion = network.Version0
const BootstrappersFile = "mainnet.pi"
const GenesisFile = "mainnet.car"

const UpgradeBreezeHeight = 41280
const UpgradeBreezeHeight abi.ChainEpoch = 41280

const BreezeGasTampingDuration = 120
const BreezeGasTampingDuration abi.ChainEpoch = 120

const UpgradeSmokeHeight = 51000
const UpgradeSmokeHeight abi.ChainEpoch = 51000

const UpgradeIgnitionHeight = 94000
const UpgradeRefuelHeight = 130800
const UpgradeIgnitionHeight abi.ChainEpoch = 94000
const UpgradeRefuelHeight abi.ChainEpoch = 130800

const UpgradeAssemblyHeight = 138720
const UpgradeAssemblyHeight abi.ChainEpoch = 138720

const UpgradeTapeHeight = 140760
const UpgradeTapeHeight abi.ChainEpoch = 140760

// 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 = 148888
const UpgradeLiftoffHeight abi.ChainEpoch = 148888

const UpgradeKumquatHeight = 170000
const UpgradeKumquatHeight abi.ChainEpoch = 170000

const UpgradeCalicoHeight = 265200
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 60)
const UpgradeCalicoHeight abi.ChainEpoch = 265200
const UpgradePersianHeight abi.ChainEpoch = UpgradeCalicoHeight + (builtin2.EpochsInHour * 60)

const UpgradeOrangeHeight = 336458
const UpgradeOrangeHeight abi.ChainEpoch = 336458

// 2020-12-22T02:00:00Z
// var because of wdpost_test.go
var UpgradeClausHeight = abi.ChainEpoch(343200)
var UpgradeClausHeight abi.ChainEpoch = 343200

// 2021-03-04T00:00:30Z
const UpgradeTrustHeight = 550321
const UpgradeTrustHeight abi.ChainEpoch = 550321

// 2021-04-12T22:00:00Z
const UpgradeNorwegianHeight = 665280
const UpgradeNorwegianHeight abi.ChainEpoch = 665280

// 2021-04-29T06:00:00Z
const UpgradeTurboHeight = 712320
const UpgradeTurboHeight abi.ChainEpoch = 712320

// 2021-06-30T22:00:00Z
const UpgradeHyperdriveHeight = 892800
const UpgradeHyperdriveHeight abi.ChainEpoch = 892800

// 2021-10-26T13:30:00Z
const UpgradeChocolateHeight = 1231620
const UpgradeChocolateHeight abi.ChainEpoch = 1231620

// 2022-03-01T15:00:00Z
const UpgradeOhSnapHeight = 1594680
const UpgradeOhSnapHeight abi.ChainEpoch = 1594680

// 2022-07-06T14:00:00Z
const UpgradeSkyrHeight = 1960320
const UpgradeSkyrHeight abi.ChainEpoch = 1960320

// 2022-11-30T14:00:00Z
const UpgradeSharkHeight = 2383680
const UpgradeSharkHeight abi.ChainEpoch = 2383680

// 2023-03-14T15:14:00Z
const UpgradeHyggeHeight = 2683348
const UpgradeHyggeHeight abi.ChainEpoch = 2683348

// 2023-04-27T13:00:00Z
const UpgradeLightningHeight = 2809800
const UpgradeLightningHeight abi.ChainEpoch = 2809800

// 2023-05-18T13:00:00Z
const UpgradeThunderHeight = UpgradeLightningHeight + 2880*21
const UpgradeThunderHeight abi.ChainEpoch = UpgradeLightningHeight + 2880*21

// 2023-12-12T13:30:00Z
const UpgradeWatermelonHeight = 3469380
const UpgradeWatermelonHeight abi.ChainEpoch = 3469380

// 2024-04-24T14:00:00Z
const UpgradeDragonHeight = 3855360
const UpgradeDragonHeight abi.ChainEpoch = 3855360

// This epoch, 120 epochs after the "rest" of the nv22 upgrade, is when we switch to Drand quicknet
// 2024-04-11T15:00:00Z
const UpgradePhoenixHeight = UpgradeDragonHeight + 120
const UpgradePhoenixHeight abi.ChainEpoch = UpgradeDragonHeight + 120

// ??????
var UpgradeWaffleHeight = abi.ChainEpoch(9999999999)
var UpgradeWaffleHeight abi.ChainEpoch = 9999999999

// This fix upgrade only ran on calibrationnet
const UpgradeWatermelonFixHeight = -1
const UpgradeWatermelonFixHeight abi.ChainEpoch = -1

// This fix upgrade only ran on calibrationnet
const UpgradeWatermelonFix2Height = -2
const UpgradeWatermelonFix2Height abi.ChainEpoch = -2

// This fix upgrade only ran on calibrationnet
const UpgradeCalibrationDragonFixHeight = -3
const UpgradeCalibrationDragonFixHeight abi.ChainEpoch = -3

var SupportedProofTypes = []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg32GiBV1,
Expand Down
Loading