-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Back To The Snarks #87
Comments
related to #68 |
In Kelvin's suggestion to abstract design, it uses "id" for state/output. I am thinking this might be a good idea actually. This would make chaining txs easier and probably solve the issue here as well. |
One more idea here: look into Powers of Tau ceremony by zcash. Why it is not used to do setup for projects on mainnet today? |
On the way of my random searching I see this idea using SGX for trusted setup: https://ethresear.ch/t/trusted-setup-with-intel-sgx/5531 Did not have real discussion and my intuition is that it probably does not worth dig into it. Just leave a note and see if it triggers any thought here. |
From the Readme of Powers of Tau, it produces parameters for [EDIT: so BLS12-381 is definitely not supported yet in Eth: tracking issue here] |
Another thought, we might be able to claim us "RC" even if OmiseGO do the trusted setup all our own and generate the verifier code to venue. Previous RC trader trust our private key is not leaked, now trader trust the setup is not leaked. Do you think this thought has potential to remove trust setup as a blocker? @whoisjeremylam @kasima |
I don't see a problem on a high level. However, I'm concerned about the practical implications - how we perform this trusted set up. If we are the first, then others in the Ethereum space will possibly use our trusted set up. Do we want this? |
I'm comfortable breaking down this problem and addressing one piece at a time. If this means doing our own trusted setup while we figure out how apply upcoming research to address the issue, I'm open to the idea of doing our own. The one difference between a compromised private key as an operator and a compromised trusted setup is that plasma gives us recourse for losing the private keys (exit, mostly) while we don't have recourse for a compromised trusted setup. Of course, it's a complex attack and only worth doing once there's enough trade volume. Practically speaking, it seems reasonable to defer that piece of trustlessness. @whoisjeremylam – can you elaborate further? Other projects have performed elaborate trusted setups. While it might be involved, we could learn from setups that have already happened.
How so and what are the concerns? |
[Note] Following up @paulperegud's investigation on MatterLabs's implementation of power of tau
I don't know how in the detail we could use the lib, but MatterLab probably already did it for their ignis plasma (?) also I see a fork from Gnosis too. So we might consult with them for the detail. High level wise, it seems to me the path to do zk-snark this way is we write our own rust version of ZKSnarks using the the tools above + their dependency library (eg. bellman, ruby lib for ZKSnarks). Sadly, we could only write the circuit in low level atm if I understand it correctly. Also, I think there is no rust --> solidity magic in the lib, so we would need to write a solidity version of verification code too. [EDIT: we can take an intermediate step to go just RC first, then we don't need the solidity version of code. Operator verifies with zk-snark in rust to decide to mine or not.] |
Hi there, Implementation of zkSnarks (not full): Papers / articles: Russian sources: Example (please translate yourself): Каким образом? StarkDEX обрабатывает большую часть расчётов вне цепочки (оффчейн), отправляя в блокчейн только доказательство нулевого знания целостности расчётов и правильного сопоставления сделок |
[Note] Some potentially way to implement:
|
Here is a fork of Powers of Tau for Ethereum. https://github.com/matter-labs/powersoftau It supports BN256 curve, which is supported by Ethereum today. Andy is investigating how much work adopting |
Remark on circuit design (popped up in discussion with Andy). Order as whole should be public, only the price needs to be blinded ( |
Interesting. Sorry for going into details. Maybe this is irrelevant at this point. But what does it mean almost everything? |
[Note on porting
TL;DR It seems pretty possible to port phase2, with the following assumption:
Zokrate notes
|
If we don't perform the ceremony properly and the the set up is compromised, this could lead to loss of funds for everyone who uses our set up. |
@whoisjeremylam curious, are you expecting people aside from our venue using our setup? Or the concern is on venue on top of us? (I thought the second is just covered by RC assumption/limitation) |
boolafish [4 hours ago] Slava [3 hours ago] boolafish [3 hours ago] boolafish [3 hours ago] boolafish [3 hours ago] Slava [2 hours ago] Slava [2 hours ago] Slava [2 hours ago] Slava [2 hours ago] boolafish [2 hours ago] boolafish [2 hours ago] pepesza [2 hours ago] Slava [2 hours ago] Slava [2 hours ago] pepesza [2 hours ago]
Slava [2 hours ago] kasima [32 minutes ago]
Noted, @boolafish, about the flexibility. Let's figure out a working end-to-end solution and we can think about flexibility from potentially a product/business perspective. From an engineering angle, it would be a big milestone to see the system work with one production venue. kasima [32 minutes ago] kasima [31 minutes ago] jeremy [29 minutes ago]
We should continuous trading as a priority to be able to support liquidity. Auctions (batch trading) are useful for assets where price discovery is difficult. jeremy [23 minutes ago]
This is very interesting - how would we be able to detect this? Can we pull the plug on settlement if we detect? kasima [23 minutes ago] Slava [21 minutes ago] pepesza [4 minutes ago] re: engineering complexity. There ceremony needs to be done once. Software for the ceremony was written in Rust and requires a change in the elliptic curve used to one used by Ethereum (BN256). For the production snark would involve proving on the venue side (prover is written in Rust, can be called as a batch job). Verifier will be written in solidity. We can use it by calling ethereum node via RPC on operator and watcher nodes. One more interesting note - we want trading to be performed without waiting for proofs to be generated. For that a venue would need to provide traders with a (trustless) feed with information about trade settlements already finalized so the traders can continue trading. Settlements would be emitted with time delay needed to generate proofs (<5 minutes, exact numbers TBD). Emitted settlement included into block and consumed by trader's watcher would enable trader to withdraw the money safely. |
[Note]
|
A question about the construction of the SNARK. How would we go about building a SNARK based upon an existing order-book algorithm? |
The possible solution is having two circuits - one for processing, one for tree balancing. |
@boolafish Re: using two heaps - one for asks, other for bids is viable after all. Random access delete is possible with heap (correcting my statement from before). |
Hi there,
|
@Nikodemek18
|
No third party needed. CEX will generate the proof, participants (operator, watchers) will check the proof.
Snark is transparent to traders.
Every change in trading algo would require a new trusted setup ceremony. Basically - changes are hard to do until community deploys SONIC.
Not much. |
@paulperegud thanks for explaining. Do you think it would be possible for us to create the list of things we still need to learn / verify in regards to SNARKs? Then we would just go one by one and everyone would see how many have left? Is that doable at this point? |
From software perspective, I think we need to learn the followings risk:
|
Nothing of that is production ready (as linux kernel; maybe it is production ready as elixir-omg). None of it is safe as in bug free. Risks are there. Fortunately we are software engineers and we know how to test stuff. There will be bugs in implementation. But there should not be any bugs in math - zcash people put enough work into that already. As for production readiness - verifier and prover will be in production. Interesting part is the prover. ZoKrates one is multicore capable and it gave us some nice performance numbers. Will it crash on us at some point? No idea, really. |
One more thing I am a bit worried is also about compiling part, unless we are code reviewing the circuit that it generates (awwwww....though it is possible that we do so). |
This feature is conditioned on #86 lifting the ban of chaining of transaction spends in the same block.
Not being forced to scale (in terms of orders settled per second) by increasing the size of the settlement means that the trade settlement can be small and snark friendly. We need to figure out how settlement proofs can be organized in situation when proof generation takes time. We can't wait for the proof to be generated to start generating next proof - that would re-introduce the limitations on throughput.
Problem: utxopos of change output
To start generating a snark for N+1 trade settlement, we need a way to spend the change output from N'th trade settlement. Utxopos does not work, it's not yet known. Snark can't be checked recursively since it's also unknown. What we can do instead, it rely on watchers and operator verifying blocks and trade settlement proofs one by one. As for the spend by something else (not trade settlement) - it is done by waiting for the trade settlement to settle, since that would assign utxopos to change output. Every other output (funds moving to traders) needs to be settled before it can be used.
Problem: hashing and signature verification is expensive in snarks
We will need to prove that hash value (public input) corresponds to order body (private input). This is true for both normal orders and partial orders. We also need to create a public commitment to partial order if such is created during this trade. Orders' signatures will be checked outside of the snark.
Solution to potential problem: order book integrity checks
One can create a merkle sum tree (of orders sorted by price) and prove that trading orders are a subset. Unfortunately this reveals at least some information about the prices. Needs more research.The text was updated successfully, but these errors were encountered: