Skip to content

Commit

Permalink
rename to zksync
Browse files Browse the repository at this point in the history
  • Loading branch information
furkhat committed Dec 5, 2019
1 parent 7ef3e5c commit 879a9d7
Show file tree
Hide file tree
Showing 28 changed files with 164 additions and 168 deletions.
52 changes: 26 additions & 26 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ steps:
- name: init
image: matterlabs/ci
commands:
- export FRANKLIN_HOME=`pwd`
- export PATH=$FRANKLIN_HOME/bin:$PATH
- export CARGO_HOME=$FRANKLIN_HOME/target/cargo
- export ZKSYNC_HOME=`pwd`
- export PATH=$ZKSYNC_HOME/bin:$PATH
- export CARGO_HOME=$ZKSYNC_HOME/target/cargo
- ci-prepare-env.sh
- franklin env ci
- franklin yarn
- franklin db-wait
- franklin db-setup
- zksync env ci
- zksync yarn
- zksync db-wait
- zksync db-setup
depends_on:
- restore-cache

- name: build-contracts
image: matterlabs/ci
commands:
- export FRANKLIN_HOME=`pwd`
- export PATH=$FRANKLIN_HOME/bin:$PATH
- export CARGO_HOME=$FRANKLIN_HOME/target/cargo
- franklin build-contracts
- export ZKSYNC_HOME=`pwd`
- export PATH=$ZKSYNC_HOME/bin:$PATH
- export CARGO_HOME=$ZKSYNC_HOME/target/cargo
- zksync build-contracts
depends_on:
- init

- name: rust-checks
image: matterlabs/ci
commands:
- export FRANKLIN_HOME=`pwd`
- export PATH=$FRANKLIN_HOME/bin:$PATH
- export CARGO_HOME=$FRANKLIN_HOME/target/cargo
- export ZKSYNC_HOME=`pwd`
- export PATH=$ZKSYNC_HOME/bin:$PATH
- export CARGO_HOME=$ZKSYNC_HOME/target/cargo
- cargo fmt -- --check
- f cargo clippy --tests --benches -- -D warnings
depends_on:
Expand All @@ -55,31 +55,31 @@ steps:
- name: rust-tests
image: matterlabs/ci
commands:
- export FRANKLIN_HOME=`pwd`
- export PATH=$FRANKLIN_HOME/bin:$PATH
- export CARGO_HOME=$FRANKLIN_HOME/target/cargo
- export ZKSYNC_HOME=`pwd`
- export PATH=$ZKSYNC_HOME/bin:$PATH
- export CARGO_HOME=$ZKSYNC_HOME/target/cargo
- f cargo test
depends_on:
- rust-checks

- name: deploy-test
image: matterlabs/ci
commands:
- export FRANKLIN_HOME=`pwd`
- export PATH=$FRANKLIN_HOME/bin:$PATH
- export CARGO_HOME=$FRANKLIN_HOME/target/cargo
- franklin genesis
- franklin redeploy
- export ZKSYNC_HOME=`pwd`
- export PATH=$ZKSYNC_HOME/bin:$PATH
- export CARGO_HOME=$ZKSYNC_HOME/target/cargo
- zksync genesis
- zksync redeploy
depends_on:
- rust-tests

- name: contract-test
image: matterlabs/ci
commands:
- export FRANKLIN_HOME=`pwd`
- export PATH=$FRANKLIN_HOME/bin:$PATH
- export CARGO_HOME=$FRANKLIN_HOME/target/cargo
- franklin test-contracts
- export ZKSYNC_HOME=`pwd`
- export PATH=$ZKSYNC_HOME/bin:$PATH
- export CARGO_HOME=$ZKSYNC_HOME/target/cargo
- zksync test-contracts
depends_on:
- build-contracts

Expand Down
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export CI_PIPELINE_ID ?= $(shell date +"%Y-%m-%d-%s")
export SERVER_DOCKER_IMAGE ?=matterlabs/server:latest
export PROVER_DOCKER_IMAGE ?=matterlabs/prover:latest
export NGINX_DOCKER_IMAGE ?= matterlabs/nginx:$(FRANKLIN_ENV)
export NGINX_DOCKER_IMAGE ?= matterlabs/nginx:$(ZKSYNC_ENV)
export GETH_DOCKER_IMAGE ?= gluk64/franklin:geth
export CI_DOCKER_IMAGE ?= matterlabs/ci

Expand Down Expand Up @@ -98,7 +98,7 @@ push-image-ci:
docker push "${CI_DOCKER_IMAGE}"

# Using RUST+Linux docker image (ekidd/rust-musl-builder) to build for Linux. More at https://github.com/emk/rust-musl-builder
docker-options = --rm -v $(shell pwd):/home/rust/src -v cargo-git:/home/rust/.cargo/git -v cargo-registry:/home/rust/.cargo/registry --env-file $(FRANKLIN_HOME)/etc/env/$(FRANKLIN_ENV).env
docker-options = --rm -v $(shell pwd):/home/rust/src -v cargo-git:/home/rust/.cargo/git -v cargo-registry:/home/rust/.cargo/registry --env-file $(ZKSYNC_HOME)/etc/env/$(ZKSYNC_ENV).env
rust-musl-builder = @docker run $(docker-options) ekidd/rust-musl-builder


