# 市场属性配置

# Simple Summary (概述)

矿工可以自己配置存储市场和检索市场的属性。

# Abstract (功能简介)

venus-market 支持矿工的市场交易属性可独立配置,并可以由矿工自己配置,而不是通过链服务维护人员间接进行。

关联:

# Motivation (来源/背景)

Filecoin 网络中的矿工参与市场交易需要一些属性来保证交易过程正常进行,也可以通过一些属性来设置自己的交易取向,如:仅接受可验证订单、只进行离线订单等。可配置属性如下:

# Default config:
ConsiderOnlineStorageDeals = true
ConsiderOfflineStorageDeals = true
ConsiderOnlineRetrievalDeals = true
ConsiderOfflineRetrievalDeals = true
ConsiderVerifiedStorageDeals = true
ConsiderUnverifiedStorageDeals = true
PieceCidBlocklist = []
ExpectedSealDuration = "24h0m0s"
MaxDealStartDelay = "336h0m0s"
PublishMsgPeriod = "30s"
MaxDealsPerPublishMsg = 8
MaxProviderCollateralMultiplier = 2
Filter = ""
RetrievalFilter = ""
TransfePath = ""
MaxPublishDealsFee = "0 FIL"
MaxMarketBalanceAddFee = "0 FIL"

[AddressConfig]
  DisableWorkerFallback = false
  
[RetrievalPricing]
  Strategy = "default"
  [RetrievalPricing.Default]
    VerifiedDealsFreeTransfer = true
  [RetrievalPricing.External]
    Path = ""

在目前的 venus-market 实现中,所有的矿工共用一份配置,无法单独为某个矿工配置交易属性。

# 延伸问题

  • 批量发单的问题:market-client 需要支持批量发单:自动切分文件、发单;

  • venus-market 统一 pool-runsolo-run 两种部署模式为一种,倾向于部署在链下。

# Specification (feature Spec)

# 属性配置

  • 有一套全局的属性表,当矿工没有独立配置时采用全局配置;
  • 支持矿工有独立的属性表;
  • 提供更新属性的 API及界面。

支持多矿工属性的配置项如下:

# global
[CommonProviderConfig]
  ConsiderOnlineStorageDeals = true
  ConsiderOfflineStorageDeals = true
  ConsiderOnlineRetrievalDeals = true
  ConsiderOfflineRetrievalDeals = true
  ConsiderVerifiedStorageDeals = true
  ConsiderUnverifiedStorageDeals = true
  PieceCidBlocklist = []
  ExpectedSealDuration = "24h0m0s"
  MaxDealStartDelay = "336h0m0s"
  PublishMsgPeriod = "1h0m0s"
  MaxDealsPerPublishMsg = 8
  MaxProviderCollateralMultiplier = 2
  Filter = ""
  RetrievalFilter = ""
  TransferPath = ""
  MaxPublishDealsFee = "0 FIL"
  MaxMarketBalanceAddFee = "0 FIL"
  [CommonProviderConfig.RetrievalPricing]
    Strategy = "default"
    [CommonProviderConfig.RetrievalPricing.Default]
      VerifiedDealsFreeTransfer = true
    [CommonProviderConfig.RetrievalPricing.External]
      Path = ""
  [CommonProviderConfig.AddressConfig]
    DisableWorkerFallback = false

# 每个矿工的属性表,没有配置则使用全局配置
[[Miners]]
  Addr = "f01000"
  Account = "testuser01"
  
   ConsiderOnlineStorageDeals = true
   ConsiderOfflineStorageDeals = true
   ConsiderOnlineRetrievalDeals = true
   ConsiderOfflineRetrievalDeals = true
   ConsiderVerifiedStorageDeals = true
   ConsiderUnverifiedStorageDeals = true
   PieceCidBlocklist = []
   ExpectedSealDuration = "24h0m0s"
   MaxDealStartDelay = "336h0m0s"
   PublishMsgPeriod = "1h0m0s"
   MaxDealsPerPublishMsg = 8
   MaxProviderCollateralMultiplier = 2
   Filter = ""
   RetrievalFilter = ""
   TransferPath = ""
   MaxPublishDealsFee = "0 FIL"
   MaxMarketBalanceAddFee = "0 FIL"
   [CommonProviderConfig.RetrievalPricing]
     Strategy = "default"
     [CommonProviderConfig.RetrievalPricing.Default]
       VerifiedDealsFreeTransfer = true
     [CommonProviderConfig.RetrievalPricing.External]
       Path = ""
   [CommonProviderConfig.AddressConfig]
     DisableWorkerFallback = false
      
[[Miners]]
  Addr = "f01002"
  Account = "testuser02"
  
   ConsiderOnlineStorageDeals = true
   ConsiderOfflineStorageDeals = true
   ConsiderOnlineRetrievalDeals = true
   ConsiderOfflineRetrievalDeals = true
   ConsiderVerifiedStorageDeals = true
   ConsiderUnverifiedStorageDeals = true
   PieceCidBlocklist = []
   ExpectedSealDuration = "24h0m0s"
   MaxDealStartDelay = "336h0m0s"
   PublishMsgPeriod = "1h0m0s"
   MaxDealsPerPublishMsg = 8
   MaxProviderCollateralMultiplier = 2
   Filter = ""
   RetrievalFilter = ""
   TransferPath = ""
   MaxPublishDealsFee = "0 FIL"
   MaxMarketBalanceAddFee = "0 FIL"
   [CommonProviderConfig.RetrievalPricing]
     Strategy = "default"
     [CommonProviderConfig.RetrievalPricing.Default]
       VerifiedDealsFreeTransfer = true
     [CommonProviderConfig.RetrievalPricing.External]
       Path = ""
   [CommonProviderConfig.AddressConfig]
     DisableWorkerFallback = false

# 用户界面

  • venus-market 的命令行;
  • venus-sector-manager/venus-tools 的命令行 (可选);

# Design Rationale (设计思路)

# Backwards Compatibility(兼容性)

本需求的实现会改变配置项的结构,需要实现配置文件的自动升级。

# Test Cases (测试用例)

  • 配置文件自动升级;
  • 矿工交易属性可通过命令行或手动改配置文件设置;

# Security Considerations (安全考量)

# Implementation(实施)