application-research / outercore-eng-kb

Official Knowledge base repo of Estuary
https://estuary.tech
5 stars 0 forks source link

Idea/Proposal: Perpetual Storage Contracts #24

Open jcace opened 1 year ago

jcace commented 1 year ago

Proposal: Perpetual Storage Contracts

Author @gmelodie @elijaharita @jcace
Status Draft
Revision 0.0.1

Proposal/Overview

This document outlines a potential scheme for perpetual Filecoin storage contracts on the Filecoin Virtual Machine (FVM).

Background

Currently, Filecoin deals are limited in length to 540 days. While there is discussion about increasing this up to 5 years, there still remains a situation where a Storage Client would like to store data for a much longer term, potentially several times the length of a single storage deal.

Benefits

A reference implementation / example for perpetual, auto-renewing storage deals would be a useful building block for others building on Filecoin and FVM

Goals

Design Overview

Use Lotus web3 client contract to make deals with storage provider

Construct DealProposal

Client Inputs

*Every parameter is configurable once the contract is deployed, except for the CID.

Detailed Design

Smart Contract Functions

Client-Side
SP-Side

Functionality

Initial Replica

  1. Client deploys the contract using the initial params
  2. Client must "seed" the file, keeping it available and downloadable until first replicas have been sealed
  3. SPs call claimDeal() function, indicating they want to seal and store it, and receive the download information
  4. SP downloads the CID from the "seed" location
  5. SP seals the CID into a sector
  6. SP calls the publishDeal() function, indicating they have successfully on-boarded the data
  7. Contract tracks the expiry epoch of the deal, opens up another replica slot before it expires.

Once all replicas have been claimed, the claimDeal() function simply returns the next expected epoch when the soonest one will expire.

Subsequent Replica After a deal expires, a slot is opened up. claimDeal() returns a list of all other SPs that the CID has been replicated to, for retrieval and the next deal. SPs can call claimDeal() and the flow is the same as detailed in Initial Replica

Dependencies

Performance Implications

Questions

Assumptions / Considerations

10d9e commented 1 year ago

https://github.com/lotus-web3/deal-bounty-contract