Skip to content

Commit

Permalink
feat: api: Clean API for Miners (filecoin-project#12112)
Browse files Browse the repository at this point in the history
* proofparams alternate

* createminer

* const factored from /build and types updated to use it

* buildconstants for more places

* deprecate msg

* itest cleanup

* alerting interface

* house cleaning

* rm policy and drand from buildconstants

* clean up curio further

* aussie waffle

* pr fixes

* fix lints

* little fixes

* oops this got updated

* unbreak test builds

* test fixes

* comments - cleanups

* itests fix alerting

* rm obsolete alertinginterface

* spelling oops

* changelog

* tests need buildconstants port

* Fully migrate BlockGasTarget

* ulimit should not depend on build

* complete the simplest deprecations

* bringing back versions
  • Loading branch information
snadrus authored Jul 14, 2024
1 parent a57dce3 commit 21abfc6
Show file tree
Hide file tree
Showing 64 changed files with 711 additions and 469 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- https://github.com/filecoin-project/lotus/pull/12203: Fix slice modification bug in ETH Tx Events Bloom Filter
- https://github.com/filecoin-project/lotus/pull/12221: Fix a nil reference panic in the ETH Trace API
- https://github.com/filecoin-project/lotus/pull/12112: Moved consts from build/ to build/buildconstants/ for ligher curio deps.

## ☢️ Upgrade Warnings ☢️

Expand Down
12 changes: 12 additions & 0 deletions build/buildconstants/drand.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package buildconstants

type DrandEnum int

const (
DrandMainnet DrandEnum = iota + 1
DrandTestnet
DrandDevnet
DrandLocalnet
DrandIncentinet
DrandQuicknet
)
6 changes: 6 additions & 0 deletions build/buildconstants/limits.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package buildconstants

var (
DefaultFDLimit uint64 = 16 << 10
MinerFDLimit uint64 = 100_000
)
25 changes: 25 additions & 0 deletions build/buildconstants/params.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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
)

var Devnet = true

// Used by tests and some obscure tooling
/* inline-gen template
const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
/* inline-gen start */
const TestNetworkVersion = network.Version23

/* inline-gen end */
13 changes: 2 additions & 11 deletions build/params_2k.go → build/buildconstants/params_2k.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//go:build debug || 2k
// +build debug 2k

package build
package buildconstants

