Storage acceptance logic

Control deal acceptance based on the realtime state of the sealing pipeline.

Access: Storage > Acceptance logic

With Acceptance logic the miner can be configured to accept deals based on simple, combined or computed states of sectors in the sealing pipeline but also time of the day, Filecoin price, etc….

Definition

A storage acceptance logic is based on diverse criterias:

  • Sealing pipeline sectors state
  • Temporal factors, like the time of day or day of the wee
  • FIL price (to be introduced in the near future)
  • Concurrent Download Thresholds (to be introduced in the near future)

Acceptance logic is the last component of the CIDgravity pipeline, it occurs after the pricing validation (for more information on how proposals are processed : reference.

Like a pricing model, an acceptance logic can be :

  • attached to clients
  • defined as default, meaning it applies to storage proposal from unregistered clients or from clients without acceptance logic defined.

How it works

CIDgravity implements JSON-formatted logic.

Here is an illustrative example of a CIDgravity JSON logic:

{
   "or":[
      {
         ">=":[
            {
               "var":"PreCommit1"
            },
            10
         ]
      },
      {
         "<=":[
            {
               "var":"PreCommit2"
            },
            2
         ]
      }
   ]
}

The storage acceptance logic is based on the following components:

  • Variables: sector state, date, etc…
  • Values: integer, time, day of the week
  • Advanced operations: +, -, *, /
  • Comparison signs: >, <, =, any, between, etc…

Variables

Sealing pipeline - sector states

These variables correspond to the states within the sealing pipeline, excluding errors or faulty states.

ValueDescription
WaitDealswaiting for more pieces (deals) to be added to the sector
Packingsector not in sealStore, and not on chain
AddPieceput deal data (and padding if required) into the sector
GetTicketgenerate ticket
PreCommit1do PreCommit1
PreCommit2do PreCommit2
PreCommittingon chain pre-commit (deprecated)
PreCommitWaitwaiting for precommit to land on chain
SubmitPreCommitBatch/
PreCommitBatchWait/
WaitSeedwaiting for seed
Committingcompute PoRep
CommitFinalizecleanup sector metadata before submitting the proof (early finalize)
SubmitCommitsend commit message to the chain
SubmitCommitAggregate/
CommitAggregateWait/
FinalizeSector/
Proving/
Availableproving CC available for SnapDeals
FailedUnrecoverable/
DealsExpired/
RecoverDealIDs/
Faultysector is corrupted or gone for some reason
FaultReportedsector has been declared as a fault on chain
FaultedFinalfault declared on chain
Terminating/
TerminateWait/
TerminateFinality/
Removing/
Removed/
SnapDealsWaitDealssnap deals / cc update
SnapDealsAddPiecesnap deals / cc update
SnapDealsPackingsnap deals / cc update
UpdateReplicasnap deals / cc update
ProveReplicaUpdatesnap deals / cc update
SubmitReplicaUpdatesnap deals / cc update
WaitMutablesnap deals / cc update
ReplicaUpdateWaitsnap deals / cc update
UpdateActivatingsnap deals / cc update
ReleaseSectorKeysnap deals / cc update
FinalizeReplicaUpdatesnap deals / cc update
SnapDealsDealsExpired/
SnapDealsRecoverDealIDs/
AbortUpgrade/
ReceiveSectorfor external import

Sealing pipeline - sector states errors

These variables correspond to number of sectors in error.

ValueDescription
Any errorSum of all sector states in error
AddPieceFailed/
CommitFinalizeFailed/
SealPreCommit1Failed/
SealPreCommit2Failed/
PreCommitFailed/
ComputeProofFailed/
RemoteCommitFailed/
CommitFailed/
PackingFailed/
FinalizeFailed/
TerminateFailed/
RemoveFailed/
SnapDealsAddPieceFailed/
ReplicaUpdateFailed/
ReleaseSectorKeyFailed/
FinalizeReplicaUpdateFailed/

Other variables

CIDgravity also offers variables that are calculated when a proposal is received. These dynamic variables can be incorporated into each stages.

ValueDescriptionUnit
ReceivedOnTimeOfDayUTCdatetime utc at which the proposal is analyzedDatetime
ReceivedOnDayOfWeekday of the week at which the proposal is analysedDay of week

Values

Values are filled when creating a JSoN logic. The value type is enforced by the JSON logic editor (integer, date, time, etc…).

Supported Comparison signs

  • ==
  • <=
  • >=
  • >
  • <
  • !=
  • Between
  • Not between
  • Is null
  • Is not null

Advanced operations

The storage acceptances logic also supports operations between variables, enabling the combination of multiple variables to construct advanced logic that can fit a wide range of requirements.

Like: (PC1 + AP) < 16

Supported operations

  • Sum
  • Substraction
  • Multiplication
  • Division

Access advanced operations

Click on the ellipsis icon () and then select Advanced operations from the dropdown menu.

This will open a menu where supported operations are available.

Add advanced operation to a storage acceptance logic rule

Manual import from JSON

To facilitate manipulating, editing and sharing JSON logic, CIDgravity implements a JSON import button available when editing a JSON logic.

It allows: - exporting to clipboard - importing a JSON logic.

Acceptance JSON import for a storage acceptance logic

Edit the JSON, copy its contents, insert a new JSON structure, and subsequently update the editor by clicking the Import button.

Modal JSON import for a storage acceptance logic

Manage existing logics

Manage storage acceptance logics using the management page

Each acceptance logic listed offers several options:

  • View
  • Edit
  • Remove
  • Set as default

Testing

Acceptance logic can be tested and troubleshooted from the Playground.