Expand Down Expand Up @@ -192,13 +192,13 @@ deposit: confirm_action
# Devops: main

# (Re)deploy contracts and database
ifeq (dev,$(FRANKLIN_ENV))
ifeq (dev,$(ZKSYNC_ENV))
redeploy: confirm_action stop deploy-contracts db-insert-contract bin/minikube-copy-keys-to-host
else
redeploy: confirm_action stop deploy-contracts db-insert-contract
endif

ifeq (dev,$(FRANKLIN_ENV))
ifeq (dev,$(ZKSYNC_ENV))
init-deploy: confirm_action deploy-contracts db-insert-contract bin/minikube-copy-keys-to-host
else
init-deploy: confirm_action deploy-contracts db-insert-contract
Expand All @@ -218,23 +218,23 @@ apply-kubeconfig:
@bin/k8s-apply

update-rust: push-image-rust apply-kubeconfig
@kubectl patch deployment $(FRANKLIN_ENV)-server -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"
@kubectl patch deployment $(FRANKLIN_ENV)-prover -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"
@kubectl patch deployment $(ZKSYNC_ENV)-server -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"
@kubectl patch deployment $(ZKSYNC_ENV)-prover -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"

update-nginx: push-image-nginx apply-kubeconfig
@kubectl patch deployment $(FRANKLIN_ENV)-nginx -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"
@kubectl patch deployment $(ZKSYNC_ENV)-nginx -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"

update-all: update-rust update-nginx apply-kubeconfig

start-kube: apply-kubeconfig

ifeq (dev,$(FRANKLIN_ENV))
ifeq (dev,$(ZKSYNC_ENV))
start: image-nginx image-rust start-local
else
start: apply-kubeconfig start-prover start-server start-nginx
endif

ifeq (dev,$(FRANKLIN_ENV))
ifeq (dev,$(ZKSYNC_ENV))
stop: confirm_action
@echo TODO: fix minikube local dev
# @kubectl delete deployments --selector=app=dev-server
Expand All @@ -244,7 +244,7 @@ stop: confirm_action
# @kubectl delete svc --selector=app=dev-nginx
# @kubectl delete -f ./etc/kube/minikube/postgres.yaml
# @kubectl delete -f ./etc/kube/minikube/geth.yaml
else ifeq (ci,$(FRANKLIN_ENV))
else ifeq (ci,$(ZKSYNC_ENV))
stop:
else
stop: confirm_action stop-prover stop-server stop-nginx
Expand All @@ -253,33 +253,33 @@ endif
restart: stop start

start-prover:
@bin/kube scale deployments/$(FRANKLIN_ENV)-prover --replicas=1
@bin/kube scale deployments/$(ZKSYNC_ENV)-prover --replicas=1

start-nginx:
@bin/kube scale deployments/$(FRANKLIN_ENV)-nginx --replicas=1
@bin/kube scale deployments/$(ZKSYNC_ENV)-nginx --replicas=1

start-server:
@bin/kube scale deployments/$(FRANKLIN_ENV)-server --replicas=1
@bin/kube scale deployments/$(ZKSYNC_ENV)-server --replicas=1

stop-prover:
@bin/kube scale deployments/$(FRANKLIN_ENV)-prover --replicas=0
@bin/kube scale deployments/$(ZKSYNC_ENV)-prover --replicas=0

stop-server:
@bin/kube scale deployments/$(FRANKLIN_ENV)-server --replicas=0
@bin/kube scale deployments/$(ZKSYNC_ENV)-server --replicas=0

stop-nginx:
@bin/kube scale deployments/$(FRANKLIN_ENV)-nginx --replicas=0
@bin/kube scale deployments/$(ZKSYNC_ENV)-nginx --replicas=0

# Monitoring

status:
@curl $(API_SERVER)/api/v0.1/status; echo

log-server:
kubectl logs -f deployments/$(FRANKLIN_ENV)-server
kubectl logs -f deployments/$(ZKSYNC_ENV)-server

log-prover:
kubectl logs --tail 300 -f deployments/$(FRANKLIN_ENV)-prover
kubectl logs --tail 300 -f deployments/$(ZKSYNC_ENV)-prover

# Kubernetes: monitoring shortcuts

Expand Down
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ In other words, ZK Rollup strictly inherits the security guarantees of the under