import (
"os"
Expand All @@ -10,17 +10,13 @@ import (
"github.com/ipfs/go-cid"

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

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

const BootstrappersFile = ""
const GenesisFile = ""

var NetworkBundle = "devnet"
var BundleOverrides map[actorstypes.Version]string
var ActorDebugging = true

var GenesisNetworkVersion = network.Version22
Expand Down Expand Up @@ -95,11 +91,6 @@ var MinVerifiedDealSize = abi.NewStoragePower(256)
var PreCommitChallengeDelay = abi.ChainEpoch(10)

func init() {
policy.SetSupportedProofTypes(SupportedProofTypes...)
policy.SetConsensusMinerMinPower(ConsensusMinerMinPower)
policy.SetMinVerifiedDealSize(MinVerifiedDealSize)
policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay)

getGenesisNetworkVersion := func(ev string, def network.Version) network.Version {
hs, found := os.LookupEnv(ev)
if found {
Expand Down Expand Up @@ -189,6 +180,6 @@ const Eip155ChainId = 31415926

var WhitelistedBlock = cid.Undef

const f3Enabled = true
const F3Enabled = true
const ManifestServerID = "12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG"
const F3BootstrapEpoch abi.ChainEpoch = 100
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
//go:build butterflynet
// +build butterflynet

package build
package buildconstants

import (
"github.com/ipfs/go-cid"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"

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

var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
Expand All @@ -22,7 +19,6 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
const GenesisNetworkVersion = network.Version22

var NetworkBundle = "butterflynet"
var BundleOverrides map[actorstypes.Version]string
var ActorDebugging = false

const BootstrappersFile = "butterflynet.pi"
Expand Down Expand Up @@ -79,11 +75,6 @@ var MinVerifiedDealSize = abi.NewStoragePower(1 << 20)
var PreCommitChallengeDelay = abi.ChainEpoch(150)

func init() {
policy.SetSupportedProofTypes(SupportedProofTypes...)
policy.SetConsensusMinerMinPower(ConsensusMinerMinPower)
policy.SetMinVerifiedDealSize(MinVerifiedDealSize)
policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay)

SetAddressNetwork(address.Testnet)

Devnet = true
Expand All @@ -106,6 +97,6 @@ const Eip155ChainId = 3141592

var WhitelistedBlock = cid.Undef

const f3Enabled = true
const F3Enabled = true
const ManifestServerID = "12D3KooWJr9jy4ngtJNR7JC1xgLFra3DjEtyxskRYWvBK9TC3Yn6"
const F3BootstrapEpoch abi.ChainEpoch = 200
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//go:build calibnet
// +build calibnet

package build
package buildconstants

import (
"os"
Expand All @@ -11,11 +11,8 @@ import (

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"

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

var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
Expand All @@ -26,7 +23,6 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
const GenesisNetworkVersion = network.Version0

var NetworkBundle = "calibrationnet"
var BundleOverrides map[actorstypes.Version]string
var ActorDebugging = false

const BootstrappersFile = "calibnet.pi"
Expand Down Expand Up @@ -110,11 +106,6 @@ var MinVerifiedDealSize = abi.NewStoragePower(1 << 20)
var PreCommitChallengeDelay = abi.ChainEpoch(150)

func init() {
policy.SetSupportedProofTypes(SupportedProofTypes...)
policy.SetConsensusMinerMinPower(ConsensusMinerMinPower)
policy.SetMinVerifiedDealSize(MinVerifiedDealSize)
policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay)

SetAddressNetwork(address.Testnet)

Devnet = true
Expand Down Expand Up @@ -152,6 +143,6 @@ const Eip155ChainId = 314159

var WhitelistedBlock = cid.Undef

const f3Enabled = true
const F3Enabled = true
const ManifestServerID = "12D3KooWS9vD9uwm8u2uPyJV32QBAhKAmPYwmziAgr3Xzk2FU1Mr"
const F3BootstrapEpoch abi.ChainEpoch = UpgradeWaffleHeight + 100
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//go:build debug
// +build debug

package build
package buildconstants

func init() {
InsecurePoStValidation = true
Expand Down
16 changes: 5 additions & 11 deletions build/params_interop.go → build/buildconstants/params_interop.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
//go:build interopnet
// +build interopnet

package build
package buildconstants

import (
"os"
"strconv"

"github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"

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

var log = logging.Logger("buildconstants")

var NetworkBundle = "caterpillarnet"
var BundleOverrides map[actorstypes.Version]string
var ActorDebugging = false

const BootstrappersFile = "interopnet.pi"
Expand Down Expand Up @@ -82,11 +81,6 @@ var MinVerifiedDealSize = abi.NewStoragePower(256)
var PreCommitChallengeDelay = abi.ChainEpoch(10)

func init() {
policy.SetSupportedProofTypes(SupportedProofTypes...)
policy.SetConsensusMinerMinPower(ConsensusMinerMinPower)
policy.SetMinVerifiedDealSize(MinVerifiedDealSize)
policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay)

getUpgradeHeight := func(ev string, def abi.ChainEpoch) abi.ChainEpoch {
hs, found := os.LookupEnv(ev)
if found {
Expand Down Expand Up @@ -145,6 +139,6 @@ const Eip155ChainId = 3141592

var WhitelistedBlock = cid.Undef

const f3Enabled = true
const F3Enabled = true
const ManifestServerID = "12D3KooWQJ2rdVnG4okDUB6yHQhAjNutGNemcM7XzqC9Eo4z9Jce"
const F3BootstrapEpoch abi.ChainEpoch = 1000
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//go:build !debug && !2k && !testground && !calibnet && !butterflynet && !interopnet
// +build !debug,!2k,!testground,!calibnet,!butterflynet,!interopnet

package build
package buildconstants

import (
"math"
Expand All @@ -10,7 +10,6 @@ import (

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
Expand All @@ -23,8 +22,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{

var NetworkBundle = "mainnet"

// NOTE: DO NOT change this unless you REALLY know what you're doing. This is consensus critical.
var BundleOverrides map[actorstypes.Version]string
var MinVerifiedDealSize = abi.NewStoragePower(1 << 20)

// NOTE: DO NOT change this unless you REALLY know what you're doing. This is consensus critical.
const ActorDebugging = false
Expand Down Expand Up @@ -169,6 +167,6 @@ const Eip155ChainId = 314
// WhitelistedBlock skips checks on message validity in this block to sidestep the zero-bls signature
var WhitelistedBlock = MustParseCid("bafy2bzaceapyg2uyzk7vueh3xccxkuwbz3nxewjyguoxvhx77malc2lzn2ybi")

const f3Enabled = false
const F3Enabled = false
const ManifestServerID = "12D3KooWENMwUF9YxvQxar7uBWJtZkA6amvK4xWmKXfSiHUo2Qq7"
const F3BootstrapEpoch abi.ChainEpoch = -1
Loading

0 comments on commit 21abfc6

Please sign in to comment.