When discussing options for VM architecture, there may be a middle ground between interactive fraud proofs and proving everything via SNARKs.
The idea in a nutshell is to use SNARKs as non-interactive fraud proofs.
In more detail, here’s how it could work:
Execution
- There are two validator roles: “executors” and “challengers”
- Executors register by staking funds (that will be used to penalize bad actors). The active executors for layer i execute transactions in layer i and publish a commitment to the state after layer i is executed. The commitment includes:
- The layer hash (the set of all transactions so far). This is required in case there’s a reorg, to ensure that the executor isn’t penalized in this case (and also so that users realize the state is no longer relevant).
- The hash of the correct executor commitment for layer i-1. This pointer forms a “state chain” consisting of the states in each layer from i to genesis.
- The hash of the state after executing all transactions up to (including) layer i.
- I’m not sure challengers need to register at all (this part needs to be determined). Assuming, challengers are a subset of the executors, they work as follows:
- Challengers also execute all transactions (just like executors). If a challenger agrees with an executor on the layer hash, but computes a different state hash for layer i, it
- Identifies the first incorrect state in the “state chain” of the bad executor. Suppose it is in layer j\le i. Let s_{j-1} be the state at layer j-1 and s^*_j be the first incorrect state in the chain.
- The challenger publishes a SNARK that executing the transactions in layer j, starting with a state whose hash is s_{j-1} leads to a state whose hash is s_j\ne s^*_j.
- The challenger will also publish a new correct state for layer i.
Verification
- If there’s only a single state hash published for a layer, miners will accept it as the correct state.
- If there are multiple state hashes published, miners will wait until successful challenges reduce the number of unchallenged state hashes to 1 (it’s possible this will take more than one round, because challengers can potentially also publish incorrect states, if the challenged states are in the past),
Advantages vs Interactive Fraud Proofs and Full SNARKs
-
Compared to interactive fraud proofs:
- executors don’t need to respond to challenges, so there’s no need for a very long settlement period.
- executors don’t need to do extra computation during execution (such as creating merkle trees, transpiling into a lower-level language, etc.), so this role can be performed by fairly low-powered devices.
-
Compared to full SNARKs:
- there’s very little delay in the optimistic case, since we don’t need to wait for the SNARK to be generated.
- there’s a much lower cost, since we don’t need to run a prover most of the time. It’s enough to spin up a cloud-based prover in an ad-hoc manner when a challenge will actually be successful (we just need to make sure that the executor’s staked funds will be sufficient to cover this cost).