lotus/node/config/def.go

225 lines
7.0 KiB
Go
Raw Normal View History

package config
import (
"encoding"
"time"
"github.com/ipfs/go-cid"
2021-06-08 13:43:43 +00:00
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
2021-05-19 12:32:41 +00:00
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
2020-08-12 17:47:00 +00:00
"github.com/filecoin-project/lotus/chain/types"
2020-08-17 13:39:33 +00:00
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
)
const (
// RetrievalPricingDefault configures the node to use the default retrieval pricing policy.
2021-06-14 04:40:29 +00:00
RetrievalPricingDefaultMode = "default"
// RetrievalPricingExternal configures the node to use the external retrieval pricing script
// configured by the user.
2021-06-14 04:40:29 +00:00
RetrievalPricingExternalMode = "external"
)
2021-06-08 13:43:43 +00:00
func (b *BatchFeeConfig) FeeForSectors(nSectors int) abi.TokenAmount {
return big.Add(big.Int(b.Base), big.Mul(big.NewInt(int64(nSectors)), big.Int(b.PerSector)))
}
func defCommon() Common {
return Common{
API: API{
ListenAddress: "/ip4/127.0.0.1/tcp/1234/http",
Timeout: Duration(30 * time.Second),
},
Libp2p: Libp2p{
ListenAddresses: []string{
"/ip4/0.0.0.0/tcp/0",
"/ip6/::/tcp/0",
},
AnnounceAddresses: []string{},
NoAnnounceAddresses: []string{},
2019-12-17 16:09:43 +00:00
ConnMgrLow: 150,
ConnMgrHigh: 180,
2019-12-17 16:09:43 +00:00
ConnMgrGrace: Duration(20 * time.Second),
},
2020-05-04 15:30:54 +00:00
Pubsub: Pubsub{
Bootstrapper: false,
DirectPeers: nil,
2020-08-24 15:01:52 +00:00
RemoteTracer: "/dns4/pubsub-tracer.filecoin.io/tcp/4001/p2p/QmTd6UvR47vUidRNZ1ZKXHrAFhqTJAD27rKL9XYghEKgKX",
2020-05-04 15:30:54 +00:00
},
}
}
var DefaultDefaultMaxFee = types.MustParseFIL("0.07")
var DefaultSimultaneousTransfers = uint64(20)
2020-10-29 19:50:04 +00:00
// DefaultFullNode returns the default config
func DefaultFullNode() *FullNode {
return &FullNode{
Common: defCommon(),
2020-10-29 19:50:04 +00:00
Fees: FeeConfig{
DefaultMaxFee: DefaultDefaultMaxFee,
},
Client: Client{
SimultaneousTransfers: DefaultSimultaneousTransfers,
},
Chainstore: Chainstore{
EnableSplitstore: false,
Splitstore: Splitstore{
ColdStoreType: "universal",
HotStoreType: "badger",
MarkSetType: "map",
HotStoreFullGCFrequency: 20,
},
},
}
}
func DefaultStorageMiner() *StorageMiner {
cfg := &StorageMiner{
Common: defCommon(),
2020-08-18 16:27:28 +00:00
2020-08-18 14:20:31 +00:00
Sealing: SealingConfig{
MaxWaitDealsSectors: 2, // 64G with 32G sectors
MaxSealingSectors: 0,
MaxSealingSectorsForDeals: 0,
WaitDealsDelay: Duration(time.Hour * 6),
AlwaysKeepUnsealedCopy: true,
FinalizeEarly: false,
2021-03-10 15:16:44 +00:00
2021-06-29 16:17:08 +00:00
CollateralFromMinerBalance: false,
AvailableBalanceBuffer: types.FIL(big.Zero()),
DisableCollateralFallback: false,
2021-03-10 15:16:44 +00:00
2021-05-18 14:51:06 +00:00
BatchPreCommits: true,
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize, // up to 256 sectors
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
PreCommitBatchSlack: Duration(3 * time.Hour), // time buffer for forceful batch submission before sectors/deals in batch would start expiring, higher value will lower the chances for message fail due to expiration
2021-05-18 14:51:06 +00:00
AggregateCommits: true,
MinCommitBatch: miner5.MinAggregatedSectors, // per FIP13, we must have at least four proofs to aggregate, where 4 is the cross over point where aggregation wins out on single provecommit gas costs
MaxCommitBatch: miner5.MaxAggregatedSectors, // maximum 819 sectors, this is the maximum aggregation per FIP13
CommitBatchWait: Duration(24 * time.Hour), // this can be up to 30 days
CommitBatchSlack: Duration(1 * time.Hour), // time buffer for forceful batch submission before sectors/deals in batch would start expiring, higher value will lower the chances for message fail due to expiration
2021-05-18 14:51:06 +00:00
AggregateAboveBaseFee: types.FIL(types.BigMul(types.PicoFil, types.NewInt(150))), // 0.15 nFIL
2021-05-18 11:30:47 +00:00
TerminateBatchMin: 1,
TerminateBatchMax: 100,
2021-05-18 14:51:06 +00:00
TerminateBatchWait: Duration(5 * time.Minute),
2020-08-18 14:20:31 +00:00
},
2019-11-12 17:59:38 +00:00
Storage: sectorstorage.SealerConfig{
2020-08-17 09:39:29 +00:00
AllowAddPiece: true,
AllowPreCommit1: true,
AllowPreCommit2: true,
AllowCommit: true,
AllowUnseal: true,
// Default to 10 - tcp should still be able to figure this out, and
// it's the ratio between 10gbit / 1gbit
ParallelFetchLimit: 10,
// By default use the hardware resource filtering strategy.
ResourceFiltering: sectorstorage.ResourceFilteringHardware,
},
Dealmaking: DealmakingConfig{
ConsiderOnlineStorageDeals: true,
ConsiderOfflineStorageDeals: true,
ConsiderOnlineRetrievalDeals: true,
ConsiderOfflineRetrievalDeals: true,
ConsiderVerifiedStorageDeals: true,
ConsiderUnverifiedStorageDeals: true,
PieceCidBlocklist: []cid.Cid{},
// TODO: It'd be nice to set this based on sector size
MaxDealStartDelay: Duration(time.Hour * 24 * 14),
ExpectedSealDuration: Duration(time.Hour * 24),
PublishMsgPeriod: Duration(time.Hour),
MaxDealsPerPublishMsg: 8,
MaxProviderCollateralMultiplier: 2,
2021-06-28 09:39:01 +00:00
SimultaneousTransfers: DefaultSimultaneousTransfers,
RetrievalPricing: &RetrievalPricing{
2021-06-14 04:40:29 +00:00
Strategy: RetrievalPricingDefaultMode,
Default: &RetrievalPricingDefault{
VerifiedDealsFreeTransfer: true,
},
2021-06-04 12:03:11 +00:00
External: &RetrievalPricingExternal{
Path: "",
},
},
},
2021-05-26 10:47:21 +00:00
Subsystems: MinerSubsystemConfig{
EnableMining: true,
EnableSealing: true,
EnableSectorStorage: true,
EnableMarkets: true,
2021-05-26 10:47:21 +00:00
},
2020-08-12 17:47:00 +00:00
Fees: MinerFeeConfig{
2021-06-08 13:43:43 +00:00
MaxPreCommitGasFee: types.MustParseFIL("0.025"),
MaxCommitGasFee: types.MustParseFIL("0.05"),
MaxPreCommitBatchGasFee: BatchFeeConfig{
Base: types.MustParseFIL("0"),
PerSector: types.MustParseFIL("0.02"),
2021-06-08 13:43:43 +00:00
},
MaxCommitBatchGasFee: BatchFeeConfig{
Base: types.MustParseFIL("0"),
PerSector: types.MustParseFIL("0.03"), // enough for 6 agg and 1nFIL base fee
2021-06-08 13:43:43 +00:00
},
2021-01-12 23:42:01 +00:00
MaxTerminateGasFee: types.MustParseFIL("0.5"),
2020-10-15 00:46:47 +00:00
MaxWindowPoStGasFee: types.MustParseFIL("5"),
MaxPublishDealsFee: types.MustParseFIL("0.05"),
MaxMarketBalanceAddFee: types.MustParseFIL("0.007"),
2020-08-12 17:47:00 +00:00
},
2020-12-02 20:54:38 +00:00
Addresses: MinerAddressConfig{
PreCommitControl: []string{},
CommitControl: []string{},
TerminateControl: []string{},
DealPublishControl: []string{},
2020-12-02 20:54:38 +00:00
},
DAGStore: DAGStoreConfig{
MaxConcurrentIndex: 5,
MaxConcurrentReadyFetches: 2,
MaxConcurrencyStorageCalls: 100,
GCInterval: Duration(1 * time.Minute),
},
}
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
cfg.Common.API.RemoteListenAddress = "127.0.0.1:2345"
return cfg
}
var _ encoding.TextMarshaler = (*Duration)(nil)
var _ encoding.TextUnmarshaler = (*Duration)(nil)
// Duration is a wrapper type for time.Duration
// for decoding and encoding from/to TOML
type Duration time.Duration
// UnmarshalText implements interface for TOML decoding
func (dur *Duration) UnmarshalText(text []byte) error {
d, err := time.ParseDuration(string(text))
if err != nil {
return err
}
*dur = Duration(d)
return err
}
func (dur Duration) MarshalText() ([]byte, error) {
d := time.Duration(dur)
return []byte(d.String()), nil
}