To learn how to use ZK Sync, please refer to the [ZK Sync SDK documentation](https://www.zksync.io).

# Development

The legacy name `franklin` is still used in many places of the code.

## Prerequisites

Prepare dev environment prerequisites: see [docs/setup-dev.md](docs/setup-dev.md)
Expand All @@ -29,14 +25,14 @@ Prepare dev environment prerequisites: see [docs/setup-dev.md](docs/setup-dev.md
Setup:

```
franklin dev-up
franklin init
zksync dev-up
zksync init
```

To completely reset the dev environment:

- Stop services:
```franklin dev-down```
```zksync dev-down```
- Remove containers data:
```
ssh minikube
Expand All @@ -46,19 +42,19 @@ rm -r /data/*

# (Re)deploy db and contraсts:

```franklin redeploy```
```zksync redeploy```

## Environment configurations

Env config files are held in `etc/env/`

List configurations:

```franklin env```
```zksync env```

Switch between configurations:

```franklin env <ENV_NAME>```
```zksync env <ENV_NAME>```

## Monitoring & management:

Expand All @@ -71,51 +67,51 @@ NOTE: if you are resetting geth, each Metamask account must be manually reset vi

Run server:
```
franklin server
zksync server
```

By default block chunk size set to `100`. For testing & development purposes you
ca change it to smaller values. Two places requires a change:
1. Environment variable value in `./etc/env/dev.env` `BLOCK_SIZE_CHUNKS`
2. Rust constant at `./core/models/params.rs` `BLOCK_SIZE_CHUNKS`
If you apply changes, do not forget to redeploy contracts `franklin redeploy`.
If you apply changes, do not forget to redeploy contracts `zksync redeploy`.

You must prepare keys. This only needs to be done once:
```
./bin/gen-keys
franklin redeploy
zksync redeploy
```
Run prover:
```
franklin prover
zksync prover
```

Run client
```
franklin client
zksync client
```

Client UI will be available at http://localhost:8080.
Make sure you have environment variables set right, you can check it by running:
```franklin env```. You should see `* dev` in output.
```zksync env```. You should see `* dev` in output.

## Start server and prover in minikube (this setup is closest to prod):

- Prerequisite: ```franklin dev-up; franklin init```
- Prerequisite: ```zksync dev-up; zksync init```

- Start:
```franklin start```
```zksync start```

- Watch logs:
Server: ```franklin log-server```
Prover: ```franklin log-prover```
Server: ```zksync log-server```
Prover: ```zksync log-prover```

- Stop:
```franklin stop```
```zksync stop```

## Build and push images to dockerhub:

```franklin dockerhub-push```
```zksync dockerhub-push```

# Development

Expand All @@ -124,7 +120,7 @@ Prover: ```franklin log-prover```
- ```cd core/storage```
- Add diesel migration
- Rename `core/storage/schema.rs.generated` to `schema.rs`
- Run tests: ```franklin db-tests```
- Run tests: ```zksync db-tests```

## Generating keys

Expand Down Expand Up @@ -160,7 +156,7 @@ So you need to rebuild the code on every change (to be automated).
### Publish source code on etherscan

```
franklin publish-source
zksync publish-source
```

# License
Expand Down
6 changes: 3 additions & 3 deletions bin/.confirm_action
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

if [ "$FRANKLIN_ENV" != "dev" ] && [ "$FRANKLIN_ENV" != "ci" ]
if [ "$ZKSYNC_ENV" != "dev" ] && [ "$ZKSYNC_ENV" != "ci" ]
then
echo -n "Dangerous action. Type environment name ('$FRANKLIN_ENV') to confirm: "
echo -n "Dangerous action. Type environment name ('$ZKSYNC_ENV') to confirm: "
read CONFIRMED
if [ ! "$FRANKLIN_ENV" == "$CONFIRMED" ]; then
if [ ! "$ZKSYNC_ENV" == "$CONFIRMED" ]; then
exit 1
fi
fi
12 changes: 6 additions & 6 deletions bin/.setup_env
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash

if [ -z "$FRANKLIN_ENV" ]
if [ -z "$ZKSYNC_ENV" ]
then

pushd `dirname $0`/.. > /dev/null

if [ -f etc/env/current ]; then
export FRANKLIN_ENV=`cat etc/env/current`
export ZKSYNC_ENV=`cat etc/env/current`
else
export FRANKLIN_ENV=dev
export ZKSYNC_ENV=dev
fi

export ENV_FILE=./etc/env/$FRANKLIN_ENV.env
export ENV_FILE=./etc/env/$ZKSYNC_ENV.env

if [ "dev" = "$FRANKLIN_ENV" ] && [ ! -f etc/env/dev.env ]
if [ "dev" = "$ZKSYNC_ENV" ] && [ ! -f etc/env/dev.env ]
then
cp etc/env/dev.env.example etc/env/dev.env
fi
Expand All @@ -28,7 +28,7 @@ then
eval $(grep -v '^#' $ENV_FILE | sed 's/^/export /')
set +o allexport

if [ "dev" != "$FRANKLIN_ENV" ]
if [ "dev" != "$ZKSYNC_ENV" ]
then
export KUBECONFIG=etc/kube/clusters/kubeconfig-main.yaml
fi
Expand Down
Loading

0 comments on commit 879a9d7

Please sign in to comment.