Skip to content

Commit

Permalink
Add commands for enabling/disabling the dummy prover
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Apr 10, 2020
1 parent 5714234 commit 7271af4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ rust-musl-builder = @docker run $(docker-options) ekidd/rust-musl-builder
dummy-prover:
cargo run --bin dummy_prover

setup-dummy-prover:
@bin/dummy-prover-setup.sh

disable-dummy-prover:
@bin/dummy-prover-disable.sh

prover:
@bin/provers-launch-dev

Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,36 @@ zksync dockerhub-push
f cargo bench
```

## Using Dummy Prover

Using the real prover for the development can be not really handy, since it's pretty slow and resource consuming.

Instead, one may want to use the Dummy Prover: lightweight version of prover, which does not actually proves anything,
but acts like it does.

To enable the dummy prover, run:

```sh
zksync setup-dummy-prover
```

And after that you will be able to use the dummy prover instead of actual prover:

```sh
zksync dummy-prover # Instead of `zksync prover`
```

**Warning:** `setup-dummy-prover` subcommand changes the `Verifier.sol` contract, which is a part of `git` repository.
Be sure not to commit these changes when using the dummy prover!

If one will need to switch back to the real prover, a following command is required:

```sh
zksync disable-dummy-prover
```

This command will revert changes in the contract and redeploy it, so the actual prover will be usable again.

## Generating keys

To generate a proving key, from `server` dir run:
Expand Down
10 changes: 10 additions & 0 deletions bin/dummy-prover-disable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Set the `DUMMY_VERIFIER` constant value in the contract to `false`.
ssed -E "s/(.*constant DUMMY_VERIFIER)(.*)\;/\1 = false\;/" -i $ZKSYNC_HOME/contracts/contracts/Verifier.sol

# Reset the database and redeploy contracts.
zksync build-contracts
zksync db-reset
zksync genesis
zksync redeploy
14 changes: 14 additions & 0 deletions bin/dummy-prover-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Set the `DUMMY_VERIFIER` constant value in the contract to `true`.
ssed -E "s/(.*constant DUMMY_VERIFIER)(.*)\;/\1 = true\;/" -i $ZKSYNC_HOME/contracts/contracts/Verifier.sol

echo "Enabled the Dummy Prover in the contract..."

# Reset the database and redeploy contracts.
zksync build-contracts
zksync db-reset
zksync genesis
zksync redeploy

echo "All done"

0 comments on commit 7271af4

Please sign in to comment.