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

feat: api: Clean API for Miners #12112

Merged
merged 30 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
156dda9
proofparams alternate
snadrus Jun 19, 2024
f6d4075
createminer
snadrus Jun 19, 2024
b10c5ff
const factored from /build and types updated to use it
snadrus Jun 20, 2024
f4cf250
buildconstants for more places
snadrus Jun 20, 2024
08f126c
deprecate msg
snadrus Jun 20, 2024
36772b5
itest cleanup
snadrus Jun 20, 2024
66c9252
alerting interface
snadrus Jun 20, 2024
883469a
house cleaning
snadrus Jun 20, 2024
856ea4b
rm policy and drand from buildconstants
snadrus Jun 20, 2024
8d8894a
clean up curio further
snadrus Jun 20, 2024
35602b4
Merge branch 'master' into curioAvoidBuildFolder
snadrus Jun 20, 2024
ee8226e
aussie waffle
snadrus Jun 20, 2024
f1a6572
pr fixes
snadrus Jun 21, 2024
fc36dcc
fix lints
snadrus Jun 21, 2024
7a1cc4d
little fixes
snadrus Jun 24, 2024
ca58e1a
Merge branch 'master' into curioAvoidBuildFolder
snadrus Jul 11, 2024
3b0fecd
oops this got updated
snadrus Jul 11, 2024
12ba6f2
unbreak test builds
snadrus Jul 11, 2024
2217b86
test fixes
snadrus Jul 11, 2024
795a865
comments - cleanups
snadrus Jul 12, 2024
81387ca
itests fix alerting
snadrus Jul 12, 2024
7272177
rm obsolete alertinginterface
snadrus Jul 12, 2024
7639a07
spelling oops
snadrus Jul 12, 2024
d0eb1dc
Merge branch 'master' into curioAvoidBuildFolder
snadrus Jul 12, 2024
320c31f
changelog
snadrus Jul 12, 2024
86b9797
tests need buildconstants port
snadrus Jul 12, 2024
20947d2
Fully migrate BlockGasTarget
snadrus Jul 12, 2024
21ca683
ulimit should not depend on build
snadrus Jul 12, 2024
bec5965
complete the simplest deprecations
snadrus Jul 12, 2024
3d830f0
bringing back versions
snadrus Jul 13, 2024
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
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
)
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)
snadrus marked this conversation as resolved.
Show resolved Hide resolved

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
ZenGround0 marked this conversation as resolved.
Show resolved Hide resolved
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
112 changes: 112 additions & 0 deletions build/buildconstants/params_shared_vals.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
//go:build !testground
// +build !testground

package buildconstants

import (
"math/big"
"os"

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

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

// /////
// Storage

const UnixfsChunkSize uint64 = 1 << 20
const UnixfsLinksPerLevel = 1024
snadrus marked this conversation as resolved.
Show resolved Hide resolved

// /////
// Consensus / Network

const AllowableClockDriftSecs = uint64(1)

// Blocks (e)
var BlocksPerEpoch = uint64(builtin2.ExpectedLeadersPerEpoch)

// Epochs
const MessageConfidence = uint64(5)

// constants for Weight calculation
// The ratio of weight contributed by short-term vs long-term factors in a given round
const WRatioNum = int64(1)
const WRatioDen = uint64(2)

// /////
// Proofs

// Epochs
// TODO: unused
const SealRandomnessLookback = policy.SealRandomnessLookback

// /////
// Mining

// Epochs
const TicketRandomnessLookback = abi.ChainEpoch(1)

// /////
// Address

const AddressMainnetEnvVar = "_mainnet_"

// the 'f' prefix doesn't matter
var ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a")

const FilBase = uint64(2_000_000_000)
const FilAllocStorageMining = uint64(1_100_000_000)

const FilecoinPrecision = uint64(1_000_000_000_000_000_000)
const FilReserved = uint64(300_000_000)

var InitialRewardBalance *big.Int
var InitialFilReserved *big.Int

// TODO: Move other important consts here
snadrus marked this conversation as resolved.
Show resolved Hide resolved

func init() {
InitialRewardBalance = big.NewInt(int64(FilAllocStorageMining))
InitialRewardBalance = InitialRewardBalance.Mul(InitialRewardBalance, big.NewInt(int64(FilecoinPrecision)))

InitialFilReserved = big.NewInt(int64(FilReserved))
InitialFilReserved = InitialFilReserved.Mul(InitialFilReserved, big.NewInt(int64(FilecoinPrecision)))

if os.Getenv("LOTUS_ADDRESS_TYPE") == AddressMainnetEnvVar {
SetAddressNetwork(address.Mainnet)
}
}

// Sync
const BadBlockCacheSize = 1 << 15

// assuming 4000 messages per round, this lets us not lose any messages across a
// 10 block reorg.
const BlsSignatureCacheSize = 40000

// Size of signature verification cache
// 32k keeps the cache around 10MB in size, max
const VerifSigCacheSize = 32000

// ///////
// Limits

// TODO: If this is gonna stay, it should move to specs-actors
snadrus marked this conversation as resolved.
Show resolved Hide resolved
const BlockMessageLimit = 10000

var BlockGasLimit = int64(10_000_000_000)
var BlockGasTarget = BlockGasLimit / 2

const BaseFeeMaxChangeDenom = 8 // 12.5%
const InitialBaseFee = 100e6
const MinimumBaseFee = 100
const PackingEfficiencyNum = 4
const PackingEfficiencyDenom = 5

// revive:disable-next-line:exported
// Actor consts
// TODO: pieceSize unused from actors
var MinDealDuration, MaxDealDuration = policy.DealDurationBounds(0)
Loading
Loading