From 33b986993ef64f62dcb8801c5b9974d1903d181e Mon Sep 17 00:00:00 2001 From: Peter Rabbitson Date: Tue, 16 Jul 2024 16:00:44 +0200 Subject: [PATCH] chore: remove (deprecated) deps on build/ proxy-constants This is a large diff, yet should have exactly zero functional changes Ideally as a result of this some parts of the depchain will become lighter, with downstream reaping the same benefits as the team that initiated this split. P.S. work was done while forming better intuition of current dependency graph --- api/docgen/docgen.go | 4 +- blockstore/splitstore/splitstore.go | 4 +- blockstore/splitstore/splitstore_compact.go | 8 +- blockstore/splitstore/splitstore_prune.go | 6 +- blockstore/splitstore/splitstore_warmup.go | 4 +- build/buildconstants/params_mainnet.go | 62 ++++++++-------- build/builtin_actors.go | 9 ++- build/limits.go | 7 -- build/parameters.go | 63 ++++++++-------- build/params_shared_vals.go | 2 + chain/badtscache.go | 4 +- chain/beacon/drand/drand.go | 5 +- chain/beacon/drand/drand_test.go | 9 +-- chain/consensus/common.go | 5 +- chain/consensus/compute_state.go | 3 +- chain/consensus/filcns/filecoin.go | 14 ++-- chain/consensus/filcns/upgrades.go | 73 ++++++++++--------- chain/consensus/filcns/weight.go | 6 +- chain/events/events.go | 4 +- chain/events/events_test.go | 4 +- chain/exchange/protocol.go | 4 +- chain/exchange/protocol_encoding.go | 6 +- chain/gen/gen.go | 11 +-- chain/gen/genesis/f02_reward.go | 4 +- chain/gen/genesis/genesis.go | 6 +- chain/lf3/manifest.go | 6 +- chain/market/fundmanager.go | 4 +- chain/messagepool/messagepool.go | 11 +-- chain/messagepool/messagepool_test.go | 4 +- chain/messagepool/selection.go | 29 ++++---- chain/messagepool/selection_test.go | 13 ++-- chain/state/statetree_test.go | 12 +-- chain/stmgr/forks.go | 4 +- chain/stmgr/stmgr.go | 4 +- chain/stmgr/supply.go | 20 ++--- chain/store/basefee.go | 15 ++-- chain/store/basefee_test.go | 5 +- chain/store/messages.go | 4 +- chain/store/snapshot.go | 8 +- chain/store/store.go | 11 +-- chain/sub/incoming.go | 3 +- chain/sync.go | 16 ++-- chain/sync_manager.go | 3 +- chain/sync_test.go | 3 +- chain/types/ethtypes/eth_1559_transactions.go | 8 +- .../ethtypes/eth_1559_transactions_test.go | 3 + .../ethtypes/eth_legacy_155_transactions.go | 12 +-- chain/types/ethtypes/eth_transactions.go | 8 +- chain/vm/fvm.go | 8 +- chain/vm/gas.go | 9 +-- chain/vm/mkactor.go | 4 +- chain/vm/syscalls.go | 5 +- chain/vm/vm.go | 3 +- cli/chain.go | 6 +- cli/filplus.go | 10 +-- cli/info.go | 6 +- cli/multisig.go | 35 ++++----- cli/paych.go | 8 +- cli/sending_ui.go | 4 +- cli/spcli/actor.go | 18 ++--- cli/spcli/proving.go | 6 +- cli/state.go | 4 +- cli/status.go | 4 +- cli/sync.go | 4 +- cli/wallet.go | 4 +- cmd/lotus-bench/main.go | 3 +- cmd/lotus-fountain/main.go | 3 +- cmd/lotus-health/main.go | 7 +- cmd/lotus-miner/info.go | 4 +- cmd/lotus-miner/init.go | 3 +- cmd/lotus-miner/proving.go | 4 +- cmd/lotus-pcr/main.go | 33 +++++---- cmd/lotus-seed/genesis.go | 14 ++-- cmd/lotus-seed/main.go | 5 +- cmd/lotus-shed/actor.go | 14 ++-- cmd/lotus-shed/balances.go | 4 +- cmd/lotus-shed/consensus.go | 6 +- cmd/lotus-shed/cron-count.go | 4 +- cmd/lotus-shed/gas-estimation.go | 5 +- cmd/lotus-shed/genesis-verify.go | 4 +- cmd/lotus-shed/miner-multisig.go | 20 ++--- cmd/lotus-shed/miner.go | 8 +- cmd/lotus-shed/verifreg.go | 11 +-- cmd/lotus-sim/simulation/block.go | 4 +- cmd/lotus-stats/main.go | 7 +- cmd/lotus-worker/main.go | 5 +- cmd/lotus/daemon.go | 3 +- cmd/lotus/debug_advance.go | 4 +- cmd/tvx/codenames.go | 36 ++++----- cmd/tvx/codenames_test.go | 6 +- gateway/node.go | 4 +- gateway/node_test.go | 8 +- gateway/proxy_eth.go | 4 +- itests/decode_params_test.go | 6 +- itests/eth_account_abstraction_test.go | 4 +- itests/eth_api_test.go | 8 +- itests/eth_conformance_test.go | 4 +- itests/eth_deploy_test.go | 4 +- itests/eth_hash_lookup_test.go | 6 +- itests/eth_legacy_transactions_test.go | 10 +-- itests/eth_transactions_test.go | 8 +- itests/fevm_test.go | 5 +- itests/gas_estimation_test.go | 4 +- itests/kit/ensemble.go | 6 +- itests/kit/ensemble_opts.go | 3 +- itests/kit/node_opts.go | 4 +- itests/paych_api_test.go | 4 +- itests/paych_cli_test.go | 6 +- itests/pending_deal_allocation_test.go | 4 +- itests/remove_verifreg_datacap_test.go | 4 +- itests/splitstore_test.go | 6 +- itests/wdpost_dispute_test.go | 7 +- miner/miner.go | 18 ++--- node/builder_miner.go | 3 +- node/bundle/bundle.go | 3 +- node/impl/common/common.go | 3 +- node/impl/full.go | 7 +- node/impl/full/eth_utils.go | 4 +- node/impl/full/gas.go | 3 +- node/impl/full/state.go | 55 +++++++------- node/impl/full/sync.go | 3 +- node/impl/full/txhashmanager.go | 6 +- node/modules/actorevent.go | 6 +- node/modules/chain.go | 6 +- node/modules/services.go | 5 +- node/modules/storageminer.go | 3 +- node/modules/testing/beacon.go | 4 +- paychmgr/mock_test.go | 4 +- paychmgr/settler/settler.go | 6 +- paychmgr/simple.go | 6 +- storage/pipeline/commit_batch.go | 6 +- storage/pipeline/input.go | 4 +- storage/pipeline/precommit_batch.go | 4 +- storage/pipeline/precommit_policy_test.go | 8 +- storage/pipeline/states_proving.go | 8 +- storage/pipeline/states_replica_update.go | 6 +- storage/pipeline/states_sealing.go | 6 +- storage/wdpost/wdpost_run.go | 3 +- storage/wdpost/wdpost_run_faults.go | 8 +- storage/wdpost/wdpost_run_test.go | 4 +- tools/stats/points/collect.go | 5 +- tools/stats/sync/sync.go | 5 +- 142 files changed, 620 insertions(+), 599 deletions(-) delete mode 100644 build/limits.go diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index b8190ce187a..3d1d4bf2e2b 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -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" @@ -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) diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 6da1cf7f3cc..01551970690 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -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" @@ -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 diff --git a/blockstore/splitstore/splitstore_compact.go b/blockstore/splitstore/splitstore_compact.go index c8e4caa45b5..78feb5bf6de 100644 --- a/blockstore/splitstore/splitstore_compact.go +++ b/blockstore/splitstore/splitstore_compact.go @@ -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" ) @@ -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 @@ -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 } diff --git a/blockstore/splitstore/splitstore_prune.go b/blockstore/splitstore/splitstore_prune.go index aebc3c00114..f9e786d1555 100644 --- a/blockstore/splitstore/splitstore_prune.go +++ b/blockstore/splitstore/splitstore_prune.go @@ -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" ) @@ -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 @@ -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 } diff --git a/blockstore/splitstore/splitstore_warmup.go b/blockstore/splitstore/splitstore_warmup.go index 7fb6f3b9d08..5a8dbc4d6ce 100644 --- a/blockstore/splitstore/splitstore_warmup.go +++ b/blockstore/splitstore/splitstore_warmup.go @@ -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; diff --git a/build/buildconstants/params_mainnet.go b/build/buildconstants/params_mainnet.go index 9e513166906..94d028e9a80 100644 --- a/build/buildconstants/params_mainnet.go +++ b/build/buildconstants/params_mainnet.go @@ -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, diff --git a/build/builtin_actors.go b/build/builtin_actors.go index af3167536a1..45df1b5a5a3 100644 --- a/build/builtin_actors.go +++ b/build/builtin_actors.go @@ -21,6 +21,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/lotus/blockstore" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" ) @@ -39,13 +40,13 @@ func init() { } BundleOverrides[actorstypes.Version(av)] = path } - if err := loadManifests(NetworkBundle); err != nil { + if err := loadManifests(buildconstants.NetworkBundle); err != nil { panic(err) } // The following code cid existed temporarily on the calibnet testnet, as a "buggy" storage miner actor implementation. // We include them in our builtin bundle, but intentionally omit from metadata. - if NetworkBundle == "calibrationnet" { + if buildconstants.NetworkBundle == "calibrationnet" { actors.AddActorMeta("storageminer", cid.MustParse("bafk2bzacecnh2ouohmonvebq7uughh4h3ppmg4cjsk74dzxlbbtlcij4xbzxq"), actorstypes.Version12) actors.AddActorMeta("storageminer", cid.MustParse("bafk2bzaced7emkbbnrewv5uvrokxpf5tlm4jslu2jsv77ofw2yqdglg657uie"), actorstypes.Version12) actors.AddActorMeta("verifiedregistry", cid.MustParse("bafk2bzacednskl3bykz5qpo54z2j2p4q44t5of4ktd6vs6ymmg2zebsbxazkm"), actorstypes.Version13) @@ -54,13 +55,13 @@ func init() { // UseNetworkBundle switches to a different network bundle, by name. func UseNetworkBundle(netw string) error { - if NetworkBundle == netw { + if buildconstants.NetworkBundle == netw { return nil } if err := loadManifests(netw); err != nil { return err } - NetworkBundle = netw + buildconstants.NetworkBundle = netw return nil } diff --git a/build/limits.go b/build/limits.go deleted file mode 100644 index 5cf3eda88d1..00000000000 --- a/build/limits.go +++ /dev/null @@ -1,7 +0,0 @@ -package build - -import "github.com/filecoin-project/lotus/build/buildconstants" - -var ( - MinerFDLimit uint64 = buildconstants.MinerFDLimit -) diff --git a/build/parameters.go b/build/parameters.go index 9da461eaa34..d92f189f883 100644 --- a/build/parameters.go +++ b/build/parameters.go @@ -1,7 +1,6 @@ package build import ( - "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/lotus/build/buildconstants" @@ -26,46 +25,46 @@ var IsNearUpgrade = buildconstants.IsNearUpgrade // Deprecated: Use buildconstan var GenesisNetworkVersion = buildconstants.GenesisNetworkVersion // Deprecated: Use buildconstants.GenesisNetworkVersion instead -var UpgradeBreezeHeight abi.ChainEpoch = buildconstants.UpgradeBreezeHeight // Deprecated: Use buildconstants.UpgradeBreezeHeight instead +var UpgradeBreezeHeight = buildconstants.UpgradeBreezeHeight // Deprecated: Use buildconstants.UpgradeBreezeHeight instead -var BreezeGasTampingDuration abi.ChainEpoch = buildconstants.BreezeGasTampingDuration // Deprecated: Use buildconstants.BreezeGasTampingDuration instead +var BreezeGasTampingDuration = buildconstants.BreezeGasTampingDuration // Deprecated: Use buildconstants.BreezeGasTampingDuration instead // upgrade heights -var UpgradeSmokeHeight abi.ChainEpoch = buildconstants.UpgradeSmokeHeight // Deprecated: Use buildconstants.UpgradeSmokeHeight instead -var UpgradeIgnitionHeight abi.ChainEpoch = buildconstants.UpgradeIgnitionHeight // Deprecated: Use buildconstants.UpgradeIgnitionHeight instead -var UpgradeRefuelHeight abi.ChainEpoch = buildconstants.UpgradeRefuelHeight // Deprecated: Use buildconstants.UpgradeRefuelHeight instead -var UpgradeTapeHeight abi.ChainEpoch = buildconstants.UpgradeTapeHeight // Deprecated: Use buildconstants.UpgradeTapeHeight instead -var UpgradeAssemblyHeight abi.ChainEpoch = buildconstants.UpgradeAssemblyHeight // Deprecated: Use buildconstants.UpgradeAssemblyHeight instead -var UpgradeLiftoffHeight abi.ChainEpoch = buildconstants.UpgradeLiftoffHeight // Deprecated: Use buildconstants.UpgradeLiftoffHeight instead -var UpgradeKumquatHeight abi.ChainEpoch = buildconstants.UpgradeKumquatHeight // Deprecated: Use buildconstants.UpgradeKumquatHeight instead -var UpgradeCalicoHeight abi.ChainEpoch = buildconstants.UpgradeCalicoHeight // Deprecated: Use buildconstants.UpgradeCalicoHeight instead -var UpgradePersianHeight abi.ChainEpoch = buildconstants.UpgradePersianHeight // Deprecated: Use buildconstants.UpgradePersianHeight instead -var UpgradeOrangeHeight abi.ChainEpoch = buildconstants.UpgradeOrangeHeight // Deprecated: Use buildconstants.UpgradeOrangeHeight instead -var UpgradeClausHeight abi.ChainEpoch = buildconstants.UpgradeClausHeight // Deprecated: Use buildconstants.UpgradeClausHeight instead -var UpgradeTrustHeight abi.ChainEpoch = buildconstants.UpgradeTrustHeight // Deprecated: Use buildconstants.UpgradeTrustHeight instead -var UpgradeNorwegianHeight abi.ChainEpoch = buildconstants.UpgradeNorwegianHeight // Deprecated: Use buildconstants.UpgradeNorwegianHeight instead -var UpgradeTurboHeight abi.ChainEpoch = buildconstants.UpgradeTurboHeight // Deprecated: Use buildconstants.UpgradeTurboHeight instead -var UpgradeHyperdriveHeight abi.ChainEpoch = buildconstants.UpgradeHyperdriveHeight // Deprecated: Use buildconstants.UpgradeHyperdriveHeight instead -var UpgradeChocolateHeight abi.ChainEpoch = buildconstants.UpgradeChocolateHeight // Deprecated: Use buildconstants.UpgradeChocolateHeight instead -var UpgradeOhSnapHeight abi.ChainEpoch = buildconstants.UpgradeOhSnapHeight // Deprecated: Use buildconstants.UpgradeOhSnapHeight instead -var UpgradeSkyrHeight abi.ChainEpoch = buildconstants.UpgradeSkyrHeight // Deprecated: Use buildconstants.UpgradeSkyrHeight instead -var UpgradeSharkHeight abi.ChainEpoch = buildconstants.UpgradeSharkHeight // Deprecated: Use buildconstants.UpgradeSharkHeight instead -var UpgradeHyggeHeight abi.ChainEpoch = buildconstants.UpgradeHyggeHeight // Deprecated: Use buildconstants.UpgradeHyggeHeight instead -var UpgradeLightningHeight abi.ChainEpoch = buildconstants.UpgradeLightningHeight // Deprecated: Use buildconstants.UpgradeLightningHeight instead -var UpgradeThunderHeight abi.ChainEpoch = buildconstants.UpgradeThunderHeight // Deprecated: Use buildconstants.UpgradeThunderHeight instead -var UpgradeWatermelonHeight abi.ChainEpoch = buildconstants.UpgradeWatermelonHeight // Deprecated: Use buildconstants.UpgradeWatermelonHeight instead -var UpgradeDragonHeight abi.ChainEpoch = buildconstants.UpgradeDragonHeight // Deprecated: Use buildconstants.UpgradeDragonHeight instead -var UpgradePhoenixHeight abi.ChainEpoch = buildconstants.UpgradePhoenixHeight // Deprecated: Use buildconstants.UpgradePhoenixHeight instead -var UpgradeWaffleHeight abi.ChainEpoch = buildconstants.UpgradeWaffleHeight // Deprecated: Use buildconstants.UpgradeWaffleHeight instead +var UpgradeSmokeHeight = buildconstants.UpgradeSmokeHeight // Deprecated: Use buildconstants.UpgradeSmokeHeight instead +var UpgradeIgnitionHeight = buildconstants.UpgradeIgnitionHeight // Deprecated: Use buildconstants.UpgradeIgnitionHeight instead +var UpgradeRefuelHeight = buildconstants.UpgradeRefuelHeight // Deprecated: Use buildconstants.UpgradeRefuelHeight instead +var UpgradeTapeHeight = buildconstants.UpgradeTapeHeight // Deprecated: Use buildconstants.UpgradeTapeHeight instead +var UpgradeAssemblyHeight = buildconstants.UpgradeAssemblyHeight // Deprecated: Use buildconstants.UpgradeAssemblyHeight instead +var UpgradeLiftoffHeight = buildconstants.UpgradeLiftoffHeight // Deprecated: Use buildconstants.UpgradeLiftoffHeight instead +var UpgradeKumquatHeight = buildconstants.UpgradeKumquatHeight // Deprecated: Use buildconstants.UpgradeKumquatHeight instead +var UpgradeCalicoHeight = buildconstants.UpgradeCalicoHeight // Deprecated: Use buildconstants.UpgradeCalicoHeight instead +var UpgradePersianHeight = buildconstants.UpgradePersianHeight // Deprecated: Use buildconstants.UpgradePersianHeight instead +var UpgradeOrangeHeight = buildconstants.UpgradeOrangeHeight // Deprecated: Use buildconstants.UpgradeOrangeHeight instead +var UpgradeClausHeight = buildconstants.UpgradeClausHeight // Deprecated: Use buildconstants.UpgradeClausHeight instead +var UpgradeTrustHeight = buildconstants.UpgradeTrustHeight // Deprecated: Use buildconstants.UpgradeTrustHeight instead +var UpgradeNorwegianHeight = buildconstants.UpgradeNorwegianHeight // Deprecated: Use buildconstants.UpgradeNorwegianHeight instead +var UpgradeTurboHeight = buildconstants.UpgradeTurboHeight // Deprecated: Use buildconstants.UpgradeTurboHeight instead +var UpgradeHyperdriveHeight = buildconstants.UpgradeHyperdriveHeight // Deprecated: Use buildconstants.UpgradeHyperdriveHeight instead +var UpgradeChocolateHeight = buildconstants.UpgradeChocolateHeight // Deprecated: Use buildconstants.UpgradeChocolateHeight instead +var UpgradeOhSnapHeight = buildconstants.UpgradeOhSnapHeight // Deprecated: Use buildconstants.UpgradeOhSnapHeight instead +var UpgradeSkyrHeight = buildconstants.UpgradeSkyrHeight // Deprecated: Use buildconstants.UpgradeSkyrHeight instead +var UpgradeSharkHeight = buildconstants.UpgradeSharkHeight // Deprecated: Use buildconstants.UpgradeSharkHeight instead +var UpgradeHyggeHeight = buildconstants.UpgradeHyggeHeight // Deprecated: Use buildconstants.UpgradeHyggeHeight instead +var UpgradeLightningHeight = buildconstants.UpgradeLightningHeight // Deprecated: Use buildconstants.UpgradeLightningHeight instead +var UpgradeThunderHeight = buildconstants.UpgradeThunderHeight // Deprecated: Use buildconstants.UpgradeThunderHeight instead +var UpgradeWatermelonHeight = buildconstants.UpgradeWatermelonHeight // Deprecated: Use buildconstants.UpgradeWatermelonHeight instead +var UpgradeDragonHeight = buildconstants.UpgradeDragonHeight // Deprecated: Use buildconstants.UpgradeDragonHeight instead +var UpgradePhoenixHeight = buildconstants.UpgradePhoenixHeight // Deprecated: Use buildconstants.UpgradePhoenixHeight instead +var UpgradeWaffleHeight = buildconstants.UpgradeWaffleHeight // Deprecated: Use buildconstants.UpgradeWaffleHeight instead // This fix upgrade only ran on calibrationnet -var UpgradeWatermelonFixHeight abi.ChainEpoch = buildconstants.UpgradeWatermelonFixHeight // Deprecated: Use buildconstants.UpgradeWatermelonFixHeight instead +var UpgradeWatermelonFixHeight = buildconstants.UpgradeWatermelonFixHeight // Deprecated: Use buildconstants.UpgradeWatermelonFixHeight instead // This fix upgrade only ran on calibrationnet -var UpgradeWatermelonFix2Height abi.ChainEpoch = buildconstants.UpgradeWatermelonFix2Height // Deprecated: Use buildconstants.UpgradeWatermelonFix2Height instead +var UpgradeWatermelonFix2Height = buildconstants.UpgradeWatermelonFix2Height // Deprecated: Use buildconstants.UpgradeWatermelonFix2Height instead // This fix upgrade only ran on calibrationnet -var UpgradeCalibrationDragonFixHeight abi.ChainEpoch = buildconstants.UpgradeCalibrationDragonFixHeight // Deprecated: Use buildconstants.UpgradeCalibrationDragonFixHeight instead +var UpgradeCalibrationDragonFixHeight = buildconstants.UpgradeCalibrationDragonFixHeight // Deprecated: Use buildconstants.UpgradeCalibrationDragonFixHeight instead var SupportedProofTypes = buildconstants.SupportedProofTypes // Deprecated: Use buildconstants.SupportedProofTypes instead var ConsensusMinerMinPower = buildconstants.ConsensusMinerMinPower // Deprecated: Use buildconstants.ConsensusMinerMinPower instead diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index 2267979b2fe..08ba15aa654 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -65,3 +65,5 @@ var PackingEfficiencyNum int64 = buildconstants.PackingEfficiencyNum // Depr var PackingEfficiencyDenom int64 = buildconstants.PackingEfficiencyDenom // Deprecated: Use buildconstants.PackingEfficiencyDenom instead const TestNetworkVersion = buildconstants.TestNetworkVersion // Deprecated: Use buildconstants.TestNetworkVersion instead + +var MinerFDLimit = buildconstants.MinerFDLimit // Deprecated: Use buildconstants.MinerFDLimit instead diff --git a/chain/badtscache.go b/chain/badtscache.go index 162e6b7a701..18240ea8246 100644 --- a/chain/badtscache.go +++ b/chain/badtscache.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/golang-lru/arc/v2" "github.com/ipfs/go-cid" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" ) type BadBlockCache struct { @@ -43,7 +43,7 @@ func (bbr BadBlockReason) String() string { } func NewBadBlockCache() *BadBlockCache { - cache, err := arc.NewARC[cid.Cid, BadBlockReason](build.BadBlockCacheSize) + cache, err := arc.NewARC[cid.Cid, BadBlockReason](buildconstants.BadBlockCacheSize) if err != nil { panic(err) // ok } diff --git a/chain/beacon/drand/drand.go b/chain/beacon/drand/drand.go index 1d781b0570e..a44aa28621b 100644 --- a/chain/beacon/drand/drand.go +++ b/chain/beacon/drand/drand.go @@ -22,6 +22,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/beacon" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/node/modules/dtypes" @@ -35,7 +36,7 @@ var log = logging.Logger("drand") // We connect to drand peers via their public HTTP endpoints. The peers are // enumerated in the drandServers variable. // -// The root trust for the Drand chain is configured from build.DrandChain. +// The root trust for the Drand chain is configured from buildconstants.DrandConfigs type DrandBeacon struct { isChained bool client dclient.Client @@ -239,7 +240,7 @@ var _ beacon.RandomBeacon = (*DrandBeacon)(nil) func BeaconScheduleFromDrandSchedule(dcs dtypes.DrandSchedule, genesisTime uint64, ps *pubsub.PubSub) (beacon.Schedule, error) { shd := beacon.Schedule{} for _, dc := range dcs { - bc, err := NewDrandBeacon(genesisTime, build.BlockDelaySecs, ps, dc.Config) + bc, err := NewDrandBeacon(genesisTime, buildconstants.BlockDelaySecs, ps, dc.Config) if err != nil { return nil, xerrors.Errorf("creating drand beacon: %w", err) } diff --git a/chain/beacon/drand/drand_test.go b/chain/beacon/drand/drand_test.go index 06ae8ae2c35..a5f4a6117d0 100644 --- a/chain/beacon/drand/drand_test.go +++ b/chain/beacon/drand/drand_test.go @@ -14,13 +14,12 @@ import ( "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" ) func TestPrintGroupInfo(t *testing.T) { - server := build.DrandConfigs[buildconstants.DrandTestnet].Servers[0] - chainInfo := build.DrandConfigs[buildconstants.DrandTestnet].ChainInfoJSON + server := buildconstants.DrandConfigs[buildconstants.DrandTestnet].Servers[0] + chainInfo := buildconstants.DrandConfigs[buildconstants.DrandTestnet].ChainInfoJSON drandChain, err := dchain.InfoFromJSON(bytes.NewReader([]byte(chainInfo))) assert.NoError(t, err) @@ -38,7 +37,7 @@ func TestPrintGroupInfo(t *testing.T) { func TestMaxBeaconRoundForEpoch(t *testing.T) { todayTs := uint64(1652222222) - db, err := NewDrandBeacon(todayTs, build.BlockDelaySecs, nil, build.DrandConfigs[buildconstants.DrandTestnet]) + db, err := NewDrandBeacon(todayTs, buildconstants.BlockDelaySecs, nil, buildconstants.DrandConfigs[buildconstants.DrandTestnet]) assert.NoError(t, err) assert.True(t, db.IsChained()) mbr15 := db.MaxBeaconRoundForEpoch(network.Version15, 100) @@ -48,7 +47,7 @@ func TestMaxBeaconRoundForEpoch(t *testing.T) { func TestQuicknetIsChained(t *testing.T) { todayTs := uint64(1652222222) - db, err := NewDrandBeacon(todayTs, build.BlockDelaySecs, nil, build.DrandConfigs[buildconstants.DrandQuicknet]) + db, err := NewDrandBeacon(todayTs, buildconstants.BlockDelaySecs, nil, buildconstants.DrandConfigs[buildconstants.DrandQuicknet]) assert.NoError(t, err) assert.False(t, db.IsChained()) } diff --git a/chain/consensus/common.go b/chain/consensus/common.go index 9f832e69433..327f5a19fa9 100644 --- a/chain/consensus/common.go +++ b/chain/consensus/common.go @@ -23,7 +23,6 @@ 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/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/state" @@ -77,7 +76,7 @@ func CommonBlkChecks(ctx context.Context, sm *stmgr.StateManager, cs *store.Chai b *types.FullBlock, baseTs *types.TipSet) []async.ErrorFuture { h := b.Header msgsCheck := async.Err(func() error { - if b.Cid() == build.WhitelistedBlock { + if b.Cid() == buildconstants.WhitelistedBlock { return nil } @@ -473,7 +472,7 @@ func decodeAndCheckBlock(msg *pubsub.Message) (*types.BlockMsg, string, error) { return nil, "invalid", xerrors.Errorf("error decoding block: %w", err) } - if count := len(blk.BlsMessages) + len(blk.SecpkMessages); count > build.BlockMessageLimit { + if count := len(blk.BlsMessages) + len(blk.SecpkMessages); count > buildconstants.BlockMessageLimit { return nil, "too_many_messages", fmt.Errorf("block contains too many messages (%d)", count) } diff --git a/chain/consensus/compute_state.go b/chain/consensus/compute_state.go index b8fec248aca..1bdd47de4cc 100644 --- a/chain/consensus/compute_state.go +++ b/chain/consensus/compute_state.go @@ -26,7 +26,6 @@ import ( exported7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/exported" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/cron" @@ -168,7 +167,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, } } - ts := genesis.Timestamp + build.BlockDelaySecs*(uint64(i)) + ts := genesis.Timestamp + buildconstants.BlockDelaySecs*(uint64(i)) vmCron, err := makeVm(pstate, i, ts) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("making cron vm: %w", err) diff --git a/chain/consensus/filcns/filecoin.go b/chain/consensus/filcns/filecoin.go index 8565f361358..b5757a09142 100644 --- a/chain/consensus/filcns/filecoin.go +++ b/chain/consensus/filcns/filecoin.go @@ -20,11 +20,13 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/power" "github.com/filecoin-project/lotus/chain/actors/builtin/reward" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/beacon" "github.com/filecoin-project/lotus/chain/consensus" "github.com/filecoin-project/lotus/chain/rand" @@ -141,12 +143,12 @@ func (filec *FilecoinEC) ValidateBlock(ctx context.Context, b *types.FullBlock) } nulls := h.Height - (baseTs.Height() + 1) - if tgtTs := baseTs.MinTimestamp() + build.BlockDelaySecs*uint64(nulls+1); h.Timestamp != tgtTs { + if tgtTs := baseTs.MinTimestamp() + buildconstants.BlockDelaySecs*uint64(nulls+1); h.Timestamp != tgtTs { return xerrors.Errorf("block has wrong timestamp: %d != %d", h.Timestamp, tgtTs) } now := uint64(build.Clock.Now().Unix()) - if h.Timestamp > now+build.AllowableClockDriftSecs { + if h.Timestamp > now+buildconstants.AllowableClockDriftSecs { return xerrors.Errorf("block was from the future (now=%d, blk=%d): %w", now, h.Timestamp, consensus.ErrTemporal) } if h.Timestamp > now { @@ -256,7 +258,7 @@ func (filec *FilecoinEC) ValidateBlock(ctx context.Context, b *types.FullBlock) return xerrors.Errorf("failed to marshal miner address to cbor: %w", err) } - if h.Height > build.UpgradeSmokeHeight { + if h.Height > buildconstants.UpgradeSmokeHeight { buf.Write(baseTs.MinTicket().VRFProof) } @@ -265,7 +267,7 @@ func (filec *FilecoinEC) ValidateBlock(ctx context.Context, b *types.FullBlock) beaconBase = h.BeaconEntries[len(h.BeaconEntries)-1] } - vrfBase, err := rand.DrawRandomnessFromBase(beaconBase.Data, crypto.DomainSeparationTag_TicketProduction, h.Height-build.TicketRandomnessLookback, buf.Bytes()) + vrfBase, err := rand.DrawRandomnessFromBase(beaconBase.Data, crypto.DomainSeparationTag_TicketProduction, h.Height-buildconstants.TicketRandomnessLookback, buf.Bytes()) if err != nil { return xerrors.Errorf("failed to compute vrf base for ticket: %w", err) } @@ -394,12 +396,12 @@ func (filec *FilecoinEC) IsEpochInConsensusRange(epoch abi.ChainEpoch) bool { // // We use _our_ current head, not the expected head, because the network's head can lag on // catch-up (after a network outage). - if epoch < filec.store.GetHeaviestTipSet().Height()-build.Finality { + if epoch < filec.store.GetHeaviestTipSet().Height()-policy.ChainFinality { return false } now := uint64(build.Clock.Now().Unix()) - return epoch <= (abi.ChainEpoch((now-filec.genesis.MinTimestamp())/build.BlockDelaySecs) + MaxHeightDrift) + return epoch <= (abi.ChainEpoch((now-filec.genesis.MinTimestamp())/buildconstants.BlockDelaySecs) + MaxHeightDrift) } func (filec *FilecoinEC) minerIsValid(ctx context.Context, maddr address.Address, baseTs *types.TipSet) error { diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index becd91bc4e2..cd350c55d57 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -51,6 +51,7 @@ import ( "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/multisig" @@ -93,52 +94,52 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { var us stmgr.UpgradeSchedule updates := []stmgr.Upgrade{{ - Height: build.UpgradeBreezeHeight, + Height: buildconstants.UpgradeBreezeHeight, Network: network.Version1, Migration: UpgradeFaucetBurnRecovery, }, { - Height: build.UpgradeSmokeHeight, + Height: buildconstants.UpgradeSmokeHeight, Network: network.Version2, Migration: nil, }, { - Height: build.UpgradeIgnitionHeight, + Height: buildconstants.UpgradeIgnitionHeight, Network: network.Version3, Migration: UpgradeIgnition, }, { - Height: build.UpgradeRefuelHeight, + Height: buildconstants.UpgradeRefuelHeight, Network: network.Version3, Migration: UpgradeRefuel, }, { - Height: build.UpgradeAssemblyHeight, + Height: buildconstants.UpgradeAssemblyHeight, Network: network.Version4, Expensive: true, Migration: UpgradeActorsV2, }, { - Height: build.UpgradeTapeHeight, + Height: buildconstants.UpgradeTapeHeight, Network: network.Version5, Migration: nil, }, { - Height: build.UpgradeLiftoffHeight, + Height: buildconstants.UpgradeLiftoffHeight, Network: network.Version5, Migration: UpgradeLiftoff, }, { - Height: build.UpgradeKumquatHeight, + Height: buildconstants.UpgradeKumquatHeight, Network: network.Version6, Migration: nil, }, { - Height: build.UpgradeCalicoHeight, + Height: buildconstants.UpgradeCalicoHeight, Network: network.Version7, Migration: UpgradeCalico, }, { - Height: build.UpgradePersianHeight, + Height: buildconstants.UpgradePersianHeight, Network: network.Version8, Migration: nil, }, { - Height: build.UpgradeOrangeHeight, + Height: buildconstants.UpgradeOrangeHeight, Network: network.Version9, Migration: nil, }, { - Height: build.UpgradeTrustHeight, + Height: buildconstants.UpgradeTrustHeight, Network: network.Version10, Migration: UpgradeActorsV3, PreMigrations: []stmgr.PreMigration{{ @@ -154,11 +155,11 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeNorwegianHeight, + Height: buildconstants.UpgradeNorwegianHeight, Network: network.Version11, Migration: nil, }, { - Height: build.UpgradeTurboHeight, + Height: buildconstants.UpgradeTurboHeight, Network: network.Version12, Migration: UpgradeActorsV4, PreMigrations: []stmgr.PreMigration{{ @@ -174,7 +175,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeHyperdriveHeight, + Height: buildconstants.UpgradeHyperdriveHeight, Network: network.Version13, Migration: UpgradeActorsV5, PreMigrations: []stmgr.PreMigration{{ @@ -190,7 +191,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeChocolateHeight, + Height: buildconstants.UpgradeChocolateHeight, Network: network.Version14, Migration: UpgradeActorsV6, PreMigrations: []stmgr.PreMigration{{ @@ -206,7 +207,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeOhSnapHeight, + Height: buildconstants.UpgradeOhSnapHeight, Network: network.Version15, Migration: UpgradeActorsV7, PreMigrations: []stmgr.PreMigration{{ @@ -217,7 +218,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeSkyrHeight, + Height: buildconstants.UpgradeSkyrHeight, Network: network.Version16, Migration: UpgradeActorsV8, PreMigrations: []stmgr.PreMigration{{ @@ -228,7 +229,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeSharkHeight, + Height: buildconstants.UpgradeSharkHeight, Network: network.Version17, Migration: UpgradeActorsV9, PreMigrations: []stmgr.PreMigration{{ @@ -244,7 +245,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeHyggeHeight, + Height: buildconstants.UpgradeHyggeHeight, Network: network.Version18, Migration: UpgradeActorsV10, PreMigrations: []stmgr.PreMigration{{ @@ -255,7 +256,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeLightningHeight, + Height: buildconstants.UpgradeLightningHeight, Network: network.Version19, Migration: UpgradeActorsV11, PreMigrations: []stmgr.PreMigration{{ @@ -266,11 +267,11 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeThunderHeight, + Height: buildconstants.UpgradeThunderHeight, Network: network.Version20, Migration: nil, }, { - Height: build.UpgradeWatermelonHeight, + Height: buildconstants.UpgradeWatermelonHeight, Network: network.Version21, Migration: UpgradeActorsV12, PreMigrations: []stmgr.PreMigration{{ @@ -281,15 +282,15 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeWatermelonFixHeight, + Height: buildconstants.UpgradeWatermelonFixHeight, Network: network.Version21, Migration: buildUpgradeActorsV12MinerFix(calibnetv12BuggyMinerCID1, calibnetv12BuggyManifestCID2), }, { - Height: build.UpgradeWatermelonFix2Height, + Height: buildconstants.UpgradeWatermelonFix2Height, Network: network.Version21, Migration: buildUpgradeActorsV12MinerFix(calibnetv12BuggyMinerCID2, calibnetv12CorrectManifestCID1), }, { - Height: build.UpgradeDragonHeight, + Height: buildconstants.UpgradeDragonHeight, Network: network.Version22, Migration: UpgradeActorsV13, PreMigrations: []stmgr.PreMigration{{ @@ -300,11 +301,11 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { }}, Expensive: true, }, { - Height: build.UpgradeCalibrationDragonFixHeight, + Height: buildconstants.UpgradeCalibrationDragonFixHeight, Network: network.Version22, Migration: upgradeActorsV13VerifregFix(calibnetv13BuggyVerifregCID1, calibnetv13CorrectManifestCID1), }, { - Height: build.UpgradeWaffleHeight, + Height: buildconstants.UpgradeWaffleHeight, Network: network.Version23, Migration: UpgradeActorsV14, PreMigrations: []stmgr.PreMigration{{ @@ -572,7 +573,7 @@ func UpgradeFaucetBurnRecovery(ctx context.Context, sm *stmgr.StateManager, _ st return cid.Undef, xerrors.Errorf("checking final state balance failed: %w", err) } - exp := types.FromFil(build.FilBase) + exp := types.FromFil(buildconstants.FilBase) if !exp.Equals(total) { return cid.Undef, xerrors.Errorf("resultant state tree account balance was not correct: %s", total) } @@ -605,7 +606,7 @@ func UpgradeFaucetBurnRecovery(ctx context.Context, sm *stmgr.StateManager, _ st func UpgradeIgnition(ctx context.Context, sm *stmgr.StateManager, _ stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) { store := sm.ChainStore().ActorStore(ctx) - if build.UpgradeLiftoffHeight <= epoch { + if buildconstants.UpgradeLiftoffHeight <= epoch { return cid.Undef, xerrors.Errorf("liftoff height must be beyond ignition height") } @@ -634,7 +635,7 @@ func UpgradeIgnition(ctx context.Context, sm *stmgr.StateManager, _ stmgr.Migrat return cid.Undef, xerrors.Errorf("second split address: %w", err) } - err = resetGenesisMsigs0(ctx, sm, store, tree, build.UpgradeLiftoffHeight) + err = resetGenesisMsigs0(ctx, sm, store, tree, buildconstants.UpgradeLiftoffHeight) if err != nil { return cid.Undef, xerrors.Errorf("resetting genesis msig start epochs: %w", err) } @@ -948,7 +949,7 @@ func UpgradeLiftoff(ctx context.Context, sm *stmgr.StateManager, _ stmgr.Migrati } func UpgradeCalico(ctx context.Context, sm *stmgr.StateManager, _ stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) { - if build.BuildType != build.BuildMainnet { + if buildconstants.BuildType != buildconstants.BuildMainnet { return root, nil } @@ -1016,8 +1017,8 @@ func UpgradeActorsV3(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi return cid.Undef, xerrors.Errorf("getting state tree: %w", err) } - if build.BuildType == build.BuildMainnet { - err := stmgr.TerminateActor(ctx, tree, build.ZeroAddress, cb, epoch, ts) + if buildconstants.BuildType == buildconstants.BuildMainnet { + err := stmgr.TerminateActor(ctx, tree, buildconstants.ZeroAddress, cb, epoch, ts) if err != nil && !xerrors.Is(err, types.ErrActorNotFound) { return cid.Undef, xerrors.Errorf("deleting zero bls actor: %w", err) } @@ -2199,7 +2200,7 @@ func PreUpgradeActorsV13(ctx context.Context, sm *stmgr.StateManager, cache stmg config := migration.Config{ MaxWorkers: uint(workerCount), ProgressLogPeriod: time.Minute * 5, - UpgradeEpoch: build.UpgradeDragonHeight, + UpgradeEpoch: buildconstants.UpgradeDragonHeight, } _, err = upgradeActorsV13Common(ctx, sm, cache, lbRoot, epoch, lbts, config) @@ -2218,7 +2219,7 @@ func UpgradeActorsV13(ctx context.Context, sm *stmgr.StateManager, cache stmgr.M JobQueueSize: 1000, ResultQueueSize: 100, ProgressLogPeriod: 10 * time.Second, - UpgradeEpoch: build.UpgradeDragonHeight, + UpgradeEpoch: buildconstants.UpgradeDragonHeight, } newRoot, err := upgradeActorsV13Common(ctx, sm, cache, root, epoch, ts, config) if err != nil { diff --git a/chain/consensus/filcns/weight.go b/chain/consensus/filcns/weight.go index ab90840c5f8..12cf8db21b2 100644 --- a/chain/consensus/filcns/weight.go +++ b/chain/consensus/filcns/weight.go @@ -10,7 +10,7 @@ import ( big2 "github.com/filecoin-project/go-state-types/big" bstore "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin/power" "github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/store" @@ -72,10 +72,10 @@ func Weight(ctx context.Context, stateBs bstore.Blockstore, ts *types.TipSet) (t totalJ += b.ElectionProof.WinCount } - eWeight := big.NewInt((log2P * build.WRatioNum)) + eWeight := big.NewInt((log2P * buildconstants.WRatioNum)) eWeight = eWeight.Lsh(eWeight, 8) eWeight = eWeight.Mul(eWeight, new(big.Int).SetInt64(totalJ)) - eWeight = eWeight.Div(eWeight, big.NewInt(int64(build.BlocksPerEpoch*build.WRatioDen))) + eWeight = eWeight.Div(eWeight, big.NewInt(int64(buildconstants.BlocksPerEpoch*buildconstants.WRatioDen))) out = out.Add(out, eWeight) diff --git a/chain/events/events.go b/chain/events/events.go index a9da32cbba2..22f17ac1bb1 100644 --- a/chain/events/events.go +++ b/chain/events/events.go @@ -10,7 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" ) @@ -62,6 +62,6 @@ func newEventsWithGCConfidence(ctx context.Context, api EventHelperAPI, gcConfid } func NewEvents(ctx context.Context, api EventHelperAPI) (*Events, error) { - gcConfidence := 2 * build.ForkLengthThreshold + gcConfidence := 2 * policy.ChainFinality return newEventsWithGCConfidence(ctx, api, gcConfidence) } diff --git a/chain/events/events_test.go b/chain/events/events_test.go index a1309b90ab5..cb54a77ac36 100644 --- a/chain/events/events_test.go +++ b/chain/events/events_test.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" ) @@ -56,7 +56,7 @@ func newFakeCS(t *testing.T) *fakeCS { msgs: make(map[cid.Cid]fakeMsg), blkMsgs: make(map[cid.Cid]cid.Cid), tipsets: make(map[types.TipSetKey]*types.TipSet), - tsc: newTSCache(nil, 2*build.ForkLengthThreshold), + tsc: newTSCache(nil, 2*policy.ChainFinality), callNumber: map[string]int{}, waitSub: make(chan struct{}), } diff --git a/chain/exchange/protocol.go b/chain/exchange/protocol.go index 7a22de8a3fa..c1a9fcb9b94 100644 --- a/chain/exchange/protocol.go +++ b/chain/exchange/protocol.go @@ -7,7 +7,7 @@ import ( logging "github.com/ipfs/go-log/v2" "golang.org/x/xerrors" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" ) @@ -27,7 +27,7 @@ const ( // to partition and reassemble the requests if they go above the maximum. // (Also as a consequence of this temporarily removing the `const` // qualifier to avoid "const initializer [...] is not a constant" error.) -var MaxRequestLength = uint64(build.ForkLengthThreshold) +var MaxRequestLength = uint64(policy.ChainFinality) const ( // Extracted constants from the code. diff --git a/chain/exchange/protocol_encoding.go b/chain/exchange/protocol_encoding.go index 040dd0d4070..f94abf5c93b 100644 --- a/chain/exchange/protocol_encoding.go +++ b/chain/exchange/protocol_encoding.go @@ -7,7 +7,7 @@ import ( cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" types "github.com/filecoin-project/lotus/chain/types" ) @@ -79,7 +79,7 @@ func (t *messageIndices) UnmarshalCBOR(r io.Reader) (err error) { return fmt.Errorf("cbor input should be of type array") } - if extra > uint64(build.BlockMessageLimit) { + if extra > uint64(buildconstants.BlockMessageLimit) { return fmt.Errorf("cbor input had wrong number of fields") } @@ -109,7 +109,7 @@ func (t *messageIndices) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if len(t.v) > build.BlockMessageLimit { + if len(t.v) > buildconstants.BlockMessageLimit { return xerrors.Errorf("Slice value in field v was too long") } diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 9f8d0834d6e..9808a4f8cba 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -29,6 +29,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/beacon" "github.com/filecoin-project/lotus/chain/consensus" @@ -227,7 +228,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS VerifregRootKey: DefaultVerifregRootkeyActor, RemainderAccount: DefaultRemainderAccountActor, NetworkName: uuid.New().String(), - Timestamp: uint64(build.Clock.Now().Add(-500 * time.Duration(build.BlockDelaySecs) * time.Second).Unix()), + Timestamp: uint64(build.Clock.Now().Add(-500 * time.Duration(buildconstants.BlockDelaySecs) * time.Second).Unix()), } genb, err := genesis2.MakeGenesisBlock(context.TODO(), j, bs, sys, tpl) @@ -252,7 +253,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS miners := []address.Address{maddr1, maddr2} beac := beacon.Schedule{{Start: 0, Beacon: beacon.NewMockBeacon(time.Second)}} - //beac, err := drand.NewDrandBeacon(tpl.Timestamp, build.BlockDelaySecs) + //beac, err := drand.NewDrandBeacon(tpl.Timestamp, buildconstants.BlockDelaySecs) //if err != nil { //return nil, xerrors.Errorf("creating drand beacon: %w", err) //} @@ -372,11 +373,11 @@ func (cg *ChainGen) nextBlockProof(ctx context.Context, pts *types.TipSet, m add return nil, nil, nil, xerrors.Errorf("failed to cbor marshal address: %w", err) } - if round > build.UpgradeSmokeHeight { + if round > buildconstants.UpgradeSmokeHeight { buf.Write(pts.MinTicket().VRFProof) } - ticketRand, err := rand.DrawRandomnessFromBase(rbase.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes()) + ticketRand, err := rand.DrawRandomnessFromBase(rbase.Data, crypto.DomainSeparationTag_TicketProduction, round-buildconstants.TicketRandomnessLookback, buf.Bytes()) if err != nil { return nil, nil, nil, err } @@ -504,7 +505,7 @@ func (cg *ChainGen) makeBlock(parents *types.TipSet, m address.Address, vrfticke if cg.Timestamper != nil { ts = cg.Timestamper(parents, height-parents.Height()) } else { - ts = parents.MinTimestamp() + uint64(height-parents.Height())*build.BlockDelaySecs + ts = parents.MinTimestamp() + uint64(height-parents.Height())*buildconstants.BlockDelaySecs } fblk, err := filcns.NewFilecoinExpectedConsensus(cg.sm, nil, nil, nil).CreateBlock(context.TODO(), cg.w, &api.BlockTemplate{ diff --git a/chain/gen/genesis/f02_reward.go b/chain/gen/genesis/f02_reward.go index db32517f9cf..9cdf712fce6 100644 --- a/chain/gen/genesis/f02_reward.go +++ b/chain/gen/genesis/f02_reward.go @@ -11,7 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/manifest" bstore "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/reward" @@ -37,7 +37,7 @@ func SetupRewardActor(ctx context.Context, bs bstore.Blockstore, qaPower big.Int act := &types.Actor{ Code: actcid, - Balance: types.BigInt{Int: build.InitialRewardBalance}, + Balance: types.BigInt{Int: buildconstants.InitialRewardBalance}, Head: statecid, } diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index 69abfd223eb..0d41b2c9f89 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -24,7 +24,7 @@ import ( adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -325,7 +325,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge return nil, nil, xerrors.Errorf("summing account balances in state tree: %w", err) } - totalFil := big.Mul(big.NewInt(int64(build.FilBase)), big.NewInt(int64(build.FilecoinPrecision))) + totalFil := big.Mul(big.NewInt(int64(buildconstants.FilBase)), big.NewInt(int64(buildconstants.FilecoinPrecision))) remainingFil := big.Sub(totalFil, totalFilAllocated) if remainingFil.Sign() < 0 { return nil, nil, xerrors.Errorf("somehow overallocated filecoin (allocated = %s)", types.FIL(totalFilAllocated)) @@ -670,7 +670,7 @@ func MakeGenesisBlock(ctx context.Context, j journal.Journal, bs bstore.Blocksto Data: make([]byte, 32), }, }, - ParentBaseFee: abi.NewTokenAmount(build.InitialBaseFee), + ParentBaseFee: abi.NewTokenAmount(buildconstants.InitialBaseFee), } sb, err := b.ToStorageBlock() diff --git a/chain/lf3/manifest.go b/chain/lf3/manifest.go index 4e304a5eab1..6baf559e1ca 100644 --- a/chain/lf3/manifest.go +++ b/chain/lf3/manifest.go @@ -9,8 +9,8 @@ import ( "github.com/filecoin-project/go-f3/gpbft" "github.com/filecoin-project/go-f3/manifest" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/node/modules/dtypes" ) @@ -18,9 +18,9 @@ func NewManifestProvider(nn dtypes.NetworkName, ps *pubsub.PubSub) manifest.Mani m := manifest.LocalDevnetManifest() m.NetworkName = gpbft.NetworkName(nn) m.ECDelayMultiplier = 2. - m.ECPeriod = time.Duration(build.BlockDelaySecs) * time.Second + m.ECPeriod = time.Duration(buildconstants.BlockDelaySecs) * time.Second m.BootstrapEpoch = int64(buildconstants.F3BootstrapEpoch) - m.ECFinality = int64(build.Finality) + m.ECFinality = int64(policy.ChainFinality) m.CommitteeLookback = 5 switch manifestServerID, err := peer.Decode(buildconstants.ManifestServerID); { diff --git a/chain/market/fundmanager.go b/chain/market/fundmanager.go index fab71dfefe1..05e8bcfe925 100644 --- a/chain/market/fundmanager.go +++ b/chain/market/fundmanager.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin/v9/market" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/node/impl/full" @@ -724,6 +724,6 @@ func (env *fundManagerEnvironment) WithdrawFunds( } func (env *fundManagerEnvironment) WaitMsg(ctx context.Context, c cid.Cid) error { - _, err := env.api.StateWaitMsg(ctx, c, build.MessageConfidence, api.LookbackNoLimit, true) + _, err := env.api.StateWaitMsg(ctx, c, buildconstants.MessageConfidence, api.LookbackNoLimit, true) return err } diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index c7437c99168..8256fd164de 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -34,6 +34,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/consensus" "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/store" @@ -51,9 +52,9 @@ var futureDebug = false var rbfNumBig = types.NewInt(uint64(ReplaceByFeePercentageMinimum)) var rbfDenomBig = types.NewInt(100) -var RepublishInterval = time.Duration(10*build.BlockDelaySecs+build.PropagationDelaySecs) * time.Second +var RepublishInterval = time.Duration(10*buildconstants.BlockDelaySecs+buildconstants.PropagationDelaySecs) * time.Second -var minimumBaseFee = types.NewInt(uint64(build.MinimumBaseFee)) +var minimumBaseFee = types.NewInt(buildconstants.MinimumBaseFee) var baseFeeLowerBoundFactor = types.NewInt(10) var baseFeeLowerBoundFactorConservative = types.NewInt(100) @@ -115,7 +116,7 @@ type MessagePoolEvtMessage struct { func init() { // if the republish interval is too short compared to the pubsub timecache, adjust it - minInterval := pubsub.TimeCacheDuration + time.Duration(build.PropagationDelaySecs)*time.Second + minInterval := pubsub.TimeCacheDuration + time.Duration(buildconstants.PropagationDelaySecs)*time.Second if RepublishInterval < minInterval { RepublishInterval = minInterval } @@ -372,8 +373,8 @@ func (ms *msgSet) toSlice() []*types.SignedMessage { } func New(ctx context.Context, api Provider, ds dtypes.MetadataDS, us stmgr.UpgradeSchedule, netName dtypes.NetworkName, j journal.Journal) (*MessagePool, error) { - cache, _ := lru.New2Q[cid.Cid, crypto.Signature](build.BlsSignatureCacheSize) - verifcache, _ := lru.New2Q[string, struct{}](build.VerifSigCacheSize) + cache, _ := lru.New2Q[cid.Cid, crypto.Signature](buildconstants.BlsSignatureCacheSize) + verifcache, _ := lru.New2Q[string, struct{}](buildconstants.VerifSigCacheSize) stateNonceCache, _ := lru.New[stateNonceCacheKey, uint64](32768) // 32k * ~200 bytes = 6MB keycache, _ := lru.New[address.Address, address.Address](1_000_000) diff --git a/chain/messagepool/messagepool_test.go b/chain/messagepool/messagepool_test.go index 3c6800d7b2b..cb7fc5f8239 100644 --- a/chain/messagepool/messagepool_test.go +++ b/chain/messagepool/messagepool_test.go @@ -21,7 +21,7 @@ import ( builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/messagepool/gasguess" "github.com/filecoin-project/lotus/chain/types" @@ -187,7 +187,7 @@ func (tma *testMpoolAPI) StateDeterministicAddressAtFinality(ctx context.Context } func (tma *testMpoolAPI) StateNetworkVersion(ctx context.Context, h abi.ChainEpoch) network.Version { - return build.TestNetworkVersion + return buildconstants.TestNetworkVersion } func (tma *testMpoolAPI) MessagesForBlock(ctx context.Context, h *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) { diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index cfe68ed63ba..69a6e30ad00 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -14,7 +14,6 @@ import ( tbig "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/messagepool/gasguess" "github.com/filecoin-project/lotus/chain/types" @@ -77,9 +76,9 @@ func (mp *MessagePool) SelectMessages(ctx context.Context, ts *types.TipSet, tq } // one last sanity check - if len(sm.msgs) > build.BlockMessageLimit { - log.Errorf("message selection chose too many messages %d > %d", len(sm.msgs), build.BlockMessageLimit) - sm.msgs = sm.msgs[:build.BlockMessageLimit] + if len(sm.msgs) > buildconstants.BlockMessageLimit { + log.Errorf("message selection chose too many messages %d > %d", len(sm.msgs), buildconstants.BlockMessageLimit) + sm.msgs = sm.msgs[:buildconstants.BlockMessageLimit] } return sm.msgs, nil @@ -96,7 +95,7 @@ type selectedMessages struct { func (sm *selectedMessages) tryToAdd(mc *msgChain) bool { l := len(mc.msgs) - if build.BlockMessageLimit < l+len(sm.msgs) || sm.gasLimit < mc.gasLimit { + if buildconstants.BlockMessageLimit < l+len(sm.msgs) || sm.gasLimit < mc.gasLimit { return false } @@ -140,8 +139,8 @@ func (sm *selectedMessages) tryToAddWithDeps(mc *msgChain, mp *MessagePool, base return false } - if smMsgLimit > build.BlockMessageLimit-len(sm.msgs) { - smMsgLimit = build.BlockMessageLimit - len(sm.msgs) + if smMsgLimit > buildconstants.BlockMessageLimit-len(sm.msgs) { + smMsgLimit = buildconstants.BlockMessageLimit - len(sm.msgs) } var chainDeps []*msgChain @@ -193,7 +192,7 @@ func (sm *selectedMessages) tryToAddWithDeps(mc *msgChain, mp *MessagePool, base } func (sm *selectedMessages) trimChain(mc *msgChain, mp *MessagePool, baseFee types.BigInt) { - msgLimit := build.BlockMessageLimit - len(sm.msgs) + msgLimit := buildconstants.BlockMessageLimit - len(sm.msgs) if mc.sigType == crypto.SigTypeBLS { if msgLimit > sm.blsLimit { msgLimit = sm.blsLimit @@ -238,7 +237,7 @@ func (mp *MessagePool) selectMessagesOptimal(ctx context.Context, curTs, ts *typ result := mp.selectPriorityMessages(ctx, pending, baseFee, ts) // have we filled the block? - if result.gasLimit < minGas || len(result.msgs) >= build.BlockMessageLimit { + if result.gasLimit < minGas || len(result.msgs) >= buildconstants.BlockMessageLimit { return result, nil } @@ -270,7 +269,7 @@ func (mp *MessagePool) selectMessagesOptimal(ctx context.Context, curTs, ts *typ partitions := make([][]*msgChain, MaxBlocks) for i := 0; i < MaxBlocks && nextChain < len(chains); i++ { gasLimit := buildconstants.BlockGasLimit - msgLimit := build.BlockMessageLimit + msgLimit := buildconstants.BlockMessageLimit for nextChain < len(chains) { chain := chains[nextChain] nextChain++ @@ -411,7 +410,7 @@ tailLoop: // if we have room to spare, pick some random (non-negative) chains to fill the block // we pick randomly so that we minimize the probability of duplication among all block producers - if result.gasLimit >= minGas && len(result.msgs) <= build.BlockMessageLimit { + if result.gasLimit >= minGas && len(result.msgs) <= buildconstants.BlockMessageLimit { preRandomLength := len(result.msgs) startRandom := time.Now() @@ -419,7 +418,7 @@ tailLoop: for _, chain := range chains { // have we filled the block - if result.gasLimit < minGas || len(result.msgs) >= build.BlockMessageLimit { + if result.gasLimit < minGas || len(result.msgs) >= buildconstants.BlockMessageLimit { break } @@ -486,7 +485,7 @@ func (mp *MessagePool) selectMessagesGreedy(ctx context.Context, curTs, ts *type result := mp.selectPriorityMessages(ctx, pending, baseFee, ts) // have we filled the block? - if result.gasLimit < minGas || len(result.msgs) > build.BlockMessageLimit { + if result.gasLimit < minGas || len(result.msgs) > buildconstants.BlockMessageLimit { return result, nil } @@ -849,8 +848,8 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6 } // if we have more messages from this sender than can fit in a block, drop the extra ones - if len(msgs) > build.BlockMessageLimit { - msgs = msgs[:build.BlockMessageLimit] + if len(msgs) > buildconstants.BlockMessageLimit { + msgs = msgs[:buildconstants.BlockMessageLimit] } // ok, now we can construct the chains using the messages we have diff --git a/chain/messagepool/selection_test.go b/chain/messagepool/selection_test.go index 9379675a672..6f6901a3528 100644 --- a/chain/messagepool/selection_test.go +++ b/chain/messagepool/selection_test.go @@ -25,7 +25,6 @@ import ( builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/messagepool/gasguess" @@ -623,7 +622,7 @@ func TestMessageSelectionTrimmingMsgsBasic(t *testing.T) { tma.setBalance(a1, 1) // in FIL // create a larger than selectable chain - for i := 0; i < build.BlockMessageLimit; i++ { + for i := 0; i < buildconstants.BlockMessageLimit; i++ { m := makeTestMessage(w1, a1, a1, uint64(i), 300000, 100) mustAdd(t, mp, m) } @@ -681,7 +680,7 @@ func TestMessageSelectionTrimmingMsgsTwoSendersBasic(t *testing.T) { tma.setBalance(a2, 1) // in FIL // create 2 larger than selectable chains - for i := 0; i < build.BlockMessageLimit; i++ { + for i := 0; i < buildconstants.BlockMessageLimit; i++ { m := makeTestMessage(w1, a1, a2, uint64(i), 300000, 100) mustAdd(t, mp, m) // a2's messages are preferred @@ -705,7 +704,7 @@ func TestMessageSelectionTrimmingMsgsTwoSendersBasic(t *testing.T) { t.Fatal("selected messages gas limit exceeds block gas limit!") } - expected := build.BlockMessageLimit + expected := buildconstants.BlockMessageLimit if len(msgs) != expected { t.Fatalf("expected %d messages, but got %d", expected, len(msgs)) } @@ -786,7 +785,7 @@ func TestMessageSelectionTrimmingMsgsTwoSendersAdvanced(t *testing.T) { t.Fatal("selected messages gas limit exceeds block gas limit!") } - expected := build.BlockMessageLimit + expected := buildconstants.BlockMessageLimit if len(msgs) != expected { t.Fatalf("expected %d messages, but got %d", expected, len(msgs)) } @@ -1599,7 +1598,7 @@ readLoop: mp, tma := makeTestMpool() - block := tma.nextBlockWithHeight(uint64(build.UpgradeBreezeHeight + 10)) + block := tma.nextBlockWithHeight(uint64(buildconstants.UpgradeBreezeHeight + 10)) ts := mock.TipSet(block) tma.applyBlock(t, block) @@ -1775,7 +1774,7 @@ readLoop: mp, tma := makeTestMpool() - block := tma.nextBlockWithHeight(uint64(build.UpgradeHyggeHeight) + 10) + block := tma.nextBlockWithHeight(uint64(buildconstants.UpgradeHyggeHeight) + 10) ts := mock.TipSet(block) tma.applyBlock(t, block) diff --git a/chain/state/statetree_test.go b/chain/state/statetree_test.go index 9a221751a75..46dd15f6d15 100644 --- a/chain/state/statetree_test.go +++ b/chain/state/statetree_test.go @@ -13,7 +13,7 @@ import ( "github.com/filecoin-project/go-state-types/network" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -48,7 +48,7 @@ func BenchmarkStateTreeSet(b *testing.B) { func BenchmarkStateTreeSetFlush(b *testing.B) { //stm: @CHAIN_STATETREE_SET_ACTOR_001 cst := cbor.NewMemCborStore() - sv, err := VersionForNetwork(build.TestNetworkVersion) + sv, err := VersionForNetwork(buildconstants.TestNetworkVersion) if err != nil { b.Fatal(err) } @@ -85,7 +85,7 @@ func TestResolveCache(t *testing.T) { //stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001 //stm: @CHAIN_STATETREE_SNAPSHOT_001, @CHAIN_STATETREE_SNAPSHOT_CLEAR_001 cst := cbor.NewMemCborStore() - sv, err := VersionForNetwork(build.TestNetworkVersion) + sv, err := VersionForNetwork(buildconstants.TestNetworkVersion) if err != nil { t.Fatal(err) } @@ -189,7 +189,7 @@ func BenchmarkStateTree10kGetActor(b *testing.B) { //stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001 //stm: @CHAIN_STATETREE_FLUSH_001 cst := cbor.NewMemCborStore() - sv, err := VersionForNetwork(build.TestNetworkVersion) + sv, err := VersionForNetwork(buildconstants.TestNetworkVersion) if err != nil { b.Fatal(err) } @@ -237,7 +237,7 @@ func BenchmarkStateTree10kGetActor(b *testing.B) { func TestSetCache(t *testing.T) { //stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001 cst := cbor.NewMemCborStore() - sv, err := VersionForNetwork(build.TestNetworkVersion) + sv, err := VersionForNetwork(buildconstants.TestNetworkVersion) if err != nil { t.Fatal(err) } @@ -282,7 +282,7 @@ func TestSnapshots(t *testing.T) { ctx := context.Background() cst := cbor.NewMemCborStore() - sv, err := VersionForNetwork(build.TestNetworkVersion) + sv, err := VersionForNetwork(buildconstants.TestNetworkVersion) if err != nil { t.Fatal(err) } diff --git a/chain/stmgr/forks.go b/chain/stmgr/forks.go index c6c513e3a26..71c12e5162b 100644 --- a/chain/stmgr/forks.go +++ b/chain/stmgr/forks.go @@ -21,7 +21,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/specs-actors/v8/actors/migration/nv16" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -171,7 +171,7 @@ func (us UpgradeSchedule) GetNtwkVersion(e abi.ChainEpoch) (network.Version, err } } - return build.GenesisNetworkVersion, nil + return buildconstants.GenesisNetworkVersion, nil } func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, cb ExecMonitor, ts *types.TipSet) (cid.Cid, error) { diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index d88d7dfd154..2e29dc8e746 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -22,7 +22,7 @@ import ( "github.com/filecoin-project/specs-actors/v8/actors/migration/nv16" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" _init "github.com/filecoin-project/lotus/chain/actors/builtin/init" "github.com/filecoin-project/lotus/chain/actors/builtin/paych" @@ -186,7 +186,7 @@ func NewStateManager(cs *store.ChainStore, exec Executor, sys vm.SyscallBuilder, stateMigrations := make(map[abi.ChainEpoch]*migration, len(us)) expensiveUpgrades := make(map[abi.ChainEpoch]struct{}, len(us)) var networkVersions []versionSpec - lastVersion := build.GenesisNetworkVersion + lastVersion := buildconstants.GenesisNetworkVersion if len(us) > 0 { // If we have any upgrades, process them and create a version // schedule. diff --git a/chain/stmgr/supply.go b/chain/stmgr/supply.go index 8ee369750e8..48e713c28d8 100644 --- a/chain/stmgr/supply.go +++ b/chain/stmgr/supply.go @@ -14,7 +14,7 @@ import ( msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" _init "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -131,11 +131,11 @@ func (sm *StateManager) setupPostIgnitionVesting(ctx context.Context) error { for k, v := range totalsByEpoch { ns := msig0.State{ // In the pre-ignition logic, we incorrectly set this value in Fil, not attoFil, an off-by-10^18 error - InitialBalance: big.Mul(v, big.NewInt(int64(build.FilecoinPrecision))), + InitialBalance: big.Mul(v, big.NewInt(int64(buildconstants.FilecoinPrecision))), UnlockDuration: k, PendingTxns: cid.Undef, // In the pre-ignition logic, the start epoch was 0. This changes in the fork logic of the Ignition upgrade itself. - StartEpoch: build.UpgradeLiftoffHeight, + StartEpoch: buildconstants.UpgradeLiftoffHeight, } sm.postIgnitionVesting = append(sm.postIgnitionVesting, ns) } @@ -183,10 +183,10 @@ func (sm *StateManager) setupPostCalicoVesting(ctx context.Context) error { sm.postCalicoVesting = make([]msig0.State, 0, len(totalsByEpoch)) for k, v := range totalsByEpoch { ns := msig0.State{ - InitialBalance: big.Mul(v, big.NewInt(int64(build.FilecoinPrecision))), + InitialBalance: big.Mul(v, big.NewInt(int64(buildconstants.FilecoinPrecision))), UnlockDuration: k, PendingTxns: cid.Undef, - StartEpoch: build.UpgradeLiftoffHeight, + StartEpoch: buildconstants.UpgradeLiftoffHeight, } sm.postCalicoVesting = append(sm.postCalicoVesting, ns) } @@ -222,12 +222,12 @@ func (sm *StateManager) GetFilVested(ctx context.Context, height abi.ChainEpoch) } } - if height <= build.UpgradeIgnitionHeight { + if height <= buildconstants.UpgradeIgnitionHeight { for _, v := range sm.preIgnitionVesting { au := big.Sub(v.InitialBalance, v.AmountLocked(height)) vf = big.Add(vf, au) } - } else if height <= build.UpgradeCalicoHeight { + } else if height <= buildconstants.UpgradeCalicoHeight { for _, v := range sm.postIgnitionVesting { // In the pre-ignition logic, we simply called AmountLocked(height), assuming startEpoch was 0. // The start epoch changed in the Ignition upgrade. @@ -244,7 +244,7 @@ func (sm *StateManager) GetFilVested(ctx context.Context, height abi.ChainEpoch) } // After UpgradeAssemblyHeight these funds are accounted for in GetFilReserveDisbursed - if height <= build.UpgradeAssemblyHeight { + if height <= buildconstants.UpgradeAssemblyHeight { // continue to use preIgnitionGenInfos, nothing changed at the Ignition epoch vf = big.Add(vf, sm.genesisPledge) } @@ -259,7 +259,7 @@ func GetFilReserveDisbursed(ctx context.Context, st *state.StateTree) (abi.Token } // If money enters the reserve actor, this could lead to a negative term - return big.Sub(big.NewFromGo(build.InitialFilReserved), ract.Balance), nil + return big.Sub(big.NewFromGo(buildconstants.InitialFilReserved), ract.Balance), nil } func GetFilMined(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) { @@ -348,7 +348,7 @@ func (sm *StateManager) GetVMCirculatingSupplyDetailed(ctx context.Context, heig } filReserveDisbursed := big.Zero() - if height > build.UpgradeAssemblyHeight { + if height > buildconstants.UpgradeAssemblyHeight { filReserveDisbursed, err = GetFilReserveDisbursed(ctx, st) if err != nil { return api.CirculatingSupply{}, xerrors.Errorf("failed to calculate filReserveDisbursed: %w", err) diff --git a/chain/store/basefee.go b/chain/store/basefee.go index e5c8049efa0..40e8345ad18 100644 --- a/chain/store/basefee.go +++ b/chain/store/basefee.go @@ -9,7 +9,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -18,14 +17,14 @@ func ComputeNextBaseFee(baseFee types.BigInt, gasLimitUsed int64, noOfBlocks int // deta := gasLimitUsed/noOfBlocks - buildconstants.BlockGasTarget // change := baseFee * deta / BlockGasTarget // nextBaseFee = baseFee + change - // nextBaseFee = max(nextBaseFee, build.MinimumBaseFee) + // nextBaseFee = max(nextBaseFee, buildconstants.MinimumBaseFee) var delta int64 - if epoch > build.UpgradeSmokeHeight { + if epoch > buildconstants.UpgradeSmokeHeight { delta = gasLimitUsed / int64(noOfBlocks) delta -= buildconstants.BlockGasTarget } else { - delta = build.PackingEfficiencyDenom * gasLimitUsed / (int64(noOfBlocks) * build.PackingEfficiencyNum) + delta = buildconstants.PackingEfficiencyDenom * gasLimitUsed / (int64(noOfBlocks) * buildconstants.PackingEfficiencyNum) delta -= buildconstants.BlockGasTarget } @@ -39,17 +38,17 @@ func ComputeNextBaseFee(baseFee types.BigInt, gasLimitUsed int64, noOfBlocks int change := big.Mul(baseFee, big.NewInt(delta)) change = big.Div(change, big.NewInt(buildconstants.BlockGasTarget)) - change = big.Div(change, big.NewInt(build.BaseFeeMaxChangeDenom)) + change = big.Div(change, big.NewInt(buildconstants.BaseFeeMaxChangeDenom)) nextBaseFee := big.Add(baseFee, change) - if big.Cmp(nextBaseFee, big.NewInt(build.MinimumBaseFee)) < 0 { - nextBaseFee = big.NewInt(build.MinimumBaseFee) + if big.Cmp(nextBaseFee, big.NewInt(buildconstants.MinimumBaseFee)) < 0 { + nextBaseFee = big.NewInt(buildconstants.MinimumBaseFee) } return nextBaseFee } func (cs *ChainStore) ComputeBaseFee(ctx context.Context, ts *types.TipSet) (abi.TokenAmount, error) { - if build.UpgradeBreezeHeight >= 0 && ts.Height() > build.UpgradeBreezeHeight && ts.Height() < build.UpgradeBreezeHeight+build.BreezeGasTampingDuration { + if buildconstants.UpgradeBreezeHeight >= 0 && ts.Height() > buildconstants.UpgradeBreezeHeight && ts.Height() < buildconstants.UpgradeBreezeHeight+buildconstants.BreezeGasTampingDuration { return abi.NewTokenAmount(100), nil } diff --git a/chain/store/basefee_test.go b/chain/store/basefee_test.go index fa22f7d042c..809bea15c22 100644 --- a/chain/store/basefee_test.go +++ b/chain/store/basefee_test.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/assert" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -32,10 +31,10 @@ func TestBaseFee(t *testing.T) { for _, test := range tests { test := test t.Run(fmt.Sprintf("%v", test), func(t *testing.T) { - preSmoke := ComputeNextBaseFee(types.NewInt(test.basefee), test.limitUsed, test.noOfBlocks, build.UpgradeSmokeHeight-1) + preSmoke := ComputeNextBaseFee(types.NewInt(test.basefee), test.limitUsed, test.noOfBlocks, buildconstants.UpgradeSmokeHeight-1) assert.Equal(t, fmt.Sprintf("%d", test.preSmoke), preSmoke.String()) - postSmoke := ComputeNextBaseFee(types.NewInt(test.basefee), test.limitUsed, test.noOfBlocks, build.UpgradeSmokeHeight+1) + postSmoke := ComputeNextBaseFee(types.NewInt(test.basefee), test.limitUsed, test.noOfBlocks, buildconstants.UpgradeSmokeHeight+1) assert.Equal(t, fmt.Sprintf("%d", test.postSmoke), postSmoke.String()) }) } diff --git a/chain/store/messages.go b/chain/store/messages.go index 4129a9199a5..60a1eaa608f 100644 --- a/chain/store/messages.go +++ b/chain/store/messages.go @@ -14,7 +14,7 @@ import ( blockadt "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/types" ) @@ -117,7 +117,7 @@ func (cs *ChainStore) BlockMsgsForTipset(ctx context.Context, ts *types.TipSet) useIds := false selectMsg := func(m *types.Message) (bool, error) { var sender address.Address - if ts.Height() >= build.UpgradeHyperdriveHeight { + if ts.Height() >= buildconstants.UpgradeHyperdriveHeight { if useIds { sender, err = st.LookupIDAddress(m.From) if err != nil { diff --git a/chain/store/snapshot.go b/chain/store/snapshot.go index ca483c2ef17..c4b9f371747 100644 --- a/chain/store/snapshot.go +++ b/chain/store/snapshot.go @@ -24,12 +24,12 @@ 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/builtin" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" ) -const TipsetkeyBackfillRange = 2 * build.Finality +const TipsetkeyBackfillRange = 2 * policy.ChainFinality func (cs *ChainStore) UnionStore() bstore.Blockstore { return bstore.Union(cs.stateBlockstore, cs.chainBlockstore) @@ -734,7 +734,7 @@ func (cs *ChainStore) WalkSnapshot(ctx context.Context, ts *types.TipSet, inclRe } log.Infow("export started") - exportStart := build.Clock.Now() + exportStart := time.Now() for len(blocksToWalk) > 0 { next := blocksToWalk[0] @@ -744,7 +744,7 @@ func (cs *ChainStore) WalkSnapshot(ctx context.Context, ts *types.TipSet, inclRe } } - log.Infow("export finished", "duration", build.Clock.Now().Sub(exportStart).Seconds()) + log.Infow("export finished", "duration", time.Since(exportStart).Seconds()) return nil } diff --git a/chain/store/store.go b/chain/store/store.go index 9c8c2b2a1e3..af7759d2b85 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -30,8 +30,9 @@ 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/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/metrics" @@ -521,7 +522,7 @@ func (cs *ChainStore) exceedsForkLength(ctx context.Context, synced, external *t // `forkLength`: number of tipsets we need to walk back from the our `synced` // chain to the common ancestor with the new `external` head in order to // adopt the fork. - for forkLength := 0; forkLength < int(build.ForkLengthThreshold); forkLength++ { + for forkLength := 0; forkLength < int(policy.ChainFinality); forkLength++ { // First walk back as many tipsets in the external chain to match the // `synced` height to compare them. If we go past the `synced` height // the subsequent match will fail but it will still be useful to get @@ -810,7 +811,7 @@ func (cs *ChainStore) SetCheckpoint(ctx context.Context, ts *types.TipSet) error defer cs.heaviestLk.Unlock() // Otherwise, this operation could get _very_ expensive. - if cs.heaviest.Height()-ts.Height() > build.ForkLengthThreshold { + if cs.heaviest.Height()-ts.Height() > policy.ChainFinality { return xerrors.Errorf("cannot set a checkpoint before the fork threshold") } @@ -1018,7 +1019,7 @@ func (cs *ChainStore) AddToTipSetTracker(ctx context.Context, b *types.BlockHead // Seems good enough to me for height := range cs.tipsets { - if height < b.Height-build.Finality { + if height < b.Height-policy.ChainFinality { delete(cs.tipsets, height) } break @@ -1031,7 +1032,7 @@ func (cs *ChainStore) AddToTipSetTracker(ctx context.Context, b *types.BlockHead // PersistTipsets writes the provided blocks and the TipSetKey objects to the blockstore func (cs *ChainStore) PersistTipsets(ctx context.Context, tipsets []*types.TipSet) error { - toPersist := make([]*types.BlockHeader, 0, len(tipsets)*int(build.BlocksPerEpoch)) + toPersist := make([]*types.BlockHeader, 0, len(tipsets)*int(buildconstants.BlocksPerEpoch)) tsBlks := make([]block.Block, 0, len(tipsets)) for _, ts := range tipsets { toPersist = append(toPersist, ts.Blocks()...) diff --git a/chain/sub/incoming.go b/chain/sub/incoming.go index 42d270a95f5..e8046bc6fe8 100644 --- a/chain/sub/incoming.go +++ b/chain/sub/incoming.go @@ -24,6 +24,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/consensus" "github.com/filecoin-project/lotus/chain/messagepool" @@ -47,7 +48,7 @@ var msgCidPrefix = cid.Prefix{ func HandleIncomingBlocks(ctx context.Context, bsub *pubsub.Subscription, s *chain.Syncer, bs bserv.BlockService, cmgr connmgr.ConnManager) { // Timeout after (block time + propagation delay). This is useless at // this point. - timeout := time.Duration(build.BlockDelaySecs+build.PropagationDelaySecs) * time.Second + timeout := time.Duration(buildconstants.BlockDelaySecs+buildconstants.PropagationDelaySecs) * time.Second for { msg, err := bsub.Next(ctx) diff --git a/chain/sync.go b/chain/sync.go index ded6ab1b549..948ebe93dfa 100644 --- a/chain/sync.go +++ b/chain/sync.go @@ -26,6 +26,8 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/pubsub" + "github.com/filecoin-project/lotus/build/buildconstants" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/consensus" "github.com/filecoin-project/lotus/node/modules/dtypes" @@ -171,14 +173,14 @@ func (syncer *Syncer) Start() { func (syncer *Syncer) runMetricsTricker(tickerCtx context.Context) { genesisTime := time.Unix(int64(syncer.Genesis.MinTimestamp()), 0) - ticker := build.Clock.Ticker(time.Duration(build.BlockDelaySecs) * time.Second) + ticker := build.Clock.Ticker(time.Duration(buildconstants.BlockDelaySecs) * time.Second) defer ticker.Stop() for { select { case <-ticker.C: sinceGenesis := build.Clock.Now().Sub(genesisTime) - expectedHeight := int64(sinceGenesis.Seconds()) / int64(build.BlockDelaySecs) + expectedHeight := int64(sinceGenesis.Seconds()) / int64(buildconstants.BlockDelaySecs) stats.Record(tickerCtx, metrics.ChainNodeHeightExpected.M(expectedHeight)) case <-tickerCtx.Done(): @@ -287,7 +289,7 @@ func (syncer *Syncer) IncomingBlocks(ctx context.Context) (<-chan *types.BlockHe // messages within this block. If validation passes, it stores the messages in // the underlying IPLD block store. func (syncer *Syncer) ValidateMsgMeta(fblk *types.FullBlock) error { - if msgc := len(fblk.BlsMessages) + len(fblk.SecpkMessages); msgc > build.BlockMessageLimit { + if msgc := len(fblk.BlsMessages) + len(fblk.SecpkMessages); msgc > buildconstants.BlockMessageLimit { return xerrors.Errorf("block %s has too many messages (%d)", fblk.Header.Cid(), msgc) } @@ -873,7 +875,7 @@ var ErrForkCheckpoint = fmt.Errorf("fork would require us to diverge from checkp // syncFork tries to obtain the chain fragment that links a fork into a common // ancestor in our view of the chain. // -// If the fork is too long (build.ForkLengthThreshold), or would cause us to diverge from the checkpoint (ErrForkCheckpoint), +// If the fork is too long (policy.ChainFinality), or would cause us to diverge from the checkpoint (ErrForkCheckpoint), // we add the entire subchain to the denylist. Else, we find the common ancestor, and add the missing chain // fragment until the fork point to the returned []TipSet. func (syncer *Syncer) syncFork(ctx context.Context, incoming *types.TipSet, known *types.TipSet, ignoreCheckpoint bool) ([]*types.TipSet, error) { @@ -917,7 +919,7 @@ func (syncer *Syncer) syncFork(ctx context.Context, incoming *types.TipSet, know // TODO: Does this mean we always ask for ForkLengthThreshold blocks from the network, even if we just need, like, 2? Yes. // Would it not be better to ask in smaller chunks, given that an ~ForkLengthThreshold is very rare? - tips, err := syncer.Exchange.GetBlocks(ctx, incoming.Parents(), int(build.ForkLengthThreshold)) + tips, err := syncer.Exchange.GetBlocks(ctx, incoming.Parents(), int(policy.ChainFinality)) if err != nil { return nil, err } @@ -949,7 +951,7 @@ func (syncer *Syncer) syncFork(ctx context.Context, incoming *types.TipSet, know // Walk back one block in our synced chain to try to meet the fork's // height. forkLengthInHead++ - if forkLengthInHead > int(build.ForkLengthThreshold) { + if forkLengthInHead > int(policy.ChainFinality) { return nil, ErrForkTooLong } @@ -1057,7 +1059,7 @@ func (syncer *Syncer) iterFullTipsets(ctx context.Context, headers []*types.TipS func checkMsgMeta(ts *types.TipSet, allbmsgs []*types.Message, allsmsgs []*types.SignedMessage, bmi, smi [][]uint64) error { for bi, b := range ts.Blocks() { - if msgc := len(bmi[bi]) + len(smi[bi]); msgc > build.BlockMessageLimit { + if msgc := len(bmi[bi]) + len(smi[bi]); msgc > buildconstants.BlockMessageLimit { return fmt.Errorf("block %q has too many messages (%d)", b.Cid(), msgc) } diff --git a/chain/sync_manager.go b/chain/sync_manager.go index 2f54ac8bb7e..119b34139c2 100644 --- a/chain/sync_manager.go +++ b/chain/sync_manager.go @@ -14,11 +14,12 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) var ( - BootstrapPeerThreshold = build.BootstrapPeerThreshold + BootstrapPeerThreshold = buildconstants.BootstrapPeerThreshold RecentSyncBufferSize = 10 MaxSyncWorkers = 5 diff --git a/chain/sync_test.go b/chain/sync_test.go index 1b556f87952..4cff5767ed5 100644 --- a/chain/sync_test.go +++ b/chain/sync_test.go @@ -21,6 +21,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/gen" @@ -518,7 +519,7 @@ func TestSyncBadTimestamp(t *testing.T) { base := tu.g.CurTipset tu.g.Timestamper = func(pts *types.TipSet, tl abi.ChainEpoch) uint64 { - return pts.MinTimestamp() + (build.BlockDelaySecs / 2) + return pts.MinTimestamp() + (buildconstants.BlockDelaySecs / 2) } fmt.Println("BASE: ", base.Cids()) diff --git a/chain/types/ethtypes/eth_1559_transactions.go b/chain/types/ethtypes/eth_1559_transactions.go index 1af2598735e..14cd3523df1 100644 --- a/chain/types/ethtypes/eth_1559_transactions.go +++ b/chain/types/ethtypes/eth_1559_transactions.go @@ -9,7 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/big" typescrypto "github.com/filecoin-project/go-state-types/crypto" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -30,7 +30,7 @@ type Eth1559TxArgs struct { } func (tx *Eth1559TxArgs) ToUnsignedFilecoinMessage(from address.Address) (*types.Message, error) { - if tx.ChainID != build.Eip155ChainId { + if tx.ChainID != buildconstants.Eip155ChainId { return nil, fmt.Errorf("invalid chain id: %d", tx.ChainID) } mi, err := getFilecoinMethodInfo(tx.To, tx.Input) @@ -123,7 +123,7 @@ func (tx *Eth1559TxArgs) ToEthTx(smsg *types.SignedMessage) (EthTx, error) { gasPremium := EthBigInt(tx.MaxPriorityFeePerGas) ethTx := EthTx{ - ChainID: EthUint64(build.Eip155ChainId), + ChainID: EthUint64(buildconstants.Eip155ChainId), Type: EIP1559TxType, Nonce: EthUint64(tx.Nonce), Hash: hash, @@ -330,7 +330,7 @@ func Eth1559TxArgsFromUnsignedFilecoinMessage(msg *types.Message) (*Eth1559TxArg } return &Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Nonce: int(msg.Nonce), To: to, Value: msg.Value, diff --git a/chain/types/ethtypes/eth_1559_transactions_test.go b/chain/types/ethtypes/eth_1559_transactions_test.go index 69835925fef..abfa61f421d 100644 --- a/chain/types/ethtypes/eth_1559_transactions_test.go +++ b/chain/types/ethtypes/eth_1559_transactions_test.go @@ -21,6 +21,9 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/lib/sigs" _ "github.com/filecoin-project/lotus/lib/sigs/delegated" + + // needed for actors.GetActorCodeID() to work + _ "github.com/filecoin-project/lotus/build" ) type TxTestcase struct { diff --git a/chain/types/ethtypes/eth_legacy_155_transactions.go b/chain/types/ethtypes/eth_legacy_155_transactions.go index bad8a0bbfa1..6dc3f688f57 100644 --- a/chain/types/ethtypes/eth_legacy_155_transactions.go +++ b/chain/types/ethtypes/eth_legacy_155_transactions.go @@ -7,7 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/big" typescrypto "github.com/filecoin-project/go-state-types/crypto" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -43,7 +43,7 @@ func (tx *EthLegacy155TxArgs) ToEthTx(smsg *types.SignedMessage) (EthTx, error) gasPrice := EthBigInt(tx.legacyTx.GasPrice) ethTx := EthTx{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Type: EthLegacyTxType, Nonce: EthUint64(tx.legacyTx.Nonce), Hash: hash, @@ -163,7 +163,7 @@ func (tx *EthLegacy155TxArgs) ToVerifiableSignature(sig []byte) ([]byte, error) } // See https://github.com/ethereum/go-ethereum/blob/86a1f0c39494c8f5caddf6bd9fbddd4bdfa944fd/core/types/transaction_signing.go#L424 - chainIdMul := big.Mul(big.NewIntUnsigned(build.Eip155ChainId), big.NewInt(2)) + chainIdMul := big.Mul(big.NewIntUnsigned(buildconstants.Eip155ChainId), big.NewInt(2)) vValue = big.Sub(vValue, chainIdMul) vValue = big.Sub(vValue, big8) @@ -241,7 +241,7 @@ func (tx *EthLegacy155TxArgs) packTxFields() ([]interface{}, error) { return nil, err } - chainIdBigInt := big.NewIntUnsigned(build.Eip155ChainId) + chainIdBigInt := big.NewIntUnsigned(buildconstants.Eip155ChainId) chainId, err := formatBigInt(chainIdBigInt) if err != nil { return nil, err @@ -272,8 +272,8 @@ func (tx *EthLegacy155TxArgs) packTxFields() ([]interface{}, error) { func validateEIP155ChainId(v big.Int) error { chainId := deriveEIP155ChainId(v) - if !chainId.Equals(big.NewIntUnsigned(build.Eip155ChainId)) { - return fmt.Errorf("invalid chain id, expected %d, got %s", build.Eip155ChainId, chainId.String()) + if !chainId.Equals(big.NewIntUnsigned(buildconstants.Eip155ChainId)) { + return fmt.Errorf("invalid chain id, expected %d, got %s", buildconstants.Eip155ChainId, chainId.String()) } return nil } diff --git a/chain/types/ethtypes/eth_transactions.go b/chain/types/ethtypes/eth_transactions.go index d1713248a6d..e147a3530c9 100644 --- a/chain/types/ethtypes/eth_transactions.go +++ b/chain/types/ethtypes/eth_transactions.go @@ -17,7 +17,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" typescrypto "github.com/filecoin-project/go-state-types/crypto" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -40,8 +40,8 @@ var ( ) func init() { - EthLegacy155TxSignatureLen0 = calcEIP155TxSignatureLen(build.Eip155ChainId, 35) - EthLegacy155TxSignatureLen1 = calcEIP155TxSignatureLen(build.Eip155ChainId, 36) + EthLegacy155TxSignatureLen0 = calcEIP155TxSignatureLen(buildconstants.Eip155ChainId, 35) + EthLegacy155TxSignatureLen1 = calcEIP155TxSignatureLen(buildconstants.Eip155ChainId, 36) } // EthTransaction defines the interface for Ethereum-like transactions. @@ -140,7 +140,7 @@ func EthTransactionFromSignedFilecoinMessage(smsg *types.SignedMessage) (EthTran switch len(smsg.Signature.Data) { case EthEIP1559TxSignatureLen: tx := Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Nonce: int(smsg.Message.Nonce), To: to, Value: smsg.Message.Value, diff --git a/chain/vm/fvm.go b/chain/vm/fvm.go index 6b631d4456a..77103d31d8d 100644 --- a/chain/vm/fvm.go +++ b/chain/vm/fvm.go @@ -95,10 +95,10 @@ func (x *FvmExtern) VerifyConsensusFault(ctx context.Context, a, b, extra []byte } // workaround chain halt - if buildconstants.IsNearUpgrade(blockA.Height, build.UpgradeWatermelonFixHeight) { + if buildconstants.IsNearUpgrade(blockA.Height, buildconstants.UpgradeWatermelonFixHeight) { return ret, totalGas } - if buildconstants.IsNearUpgrade(blockB.Height, build.UpgradeWatermelonFixHeight) { + if buildconstants.IsNearUpgrade(blockB.Height, buildconstants.UpgradeWatermelonFixHeight) { return ret, totalGas } @@ -275,13 +275,13 @@ func defaultFVMOpts(ctx context.Context, opts *VMOpts) (*ffi.FVMOpts, error) { }, Epoch: opts.Epoch, Timestamp: opts.Timestamp, - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, BaseFee: opts.BaseFee, BaseCircSupply: circToReport, NetworkVersion: opts.NetworkVersion, StateBase: opts.StateBase, Tracing: opts.Tracing || EnableDetailedTracing, - Debug: build.ActorDebugging, + Debug: buildconstants.ActorDebugging, }, nil } diff --git a/chain/vm/gas.go b/chain/vm/gas.go index 4bd63bf9c08..43e023a40ce 100644 --- a/chain/vm/gas.go +++ b/chain/vm/gas.go @@ -6,13 +6,12 @@ import ( "github.com/ipfs/go-cid" "github.com/filecoin-project/go-address" - addr "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/crypto" vmr "github.com/filecoin-project/specs-actors/v7/actors/runtime" proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" ) type GasCharge struct { @@ -135,7 +134,7 @@ var Prices = map[abi.ChainEpoch]Pricelist{ verifyPostDiscount: true, verifyConsensusFault: 495422, }, - build.UpgradeCalicoHeight: &pricelistV0{ + buildconstants.UpgradeCalicoHeight: &pricelistV0{ computeGasMulti: 1, storageGasMulti: 1300, @@ -213,7 +212,7 @@ var Prices = map[abi.ChainEpoch]Pricelist{ verifyReplicaUpdate: 36316136, }, - build.UpgradeHyggeHeight: &pricelistV0{ + buildconstants.UpgradeHyggeHeight: &pricelistV0{ computeGasMulti: 1, storageGasMulti: 1300, // only applies to messages/return values. @@ -251,7 +250,7 @@ type pricedSyscalls struct { } // Verifies that a signature is valid for an address and plaintext. -func (ps pricedSyscalls) VerifySignature(signature crypto.Signature, signer addr.Address, plaintext []byte) error { +func (ps pricedSyscalls) VerifySignature(signature crypto.Signature, signer address.Address, plaintext []byte) error { c, err := ps.pl.OnVerifySignature(signature.Type, len(plaintext)) if err != nil { return err diff --git a/chain/vm/mkactor.go b/chain/vm/mkactor.go index 3a0ee66996c..38f8eee3450 100644 --- a/chain/vm/mkactor.go +++ b/chain/vm/mkactor.go @@ -19,7 +19,7 @@ import ( builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/aerrors" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -45,7 +45,7 @@ func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, add return nil, address.Undef, err } - if addr == build.ZeroAddress && rt.NetworkVersion() >= network.Version10 { + if addr == buildconstants.ZeroAddress && rt.NetworkVersion() >= network.Version10 { return nil, address.Undef, aerrors.New(exitcode.ErrIllegalArgument, "cannot create the zero bls actor") } diff --git a/chain/vm/syscalls.go b/chain/vm/syscalls.go index 0aa29b5b974..95add415fed 100644 --- a/chain/vm/syscalls.go +++ b/chain/vm/syscalls.go @@ -20,7 +20,6 @@ import ( runtime7 "github.com/filecoin-project/specs-actors/v7/actors/runtime" proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -116,10 +115,10 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime7.Conse } // workaround chain halt - if buildconstants.IsNearUpgrade(blockA.Height, build.UpgradeOrangeHeight) { + if buildconstants.IsNearUpgrade(blockA.Height, buildconstants.UpgradeOrangeHeight) { return nil, xerrors.Errorf("consensus reporting disabled around Upgrade Orange") } - if buildconstants.IsNearUpgrade(blockB.Height, build.UpgradeOrangeHeight) { + if buildconstants.IsNearUpgrade(blockB.Height, buildconstants.UpgradeOrangeHeight) { return nil, xerrors.Errorf("consensus reporting disabled around Upgrade Orange") } diff --git a/chain/vm/vm.go b/chain/vm/vm.go index f6f93a0d3da..c47983df4c3 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -26,6 +26,7 @@ import ( "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/aerrors" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -640,7 +641,7 @@ func (vm *LegacyVM) ShouldBurn(ctx context.Context, st *state.StateTree, msg *ty // Check to see if we should burn funds. We avoid burning on successful // window post. This won't catch _indirect_ window post calls, but this // is the best we can get for now. - if vm.blockHeight > build.UpgradeClausHeight && errcode == exitcode.Ok && msg.Method == builtin_types.MethodsMiner.SubmitWindowedPoSt { + if vm.blockHeight > buildconstants.UpgradeClausHeight && errcode == exitcode.Ok && msg.Method == builtin_types.MethodsMiner.SubmitWindowedPoSt { // Ok, we've checked the _method_, but we still need to check // the target actor. It would be nice if we could just look at // the trace, but I'm not sure if that's safe? diff --git a/cli/chain.go b/cli/chain.go index d9f6dc0bd96..f941061d5d9 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -36,9 +36,9 @@ import ( "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api" "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" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/consensus" "github.com/filecoin-project/lotus/chain/types" ) @@ -1099,8 +1099,8 @@ var ChainExportCmd = &cli.Command{ } rsrs := abi.ChainEpoch(cctx.Int64("recent-stateroots")) - if cctx.IsSet("recent-stateroots") && rsrs < build.Finality { - return fmt.Errorf("\"recent-stateroots\" has to be greater than %d", build.Finality) + if cctx.IsSet("recent-stateroots") && rsrs < policy.ChainFinality { + return fmt.Errorf("\"recent-stateroots\" has to be greater than %d", policy.ChainFinality) } fi, err := createExportFile(cctx.App, cctx.Args().First()) diff --git a/cli/filplus.go b/cli/filplus.go index cf37a10f331..ae380afa102 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -30,7 +30,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/datacap" @@ -134,7 +134,7 @@ var filplusVerifyClientCmd = &cli.Command{ fmt.Printf("message sent, now waiting on cid: %s\n", smsg.Cid()) - mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -614,7 +614,7 @@ var filplusRemoveExpiredAllocationsCmd = &cli.Command{ fmt.Printf("message sent, now waiting on cid: %s\n", smsg.Cid()) - mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -707,7 +707,7 @@ var filplusRemoveExpiredClaimsCmd = &cli.Command{ fmt.Printf("message sent, now waiting on cid: %s\n", smsg.Cid()) - mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -973,7 +973,7 @@ If the client id different then claim can be extended up to maximum 5 years from &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, &cli.IntFlag{ Name: "batch-size", diff --git a/cli/info.go b/cli/info.go index 482f01d98f2..411a3169eb3 100644 --- a/cli/info.go +++ b/cli/info.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/api/v1api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/journal/alerting" ) @@ -183,9 +183,9 @@ func SyncBasefeeCheck(ctx context.Context, fullapi v1api.FullNode) error { } switch { - case time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs*3/2): // within 1.5 epochs + case time.Now().Unix()-int64(head.MinTimestamp()) < int64(buildconstants.BlockDelaySecs*3/2): // within 1.5 epochs fmt.Printf("[%s]", color.GreenString("sync ok")) - case time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs*5): // within 5 epochs + case time.Now().Unix()-int64(head.MinTimestamp()) < int64(buildconstants.BlockDelaySecs*5): // within 5 epochs fmt.Printf("[%s]", color.YellowString("sync slow (%s behind)", time.Now().Sub(time.Unix(int64(head.MinTimestamp()), 0)).Truncate(time.Second))) default: fmt.Printf("[%s]", color.RedString("sync behind! (%s behind)", time.Now().Sub(time.Unix(int64(head.MinTimestamp()), 0)).Truncate(time.Second))) diff --git a/cli/multisig.go b/cli/multisig.go index 948d5006661..6e45e4bb333 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -23,11 +23,12 @@ import ( msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/multisig" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/consensus" "github.com/filecoin-project/lotus/chain/types" ) @@ -39,7 +40,7 @@ var MultisigCmd = &cli.Command{ &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, }, Subcommands: []*cli.Command{ @@ -161,7 +162,7 @@ var msigCreateCmd = &cli.Command{ fmt.Println("waiting for confirmation..") // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -484,7 +485,7 @@ var msigProposeCmd = &cli.Command{ fmt.Println("sent proposal in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -633,7 +634,7 @@ var msigApproveCmd = &cli.Command{ fmt.Println("sent approval in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -758,7 +759,7 @@ var msigCancelCmd = &cli.Command{ fmt.Println("sent cancel in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -838,7 +839,7 @@ var msigRemoveProposeCmd = &cli.Command{ fmt.Println("sent remove proposal in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -958,7 +959,7 @@ var msigAddProposeCmd = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "sent add proposal in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1049,7 +1050,7 @@ var msigAddApproveCmd = &cli.Command{ fmt.Println("sent add approval in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1135,7 +1136,7 @@ var msigAddCancelCmd = &cli.Command{ fmt.Println("sent add cancellation in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1216,7 +1217,7 @@ var msigSwapProposeCmd = &cli.Command{ fmt.Println("sent swap proposal in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1307,7 +1308,7 @@ var msigSwapApproveCmd = &cli.Command{ fmt.Println("sent swap approval in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1393,7 +1394,7 @@ var msigSwapCancelCmd = &cli.Command{ fmt.Println("sent swap cancellation in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1489,7 +1490,7 @@ var msigLockProposeCmd = &cli.Command{ fmt.Println("sent lock proposal in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1595,7 +1596,7 @@ var msigLockApproveCmd = &cli.Command{ fmt.Println("sent lock approval in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1696,7 +1697,7 @@ var msigLockCancelCmd = &cli.Command{ fmt.Println("sent lock cancellation in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -1842,7 +1843,7 @@ var msigProposeThresholdCmd = &cli.Command{ fmt.Println("sent change threshold proposal in message: ", msgCid) - wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } diff --git a/cli/paych.go b/cli/paych.go index a2f427fd5a5..ae827fab9bf 100644 --- a/cli/paych.go +++ b/cli/paych.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin/v8/paych" lapi "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" lpaych "github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/paychmgr" @@ -273,7 +273,7 @@ var paychSettleCmd = &cli.Command{ return err } - mwait, err := api.StateWaitMsg(ctx, mcid, build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, mcid, buildconstants.MessageConfidence) if err != nil { return nil } @@ -313,7 +313,7 @@ var paychCloseCmd = &cli.Command{ return err } - mwait, err := api.StateWaitMsg(ctx, mcid, build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, mcid, buildconstants.MessageConfidence) if err != nil { return nil } @@ -624,7 +624,7 @@ var paychVoucherSubmitCmd = &cli.Command{ return err } - mwait, err := api.StateWaitMsg(ctx, mcid, build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, mcid, buildconstants.MessageConfidence) if err != nil { return err } diff --git a/cli/sending_ui.go b/cli/sending_ui.go index 34eb256494b..60c46bb02ef 100644 --- a/cli/sending_ui.go +++ b/cli/sending_ui.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -149,7 +149,7 @@ func isFeeCapProblem(checkGroups [][]api.MessageCheckStatus, protoCid cid.Cid) ( } if baseFee.IsZero() { // this will only be the case if failing check is: MessageMinBaseFee - baseFee = big.NewInt(build.MinimumBaseFee) + baseFee = big.NewInt(buildconstants.MinimumBaseFee) } return yes, baseFee diff --git a/cli/spcli/actor.go b/cli/spcli/actor.go index 0ff59d6e0a4..748ecef1054 100644 --- a/cli/spcli/actor.go +++ b/cli/spcli/actor.go @@ -23,7 +23,7 @@ import ( lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -43,7 +43,7 @@ func ActorWithdrawCmd(getActor ActorAddressGetter) *cli.Command { &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, &cli.BoolFlag{ Name: "beneficiary", @@ -592,7 +592,7 @@ func ActorSetOwnerCmd(getActor ActorAddressGetter) *cli.Command { fmt.Println("Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -694,7 +694,7 @@ func ActorProposeChangeWorkerCmd(getActor ActorAddressGetter) *cli.Command { _, _ = fmt.Fprintln(cctx.App.Writer, "Propose Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -830,7 +830,7 @@ func ActorProposeChangeBeneficiaryCmd(getActor ActorAddressGetter) *cli.Command fmt.Println("Propose Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for message to be included in block: %w", err) } @@ -931,7 +931,7 @@ func ActorConfirmChangeWorkerCmd(getActor ActorAddressGetter) *cli.Command { fmt.Println("Confirm Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -1054,7 +1054,7 @@ func ActorConfirmChangeBeneficiaryCmd(getActor ActorAddressGetter) *cli.Command fmt.Println("Confirm Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for message to be included in block: %w", err) } @@ -1211,7 +1211,7 @@ func ActorCompactAllocatedCmd(getActor ActorAddressGetter) *cli.Command { fmt.Println("CompactSectorNumbers Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -1267,7 +1267,7 @@ var ActorNewMinerCmd = &cli.Command{ &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, }, Action: func(cctx *cli.Context) error { diff --git a/cli/spcli/proving.go b/cli/spcli/proving.go index ed4251f1b3c..92ba85b94e8 100644 --- a/cli/spcli/proving.go +++ b/cli/spcli/proving.go @@ -18,7 +18,7 @@ import ( "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/lotus/blockstore" - "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/store" "github.com/filecoin-project/lotus/chain/types" @@ -242,9 +242,9 @@ func deadlineOpenTime(ts *types.TipSet, dlIdx uint64, di *dline.Info) string { gapHeight := uint64(di.WPoStProvingPeriod) / di.WPoStPeriodDeadlines * gapIdx openHeight := di.Open + abi.ChainEpoch(gapHeight) - genesisBlockTimestamp := ts.MinTimestamp() - uint64(ts.Height())*build.BlockDelaySecs + genesisBlockTimestamp := ts.MinTimestamp() - uint64(ts.Height())*buildconstants.BlockDelaySecs - return time.Unix(int64(genesisBlockTimestamp+build.BlockDelaySecs*uint64(openHeight)), 0).Format(time.TimeOnly) + return time.Unix(int64(genesisBlockTimestamp+buildconstants.BlockDelaySecs*uint64(openHeight)), 0).Format(time.TimeOnly) } func ProvingDeadlineInfoCmd(getActorAddress ActorAddressGetter) *cli.Command { diff --git a/cli/state.go b/cli/state.go index 57edf413f7a..14235a6ee94 100644 --- a/cli/state.go +++ b/cli/state.go @@ -35,7 +35,7 @@ import ( lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/consensus" @@ -1162,7 +1162,7 @@ var StateWaitMsgCmd = &cli.Command{ return err } - mw, err := api.StateWaitMsg(ctx, msg, build.MessageConfidence) + mw, err := api.StateWaitMsg(ctx, msg, buildconstants.MessageConfidence) if err != nil { return err } diff --git a/cli/status.go b/cli/status.go index 75f91196a1c..34f46fe86f3 100644 --- a/cli/status.go +++ b/cli/status.go @@ -5,7 +5,7 @@ import ( "github.com/urfave/cli/v2" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" ) var StatusCmd = &cli.Command{ @@ -38,7 +38,7 @@ var StatusCmd = &cli.Command{ fmt.Printf("Peers to Publish Messages: %d\n", status.PeerStatus.PeersToPublishMsgs) fmt.Printf("Peers to Publish Blocks: %d\n", status.PeerStatus.PeersToPublishBlocks) - if inclChainStatus && status.SyncStatus.Epoch > uint64(build.Finality) { + if inclChainStatus && status.SyncStatus.Epoch > uint64(policy.ChainFinality) { var ok100, okFin string if status.ChainStatus.BlocksPerTipsetLast100 >= 4.75 { ok100 = "[OK]" diff --git a/cli/sync.go b/cli/sync.go index 18ff24bc26e..8e4c3d889f7 100644 --- a/cli/sync.go +++ b/cli/sync.go @@ -12,7 +12,7 @@ import ( "github.com/filecoin-project/lotus/api" "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/types" cliutil "github.com/filecoin-project/lotus/cli/util" ) @@ -358,5 +358,5 @@ func IsSyncDone(ctx context.Context, napi v0api.FullNode) (bool, error) { if err != nil { return false, err } - return time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs), nil + return time.Now().Unix()-int64(head.MinTimestamp()) < int64(buildconstants.BlockDelaySecs), nil } diff --git a/cli/wallet.go b/cli/wallet.go index 4af8dca58b8..896a9888a86 100644 --- a/cli/wallet.go +++ b/cli/wallet.go @@ -21,7 +21,7 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/lib/tablewriter" @@ -583,7 +583,7 @@ var walletMarketWithdraw = &cli.Command{ &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, }, Action: func(cctx *cli.Context) error { diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index 8c415180612..12fe446eaff 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -24,6 +24,7 @@ import ( lapi "github.com/filecoin-project/lotus/api" "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" lcli "github.com/filecoin-project/lotus/cli" @@ -829,7 +830,7 @@ func bps(sectorSize abi.SectorSize, sectorNum int, d time.Duration) string { } func spt(ssize abi.SectorSize, variant miner.SealProofVariant) abi.RegisteredSealProof { - spt, err := miner.SealProofTypeFromSectorSize(ssize, build.TestNetworkVersion, variant) + spt, err := miner.SealProofTypeFromSectorSize(ssize, buildconstants.TestNetworkVersion, variant) if err != nil { panic(err) } diff --git a/cmd/lotus-fountain/main.go b/cmd/lotus-fountain/main.go index 191a91da403..d0478685b3c 100644 --- a/cmd/lotus-fountain/main.go +++ b/cmd/lotus-fountain/main.go @@ -20,6 +20,7 @@ import ( "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" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" "github.com/filecoin-project/lotus/chain/types" @@ -122,7 +123,7 @@ var runCmd = &cli.Command{ sendPerRequest: sendPerRequest, limiter: NewLimiter(LimiterConfig{ TotalRate: 500 * time.Millisecond, - TotalBurst: build.BlockMessageLimit, + TotalBurst: buildconstants.BlockMessageLimit, IPRate: 10 * time.Minute, IPBurst: 5, WalletRate: 15 * time.Minute, diff --git a/cmd/lotus-health/main.go b/cmd/lotus-health/main.go index 8e58624b673..55e98c97167 100644 --- a/cmd/lotus-health/main.go +++ b/cmd/lotus-health/main.go @@ -16,6 +16,7 @@ import ( "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/types" lcli "github.com/filecoin-project/lotus/cli" ) @@ -63,7 +64,7 @@ var watchHeadCmd = &cli.Command{ }, &cli.IntFlag{ Name: "interval", - Value: int(build.BlockDelaySecs), + Value: int(buildconstants.BlockDelaySecs), Usage: "interval in seconds between chain head checks", }, &cli.StringFlag{ @@ -74,7 +75,7 @@ var watchHeadCmd = &cli.Command{ &cli.IntFlag{ Name: "api-timeout", // TODO: this default value seems spurious. - Value: int(build.BlockDelaySecs), + Value: int(buildconstants.BlockDelaySecs), Usage: "timeout between API retries", }, &cli.IntFlag{ @@ -237,7 +238,7 @@ func waitForSyncComplete(ctx context.Context, a v0api.FullNode, r int, t time.Du return err } - if time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs) { + if time.Now().Unix()-int64(head.MinTimestamp()) < int64(buildconstants.BlockDelaySecs) { return nil } } diff --git a/cmd/lotus-miner/info.go b/cmd/lotus-miner/info.go index 52b230daab0..9548a4a771f 100644 --- a/cmd/lotus-miner/info.go +++ b/cmd/lotus-miner/info.go @@ -23,7 +23,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v1api" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/reward" @@ -192,7 +192,7 @@ func handleMiningInfo(ctx context.Context, cctx *cli.Context, fullapi v1api.Full } else { winRatio := new(corebig.Rat).SetFrac( - types.BigMul(pow.MinerPower.QualityAdjPower, types.NewInt(build.BlocksPerEpoch)).Int, + types.BigMul(pow.MinerPower.QualityAdjPower, types.NewInt(buildconstants.BlocksPerEpoch)).Int, pow.TotalPower.QualityAdjPower.Int, ) diff --git a/cmd/lotus-miner/init.go b/cmd/lotus-miner/init.go index 621cb078e7e..b81c42f50e0 100644 --- a/cmd/lotus-miner/init.go +++ b/cmd/lotus-miner/init.go @@ -38,6 +38,7 @@ import ( "github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/api/v1api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/power" @@ -124,7 +125,7 @@ var initCmd = &cli.Command{ &cli.Uint64Flag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: build.MessageConfidence, + Value: buildconstants.MessageConfidence, }, }, Subcommands: []*cli.Command{ diff --git a/cmd/lotus-miner/proving.go b/cmd/lotus-miner/proving.go index 9048da8e2b3..79ad623d1ca 100644 --- a/cmd/lotus-miner/proving.go +++ b/cmd/lotus-miner/proving.go @@ -18,7 +18,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/cli/spcli" @@ -300,7 +300,7 @@ var provingRecoverFaultsCmd = &cli.Command{ &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, }, Action: func(cctx *cli.Context) error { diff --git a/cmd/lotus-pcr/main.go b/cmd/lotus-pcr/main.go index a4a246f33c7..71cf888e827 100644 --- a/cmd/lotus-pcr/main.go +++ b/cmd/lotus-pcr/main.go @@ -33,6 +33,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" lbuiltin "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -373,7 +374,7 @@ var runCmd = &cli.Command{ Name: "head-delay", EnvVars: []string{"LOTUS_PCR_HEAD_DELAY"}, Usage: "the number of tipsets to delay message processing to smooth chain reorgs", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, &cli.BoolFlag{ Name: "miner-recovery", @@ -572,7 +573,7 @@ var runCmd = &cli.Command{ msgs, err := api.MpoolPending(ctx, types.EmptyTSK) if err != nil { log.Warnw("failed to fetch pending messages", "err", err) - time.Sleep(time.Duration(int64(time.Second) * int64(build.BlockDelaySecs))) + time.Sleep(time.Duration(int64(time.Second) * int64(buildconstants.BlockDelaySecs))) continue } @@ -588,7 +589,7 @@ var runCmd = &cli.Command{ } log.Warnw("messages in mpool over max message queue", "message_count", count, "max_message_queue", maxMessageQueue) - time.Sleep(time.Duration(int64(time.Second) * int64(build.BlockDelaySecs))) + time.Sleep(time.Duration(int64(time.Second) * int64(buildconstants.BlockDelaySecs))) } } @@ -842,7 +843,7 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet } totalAvailableBalance := big.Add(addrSum, minerAvailableBalance) - balanceCutoff := big.Mul(big.Div(big.NewIntUnsigned(faultsCount), big.NewInt(10)), big.NewIntUnsigned(build.FilecoinPrecision)) + balanceCutoff := big.Mul(big.Div(big.NewIntUnsigned(faultsCount), big.NewInt(10)), big.NewIntUnsigned(buildconstants.FilecoinPrecision)) if totalAvailableBalance.GreaterThan(balanceCutoff) { log.Debugw( @@ -853,8 +854,8 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet "available_balance", totalAvailableBalance, "balance_cutoff", balanceCutoff, "faults_count", faultsCount, - "available_balance_fil", big.Div(totalAvailableBalance, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), - "balance_cutoff_fil", big.Div(balanceCutoff, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), + "available_balance_fil", big.Div(totalAvailableBalance, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), + "balance_cutoff_fil", big.Div(balanceCutoff, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), ) continue } @@ -876,9 +877,9 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet "balance_cutoff", balanceCutoff, "faults_count", faultsCount, "refund", refundValue, - "available_balance_fil", big.Div(totalAvailableBalance, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), - "balance_cutoff_fil", big.Div(balanceCutoff, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), - "refund_fil", big.Div(refundValue, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), + "available_balance_fil", big.Div(totalAvailableBalance, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), + "balance_cutoff_fil", big.Div(balanceCutoff, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), + "refund_fil", big.Div(refundValue, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), ) continue } @@ -887,8 +888,8 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet record := []string{ maddr.String(), fmt.Sprintf("%d", faultsCount), - big.Div(totalAvailableBalance, big.NewIntUnsigned(build.FilecoinPrecision)).String(), - big.Div(refundValue, big.NewIntUnsigned(build.FilecoinPrecision)).String(), + big.Div(totalAvailableBalance, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).String(), + big.Div(refundValue, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).String(), } if err := csvOut.Write(record); err != nil { return nil, err @@ -900,8 +901,8 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet "faults_count", faultsCount, "available_balance", totalAvailableBalance, "refund", refundValue, - "available_balance_fil", big.Div(totalAvailableBalance, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), - "refund_fil", big.Div(refundValue, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), + "available_balance_fil", big.Div(totalAvailableBalance, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), + "refund_fil", big.Div(refundValue, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), ) } @@ -1131,7 +1132,7 @@ func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet, refu "gas_premium", m.GasPremium, "gas_used", recps[i].GasUsed, "refund", refundValue, - "refund_fil", big.Div(refundValue, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), + "refund_fil", big.Div(refundValue, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), ) refunds.Track(m.From, refundValue) @@ -1143,7 +1144,7 @@ func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet, refu "height", tipset.Height(), "key", tipset.Key(), "total_refunds", tipsetRefunds.TotalRefunds(), - "total_refunds_fil", big.Div(tipsetRefunds.TotalRefunds(), big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), + "total_refunds_fil", big.Div(tipsetRefunds.TotalRefunds(), big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), "messages_processed", tipsetRefunds.Count(), ) @@ -1215,7 +1216,7 @@ func (r *refunder) Refund(ctx context.Context, name string, tipset *types.TipSet "key", tipset.Key(), "messages_sent", len(messages)-failures, "refund_sum", refundSum, - "refund_sum_fil", big.Div(refundSum, big.NewIntUnsigned(build.FilecoinPrecision)).Int64(), + "refund_sum_fil", big.Div(refundSum, big.NewIntUnsigned(buildconstants.FilecoinPrecision)).Int64(), "messages_failures", failures, "messages_processed", refunds.Count(), ) diff --git a/cmd/lotus-seed/genesis.go b/cmd/lotus-seed/genesis.go index 9fdce456bf1..bb3aa7c0e31 100644 --- a/cmd/lotus-seed/genesis.go +++ b/cmd/lotus-seed/genesis.go @@ -19,7 +19,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/gen" genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis" "github.com/filecoin-project/lotus/chain/types" @@ -58,7 +58,7 @@ var genesisNewCmd = &cli.Command{ return xerrors.New("seed genesis new [genesis.json]") } out := genesis.Template{ - NetworkVersion: build.GenesisNetworkVersion, + NetworkVersion: buildconstants.GenesisNetworkVersion, Accounts: []genesis.Actor{}, Miners: []genesis.Miner{}, VerifregRootKey: gen.DefaultVerifregRootkeyActor, @@ -145,7 +145,7 @@ var genesisAddMinerCmd = &cli.Command{ log.Infof("Giving %s some initial balance", miner.Owner) template.Accounts = append(template.Accounts, genesis.Actor{ Type: genesis.TAccount, - Balance: big.Mul(big.NewInt(50_000_000), big.NewInt(int64(build.FilecoinPrecision))), + Balance: big.Mul(big.NewInt(50_000_000), big.NewInt(int64(buildconstants.FilecoinPrecision))), Meta: (&genesis.AccountMeta{Owner: miner.Owner}).ActorMeta(), }) } @@ -245,7 +245,7 @@ var genesisAddMsigsCmd = &cli.Command{ func monthsToBlocks(nmonths int) int { days := uint64((365 * nmonths) / 12) - return int(days * 24 * 60 * 60 / build.BlockDelaySecs) + return int(days * 24 * 60 * 60 / buildconstants.BlockDelaySecs) } func parseMultisigCsv(csvf string) ([]GenAccountEntry, error) { @@ -513,7 +513,7 @@ var genesisSetActorVersionCmd = &cli.Command{ &cli.IntFlag{ Name: "network-version", Usage: "network version to start genesis with", - Value: int(build.GenesisNetworkVersion), + Value: int(buildconstants.GenesisNetworkVersion), }, }, ArgsUsage: "", @@ -538,7 +538,7 @@ var genesisSetActorVersionCmd = &cli.Command{ } nv := network.Version(cctx.Int("network-version")) - if nv > build.TestNetworkVersion { + if nv > buildconstants.TestNetworkVersion { return xerrors.Errorf("invalid network version: %d", nv) } @@ -626,7 +626,7 @@ var genesisSetVRKSignersCmd = &cli.Command{ signers = append(signers, signer) template.Accounts = append(template.Accounts, genesis.Actor{ Type: genesis.TAccount, - Balance: big.Mul(big.NewInt(50_000), big.NewInt(int64(build.FilecoinPrecision))), + Balance: big.Mul(big.NewInt(50_000), big.NewInt(int64(buildconstants.FilecoinPrecision))), Meta: (&genesis.AccountMeta{Owner: signer}).ActorMeta(), }) } diff --git a/cmd/lotus-seed/main.go b/cmd/lotus-seed/main.go index 1a9a3ce2499..4a55375bae0 100644 --- a/cmd/lotus-seed/main.go +++ b/cmd/lotus-seed/main.go @@ -17,6 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "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/cmd/lotus-seed/seed" @@ -95,7 +96,7 @@ var preSealCmd = &cli.Command{ &cli.UintFlag{ Name: "network-version", Usage: "specify network version", - Value: uint(build.GenesisNetworkVersion), + Value: uint(buildconstants.GenesisNetworkVersion), }, }, Action: func(c *cli.Context) error { @@ -132,7 +133,7 @@ var preSealCmd = &cli.Command{ } sectorSize := abi.SectorSize(sectorSizeInt) - nv := build.GenesisNetworkVersion + nv := buildconstants.GenesisNetworkVersion if c.IsSet("network-version") { nv = network.Version(c.Uint64("network-version")) } diff --git a/cmd/lotus-shed/actor.go b/cmd/lotus-shed/actor.go index c7eb949c22f..ca2c52fa94c 100644 --- a/cmd/lotus-shed/actor.go +++ b/cmd/lotus-shed/actor.go @@ -22,7 +22,7 @@ import ( miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" @@ -226,7 +226,7 @@ var actorWithdrawCmd = &cli.Command{ &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, &cli.BoolFlag{ Name: "beneficiary", @@ -451,7 +451,7 @@ var actorSetOwnerCmd = &cli.Command{ fmt.Println("Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := nodeAPI.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := nodeAPI.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -843,7 +843,7 @@ var actorProposeChangeWorker = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Propose Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := nodeAPI.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := nodeAPI.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -964,7 +964,7 @@ var actorConfirmChangeWorker = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Confirm Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := nodeAPI.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := nodeAPI.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -1112,7 +1112,7 @@ var actorProposeChangeBeneficiary = &cli.Command{ fmt.Println("Propose Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for message to be included in block: %w", err) } @@ -1235,7 +1235,7 @@ var actorConfirmChangeBeneficiary = &cli.Command{ fmt.Println("Confirm Message CID:", smsg.Cid()) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for message to be included in block: %w", err) } diff --git a/cmd/lotus-shed/balances.go b/cmd/lotus-shed/balances.go index 666abbfe8aa..013bf5bc343 100644 --- a/cmd/lotus-shed/balances.go +++ b/cmd/lotus-shed/balances.go @@ -24,7 +24,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" _init "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -373,7 +373,7 @@ var chainBalanceSanityCheckCmd = &cli.Command{ bal = big.Add(bal, act.Balance) } - attoBase := big.Mul(big.NewInt(int64(build.FilBase)), big.NewInt(int64(build.FilecoinPrecision))) + attoBase := big.Mul(big.NewInt(int64(buildconstants.FilBase)), big.NewInt(int64(buildconstants.FilecoinPrecision))) if big.Cmp(attoBase, bal) != 0 { return xerrors.Errorf("sanity check failed (expected %s, actual %s)", attoBase, bal) diff --git a/cmd/lotus-shed/consensus.go b/cmd/lotus-shed/consensus.go index 197de56f92b..81d72a82a6e 100644 --- a/cmd/lotus-shed/consensus.go +++ b/cmd/lotus-shed/consensus.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/client" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" cliutil "github.com/filecoin-project/lotus/cli/util" @@ -76,7 +76,7 @@ var consensusCheckCmd = &cli.Command{ }, &cli.IntFlag{ Name: "lookback", - Value: int(build.MessageConfidence * 2), + Value: int(buildconstants.MessageConfidence * 2), Usage: "number of tipsets behind to look back when comparing nodes", }, }, @@ -205,7 +205,7 @@ var consensusCheckCmd = &cli.Command{ tnow := uint64(time.Now().Unix()) tgen := nodes[0].genesisTipset.MinTimestamp() - target = abi.ChainEpoch((tnow - tgen) / build.BlockDelaySecs) + target = abi.ChainEpoch((tnow - tgen) / buildconstants.BlockDelaySecs) default: h, err := strconv.Atoi(strings.TrimSpace(cctx.String("height"))) if err != nil { diff --git a/cmd/lotus-shed/cron-count.go b/cmd/lotus-shed/cron-count.go index 9741792ecf1..fd843fb5ea0 100644 --- a/cmd/lotus-shed/cron-count.go +++ b/cmd/lotus-shed/cron-count.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin/v11/util/adt" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" ) @@ -311,7 +311,7 @@ func findDeadlineCrons(c *cli.Context) (map[address.Address]struct{}, error) { // All miners have active cron before v4. // v4 upgrade epoch is last epoch running v3 epoch and api.StateReadState reads // parent state, so v4 state isn't read until upgrade epoch + 2 - if ts.Height() <= build.UpgradeTurboHeight+1 { + if ts.Height() <= buildconstants.UpgradeTurboHeight+1 { activeMiners[mAddr] = struct{}{} continue } diff --git a/cmd/lotus-shed/gas-estimation.go b/cmd/lotus-shed/gas-estimation.go index 31b5384d5ce..15fb2b5ba42 100644 --- a/cmd/lotus-shed/gas-estimation.go +++ b/cmd/lotus-shed/gas-estimation.go @@ -15,7 +15,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/beacon/drand" "github.com/filecoin-project/lotus/chain/consensus" @@ -100,7 +99,7 @@ var gasTraceCmd = &cli.Command{ return err } - shd, err := drand.BeaconScheduleFromDrandSchedule(build.DrandConfigSchedule(), MAINNET_GENESIS_TIME, nil) + shd, err := drand.BeaconScheduleFromDrandSchedule(buildconstants.DrandConfigSchedule(), MAINNET_GENESIS_TIME, nil) if err != nil { return err } @@ -196,7 +195,7 @@ var replayOfflineCmd = &cli.Command{ return err } - shd, err := drand.BeaconScheduleFromDrandSchedule(build.DrandConfigSchedule(), MAINNET_GENESIS_TIME, nil) + shd, err := drand.BeaconScheduleFromDrandSchedule(buildconstants.DrandConfigSchedule(), MAINNET_GENESIS_TIME, nil) if err != nil { return err } diff --git a/cmd/lotus-shed/genesis-verify.go b/cmd/lotus-shed/genesis-verify.go index 4ead8467ea2..4db5eb1436b 100644 --- a/cmd/lotus-shed/genesis-verify.go +++ b/cmd/lotus-shed/genesis-verify.go @@ -16,7 +16,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/account" @@ -73,7 +73,7 @@ var genesisVerifyCmd = &cli.Command{ } fmt.Println("Genesis: ", ts.Key()) - expFIL := big.Mul(big.NewInt(int64(build.FilBase)), big.NewInt(int64(build.FilecoinPrecision))) + expFIL := big.Mul(big.NewInt(int64(buildconstants.FilBase)), big.NewInt(int64(buildconstants.FilecoinPrecision))) fmt.Printf("Total FIL: %s", types.FIL(total)) if !expFIL.Equals(total) { color.Red(" INCORRECT!") diff --git a/cmd/lotus-shed/miner-multisig.go b/cmd/lotus-shed/miner-multisig.go index 0b7042e83a6..1aa6e80dd4f 100644 --- a/cmd/lotus-shed/miner-multisig.go +++ b/cmd/lotus-shed/miner-multisig.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin/v9/miner" "github.com/filecoin-project/go-state-types/builtin/v9/multisig" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" @@ -96,7 +96,7 @@ var mmProposeWithdrawBalance = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Propose Message CID:", pcid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, pcid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, pcid, buildconstants.MessageConfidence) if err != nil { return err } @@ -175,7 +175,7 @@ var mmApproveWithdrawBalance = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Approve Message CID:", acid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, acid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, acid, buildconstants.MessageConfidence) if err != nil { return err } @@ -256,7 +256,7 @@ var mmProposeChangeOwner = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Propose Message CID:", pcid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, pcid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, pcid, buildconstants.MessageConfidence) if err != nil { return err } @@ -346,7 +346,7 @@ var mmApproveChangeOwner = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Approve Message CID:", acid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, acid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, acid, buildconstants.MessageConfidence) if err != nil { return err } @@ -443,7 +443,7 @@ var mmProposeChangeWorker = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Propose Message CID:", pcid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, pcid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, pcid, buildconstants.MessageConfidence) if err != nil { return err } @@ -564,7 +564,7 @@ var mmProposeChangeBeneficiary = &cli.Command{ fmt.Println("Propose Message CID: ", pcid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, pcid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, pcid, buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for message to be included in block: %w", err) } @@ -635,7 +635,7 @@ var mmConfirmChangeWorker = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Propose Message CID:", pcid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, pcid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, pcid, buildconstants.MessageConfidence) if err != nil { return err } @@ -728,7 +728,7 @@ var mmConfirmChangeBeneficiary = &cli.Command{ fmt.Println("Confirm Message CID:", pcid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, pcid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, pcid, buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for message to be included in block: %w", err) } @@ -842,7 +842,7 @@ var mmProposeControlSet = &cli.Command{ _, _ = fmt.Fprintln(cctx.App.Writer, "Propose Message CID:", pcid) // wait for it to get mined into a block - wait, err := api.StateWaitMsg(ctx, pcid, build.MessageConfidence) + wait, err := api.StateWaitMsg(ctx, pcid, buildconstants.MessageConfidence) if err != nil { return err } diff --git a/cmd/lotus-shed/miner.go b/cmd/lotus-shed/miner.go index 827fbf41514..3e7be3b1f30 100644 --- a/cmd/lotus-shed/miner.go +++ b/cmd/lotus-shed/miner.go @@ -32,7 +32,7 @@ import ( "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" "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" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/power" @@ -224,7 +224,7 @@ var minerCreateCmd = &cli.Command{ &cli.IntFlag{ Name: "confidence", Usage: "number of block confirmations to wait for", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, }, Action: func(cctx *cli.Context) error { @@ -306,7 +306,7 @@ var minerCreateCmd = &cli.Command{ log.Infof("Initializing owner account %s, message: %s", worker, signed.Cid()) log.Infof("Wating for confirmation") - mw, err := wapi.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence) + mw, err := wapi.StateWaitMsg(ctx, signed.Cid(), buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for owner init: %w", err) } @@ -353,7 +353,7 @@ var minerCreateCmd = &cli.Command{ log.Infof("Pushed CreateMiner message: %s", signed.Cid()) log.Infof("Waiting for confirmation") - mw, err := wapi.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence) + mw, err := wapi.StateWaitMsg(ctx, signed.Cid(), buildconstants.MessageConfidence) if err != nil { return xerrors.Errorf("waiting for createMiner message: %w", err) } diff --git a/cmd/lotus-shed/verifreg.go b/cmd/lotus-shed/verifreg.go index 4e2894442a3..585c5a0db5e 100644 --- a/cmd/lotus-shed/verifreg.go +++ b/cmd/lotus-shed/verifreg.go @@ -16,11 +16,12 @@ import ( verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/multisig" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" ) @@ -98,7 +99,7 @@ var verifRegAddVerifierFromMsigCmd = &cli.Command{ fmt.Printf("message sent, now waiting on cid: %s\n", msgCid) - mwait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + mwait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } @@ -164,7 +165,7 @@ var verifRegAddVerifierFromAccountCmd = &cli.Command{ fmt.Printf("message sent, now waiting on cid: %s\n", smsg.Cid()) - mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -240,7 +241,7 @@ var verifRegVerifyClientCmd = &cli.Command{ fmt.Printf("message sent, now waiting on cid: %s\n", smsg.Cid()) - mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence) + mwait, err := api.StateWaitMsg(ctx, smsg.Cid(), buildconstants.MessageConfidence) if err != nil { return err } @@ -516,7 +517,7 @@ var verifRegRemoveVerifiedClientDataCapCmd = &cli.Command{ msgCid := sm.Cid() fmt.Println("sending msg: ", msgCid) - mwait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true) + mwait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), policy.ChainFinality, true) if err != nil { return err } diff --git a/cmd/lotus-sim/simulation/block.go b/cmd/lotus-sim/simulation/block.go index 7cf5a6be66b..1416ac847f9 100644 --- a/cmd/lotus-sim/simulation/block.go +++ b/cmd/lotus-sim/simulation/block.go @@ -10,7 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -59,7 +59,7 @@ func (sim *Simulation) makeTipSet(ctx context.Context, messages []*types.Message return nil, xerrors.Errorf("failed to store block messages: %w", err) } - uts := parentTs.MinTimestamp() + build.BlockDelaySecs + uts := parentTs.MinTimestamp() + buildconstants.BlockDelaySecs blks := []*types.BlockHeader{{ Miner: parentTs.MinTicketBlock().Miner, // keep reusing the same miner. diff --git a/cmd/lotus-stats/main.go b/cmd/lotus-stats/main.go index 16c62595228..1b35bc32a4e 100644 --- a/cmd/lotus-stats/main.go +++ b/cmd/lotus-stats/main.go @@ -17,6 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" lcli "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/tools/stats/influx" "github.com/filecoin-project/lotus/tools/stats/ipldstore" @@ -115,7 +116,7 @@ var runCmd = &cli.Command{ Name: "head-lag", EnvVars: []string{"LOTUS_STATS_HEAD_LAG"}, Usage: "the number of tipsets to delay processing on to smooth chain reorgs", - Value: int(build.MessageConfidence), + Value: int(buildconstants.MessageConfidence), }, &cli.BoolFlag{ Name: "no-sync", @@ -214,7 +215,7 @@ var runCmd = &cli.Command{ } sinceGenesis := build.Clock.Now().Sub(genesisTime) - expectedHeight := int64(sinceGenesis.Seconds()) / int64(build.BlockDelaySecs) + expectedHeight := int64(sinceGenesis.Seconds()) / int64(buildconstants.BlockDelaySecs) startOfWindowHeight := expectedHeight - 60 @@ -242,7 +243,7 @@ var runCmd = &cli.Command{ select { case <-t.C: sinceGenesis := build.Clock.Now().Sub(genesisTime) - expectedHeight := int64(sinceGenesis.Seconds()) / int64(build.BlockDelaySecs) + expectedHeight := int64(sinceGenesis.Seconds()) / int64(buildconstants.BlockDelaySecs) stats.Record(ctx, metrics.TipsetCollectionHeightExpected.M(expectedHeight)) } diff --git a/cmd/lotus-worker/main.go b/cmd/lotus-worker/main.go index 15283a30bb9..6d70b8240e8 100644 --- a/cmd/lotus-worker/main.go +++ b/cmd/lotus-worker/main.go @@ -29,6 +29,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" lcli "github.com/filecoin-project/lotus/cli" cliutil "github.com/filecoin-project/lotus/cli/util" "github.com/filecoin-project/lotus/cmd/lotus-worker/sealworker" @@ -348,8 +349,8 @@ Example invocation of lotus-bench as external executor: case err != nil: return xerrors.Errorf("checking fd limit: %w", err) default: - if limit < build.MinerFDLimit { - return xerrors.Errorf("soft file descriptor limit (ulimit -n) too low, want %d, current %d", build.MinerFDLimit, limit) + if limit < buildconstants.MinerFDLimit { + return xerrors.Errorf("soft file descriptor limit (ulimit -n) too low, want %d, current %d", buildconstants.MinerFDLimit, limit) } } diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 9910ffe48f9..753820f388a 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -32,6 +32,7 @@ import ( lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/beacon/drand" "github.com/filecoin-project/lotus/chain/consensus" "github.com/filecoin-project/lotus/chain/consensus/filcns" @@ -606,7 +607,7 @@ func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool) } if !snapshot { - shd, err := drand.BeaconScheduleFromDrandSchedule(build.DrandConfigSchedule(), gen.Timestamp, nil) + shd, err := drand.BeaconScheduleFromDrandSchedule(buildconstants.DrandConfigSchedule(), gen.Timestamp, nil) if err != nil { return xerrors.Errorf("failed to construct beacon schedule: %w", err) } diff --git a/cmd/lotus/debug_advance.go b/cmd/lotus/debug_advance.go index dee2db97e2b..422f14e5a2e 100644 --- a/cmd/lotus/debug_advance.go +++ b/cmd/lotus/debug_advance.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/crypto" lapi "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" @@ -80,7 +80,7 @@ func init() { ep.WinCount = ep.ComputeWinCount(types.NewInt(1), types.NewInt(1)) } - uts := head.MinTimestamp() + uint64(build.BlockDelaySecs) + uts := head.MinTimestamp() + uint64(buildconstants.BlockDelaySecs) nheight := head.Height() + 1 blk, err := api.MinerCreateBlock(ctx, &lapi.BlockTemplate{ addr, head.Key(), ticket, ep, mbi.BeaconEntries, msgs, nheight, uts, gen.ValidWpostForTesting, diff --git a/cmd/tvx/codenames.go b/cmd/tvx/codenames.go index 81143c85ce0..9136ff612fe 100644 --- a/cmd/tvx/codenames.go +++ b/cmd/tvx/codenames.go @@ -3,7 +3,7 @@ package main import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" ) // ProtocolCodenames is a table that summarises the protocol codenames that @@ -16,23 +16,23 @@ var ProtocolCodenames = []struct { name string }{ {0, "genesis"}, - {build.UpgradeBreezeHeight + 1, "breeze"}, - {build.UpgradeSmokeHeight + 1, "smoke"}, - {build.UpgradeIgnitionHeight + 1, "ignition"}, - {build.UpgradeRefuelHeight + 1, "refuel"}, - {build.UpgradeAssemblyHeight + 1, "actorsv2"}, - {build.UpgradeTapeHeight + 1, "tape"}, - {build.UpgradeLiftoffHeight + 1, "liftoff"}, - {build.UpgradeKumquatHeight + 1, "postliftoff"}, - {build.UpgradeCalicoHeight + 1, "calico"}, - {build.UpgradePersianHeight + 1, "persian"}, - {build.UpgradeOrangeHeight + 1, "orange"}, - {build.UpgradeTrustHeight + 1, "trust"}, - {build.UpgradeNorwegianHeight + 1, "norwegian"}, - {build.UpgradeTurboHeight + 1, "turbo"}, - {build.UpgradeHyperdriveHeight + 1, "hyperdrive"}, - {build.UpgradeChocolateHeight + 1, "chocolate"}, - {build.UpgradeOhSnapHeight + 1, "ohsnap"}, + {buildconstants.UpgradeBreezeHeight + 1, "breeze"}, + {buildconstants.UpgradeSmokeHeight + 1, "smoke"}, + {buildconstants.UpgradeIgnitionHeight + 1, "ignition"}, + {buildconstants.UpgradeRefuelHeight + 1, "refuel"}, + {buildconstants.UpgradeAssemblyHeight + 1, "actorsv2"}, + {buildconstants.UpgradeTapeHeight + 1, "tape"}, + {buildconstants.UpgradeLiftoffHeight + 1, "liftoff"}, + {buildconstants.UpgradeKumquatHeight + 1, "postliftoff"}, + {buildconstants.UpgradeCalicoHeight + 1, "calico"}, + {buildconstants.UpgradePersianHeight + 1, "persian"}, + {buildconstants.UpgradeOrangeHeight + 1, "orange"}, + {buildconstants.UpgradeTrustHeight + 1, "trust"}, + {buildconstants.UpgradeNorwegianHeight + 1, "norwegian"}, + {buildconstants.UpgradeTurboHeight + 1, "turbo"}, + {buildconstants.UpgradeHyperdriveHeight + 1, "hyperdrive"}, + {buildconstants.UpgradeChocolateHeight + 1, "chocolate"}, + {buildconstants.UpgradeOhSnapHeight + 1, "ohsnap"}, } // GetProtocolCodename gets the protocol codename associated with a height. diff --git a/cmd/tvx/codenames_test.go b/cmd/tvx/codenames_test.go index e7476b1243a..5801bce0078 100644 --- a/cmd/tvx/codenames_test.go +++ b/cmd/tvx/codenames_test.go @@ -7,7 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" ) func TestProtocolCodenames(t *testing.T) { @@ -16,11 +16,11 @@ func TestProtocolCodenames(t *testing.T) { t.Fatal("expected genesis codename") } - if height := build.UpgradeBreezeHeight + 1; GetProtocolCodename(height) != "breeze" { + if height := buildconstants.UpgradeBreezeHeight + 1; GetProtocolCodename(height) != "breeze" { t.Fatal("expected breeze codename") } - if height := build.UpgradeAssemblyHeight + 1; GetProtocolCodename(height) != "actorsv2" { + if height := buildconstants.UpgradeAssemblyHeight + 1; GetProtocolCodename(height) != "actorsv2" { t.Fatal("expected actorsv2 codename") } diff --git a/gateway/node.go b/gateway/node.go index 0d7a04109fb..69e0dc9aa2b 100644 --- a/gateway/node.go +++ b/gateway/node.go @@ -19,7 +19,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/api" - "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" @@ -218,7 +218,7 @@ func (gw *Node) checkTipsetHeight(ts *types.TipSet, h abi.ChainEpoch) error { return fmt.Errorf("tipset height in future") } tsBlock := ts.Blocks()[0] - heightDelta := time.Duration(uint64(tsBlock.Height-h)*build.BlockDelaySecs) * time.Second + heightDelta := time.Duration(uint64(tsBlock.Height-h)*buildconstants.BlockDelaySecs) * time.Second timeAtHeight := time.Unix(int64(tsBlock.Timestamp), 0).Add(-heightDelta) if err := gw.checkTimestamp(timeAtHeight); err != nil { diff --git a/gateway/node_test.go b/gateway/node_test.go index aa33e8bfb20..3b801e19d84 100644 --- a/gateway/node_test.go +++ b/gateway/node_test.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/mock" ) @@ -58,7 +58,7 @@ func TestGatewayAPIChainGetTipSetByHeight(t *testing.T) { // So resulting tipset height will be 5 epochs earlier than LookbackCap. h: abi.ChainEpoch(1), tskh: abi.ChainEpoch(5), - genesisTS: lookbackTimestamp - build.BlockDelaySecs*10, + genesisTS: lookbackTimestamp - buildconstants.BlockDelaySecs*10, }, expErr: true, }, { @@ -70,7 +70,7 @@ func TestGatewayAPIChainGetTipSetByHeight(t *testing.T) { // - tipset height will be 2 epochs later than LookbackCap. h: abi.ChainEpoch(1), tskh: abi.ChainEpoch(5), - genesisTS: lookbackTimestamp - build.BlockDelaySecs*3, + genesisTS: lookbackTimestamp - buildconstants.BlockDelaySecs*3, }, expErr: true, }, { @@ -177,7 +177,7 @@ func (m *mockGatewayDepsAPI) createTipSets(h abi.ChainEpoch, genesisTimestamp ui targeth := h + 1 // add one for genesis block if genesisTimestamp == 0 { - genesisTimestamp = uint64(time.Now().Unix()) - build.BlockDelaySecs*uint64(targeth) + genesisTimestamp = uint64(time.Now().Unix()) - buildconstants.BlockDelaySecs*uint64(targeth) } var currts *types.TipSet for currh := abi.ChainEpoch(0); currh < targeth; currh++ { diff --git a/gateway/proxy_eth.go b/gateway/proxy_eth.go index 55780c53a20..dd91dcf0df8 100644 --- a/gateway/proxy_eth.go +++ b/gateway/proxy_eth.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/events/filter" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" @@ -146,7 +146,7 @@ func (gw *Node) checkBlkParam(ctx context.Context, blkParam string, lookback eth case "safe": num = ethtypes.EthUint64(head.Height()) - lookback - ethtypes.EthUint64(ethtypes.SafeEpochDelay) case "finalized": - num = ethtypes.EthUint64(head.Height()) - lookback - ethtypes.EthUint64(build.Finality) + num = ethtypes.EthUint64(head.Height()) - lookback - ethtypes.EthUint64(policy.ChainFinality) default: if err := num.UnmarshalJSON([]byte(`"` + blkParam + `"`)); err != nil { return fmt.Errorf("cannot parse block number: %v", err) diff --git a/itests/decode_params_test.go b/itests/decode_params_test.go index 6a4a8c681ed..ea80e713753 100644 --- a/itests/decode_params_test.go +++ b/itests/decode_params_test.go @@ -16,7 +16,7 @@ import ( "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/manifest" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/cli" ) @@ -52,7 +52,7 @@ func TestDecodeParams(t *testing.T) { for _, _tc := range testCases { tc := _tc t.Run(tc.ActorKey+" "+tc.MethodNum.String(), func(t *testing.T) { - av, err := actorstypes.VersionForNetwork(build.TestNetworkVersion) + av, err := actorstypes.VersionForNetwork(buildconstants.TestNetworkVersion) require.NoError(t, err) actorCodeCid, found := actors.GetActorCodeID(av, tc.ActorKey) require.True(t, found) @@ -103,7 +103,7 @@ func TestDecodeReturn(t *testing.T) { for _, _tc := range testCases { tc := _tc t.Run(tc.ActorKey+" "+tc.MethodNum.String(), func(t *testing.T) { - av, err := actorstypes.VersionForNetwork(build.TestNetworkVersion) + av, err := actorstypes.VersionForNetwork(buildconstants.TestNetworkVersion) require.NoError(t, err) actorCodeCid, found := actors.GetActorCodeID(av, tc.ActorKey) require.True(t, found) diff --git a/itests/eth_account_abstraction_test.go b/itests/eth_account_abstraction_test.go index 58e122e1603..45ebc0cacba 100644 --- a/itests/eth_account_abstraction_test.go +++ b/itests/eth_account_abstraction_test.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" @@ -286,7 +286,7 @@ func TestEthAccountAbstractionFailsFromEvmActor(t *testing.T) { require.NoError(t, err) tx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.Zero(), Nonce: 0, MaxFeePerGas: types.NanoFil, diff --git a/itests/eth_api_test.go b/itests/eth_api_test.go index 7b9f61662a7..043a68f5b4d 100644 --- a/itests/eth_api_test.go +++ b/itests/eth_api_test.go @@ -11,6 +11,8 @@ import ( "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/chain/wallet/key" @@ -122,7 +124,7 @@ func TestNetVersion(t *testing.T) { version, err := client.NetVersion(ctx) require.NoError(t, err) - require.Equal(t, strconv.Itoa(build.Eip155ChainId), version) + require.Equal(t, strconv.Itoa(buildconstants.Eip155ChainId), version) } func TestEthBlockNumberAliases(t *testing.T) { @@ -137,7 +139,7 @@ func TestEthBlockNumberAliases(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() - head := client.WaitTillChain(ctx, kit.HeightAtLeast(build.Finality+100)) + head := client.WaitTillChain(ctx, kit.HeightAtLeast(policy.ChainFinality+100)) // latest should be head-1 (parents) latestEthBlk, err := client.EVM().EthGetBlockByNumber(ctx, "latest", true) @@ -156,7 +158,7 @@ func TestEthBlockNumberAliases(t *testing.T) { // finalized should be Finality blocks behind latest finalityEthBlk, err := client.EVM().EthGetBlockByNumber(ctx, "finalized", true) require.NoError(t, err) - diff = int64(latestEthBlk.Number) - int64(build.Finality) - int64(finalityEthBlk.Number) + diff = int64(latestEthBlk.Number) - int64(policy.ChainFinality) - int64(finalityEthBlk.Number) require.GreaterOrEqual(t, diff, int64(0)) require.LessOrEqual(t, diff, int64(2)) } diff --git a/itests/eth_conformance_test.go b/itests/eth_conformance_test.go index 13d42e741cd..3ce4ca4d324 100644 --- a/itests/eth_conformance_test.go +++ b/itests/eth_conformance_test.go @@ -22,7 +22,7 @@ import ( "github.com/filecoin-project/go-jsonrpc" "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/chain/wallet/key" @@ -464,7 +464,7 @@ func createRawSignedEthTx(ctx context.Context, t *testing.T, client *kit.TestFul require.NoError(t, err) tx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.NewInt(100), Nonce: 0, To: &receiverEthAddr, diff --git a/itests/eth_deploy_test.go b/itests/eth_deploy_test.go index b3a4c26f7f7..8fb9b1515ed 100644 --- a/itests/eth_deploy_test.go +++ b/itests/eth_deploy_test.go @@ -19,7 +19,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin/evm" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" @@ -74,7 +74,7 @@ func TestDeployment(t *testing.T) { // now deploy a contract from the placeholder, and validate it went well tx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.Zero(), Nonce: 0, MaxFeePerGas: types.NanoFil, diff --git a/itests/eth_hash_lookup_test.go b/itests/eth_hash_lookup_test.go index a37c6ffa96a..8329c2deb89 100644 --- a/itests/eth_hash_lookup_test.go +++ b/itests/eth_hash_lookup_test.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/itests/kit" @@ -63,7 +63,7 @@ func TestTransactionHashLookup(t *testing.T) { // now deploy a contract from the embryo, and validate it went well tx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.Zero(), Nonce: 0, MaxFeePerGas: types.NanoFil, @@ -369,7 +369,7 @@ func TestEthGetMessageCidByTransactionHashEthTx(t *testing.T) { // now deploy a contract from the embryo, and validate it went well tx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.Zero(), Nonce: 0, MaxFeePerGas: types.NanoFil, diff --git a/itests/eth_legacy_transactions_test.go b/itests/eth_legacy_transactions_test.go index 791f6794d9b..fec0a455223 100644 --- a/itests/eth_legacy_transactions_test.go +++ b/itests/eth_legacy_transactions_test.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/types" @@ -154,7 +154,7 @@ func TestLegacyEIP155ValueTransferValidSignatureFailsNV22(t *testing.T) { tx := ethtypes.NewEthLegacy155TxArgs(legacyTx) // TX will fail as we're still at NV22 - client.EVM().SignLegacyEIP155Transaction(tx, key.PrivateKey, big.NewInt(build.Eip155ChainId)) + client.EVM().SignLegacyEIP155Transaction(tx, key.PrivateKey, big.NewInt(buildconstants.Eip155ChainId)) signed, err := tx.ToRawTxBytesSigned() require.NoError(t, err) @@ -201,7 +201,7 @@ func TestLegacyEIP155ValueTransferValidSignature(t *testing.T) { } tx := ethtypes.NewEthLegacy155TxArgs(legacyTx) - client.EVM().SignLegacyEIP155Transaction(tx, key.PrivateKey, big.NewInt(build.Eip155ChainId)) + client.EVM().SignLegacyEIP155Transaction(tx, key.PrivateKey, big.NewInt(buildconstants.Eip155ChainId)) // Mangle signature innerTx := tx.GetLegacyTx() innerTx.V.Int.Xor(innerTx.V.Int, big.NewInt(1).Int) @@ -213,7 +213,7 @@ func TestLegacyEIP155ValueTransferValidSignature(t *testing.T) { require.Error(t, err) // Submit transaction with valid signature but incorrect chain ID - client.EVM().SignLegacyEIP155Transaction(tx, key.PrivateKey, big.NewInt(build.Eip155ChainId)) + client.EVM().SignLegacyEIP155Transaction(tx, key.PrivateKey, big.NewInt(buildconstants.Eip155ChainId)) signed, err = tx.ToRawTxBytesSigned() require.NoError(t, err) @@ -244,7 +244,7 @@ func TestLegacyEIP155ValueTransferValidSignature(t *testing.T) { require.EqualValues(t, hash, ethTx.Hash) require.EqualValues(t, innerTx.Value, ethTx.Value) require.EqualValues(t, 0, ethTx.Type) - require.EqualValues(t, build.Eip155ChainId, ethTx.ChainID) + require.EqualValues(t, buildconstants.Eip155ChainId, ethTx.ChainID) require.EqualValues(t, ethtypes.EthBytes{}, ethTx.Input) require.EqualValues(t, innerTx.GasLimit, ethTx.Gas) require.EqualValues(t, innerTx.GasPrice, *ethTx.GasPrice) diff --git a/itests/eth_transactions_test.go b/itests/eth_transactions_test.go index 3cb11d4a3a6..715c6c7a6d2 100644 --- a/itests/eth_transactions_test.go +++ b/itests/eth_transactions_test.go @@ -18,7 +18,7 @@ import ( "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" @@ -65,7 +65,7 @@ func TestValueTransferValidSignature(t *testing.T) { require.NoError(t, err) tx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.NewInt(100), Nonce: 0, To: ðAddr2, @@ -239,7 +239,7 @@ func TestContractInvocation(t *testing.T) { require.NoError(t, err) invokeTx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, To: &contractAddr, Value: big.Zero(), Nonce: 1, @@ -367,7 +367,7 @@ func deployContractTx(ctx context.Context, client *kit.TestFullNode, ethAddr eth // now deploy a contract from the embryo, and validate it went well return ðtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.Zero(), Nonce: 0, MaxFeePerGas: types.NanoFil, diff --git a/itests/fevm_test.go b/itests/fevm_test.go index 778461effdc..5b0a79ecbe4 100644 --- a/itests/fevm_test.go +++ b/itests/fevm_test.go @@ -20,7 +20,6 @@ import ( "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" @@ -679,7 +678,7 @@ func TestFEVMRecursiveActorCallEstimate(t *testing.T) { require.NoError(t, err) tx := ðtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, To: &contractAddr, Value: big.Zero(), Nonce: int(nonce), @@ -835,7 +834,7 @@ func TestFEVMBareTransferTriggersSmartContractLogic(t *testing.T) { require.NoError(t, err) tx := ethtypes.Eth1559TxArgs{ - ChainID: build.Eip155ChainId, + ChainID: buildconstants.Eip155ChainId, Value: big.NewInt(100), Nonce: 0, To: &contractEth, diff --git a/itests/gas_estimation_test.go b/itests/gas_estimation_test.go index 1f3372afec5..c4c618be910 100644 --- a/itests/gas_estimation_test.go +++ b/itests/gas_estimation_test.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/account" "github.com/filecoin-project/lotus/chain/types" @@ -75,7 +75,7 @@ func TestEstimateInclusion(t *testing.T) { // (which, unfortunately, looks at the height and not the current network version). oldPrices := vm.Prices vm.Prices = map[abi.ChainEpoch]vm.Pricelist{ - 0: oldPrices[build.UpgradeHyggeHeight], + 0: oldPrices[buildconstants.UpgradeHyggeHeight], } t.Cleanup(func() { vm.Prices = oldPrices }) diff --git a/itests/kit/ensemble.go b/itests/kit/ensemble.go index 84036deb623..92dc4fd6f37 100644 --- a/itests/kit/ensemble.go +++ b/itests/kit/ensemble.go @@ -555,7 +555,7 @@ func (n *Ensemble) Start() *Ensemble { }) require.NoError(n.t, err) - mw, err := m.FullNode.FullNode.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.FullNode.FullNode.StateWaitMsg(ctx, signed.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) require.NoError(n.t, err) require.Equal(n.t, exitcode.Ok, mw.Receipt.ExitCode) @@ -581,7 +581,7 @@ func (n *Ensemble) Start() *Ensemble { }) require.NoError(n.t, err2) - mw, err2 := m.FullNode.FullNode.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + mw, err2 := m.FullNode.FullNode.StateWaitMsg(ctx, signed.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) require.NoError(n.t, err2) require.Equal(n.t, exitcode.Ok, mw.Receipt.ExitCode) } @@ -845,7 +845,7 @@ func (n *Ensemble) Start() *Ensemble { }) require.NoError(n.t, err) - mw, err := m.FullNode.FullNode.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.FullNode.FullNode.StateWaitMsg(ctx, signed.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) require.NoError(n.t, err) require.Equal(n.t, exitcode.Ok, mw.Receipt.ExitCode) diff --git a/itests/kit/ensemble_opts.go b/itests/kit/ensemble_opts.go index 95bdd8da872..a2f113f9411 100644 --- a/itests/kit/ensemble_opts.go +++ b/itests/kit/ensemble_opts.go @@ -6,6 +6,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/wallet/key" ) @@ -30,7 +31,7 @@ var DefaultEnsembleOpts = ensembleOpts{ pastOffset: 10000000 * time.Second, // time sufficiently in the past to trigger catch-up mining. upgradeSchedule: stmgr.UpgradeSchedule{{ Height: -1, - Network: build.TestNetworkVersion, + Network: buildconstants.TestNetworkVersion, }}, } diff --git a/itests/kit/node_opts.go b/itests/kit/node_opts.go index 3d2b16e4e70..a7d1083cbee 100644 --- a/itests/kit/node_opts.go +++ b/itests/kit/node_opts.go @@ -6,7 +6,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/wallet/key" "github.com/filecoin-project/lotus/node" @@ -56,7 +56,7 @@ type nodeOpts struct { // DefaultNodeOpts are the default options that will be applied to test nodes. var DefaultNodeOpts = nodeOpts{ - balance: big.Mul(big.NewInt(100000000), types.NewInt(build.FilecoinPrecision)), + balance: big.Mul(big.NewInt(100000000), types.NewInt(buildconstants.FilecoinPrecision)), sectors: DefaultPresealsPerBootstrapMiner, sectorSize: abi.SectorSize(2 << 10), // 2KiB. diff --git a/itests/paych_api_test.go b/itests/paych_api_test.go index f8ecb5377da..a6d500fc322 100644 --- a/itests/paych_api_test.go +++ b/itests/paych_api_test.go @@ -16,7 +16,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/actors/policy" @@ -154,7 +154,7 @@ func TestPaymentChannelsAPI(t *testing.T) { return true, nil }, func(ctx context.Context, ts *types.TipSet) error { return nil - }, int(build.MessageConfidence)+1, build.Finality, func(oldTs, newTs *types.TipSet) (bool, events.StateChange, error) { + }, int(buildconstants.MessageConfidence)+1, policy.ChainFinality, func(oldTs, newTs *types.TipSet) (bool, events.StateChange, error) { return preds.OnPaymentChannelActorChanged(channel, preds.OnToSendAmountChanges())(ctx, oldTs.Key(), newTs.Key()) }) require.NoError(t, err) diff --git a/itests/paych_cli_test.go b/itests/paych_cli_test.go index 1079aade9fb..f65c41dc714 100644 --- a/itests/paych_cli_test.go +++ b/itests/paych_cli_test.go @@ -20,7 +20,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/events" @@ -159,7 +159,7 @@ func TestPaymentChannelStatus(t *testing.T) { stateCreated := regexp.MustCompile("Channel exists").MatchString(out) require.True(t, stateCreating || stateCreated) - channelAmtAtto := types.BigMul(types.NewInt(channelAmt), types.NewInt(build.FilecoinPrecision)) + channelAmtAtto := types.BigMul(types.NewInt(channelAmt), types.NewInt(buildconstants.FilecoinPrecision)) channelAmtStr := fmt.Sprintf("%s", types.FIL(channelAmtAtto)) if stateCreating { // If we're in the creating state (most likely) the amount should be pending @@ -185,7 +185,7 @@ func TestPaymentChannelStatus(t *testing.T) { out = creatorCLI.RunCmd("paych", "status", chstr) fmt.Println(out) - voucherAmtAtto := types.BigMul(types.NewInt(voucherAmt), types.NewInt(build.FilecoinPrecision)) + voucherAmtAtto := types.BigMul(types.NewInt(voucherAmt), types.NewInt(buildconstants.FilecoinPrecision)) voucherAmtStr := fmt.Sprintf("%s", types.FIL(voucherAmtAtto)) // Output should include voucher amount require.Regexp(t, regexp.MustCompile("Voucher.*"+voucherAmtStr), out) diff --git a/itests/pending_deal_allocation_test.go b/itests/pending_deal_allocation_test.go index 60b755ac05e..802f467db05 100644 --- a/itests/pending_deal_allocation_test.go +++ b/itests/pending_deal_allocation_test.go @@ -20,7 +20,7 @@ import ( "github.com/filecoin-project/go-state-types/exitcode" lapi "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" @@ -172,7 +172,7 @@ func TestGetAllocationForPendingDeal(t *testing.T) { require.NoError(t, err) require.Equal(t, exitcode.Ok, r.Receipt.ExitCode) - ret, err := market.DecodePublishStorageDealsReturn(r.Receipt.Return, build.TestNetworkVersion) + ret, err := market.DecodePublishStorageDealsReturn(r.Receipt.Return, buildconstants.TestNetworkVersion) require.NoError(t, err) valid, _, err := ret.IsDealValid(0) require.NoError(t, err) diff --git a/itests/remove_verifreg_datacap_test.go b/itests/remove_verifreg_datacap_test.go index ac88574d2b6..32fb8b8ba7a 100644 --- a/itests/remove_verifreg_datacap_test.go +++ b/itests/remove_verifreg_datacap_test.go @@ -18,7 +18,7 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" @@ -211,7 +211,7 @@ func TestNoRemoveDatacapFromVerifreg(t *testing.T) { require.NoError(t, err) require.True(t, r.Receipt.ExitCode.IsSuccess()) - ret, err := market.DecodePublishStorageDealsReturn(r.Receipt.Return, build.TestNetworkVersion) + ret, err := market.DecodePublishStorageDealsReturn(r.Receipt.Return, buildconstants.TestNetworkVersion) require.NoError(t, err) valid, _, err := ret.IsDealValid(0) require.NoError(t, err) diff --git a/itests/splitstore_test.go b/itests/splitstore_test.go index ff2a60a3e99..bd0fe762465 100644 --- a/itests/splitstore_test.go +++ b/itests/splitstore_test.go @@ -25,7 +25,7 @@ import ( "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/blockstore/splitstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/power" "github.com/filecoin-project/lotus/chain/types" @@ -434,7 +434,7 @@ func (g *Garbager) newPeerID(ctx context.Context) abi.ChainEpoch { signed, err2 := g.node.MpoolPushMessage(ctx, msg, nil) require.NoError(g.t, err2) - mw, err2 := g.node.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + mw, err2 := g.node.StateWaitMsg(ctx, signed.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) require.NoError(g.t, err2) require.Equal(g.t, exitcode.Ok, mw.Receipt.ExitCode) return mw.Height @@ -486,7 +486,7 @@ func (g *Garbager) createMiner(ctx context.Context) *lapi.MsgLookup { signed, err := g.node.MpoolPushMessage(ctx, createStorageMinerMsg, nil) require.NoError(g.t, err) - mw, err := g.node.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true) + mw, err := g.node.StateWaitMsg(ctx, signed.Cid(), buildconstants.MessageConfidence, lapi.LookbackNoLimit, true) require.NoError(g.t, err) require.True(g.t, mw.Receipt.ExitCode == 0, "garbager's internal create miner message failed") return mw diff --git a/itests/wdpost_dispute_test.go b/itests/wdpost_dispute_test.go index 7d52a1b240f..49f0d2053ce 100644 --- a/itests/wdpost_dispute_test.go +++ b/itests/wdpost_dispute_test.go @@ -18,6 +18,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/itests/kit" @@ -163,7 +164,7 @@ func TestWindowPostDispute(t *testing.T) { t.Log("waiting dispute") //stm: @CHAIN_STATE_WAIT_MSG_001 - rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + rec, err := client.StateWaitMsg(ctx, sm.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) require.NoError(t, err) require.Zero(t, rec.Receipt.ExitCode, "dispute not accepted: %s", rec.Receipt.ExitCode.Error()) } @@ -207,7 +208,7 @@ func TestWindowPostDispute(t *testing.T) { require.NoError(t, err) //stm: @CHAIN_STATE_WAIT_MSG_001 - rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + rec, err := client.StateWaitMsg(ctx, sm.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) require.NoError(t, err) require.Zero(t, rec.Receipt.ExitCode, "recovery not accepted: %s", rec.Receipt.ExitCode.Error()) } @@ -386,7 +387,7 @@ func submitBadProof( } //stm: @CHAIN_STATE_WAIT_MSG_001 - rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + rec, err := client.StateWaitMsg(ctx, sm.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { return err } diff --git a/miner/miner.go b/miner/miner.go index b18e027a28b..b7e39a953c4 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -83,7 +83,7 @@ func NewMiner(api v1api.FullNode, epp gen.WinningPoStProver, addr address.Addres // the result is that we WILL NOT wait, therefore fast-forwarding // and thus healing the chain by backfilling it with null rounds // rapidly. - deadline := baseTime + build.PropagationDelaySecs + deadline := baseTime + buildconstants.PropagationDelaySecs baseT := time.Unix(int64(deadline), 0) baseT = baseT.Add(randTimeOffset(time.Second)) @@ -286,7 +286,7 @@ minerLoop: // Check for repeated mining candidates and handle sleep for the next round. if base.TipSet.Equals(lastBase.TipSet) && lastBase.NullRounds == base.NullRounds { log.Warnf("BestMiningCandidate from the previous round: %s (nulls:%d)", lastBase.TipSet.Cids(), lastBase.NullRounds) - if !m.niceSleep(time.Duration(build.BlockDelaySecs) * time.Second) { + if !m.niceSleep(time.Duration(buildconstants.BlockDelaySecs) * time.Second) { continue minerLoop } continue @@ -343,7 +343,7 @@ minerLoop: } // Check for slash filter conditions. - if os.Getenv("LOTUS_MINER_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" && !build.IsNearUpgrade(base.TipSet.Height(), build.UpgradeWatermelonFixHeight) { + if os.Getenv("LOTUS_MINER_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" && !buildconstants.IsNearUpgrade(base.TipSet.Height(), buildconstants.UpgradeWatermelonFixHeight) { witness, fault, err := m.sf.MinedBlock(ctx, b.Header, base.TipSet.Height()+base.NullRounds) if err != nil { log.Errorf(" SLASH FILTER ERRORED: %s", err) @@ -375,7 +375,7 @@ minerLoop: base.NullRounds++ // Calculate the time for the next round. - nextRound := time.Unix(int64(base.TipSet.MinTimestamp()+build.BlockDelaySecs*uint64(base.NullRounds))+int64(build.PropagationDelaySecs), 0) + nextRound := time.Unix(int64(base.TipSet.MinTimestamp()+buildconstants.BlockDelaySecs*uint64(base.NullRounds))+int64(buildconstants.PropagationDelaySecs), 0) // Wait for the next round or stop signal. select { @@ -480,7 +480,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type } } - isLate := uint64(tStart.Unix()) > (base.TipSet.MinTimestamp() + uint64(base.NullRounds*builtin.EpochDurationSeconds) + build.PropagationDelaySecs) + isLate := uint64(tStart.Unix()) > (base.TipSet.MinTimestamp() + uint64(base.NullRounds*builtin.EpochDurationSeconds) + buildconstants.PropagationDelaySecs) logStruct := []interface{}{ "tookMilliseconds", (build.Clock.Now().UnixNano() - tStart.UnixNano()) / 1_000_000, @@ -659,7 +659,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type parentMiners[i] = header.Miner } log.Infow("mined new block", "cid", minedBlock.Cid(), "height", int64(minedBlock.Header.Height), "miner", minedBlock.Header.Miner, "parents", parentMiners, "parentTipset", base.TipSet.Key().String(), "took", dur) - if dur > time.Second*time.Duration(build.BlockDelaySecs) || time.Now().Compare(time.Unix(int64(minedBlock.Header.Timestamp), 0)) >= 0 { + if dur > time.Second*time.Duration(buildconstants.BlockDelaySecs) || time.Now().Compare(time.Unix(int64(minedBlock.Header.Timestamp), 0)) >= 0 { log.Warnw("CAUTION: block production took us past the block time. Your computer may not be fast enough to keep up", "tPowercheck ", tPowercheck.Sub(tStart), "tTicket ", tTicket.Sub(tPowercheck), @@ -680,11 +680,11 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types.BeaconEntry, rou return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err) } - if round > build.UpgradeSmokeHeight { + if round > buildconstants.UpgradeSmokeHeight { buf.Write(chainRand.VRFProof) } - input, err := lrand.DrawRandomnessFromBase(brand.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes()) + input, err := lrand.DrawRandomnessFromBase(brand.Data, crypto.DomainSeparationTag_TicketProduction, round-buildconstants.TicketRandomnessLookback, buf.Bytes()) if err != nil { return nil, err } @@ -701,7 +701,7 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types.BeaconEntry, rou func (m *Miner) createBlock(base *MiningBase, addr address.Address, ticket *types.Ticket, eproof *types.ElectionProof, bvals []types.BeaconEntry, wpostProof []proof.PoStProof, msgs []*types.SignedMessage) (*types.BlockMsg, error) { - uts := base.TipSet.MinTimestamp() + build.BlockDelaySecs*(uint64(base.NullRounds)+1) + uts := base.TipSet.MinTimestamp() + buildconstants.BlockDelaySecs*(uint64(base.NullRounds)+1) nheight := base.TipSet.Height() + base.NullRounds + 1 diff --git a/node/builder_miner.go b/node/builder_miner.go index 9aaf2fc4bc6..4d0818b2cf9 100644 --- a/node/builder_miner.go +++ b/node/builder_miner.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v1api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/lib/harmony/harmonydb" @@ -59,7 +60,7 @@ func ConfigStorageMiner(c interface{}) Option { Override(new(dtypes.DrandBootstrap), modules.DrandBootstrap), ConfigCommon(&cfg.Common, build.NodeUserVersion(), false), - Override(CheckFDLimit, modules.CheckFdLimit(build.MinerFDLimit)), // recommend at least 100k FD limit to miners + Override(CheckFDLimit, modules.CheckFdLimit(buildconstants.MinerFDLimit)), // recommend at least 100k FD limit to miners Override(new(api.MinerSubsystems), modules.ExtractEnabledMinerSubsystems(cfg.Subsystems)), Override(new(paths.LocalStorage), From(new(repo.LockedRepo))), diff --git a/node/bundle/bundle.go b/node/bundle/bundle.go index 716c9043bb6..6e4aa27c1f2 100644 --- a/node/bundle/bundle.go +++ b/node/bundle/bundle.go @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" ) @@ -69,7 +70,7 @@ func LoadBundles(ctx context.Context, bs blockstore.Blockstore, versions ...acto ) if path, ok := build.BundleOverrides[av]; ok { root, err = LoadBundleFromFile(ctx, bs, path) - } else if embedded, ok := build.GetEmbeddedBuiltinActorsBundle(av, build.NetworkBundle); ok { + } else if embedded, ok := build.GetEmbeddedBuiltinActorsBundle(av, buildconstants.NetworkBundle); ok { root, err = LoadBundle(ctx, bs, bytes.NewReader(embedded)) } else { err = xerrors.Errorf("bundle for actors version v%d not found", av) diff --git a/node/impl/common/common.go b/node/impl/common/common.go index 5c4dd6a7fc5..5629adcb3bd 100644 --- a/node/impl/common/common.go +++ b/node/impl/common/common.go @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/lotus/api" apitypes "github.com/filecoin-project/lotus/api/types" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/journal/alerting" "github.com/filecoin-project/lotus/node/modules/dtypes" ) @@ -68,7 +69,7 @@ func (a *CommonAPI) Version(context.Context) (api.APIVersion, error) { Version: string(a.BuildVersion), APIVersion: v, - BlockDelay: build.BlockDelaySecs, + BlockDelay: buildconstants.BlockDelaySecs, }, nil } diff --git a/node/impl/full.go b/node/impl/full.go index cf8048eb3a4..6ed0bf3eb11 100644 --- a/node/impl/full.go +++ b/node/impl/full.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/node/impl/common" "github.com/filecoin-project/lotus/node/impl/full" "github.com/filecoin-project/lotus/node/impl/market" @@ -87,7 +88,7 @@ func (n *FullNodeAPI) NodeStatus(ctx context.Context, inclChainStatus bool) (sta } } - if inclChainStatus && status.SyncStatus.Epoch > uint64(build.Finality) { + if inclChainStatus && status.SyncStatus.Epoch > uint64(policy.ChainFinality) { blockCnt := 0 ts := curTs @@ -102,7 +103,7 @@ func (n *FullNodeAPI) NodeStatus(ctx context.Context, inclChainStatus bool) (sta status.ChainStatus.BlocksPerTipsetLast100 = float64(blockCnt) / 100 - for i := 100; i < int(build.Finality); i++ { + for i := 100; i < int(policy.ChainFinality); i++ { blockCnt += len(ts.Blocks()) tsk := ts.Parents() ts, err = n.ChainGetTipSet(ctx, tsk) @@ -111,7 +112,7 @@ func (n *FullNodeAPI) NodeStatus(ctx context.Context, inclChainStatus bool) (sta } } - status.ChainStatus.BlocksPerTipsetLastFinality = float64(blockCnt) / float64(build.Finality) + status.ChainStatus.BlocksPerTipsetLastFinality = float64(blockCnt) / float64(policy.ChainFinality) } diff --git a/node/impl/full/eth_utils.go b/node/impl/full/eth_utils.go index d67bb26fb44..61a66689b2f 100644 --- a/node/impl/full/eth_utils.go +++ b/node/impl/full/eth_utils.go @@ -20,10 +20,10 @@ import ( "github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" @@ -68,7 +68,7 @@ func getTipsetByBlockNumber(ctx context.Context, chain *store.ChainStore, blkPar return ts, nil case "finalized": latestHeight := head.Height() - 1 - safeHeight := latestHeight - build.Finality + safeHeight := latestHeight - policy.ChainFinality ts, err := chain.GetTipsetByHeight(ctx, safeHeight, head, true) if err != nil { return nil, fmt.Errorf("cannot get tipset at height: %v", safeHeight) diff --git a/node/impl/full/gas.go b/node/impl/full/gas.go index 3f105e63753..0e0827b3d07 100644 --- a/node/impl/full/gas.go +++ b/node/impl/full/gas.go @@ -18,7 +18,6 @@ import ( "github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" lbuiltin "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/messagepool" @@ -334,7 +333,7 @@ func gasEstimateGasLimit( transitionalMulti := 1.0 // Overestimate gas around the upgrade - if ts.Height() <= build.UpgradeHyggeHeight && (build.UpgradeHyggeHeight-ts.Height() <= 20) { + if ts.Height() <= buildconstants.UpgradeHyggeHeight && (buildconstants.UpgradeHyggeHeight-ts.Height() <= 20) { func() { // Bare transfers get about 3x more expensive: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0057.md#product-considerations diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 332ba00720f..f3fd1127264 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -29,7 +29,6 @@ import ( market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -1936,34 +1935,34 @@ func (a *StateAPI) StateGetNetworkParams(ctx context.Context) (*api.NetworkParam PreCommitChallengeDelay: buildconstants.PreCommitChallengeDelay, Eip155ChainID: buildconstants.Eip155ChainId, ForkUpgradeParams: api.ForkUpgradeParams{ - UpgradeSmokeHeight: build.UpgradeSmokeHeight, - UpgradeBreezeHeight: build.UpgradeBreezeHeight, - UpgradeIgnitionHeight: build.UpgradeIgnitionHeight, - UpgradeLiftoffHeight: build.UpgradeLiftoffHeight, - UpgradeAssemblyHeight: build.UpgradeAssemblyHeight, - UpgradeRefuelHeight: build.UpgradeRefuelHeight, - UpgradeTapeHeight: build.UpgradeTapeHeight, - UpgradeKumquatHeight: build.UpgradeKumquatHeight, + UpgradeSmokeHeight: buildconstants.UpgradeSmokeHeight, + UpgradeBreezeHeight: buildconstants.UpgradeBreezeHeight, + UpgradeIgnitionHeight: buildconstants.UpgradeIgnitionHeight, + UpgradeLiftoffHeight: buildconstants.UpgradeLiftoffHeight, + UpgradeAssemblyHeight: buildconstants.UpgradeAssemblyHeight, + UpgradeRefuelHeight: buildconstants.UpgradeRefuelHeight, + UpgradeTapeHeight: buildconstants.UpgradeTapeHeight, + UpgradeKumquatHeight: buildconstants.UpgradeKumquatHeight, BreezeGasTampingDuration: buildconstants.BreezeGasTampingDuration, - UpgradeCalicoHeight: build.UpgradeCalicoHeight, - UpgradePersianHeight: build.UpgradePersianHeight, - UpgradeOrangeHeight: build.UpgradeOrangeHeight, - UpgradeClausHeight: build.UpgradeClausHeight, - UpgradeTrustHeight: build.UpgradeTrustHeight, - UpgradeNorwegianHeight: build.UpgradeNorwegianHeight, - UpgradeTurboHeight: build.UpgradeTurboHeight, - UpgradeHyperdriveHeight: build.UpgradeHyperdriveHeight, - UpgradeChocolateHeight: build.UpgradeChocolateHeight, - UpgradeOhSnapHeight: build.UpgradeOhSnapHeight, - UpgradeSkyrHeight: build.UpgradeSkyrHeight, - UpgradeSharkHeight: build.UpgradeSharkHeight, - UpgradeHyggeHeight: build.UpgradeHyggeHeight, - UpgradeLightningHeight: build.UpgradeLightningHeight, - UpgradeThunderHeight: build.UpgradeThunderHeight, - UpgradeWatermelonHeight: build.UpgradeWatermelonHeight, - UpgradeDragonHeight: build.UpgradeDragonHeight, - UpgradePhoenixHeight: build.UpgradePhoenixHeight, - UpgradeWaffleHeight: build.UpgradeWaffleHeight, + UpgradeCalicoHeight: buildconstants.UpgradeCalicoHeight, + UpgradePersianHeight: buildconstants.UpgradePersianHeight, + UpgradeOrangeHeight: buildconstants.UpgradeOrangeHeight, + UpgradeClausHeight: buildconstants.UpgradeClausHeight, + UpgradeTrustHeight: buildconstants.UpgradeTrustHeight, + UpgradeNorwegianHeight: buildconstants.UpgradeNorwegianHeight, + UpgradeTurboHeight: buildconstants.UpgradeTurboHeight, + UpgradeHyperdriveHeight: buildconstants.UpgradeHyperdriveHeight, + UpgradeChocolateHeight: buildconstants.UpgradeChocolateHeight, + UpgradeOhSnapHeight: buildconstants.UpgradeOhSnapHeight, + UpgradeSkyrHeight: buildconstants.UpgradeSkyrHeight, + UpgradeSharkHeight: buildconstants.UpgradeSharkHeight, + UpgradeHyggeHeight: buildconstants.UpgradeHyggeHeight, + UpgradeLightningHeight: buildconstants.UpgradeLightningHeight, + UpgradeThunderHeight: buildconstants.UpgradeThunderHeight, + UpgradeWatermelonHeight: buildconstants.UpgradeWatermelonHeight, + UpgradeDragonHeight: buildconstants.UpgradeDragonHeight, + UpgradePhoenixHeight: buildconstants.UpgradePhoenixHeight, + UpgradeWaffleHeight: buildconstants.UpgradeWaffleHeight, }, }, nil } diff --git a/node/impl/full/sync.go b/node/impl/full/sync.go index 4bf44363ce0..105149bef7b 100644 --- a/node/impl/full/sync.go +++ b/node/impl/full/sync.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/chain/types" @@ -57,7 +58,7 @@ func (a *SyncAPI) SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) erro return xerrors.Errorf("loading parent block: %w", err) } - if a.SlashFilter != nil && os.Getenv("LOTUS_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" && !build.IsNearUpgrade(blk.Header.Height, build.UpgradeWatermelonFixHeight) { + if a.SlashFilter != nil && os.Getenv("LOTUS_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" && !buildconstants.IsNearUpgrade(blk.Header.Height, buildconstants.UpgradeWatermelonFixHeight) { witness, fault, err := a.SlashFilter.MinedBlock(ctx, blk.Header, parent.Height) if err != nil { log.Errorf(" SLASH FILTER ERRORED: %s", err) diff --git a/node/impl/full/txhashmanager.go b/node/impl/full/txhashmanager.go index ba5de0fcb40..df31670b60a 100644 --- a/node/impl/full/txhashmanager.go +++ b/node/impl/full/txhashmanager.go @@ -8,7 +8,7 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/ethhashlookup" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" @@ -24,8 +24,8 @@ func (m *EthTxHashManager) Revert(ctx context.Context, from, to *types.TipSet) e } func (m *EthTxHashManager) PopulateExistingMappings(ctx context.Context, minHeight abi.ChainEpoch) error { - if minHeight < build.UpgradeHyggeHeight { - minHeight = build.UpgradeHyggeHeight + if minHeight < buildconstants.UpgradeHyggeHeight { + minHeight = buildconstants.UpgradeHyggeHeight } ts := m.StateAPI.Chain.GetHeaviestTipSet() diff --git a/node/modules/actorevent.go b/node/modules/actorevent.go index 22c5c5bc587..3b02be1c4e0 100644 --- a/node/modules/actorevent.go +++ b/node/modules/actorevent.go @@ -11,7 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events/filter" "github.com/filecoin-project/lotus/chain/messagepool" @@ -169,7 +169,7 @@ func ActorEventHandler(cfg config.EventsConfig) func(helpers.MetricsCtx, repo.Lo return full.NewActorEventHandler( cs, nil, // no EventFilterManager disables API calls - time.Duration(build.BlockDelaySecs)*time.Second, + time.Duration(buildconstants.BlockDelaySecs)*time.Second, abi.ChainEpoch(cfg.MaxFilterHeightRange), ), nil } @@ -177,7 +177,7 @@ func ActorEventHandler(cfg config.EventsConfig) func(helpers.MetricsCtx, repo.Lo return full.NewActorEventHandler( cs, fm, - time.Duration(build.BlockDelaySecs)*time.Second, + time.Duration(buildconstants.BlockDelaySecs)*time.Second, abi.ChainEpoch(cfg.MaxFilterHeightRange), ), nil } diff --git a/node/modules/chain.go b/node/modules/chain.go index 70cb9b58541..d6779a6305a 100644 --- a/node/modules/chain.go +++ b/node/modules/chain.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/blockstore/splitstore" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/beacon" "github.com/filecoin-project/lotus/chain/consensus" @@ -40,7 +40,7 @@ func ChainBitswap(lc fx.Lifecycle, mctx helpers.MetricsCtx, host host.Host, rt r // Write all incoming bitswap blocks into a temporary blockstore for two // block times. If they validate, they'll be persisted later. - cache := blockstore.NewTimedCacheBlockstore(2 * time.Duration(build.BlockDelaySecs) * time.Second) + cache := blockstore.NewTimedCacheBlockstore(2 * time.Duration(buildconstants.BlockDelaySecs) * time.Second) lc.Append(fx.Hook{OnStop: cache.Stop, OnStart: cache.Start}) bitswapBs := blockstore.NewTieredBstore(bs, cache) @@ -118,7 +118,7 @@ func NetworkName(mctx helpers.MetricsCtx, syscalls vm.SyscallBuilder, us stmgr.UpgradeSchedule, _ dtypes.AfterGenesisSet) (dtypes.NetworkName, error) { - if !build.Devnet { + if !buildconstants.Devnet { return "testnetnet", nil } diff --git a/node/modules/services.go b/node/modules/services.go index 9c90ba1308d..37ae325d3ec 100644 --- a/node/modules/services.go +++ b/node/modules/services.go @@ -16,6 +16,7 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/beacon" "github.com/filecoin-project/lotus/chain/beacon/drand" @@ -92,7 +93,7 @@ func RunChainExchange(h host.Host, svc exchange.Server) { } func waitForSync(stmgr *stmgr.StateManager, epochs int, subscribe func()) { - nearsync := time.Duration(epochs*int(build.BlockDelaySecs)) * time.Second + nearsync := time.Duration(epochs*int(buildconstants.BlockDelaySecs)) * time.Second // early check, are we synced at start up? ts := stmgr.ChainStore().GetHeaviestTipSet() @@ -227,7 +228,7 @@ type RandomBeaconParams struct { } func BuiltinDrandConfig() dtypes.DrandSchedule { - return build.DrandConfigSchedule() + return buildconstants.DrandConfigSchedule() } func RandomSchedule(lc fx.Lifecycle, mctx helpers.MetricsCtx, p RandomBeaconParams, _ dtypes.AfterGenesisSet) (beacon.Schedule, error) { diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index b244b4a28ca..74e20fba89a 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -25,6 +25,7 @@ import ( "github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/api/v1api" "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/events" "github.com/filecoin-project/lotus/chain/gen" @@ -109,7 +110,7 @@ func MinerID(ma dtypes.MinerAddress) (dtypes.MinerID, error) { } func StorageNetworkName(ctx helpers.MetricsCtx, a v1api.FullNode) (dtypes.NetworkName, error) { - if !build.Devnet { + if !buildconstants.Devnet { return "testnetnet", nil } return a.StateNetworkName(ctx) diff --git a/node/modules/testing/beacon.go b/node/modules/testing/beacon.go index 7876e1d0528..a449b8c85c1 100644 --- a/node/modules/testing/beacon.go +++ b/node/modules/testing/beacon.go @@ -3,13 +3,13 @@ package testing import ( "time" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/beacon" ) func RandomBeacon() (beacon.Schedule, error) { return beacon.Schedule{ {Start: 0, - Beacon: beacon.NewMockBeacon(time.Duration(build.BlockDelaySecs) * time.Second), + Beacon: beacon.NewMockBeacon(time.Duration(buildconstants.BlockDelaySecs) * time.Second), }}, nil } diff --git a/paychmgr/mock_test.go b/paychmgr/mock_test.go index 5d36e60f074..265f05dc010 100644 --- a/paychmgr/mock_test.go +++ b/paychmgr/mock_test.go @@ -13,7 +13,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/lib/sigs" @@ -250,5 +250,5 @@ func (pchapi *mockPaychAPI) addSigningKey(key []byte) { } func (pchapi *mockPaychAPI) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) { - return build.TestNetworkVersion, nil + return buildconstants.TestNetworkVersion, nil } diff --git a/paychmgr/settler/settler.go b/paychmgr/settler/settler.go index 55431f0a561..eb1bfe68002 100644 --- a/paychmgr/settler/settler.go +++ b/paychmgr/settler/settler.go @@ -14,7 +14,7 @@ import ( paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/node/impl/full" @@ -59,7 +59,7 @@ func SettlePaymentChannels(mctx helpers.MetricsCtx, lc fx.Lifecycle, papi API) e if err != nil { return err } - return ev.Called(ctx, pcs.check, pcs.messageHandler, pcs.revertHandler, int(build.MessageConfidence+1), events.NoTimeout, pcs.matcher) + return ev.Called(ctx, pcs.check, pcs.messageHandler, pcs.revertHandler, int(buildconstants.MessageConfidence+1), events.NoTimeout, pcs.matcher) }, }) return nil @@ -95,7 +95,7 @@ func (pcs *paymentChannelSettler) messageHandler(msg *types.Message, rec *types. } go func(voucher *paychtypes.SignedVoucher, submitMessageCID cid.Cid) { defer wg.Done() - msgLookup, err := pcs.api.StateWaitMsg(pcs.ctx, submitMessageCID, build.MessageConfidence, api.LookbackNoLimit, true) + msgLookup, err := pcs.api.StateWaitMsg(pcs.ctx, submitMessageCID, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { log.Errorf("submitting voucher: %s", err.Error()) return diff --git a/paychmgr/simple.go b/paychmgr/simple.go index 6d6b78a713e..daa0c55afca 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -17,7 +17,7 @@ import ( init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/types" ) @@ -530,7 +530,7 @@ func (ca *channelAccessor) waitForPaychCreateMsg(ctx context.Context, channelID } func (ca *channelAccessor) waitPaychCreateMsg(ctx context.Context, channelID string, mcid cid.Cid) error { - mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true) + mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { log.Errorf("wait msg: %v", err) return err @@ -645,7 +645,7 @@ func (ca *channelAccessor) waitForAddFundsMsg(ctx context.Context, channelID str } func (ca *channelAccessor) waitAddFundsMsg(ctx context.Context, channelID string, mcid cid.Cid) error { - mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true) + mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { log.Error(err) return err diff --git a/storage/pipeline/commit_batch.go b/storage/pipeline/commit_batch.go index e1e1e8f0902..22ed33965c7 100644 --- a/storage/pipeline/commit_batch.go +++ b/storage/pipeline/commit_batch.go @@ -21,7 +21,7 @@ import ( "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/lotus/api" - "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/actors/policy" "github.com/filecoin-project/lotus/chain/messagepool" @@ -229,7 +229,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes, blackedOut := func() bool { const nv16BlackoutWindow = abi.ChainEpoch(20) // a magik number - if ts.Height() <= build.UpgradeSkyrHeight && build.UpgradeSkyrHeight-ts.Height() < nv16BlackoutWindow { + if ts.Height() <= buildconstants.UpgradeSkyrHeight && buildconstants.UpgradeSkyrHeight-ts.Height() < nv16BlackoutWindow { return true } return false @@ -892,7 +892,7 @@ func (b *CommitBatcher) getCommitCutoff(si SectorInfo) (time.Time, error) { return time.Now(), nil } - return time.Now().Add(time.Duration(cutoffEpoch-ts.Height()) * time.Duration(build.BlockDelaySecs) * time.Second), nil + return time.Now().Add(time.Duration(cutoffEpoch-ts.Height()) * time.Duration(buildconstants.BlockDelaySecs) * time.Second), nil } func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tsk types.TipSetKey) (abi.TokenAmount, error) { diff --git a/storage/pipeline/input.go b/storage/pipeline/input.go index 8862380d8f6..97a78372fe8 100644 --- a/storage/pipeline/input.go +++ b/storage/pipeline/input.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/lib/result" @@ -148,7 +148,7 @@ func (m *Sealing) maybeStartSealing(ctx statemachine.Context, sector SectorInfo, // check deal age, start sealing when the deal closest to starting is within slack time ts, err := m.Api.ChainHead(ctx.Context()) - blockTime := time.Second * time.Duration(build.BlockDelaySecs) + blockTime := time.Second * time.Duration(buildconstants.BlockDelaySecs) if err != nil { return false, xerrors.Errorf("API error getting head: %w", err) } diff --git a/storage/pipeline/precommit_batch.go b/storage/pipeline/precommit_batch.go index 0efe446bdd9..79ba5eefbc1 100644 --- a/storage/pipeline/precommit_batch.go +++ b/storage/pipeline/precommit_batch.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/api" - "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/actors/policy" "github.com/filecoin-project/lotus/chain/types" @@ -349,7 +349,7 @@ func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, depos sn := s.SectorNumber b.lk.Lock() - b.cutoffs[sn] = time.Now().Add(time.Duration(cutoffEpoch-ts.Height()) * time.Duration(build.BlockDelaySecs) * time.Second) + b.cutoffs[sn] = time.Now().Add(time.Duration(cutoffEpoch-ts.Height()) * time.Duration(buildconstants.BlockDelaySecs) * time.Second) b.todo[sn] = &preCommitEntry{ deposit: deposit, pci: in, diff --git a/storage/pipeline/precommit_policy_test.go b/storage/pipeline/precommit_policy_test.go index 6329e90d3b9..4860756baa0 100644 --- a/storage/pipeline/precommit_policy_test.go +++ b/storage/pipeline/precommit_policy_test.go @@ -16,7 +16,7 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/policy" @@ -48,7 +48,7 @@ func fakeConfigGetter(stub *fakeConfigStub) dtypes.GetSealingConfigFunc { } func (f *fakeChain) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) { - return build.TestNetworkVersion, nil + return buildconstants.TestNetworkVersion, nil } func makeBFTs(t *testing.T, basefee abi.TokenAmount, h abi.ChainEpoch) *types.TipSet { @@ -109,7 +109,7 @@ func TestBasicPolicyEmptySector(t *testing.T) { require.NoError(t, err) // as set when there are no deal pieces - maxExtension, err := policy.GetMaxSectorExpirationExtension(build.TestNetworkVersion) + maxExtension, err := policy.GetMaxSectorExpirationExtension(buildconstants.TestNetworkVersion) assert.NoError(t, err) expected := h + maxExtension - pBuffer assert.Equal(t, int(expected), int(exp)) @@ -201,7 +201,7 @@ func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) { exp, err := pcp.Expiration(context.Background(), pieces...) require.NoError(t, err) - maxLifetime, err := policy.GetMaxSectorExpirationExtension(build.TestNetworkVersion) + maxLifetime, err := policy.GetMaxSectorExpirationExtension(buildconstants.TestNetworkVersion) require.NoError(t, err) // Treated as a CC sector, so expiration becomes currEpoch + maxLifetime = 55 + 1555200 diff --git a/storage/pipeline/states_proving.go b/storage/pipeline/states_proving.go index 500dcab48e6..0c15d7ae934 100644 --- a/storage/pipeline/states_proving.go +++ b/storage/pipeline/states_proving.go @@ -9,7 +9,7 @@ import ( "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" ) @@ -26,7 +26,7 @@ func (m *Sealing) handleFaultReported(ctx statemachine.Context, sector SectorInf return xerrors.Errorf("entered fault reported state without a FaultReportMsg cid") } - mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.FaultReportMsg, build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.FaultReportMsg, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { return xerrors.Errorf("failed to wait for fault declaration: %w", err) } @@ -89,7 +89,7 @@ func (m *Sealing) handleTerminateWait(ctx statemachine.Context, sector SectorInf return ctx.Send(SectorTerminated{TerminatedAt: ts.Height()}) } - mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.TerminateMessage, build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.TerminateMessage, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { return ctx.Send(SectorTerminateFailed{xerrors.Errorf("waiting for terminate message to land on chain: %w", err)}) } @@ -117,7 +117,7 @@ func (m *Sealing) handleTerminateFinality(ctx statemachine.Context, sector Secto return ctx.Send(SectorRemove{}) } - toWait := time.Duration(ts.Height()-sector.TerminatedAt+policy.GetWinningPoStSectorSetLookback(nv)) * time.Duration(build.BlockDelaySecs) * time.Second + toWait := time.Duration(ts.Height()-sector.TerminatedAt+policy.GetWinningPoStSectorSetLookback(nv)) * time.Duration(buildconstants.BlockDelaySecs) * time.Second select { case <-time.After(toWait): continue diff --git a/storage/pipeline/states_replica_update.go b/storage/pipeline/states_replica_update.go index 85e3fabee79..0983a08e634 100644 --- a/storage/pipeline/states_replica_update.go +++ b/storage/pipeline/states_replica_update.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/lotus/api" - "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/actors/policy" "github.com/filecoin-project/lotus/chain/types" @@ -318,7 +318,7 @@ func (m *Sealing) handleReplicaUpdateWait(ctx statemachine.Context, sector Secto return ctx.Send(SectorSubmitReplicaUpdateFailed{}) } - mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage, build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { log.Errorf("handleReplicaUpdateWait: failed to wait for message: %+v", err) return ctx.Send(SectorSubmitReplicaUpdateFailed{}) @@ -374,7 +374,7 @@ func (m *Sealing) handleUpdateActivating(ctx statemachine.Context, sector Sector } try := func() error { - mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage, build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { return err } diff --git a/storage/pipeline/states_sealing.go b/storage/pipeline/states_sealing.go index 795cabdb34d..bbd4332db28 100644 --- a/storage/pipeline/states_sealing.go +++ b/storage/pipeline/states_sealing.go @@ -28,7 +28,7 @@ import ( "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/policy" @@ -519,7 +519,7 @@ func (m *Sealing) handlePreCommitWait(ctx statemachine.Context, sector SectorInf // would be ideal to just use the events.Called handler, but it wouldn't be able to handle individual message timeouts log.Info("Sector precommitted: ", sector.SectorNumber) - mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.PreCommitMessage, build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.PreCommitMessage, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { return ctx.Send(SectorChainPreCommitFailed{err}) } @@ -905,7 +905,7 @@ func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo) return ctx.Send(SectorCommitFailed{xerrors.Errorf("entered commit wait with no commit cid")}) } - mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.CommitMessage, build.MessageConfidence, api.LookbackNoLimit, true) + mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.CommitMessage, buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { return ctx.Send(SectorCommitFailed{xerrors.Errorf("failed to wait for porep inclusion: %w", err)}) } diff --git a/storage/wdpost/wdpost_run.go b/storage/wdpost/wdpost_run.go index edc088ccf64..87d161e5f01 100644 --- a/storage/wdpost/wdpost_run.go +++ b/storage/wdpost/wdpost_run.go @@ -23,6 +23,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/policy" @@ -664,7 +665,7 @@ func (s *WindowPoStScheduler) submitPoStMessage(ctx context.Context, proof *mine log.Infof("Submitted window post: %s (deadline %d)", sm.Cid(), proof.Deadline) go func() { - rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { log.Error(err) return diff --git a/storage/wdpost/wdpost_run_faults.go b/storage/wdpost/wdpost_run_faults.go index 250be0c3ab7..3d6a846c7e4 100644 --- a/storage/wdpost/wdpost_run_faults.go +++ b/storage/wdpost/wdpost_run_faults.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/types" @@ -46,7 +46,7 @@ func init() { // sectors arrives. That way, recoveries are declared in preparation for those // sectors to be proven. // -// If a declaration is made, it awaits for build.MessageConfidence confirmations +// If a declaration is made, it awaits for buildconstants.MessageConfidence confirmations // on chain before returning. // // TODO: the waiting should happen in the background. Right now this @@ -182,7 +182,7 @@ func (s *WindowPoStScheduler) declareRecoveries(ctx context.Context, dlIdx uint6 } for _, msg := range msgs { - rec, err := s.api.StateWaitMsg(context.TODO(), msg.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) + rec, err := s.api.StateWaitMsg(context.TODO(), msg.Cid(), buildconstants.MessageConfidence, api.LookbackNoLimit, true) if err != nil { return batchedRecoveryDecls, msgs, xerrors.Errorf("declare faults recovered wait error: %w", err) } @@ -258,7 +258,7 @@ func (s *WindowPoStScheduler) asyncFaultRecover(di dline.Info, ts *types.TipSet) // sectors arrives. That way, recoveries are declared in preparation for those // sectors to be proven. // -// If a declaration is made, it awaits for build.MessageConfidence confirmations +// If a declaration is made, it awaits for buildconstants.MessageConfidence confirmations // on chain before returning. func (s *WindowPoStScheduler) declareManualRecoveries(ctx context.Context, maddr address.Address, sectors []abi.SectorNumber, tsk types.TipSetKey) ([]cid.Cid, error) { diff --git a/storage/wdpost/wdpost_run_test.go b/storage/wdpost/wdpost_run_test.go index 381f0e818bd..f33db91af4e 100644 --- a/storage/wdpost/wdpost_run_test.go +++ b/storage/wdpost/wdpost_run_test.go @@ -25,7 +25,7 @@ import ( tutils "github.com/filecoin-project/specs-actors/v2/support/testing" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/policy" @@ -55,7 +55,7 @@ func (m *mockStorageMinerAPI) StateMinerInfo(ctx context.Context, a address.Addr } func (m *mockStorageMinerAPI) StateNetworkVersion(ctx context.Context, key types.TipSetKey) (network.Version, error) { - return build.TestNetworkVersion, nil + return buildconstants.TestNetworkVersion, nil } func (m *mockStorageMinerAPI) StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) { diff --git a/tools/stats/points/collect.go b/tools/stats/points/collect.go index 24be14a6a96..8b1d3e06c85 100644 --- a/tools/stats/points/collect.go +++ b/tools/stats/points/collect.go @@ -17,7 +17,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -192,7 +191,7 @@ func (c *ChainPointCollector) collectBlockheaderPoints(ctx context.Context, pl * baseFeeIn := tipset.Blocks()[0].ParentBaseFee newBaseFee := store.ComputeNextBaseFee(baseFeeIn, totalUniqGasLimit, len(tipset.Blocks()), tipset.Height()) - baseFeeRat := new(big.Rat).SetFrac(newBaseFee.Int, new(big.Int).SetUint64(build.FilecoinPrecision)) + baseFeeRat := new(big.Rat).SetFrac(newBaseFee.Int, new(big.Int).SetUint64(buildconstants.FilecoinPrecision)) baseFeeFloat, _ := baseFeeRat.Float64() p = influx.NewPoint("chain.basefee", baseFeeFloat) pl.AddPoint(p) @@ -223,7 +222,7 @@ func (c *ChainPointCollector) collectStaterootPoints(ctx context.Context, pl *in done() }() - attoFil := types.NewInt(build.FilecoinPrecision).Int + attoFil := types.NewInt(buildconstants.FilecoinPrecision).Int netBal, err := c.api.WalletBalance(ctx, reward.Address) if err != nil { diff --git a/tools/stats/sync/sync.go b/tools/stats/sync/sync.go index 5a925d4cbcc..04aec901b65 100644 --- a/tools/stats/sync/sync.go +++ b/tools/stats/sync/sync.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/tools/stats/headbuffer" @@ -70,14 +71,14 @@ func SyncWait(ctx context.Context, napi SyncWaitApi) error { ) } - if build.Clock.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs)*30 { + if build.Clock.Now().Unix()-int64(head.MinTimestamp()) < int64(buildconstants.BlockDelaySecs)*30 { break } select { case <-ctx.Done(): return ctx.Err() - case <-build.Clock.After(time.Duration(int64(build.BlockDelaySecs) * int64(time.Second))): + case <-build.Clock.After(time.Duration(int64(buildconstants.BlockDelaySecs) * int64(time.Second))): } }