From 795a865f86aaca3896814396af2665418022b2ed Mon Sep 17 00:00:00 2001 From: "Andrew Jackson (Ajax)" Date: Thu, 11 Jul 2024 22:41:25 -0500 Subject: [PATCH] comments - cleanups --- build/buildconstants/params_interop.go | 5 ++++- build/buildconstants/params_mainnet.go | 2 ++ build/params_shared_vals.go | 17 +++++++++-------- build/params_testground_vals.go | 8 -------- build/proof-params/parameters.go | 2 +- build/version.go | 16 ++++++++-------- itests/api_test.go | 4 +--- 7 files changed, 25 insertions(+), 29 deletions(-) diff --git a/build/buildconstants/params_interop.go b/build/buildconstants/params_interop.go index ba61840ef94..c00ac8d9fc2 100644 --- a/build/buildconstants/params_interop.go +++ b/build/buildconstants/params_interop.go @@ -4,10 +4,11 @@ package buildconstants import ( - "log" "os" "strconv" + logging "github.com/ipfs/go-log/v2" + "github.com/ipfs/go-cid" "github.com/filecoin-project/go-address" @@ -16,6 +17,8 @@ import ( builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" ) +var log = logging.Logger("buildconstants") + var NetworkBundle = "caterpillarnet" var ActorDebugging = false diff --git a/build/buildconstants/params_mainnet.go b/build/buildconstants/params_mainnet.go index 2633aa5d4d2..1dfe97afe1a 100644 --- a/build/buildconstants/params_mainnet.go +++ b/build/buildconstants/params_mainnet.go @@ -22,6 +22,8 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ var NetworkBundle = "mainnet" +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 diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index e94a43dfdbc..6dc3935f16e 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -4,6 +4,7 @@ import ( "math/big" "github.com/filecoin-project/lotus/build/buildconstants" + "github.com/filecoin-project/lotus/chain/actors/policy" ) // ///// @@ -18,7 +19,7 @@ var UnixfsLinksPerLevel = buildconstants.UnixfsLinksPerLevel // Deprecated: Use var AllowableClockDriftSecs = buildconstants.AllowableClockDriftSecs // Deprecated: Use buildconstants.AllowableClockDriftSecs instead // Epochs -var ForkLengthThreshold = Finality // Deprecated: Use Finality instead +const ForkLengthThreshold = Finality // Deprecated: Use Finality instead // Blocks (e) var BlocksPerEpoch = buildconstants.BlocksPerEpoch // Deprecated: Use buildconstants.BlocksPerEpoch instead @@ -26,8 +27,6 @@ var BlocksPerEpoch = buildconstants.BlocksPerEpoch // Deprecated: Use buildconst // Epochs var MessageConfidence = buildconstants.MessageConfidence // Deprecated: Use buildconstants.MessageConfidence instead -// constants for Weight calculation -// The ratio of weight contributed by short-term vs long-term factors in a given round var WRatioNum = buildconstants.WRatioNum // Deprecated: Use buildconstants.WRatioNum instead var WRatioDen = buildconstants.WRatioDen // Deprecated: Use buildconstants.WRatioDen instead @@ -39,7 +38,6 @@ var TicketRandomnessLookback = buildconstants.TicketRandomnessLookback // Deprec // the 'f' prefix doesn't matter var ZeroAddress = buildconstants.ZeroAddress // Deprecated: Use buildconstants.ZeroAddress instead - // ///// // Devnet settings @@ -67,12 +65,8 @@ func init() { // Sync var BadBlockCacheSize = buildconstants.BadBlockCacheSize // Deprecated: Use buildconstants.BadBlockCacheSize instead -// assuming 4000 messages per round, this lets us not lose any messages across a -// 10 block reorg. var BlsSignatureCacheSize = buildconstants.BlsSignatureCacheSize // Deprecated: Use buildconstants.BlsSignatureCacheSize instead -// Size of signature verification cache -// 32k keeps the cache around 10MB in size, max var VerifSigCacheSize = buildconstants.VerifSigCacheSize // Deprecated: Use buildconstants.VerifSigCacheSize instead // /////// @@ -94,3 +88,10 @@ var MinDealDuration = buildconstants.MinDealDuration // Deprecated: Use buildcon var MaxDealDuration = buildconstants.MaxDealDuration // Deprecated: Use buildconstants.MaxDealDuration instead const TestNetworkVersion = buildconstants.TestNetworkVersion // Deprecated: Use buildconstants.TestNetworkVersion instead + +func init() { + policy.SetSupportedProofTypes(buildconstants.SupportedProofTypes...) + policy.SetConsensusMinerMinPower(buildconstants.ConsensusMinerMinPower) + policy.SetMinVerifiedDealSize(buildconstants.MinVerifiedDealSize) + policy.SetPreCommitChallengeDelay(buildconstants.PreCommitChallengeDelay) +} diff --git a/build/params_testground_vals.go b/build/params_testground_vals.go index a032e5fad48..4503f76dcfb 100644 --- a/build/params_testground_vals.go +++ b/build/params_testground_vals.go @@ -4,17 +4,9 @@ package build import ( - "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/policy" ) // Actor consts // TODO: pieceSize unused from actors var MinDealDuration, MaxDealDuration = policy.DealDurationBounds(0) - -func init() { - policy.SetSupportedProofTypes(buildconstants.SupportedProofTypes...) - policy.SetConsensusMinerMinPower(buildconstants.ConsensusMinerMinPower) - policy.SetMinVerifiedDealSize(buildconstants.MinVerifiedDealSize) - policy.SetPreCommitChallengeDelay(buildconstants.PreCommitChallengeDelay) -} diff --git a/build/proof-params/parameters.go b/build/proof-params/parameters.go index 68158391e99..1bef20f60f7 100644 --- a/build/proof-params/parameters.go +++ b/build/proof-params/parameters.go @@ -1,4 +1,4 @@ -package build +package proofparams import ( _ "embed" diff --git a/build/version.go b/build/version.go index ea1f4db8810..39b0e193ff8 100644 --- a/build/version.go +++ b/build/version.go @@ -9,16 +9,16 @@ import ( type BuildVersion string var CurrentCommit string -var BuildType = buildconstants.BuildType +var BuildType = buildconstants.BuildType // Deprecated: Use buildconstants.BuildType instead const ( - BuildDefault = buildconstants.BuildDefault - BuildMainnet = buildconstants.BuildMainnet - Build2k = buildconstants.Build2k - BuildDebug = buildconstants.BuildDebug - BuildCalibnet = buildconstants.BuildCalibnet - BuildInteropnet = buildconstants.BuildInteropnet - BuildButterflynet = buildconstants.BuildButterflynet + BuildDefault = buildconstants.BuildDefault // Deprecated: Use buildconstants.BuildDefault instead + BuildMainnet = buildconstants.BuildMainnet // Deprecated: Use buildconstants.BuildMainnet instead + Build2k = buildconstants.Build2k // Deprecated: Use buildconstants.Build2k instead + BuildDebug = buildconstants.BuildDebug // Deprecated: Use buildconstants.BuildDebug instead + BuildCalibnet = buildconstants.BuildCalibnet // Deprecated: Use buildconstants.BuildCalibnet instead + BuildInteropnet = buildconstants.BuildInteropnet // Deprecated: Use buildconstants.BuildInteropnet instead + BuildButterflynet = buildconstants.BuildButterflynet // Deprecated: Use buildconstants.BuildButterflynet instead ) func BuildTypeString() string { diff --git a/itests/api_test.go b/itests/api_test.go index 8ad1156b35a..afa2aa2bf4d 100644 --- a/itests/api_test.go +++ b/itests/api_test.go @@ -167,11 +167,9 @@ func (ts *apiSuite) testOutOfGasError(t *testing.T) { // the gas estimator API executes the message with gasLimit = BlockGasLimit // Lowering it to 2 will cause it to run out of gas, testing the failure case we want - originalLimit := build.BlockGasLimit - build.BlockGasLimit = 2 + originalLimit := buildconstants.BlockGasTarget buildconstants.BlockGasTarget = 2 defer func() { - build.BlockGasLimit = originalLimit buildconstants.BlockGasTarget = originalLimit }()