filecoin-project / FIPs

The Filecoin Improvement Proposal repository
312 stars 164 forks source link

Standardize Storage AskProtocol v2 #225

Closed jennijuju closed 2 years ago

jennijuju commented 2 years ago

Originally posted by @brendalee, edited by @jennijuju December 13, 2021 Starting this issue to get additional feedback from the community on proposed updates to the storage AsksProtocol v1.1.0. Currently, the ask protocol does not give the client / SP enough information on the likelihood of a storage deal being accepted. Note that there have already been a handful of discussions around storage ask protocol changes with the community (notably in Filecoin Slack #arg channel and other ad-hoc discussions with storage providers).

The goal of AskProtocol v2 is to help with awareness between the client and the storage provider before a deal proposal. Before a client attempts to make a deal, they can send details of their proposed deal, and the storage provider can respond to the proposal (with accept or reject and other details such as price). Note that the ask protocol is not designed to handle back and forth deal negotiations.

Proposed Storage AskProtocol v2 Standard

This proposal is to request change to the current ask protocol and update the version of AskProtocolID to /fil/storage/ask/1.1.0, and

Storage AskProtocol v2 Sketch

We need to design a new storage ask protocol. Let's brainstorm what it might look like here. I think we should keep it very simple still, with a client requesting, and the storage provider responding. To get started, i'm just going to define a request and a response type, and then we can assume thats the protocol.

Request

type StorageAskRequest struct {
  ClientAddress Address
  PeerId  *abi.PeerID //nullable
  PieceSize abi.PaddedPieceSize
  Duration int64
  //Deal start epoch
  StartEpoch abi.ChainEpoch 
  Verified bool
  TransferProtocol string
  Message string

Signature: The request should be signed by the client.

Open question:

Response

The response should be a signed object containing the request, for context

type StorageAskResponse struct {
  Query StorageAskRequest

  // WillAccept denotes whether or not the storage provider will accept the proposed deal
  WillAccept bool

  // RejectionCode should projects the reection reason
  RejectionCode uint

  // Price per GB per epoch. This is a single price field, verified vs unverified is specified by the Query
  Price abi.TokenAmount

  // Expiry denotes how long this offer is valid for
  // This AskResponse is not binding in any way, this is just for the clients convenience.
  Expiry time.Time

  //DealStartEpoch is how soon miner offers to get the deal fully onchain (provecommited) 
  DealStartEpoch abi.ChainEpoch

  // Message is a free-form field set by the storage provider to the client
  Message string
}

Open Questions:

jennijuju commented 2 years ago

Initial FIP draft created at #224

Simple Summary

The goal of AskProtocol v2 is to help with the discovery between the client and storage providers before making a storage deal proposal. As the first step of the SP discovery, clients can send details of their proposed deal to the storage provider, and the storage provider should be able to respond to the proposal (with accept or reject, price and additional service offer). Note that the ask protocol is not designed to handle back and forth deal negotiations.

Abstract

AskProtocol v2 aims to improve the existing AskProtocol to help the client understand whether or not a storage provider is likely to accept their deal before they send a signed proposal.

The proposed flow is simple. The client sends an ask request with information about the storage deal they would like to make. The ask response by the storage provider indicates whether or not the deal will be accepted with specifics on conditions (for example, how long the offer is valid for, and what the price to store is). More details about the AskProtocol v2 request/response can be found in the specification section.

Change Motivation

Clients need to be able to share details of the storage deal they want to make. Furthermore, they need to know what capabilities and features a Storage Provider supports, so as to understand what Storage Providers they can successfully make a deal with.

Specification

Client Request of AskProtocol v2

For the AskProtocol v2 request, the client provides the following information:

type StorageAskRequest struct {
  ClientAddress Address
  PeerId  *abi.PeerID 
  PieceSize abi.PaddedPieceSize
  Duration int64
  StartEpoch abi.ChainEpoch 
  Verified bool
  TransferProtocol string
  Message string

where:

Storage Provider Response of AskProtocol v2

For the response, the provider will respond with the following information:

type StorageAskResponse struct {
  Query StorageAskRequest
  WillAccept bool
  RejectionCode uint
  Price abi.TokenAmount
  Expiry time.Time
  DealStartEpoch abi.ChainEpoch
  Message string
}

where:

Design Rationale

TBD

Backwards Compatibility

TBD

Test Cases

TBD

Security Considerations

TBD

Incentive Considerations

N/A

Product Considerations

One of the main experiences we want to improve is storage dealmaking and overall Filecoin storage reliability. AskProtocol v2 improvements aim to help with the following:

Implementation

TBD

Copyright

Copyright and related rights waived via CC0.

brendalee commented 2 years ago

Some discussion points -

Ask request

Ask response

hunjixin commented 2 years ago

In venus-market, we have gathered the needs of many miners and miners. access the venus-market address directly during the ask process (market url obtained by accessing a fixed contract/config in the future), and return a series of miners and the miner’s demand, and then let the client choose a miner to issue an order.

steven004 commented 2 years ago

I would like to put @hunjixin 's thought into more general.

In Filecoin ecosystem, the storage provider just part of the network infrastructure, above that, there could be higher layer services, e.g. deal broker, gateway or proxy, to help on storing data to Filecoin and retrieval from Filecoin network too. In addition, when we consider retrieval, there could be services particularly for retrieval too, that means, the fast retrieval could be done by other service nodes.

And all these services bridging between the clients and storage providers could be possibly provided by smart contracts when FVM is available.

In the v2 design, should we make it more flexible to not limit to storage provide nodes and end clients, or we design a delegate or trust protocol for the market in another FIP, while having this protocol support it?

anorth commented 2 years ago

I would love to evaluate this proposal, but can't do much without much more description of the perceived problems, motivation for specific changes, and design rationale.