Optimistic SnapDeals: A cost effective option for the SnapDeal protocol #645
Replies: 2 comments 3 replies
-
Is there any test data on how much faster Optimistic SnapDeal would run on hardwares? Also would there be batched UpdateReplica messages to save gas too? |
Beta Was this translation helpful? Give feedback.
-
Questions posted here for posterity:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
@irenegia @lucaniz @Kubuxu @nicola
This proposal aims to introduce a cost effective option for current the SnapDeal protocol
Background
The introduction of the SnapDeals protocol made possible to inject deals inside CC sectors. SnapDeals made possible to take existing CC sectors in the network and fill them with datas.
Nevertheless, for technical reasons the SnapDeals cost in terms of proving overhead resulted similar to the cost of sealing a new sector. This fact partially limited SnapDeals massive adoption despite the realm of new possibilities that this protocol could have unblocked.
We want here to propose a new version of the SnapDeal protocol which aims to introduce a tradeoff between SnapDeals cost and SLA offered by the protocol.
We stress that this new version of the protocol is not aiming to replace the old one, but to introduce a low cost alternative at the price of accepting some compromise. It would be up to the single client to decide which version of the protocol is better fit his needs.
We are convinced that this new version, by drastically reducing cost overhead, can massively improve SnapDeals usability and adoption.
Optimistic SnapDeals in a nutshell
We propose an optimistic version of the SnapDeals protocol which would allow for massive cost saving on the SP side.
On Sha and Poseidon based
CommD
The greatest part of the cost of the standard SnapDeal protocol comes from the fact that the
CommD
(which isunsealed sector CID
in the protocol code) used is based on Sha, which makes checking against it expensive in terms of proving cost. On the other hand, Sha basedCommD
is needed in order to allow Clients to efficiently check it.On the other hand, having SnapDeal using a Poseidon
CommD
would be beneficial in terms of proving efficiency but would be a up to 100x overhead for a client willing to checkCommD
The best of two worlds
What we propose is an optimistic approach in order to get the best of the two worlds. Assume that the client computes the commitment to the data using Sha, thus preserving the efficiency on the client side, while we the SP uses Poseidon in the SnapDeals protocol, giving the possibility to the Client to submit a fraud proof if at some point he doubts that the SnapDeals sector actually contain the data he committed with Sha.
Protocol Overview
Step 0: SP receives some data
D
from a client, who can efficiently compute Sha basedCommD
Step 1: SP posts onchain both the Sha and the Poseidon based
CommD
. Then he snapsD
into a CC-sector proving the Snap using the Poseidon basedCommD
. Note that snarks become way cheaper than in the standard SnapDeals protocol, and thus also way cheaper than sealing a new sector (see product consideration below).Step 2: As soon as a client retrieve the file (let's call the retrieved file D’), he can check that
CommD == CommD'
. Note that this check can happen using the Sha basedCommD
, thus in an efficient way for the clientStep 3: If
CommD
≠CommD'
, then the client sends a fraud message onchain paying afraud_fee
(note that this is needed to prevent malicious behaviors on the client side). The prover has 24h hours of time to produce a SnapDeal proof using the Sha basedCommD
(which is, running the standard SnapDeal protocol from scratch). If the prover does not submit the proof, the sector is flagged as “wrongly SnapDealed” and the SP is slashed.SLA Considerations
Note that in the optimistic protocol we described above, one can have evidence of a wrong SnapDealed sector only if (and when) the data
D
is retrieved (or if the Poseidon commitment is checked at the beginning of the protocol).While this is actually changing the SLA (a priori, we can not ensure clients data are not modified before being sealed into a sector), here is why we think the Optimistic protocol is a (cheap) valid alternative to the standard one:
D
once in order to realize if there is a mismatch in the stored data with respect to the original one. If the SP serves the data, then the Client can check against the ShacommD
and eventually send a fraud proof request onchain. If the SP does not serve retrieval, then the client can proceed with a fraud proof directly.D’≠ D
in the SnapDealed sector.Product Considerations
Compared with the standard SnapDeal protocol, the Optimistic SnapDeal protocol allows for much better efficiency on the SP side and for much more flexibility on the client side.
Optimistic SnapDeals for SPs: a 54x cost improvement
On the Storage Provider side, the introduction of the Optimistic version of SnapDeals massively reduce the snark proving overhead currently due to SHA, given that the commitment used for proofs is based Poseidon hash.
A back on the envelope calculation reveals a ~54x improvement in terms of needed constraints (and thus proving overhead). The main savings come from MT path openings. Indeed:
Note that in case of fraud proof an SP is still required to run the standard SnapDeal protocol, but we need to take into account that this should happen only in case of wrong data snapped into a sector. Indeed, the fraud proof fee which the client has to pay in order to force the creation of a standard SnapDeal proof aims to discourage malicious client behaviors (assuming clients being rational actors).
Optimistic SnapDeals for Clients: full fledged flexibility
With Optimistic SnapDeals a client gets full flexibility, in the form of a tunable tradeoff between SLA guarantees, trust, fraud proof fee costs and computation overhead.
Indeed, a client has at his disposal several different options:
Moreover, the coexistence of both the standard SnapDeal and the Optimistic SnapDeal protocol does not prevent clients that are fine with the current protocol to keep using it.
A more detailed technical description of the protocol can be found here
Beta Was this translation helpful? Give feedback.
All reactions