Storage Deal Flow
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow
Add Storage Deal and Power
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.add-storage-deal-and-power
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.add-storage-deal-and-power
StorageClient
andStorageProvider
callStorageMarketActor.AddBalance
to deposit funds into Storage Market.StorageClient
andStorageProvider
can callWithdrawBalance
before any deal is made.
StorageClient
andStorageProvider
negotiate a deal off chain.StorageClient
sends aStorageDealProposal
to aStorageProvider
.StorageProvider
verifies theStorageDeal
by checking: - the address and signature of theStorageClient
, - the proposal’sStartEpoch
is after the current Epoch, - (tentative) theStorageClient
did not call withdraw in the last X epochs (WithdrawBalance
should take at least X epochs) - X is currently set to 0, but the setting will be re-considered in the near future. - bothStorageProvider
andStorageClient
have sufficient available balances inStorageMarketActor
.
StorageProvider
signs theStorageDealProposal
by constructing an on-chain message.StorageProvider
callsPublishStorageDeals
inStorageMarketActor
to publish this on-chain message which will generate aDealID
for eachStorageDeal
and store a mapping fromDealID
toStorageDeal
. However, the deals are not active at this point.- As a backup,
StorageClient
may callPublishStorageDeals
with theStorageDeal
, to activate the deal if they can obtain the signed on-chain message fromStorageProvider
. - It is possible for either
StorageProvider
orStorageClient
to try to enter into two deals simultaneously with funds available only for one. Only the first deal to commit to the chain will clear, the second will fail with errorerrorcode.InsufficientFunds
.
- As a backup,
StorageProvider
callsHandleStorageDeal
inStorageMiningSubsystem
which will then add theStorageDeal
into aSector
.
Sealing sectors
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.sealing-sectors
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.sealing-sectors
- Once a miner finishes packing a
Sector
, it generates aSectorPreCommitInfo
and callsPreCommitSector
orPreCommitSectorBatch
with aPreCommitDeposit
. It must callProveCommitSector
orProveCommitAggregate with
SectorProveCommitInfowithin some bound to recover the deposit. Initial pledge will then be required at time of
ProveCommit. Initial Pledge is usually higher than
PreCommitDeposit. Recovered
PreCommitDepositwill count towards Initial Pledge and miners only need to top up additional funds at
ProveCommit. Excess
PreCommitDeposit, when it is greater than Initial Pledge, will be returned to the miner. An expired
PreCommitmessage will result in
PreCommitDepositbeing burned. All Sectors have an explicit expiration epoch declared during
PreCommit. For sectors with deals, all deals must expire before sector expiration. The Miner gains power for this particular sector upon successful
ProveCommit`. For more details on the Sectors and the different types of deals that can be included in a Sector refer to the Sector section.
Prove Storage
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.prove-storage
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.prove-storage
- Miners have to prove that they hold unique copies of Sectors by submitting proofs according to the Proof of SpaceTime algorithm. Miners have to prove all their Sectors in regular time intervals in order for the system to guarantee that they indeed store the data they committed to store in the deal phase.
Declare and Recover Faults
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.declare-and-recover-faults
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.declare-and-recover-faults
- Miners can call
DeclareFaults
to mark certain Sectors as faulty to avoid paying Sector Fault Detection Fee. Power associated with the sector will be removed at fault declaration. - Miners can call
DeclareFaultsRecovered
to mark previously faulty sector as recovered. Power will be restored when recovered sectors pass WindowPoSt checks successfully. - A sector pays a Sector Fault Fee for every proving period during which it is marked as faulty.
Skipped Faults
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.skipped-faults
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.skipped-faults
- After a WindowPoSt deadline opens, a miner can mark one of their sectors as faulty and exempted by WindowPoSt checks, hence Skipped Faults. This could avoid paying a Sector Fault Detection Fee on the whole partition.
Detected Faults
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.detected-faults
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.detected-faults
- If a partition misses a WindowPoSt submission deadline, all previously non-faulty sectors in the partition are detected as faulty and a Fault Detection Fee is charged.
Sector Expiration
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.sector-expiration
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.sector-expiration
- Sector expires when its expiration epoch is reached and sector expiration epoch must be greater than the expiration epoch of all its deals.
Sector Termination
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.sector-termination
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.sector-termination
- Termination of a sector can be triggered in two ways. One when sector remains faulty for 42 consecutive days and the other when a miner initiates a termination by calling
TerminateSectors
. In both cases, aTerminationFee
is penalized, which is in principle equivalent to how much the sector has earned so far. Miners are also penalized for theDealCollateral
that the sector contains and remainingDealPayment
will be returned to clients.
Deal Payment and slashing
-
State
reliable
-
Theory Audit
wip
-
Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.deal-payment-and-slashing
-
State
reliable
-
Theory Audit
wip
- Edit this section
-
section-systems.filecoin_markets.onchain_storage_market.storage_deal_flow.deal-payment-and-slashing
- Deal payment and slashing are evaluated lazily through
updatePendingDealState
called atCronTick
.