diff --git a/deploy/README.md b/deploy/README.md deleted file mode 100644 index f5d88bc..0000000 --- a/deploy/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Deployment for prover-cluster - -This directory include assets for deploying prover-cluster on container-based workset managament (docker-compose, k8s, etc.). - -## For docker-compose - -Use docker-compose.yaml to demo a test cluster, you have flexible choices to integrate setup assets with prover binaries. For example, if you have prepared the monomial SRS, you can put it in `./setup/mon.key` and use `images/cluster_client.docker` rather than `cluster_client_test.docker`(which regenerates an monomial SRS while building the docker image). - -The default config provide use a simpler test circuit to replace the real "block" circuit, to benefit verify the whole cluster is functioning . To apply the real block circuit, change all "/opt/test" field into "/opt/block" in client.yaml and "/opt/circuit_test" into "/opt/circuit_block" in coordinator.yaml - -## For kuberntes - -There maybe not be general setup scripts/config for deploying the whole prover-cluster on a specified kubernetes. We have put as many assets as possible in `commonk8s` for reference. - diff --git a/deploy/commonk8s/0_configmaps.yaml b/deploy/commonk8s/0_configmaps.yaml deleted file mode 100644 index edc635c..0000000 --- a/deploy/commonk8s/0_configmaps.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v1 -data: - client: |- - prover_id: 1 - upstream: "http://cluster_coordinator:50055" - poll_interval: 10000 - circuit: "block" - r1cs: "/opt/test/circuit.r1cs" - srs_monomial_form: "/opt/mon.key" - srs_lagrange_form: "/opt/test/lag.key" - vk: "/opt/test/vk.bin" - coordinator: | - listenaddr: 0.0.0.0 - port: 50055 - db: postgres://coordinator:coordinator_AA9944@exchange_pq/prover_cluster - witgen: - interval: 10000 - n_workers: 5 - circuits: - block: "/opt/circuit_test/circuit.fast" - test-upstream: http://coordinator-test:50055 -kind: ConfigMap -metadata: - name: cluster-conf diff --git a/deploy/commonk8s/0_secrets.yaml b/deploy/commonk8s/0_secrets.yaml deleted file mode 100644 index 6dae743..0000000 --- a/deploy/commonk8s/0_secrets.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -data: - password: - url: :@db/prover_cluster> - username: -kind: Secret -metadata: - name: db-secrets -type: Opaque \ No newline at end of file diff --git a/deploy/commonk8s/1_coordinator.yaml b/deploy/commonk8s/1_coordinator.yaml deleted file mode 100644 index d7547b6..0000000 --- a/deploy/commonk8s/1_coordinator.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: coordinator-test - labels: - app: coordinator - group: test -spec: - replicas: 1 - selector: - matchLabels: - app: coordinator-test - template: - metadata: - labels: - app: coordinator-test - spec: - containers: - - name: coordinator - # TODO: specify the image url from your repo service - image: registry-vpc.cn-zhangjiakou.aliyuncs.com/fluidex/prover-cluster:coordinator - ports: - - containerPort: 50055 - name: grpc - protocol: TCP - readinessProbe: - tcpSocket: - port: 50055 - initialDelaySeconds: 10 - periodSeconds: 10 - livenessProbe: - tcpSocket: - port: 50055 - initialDelaySeconds: 30 - periodSeconds: 60 - env: - - name: COORDINATOR_DB - valueFrom: - secretKeyRef: - name: db-secrets - key: url - - name: COORDINATOR_LISTENADDR - value: 0.0.0.0 - - name: RUST_LOG - value: info,sqlx=warn - - name: COORDINATOR_WITGEN_CIRCUITS_BLOCK - value: /opt/circuit_test/circuit.fast - - name: COORDINATOR_CONFIG - value: config/coordinator.yaml - volumeMounts: - - name: config-volume - mountPath: /opt/config - volumes: - - name: config-volume - configMap: - name: cluster-conf - items: - - key: coordinator - path: coordinator.yaml - diff --git a/deploy/commonk8s/2_services.yaml b/deploy/commonk8s/2_services.yaml deleted file mode 100644 index 1b78446..0000000 --- a/deploy/commonk8s/2_services.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: coordinator-test -spec: - ports: - - protocol: TCP - name: grpc - port: 50055 - targetPort: 50055 - type: ClusterIP diff --git a/deploy/commonk8s/3_client.yaml b/deploy/commonk8s/3_client.yaml deleted file mode 100644 index 3fb8a63..0000000 --- a/deploy/commonk8s/3_client.yaml +++ /dev/null @@ -1,71 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - #we use pod name and constrain the size among 30 bytes - name: cli-t - labels: - app: client - group: test -spec: - replicas: 3 - selector: - matchLabels: - app: client-test - template: - metadata: - labels: - app: client-test - role: cluster-prover - spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: fluidexnode - operator: In - values: - - computation - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchLabels: - role: cluster-prover - topologyKey: kubernetes.io/hostname - tolerations: - - key: dedicated - operator: Equal - value: computation - containers: - - name: client - # TODO: specify the image url from your repo service - image: registry-vpc.cn-zhangjiakou.aliyuncs.com/fluidex/prover-cluster:client - env: - - name: CLIENT_UPSTREAM - valueFrom: - configMapKeyRef: - name: cluster-conf - key: test-upstream - - name: RUST_LOG - value: info - - name: CLIENT_PROVER_ID - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: CLIENT_SRS_LAGRANGE_FORM - value: /opt/test/lag.key - - name: CLIENT_VK - value: /opt/test/vk.bin - - name: CLIENT_CONFIG - value: config/client.yaml - volumeMounts: - - name: config-volume - mountPath: /opt/config - volumes: - - name: config-volume - configMap: - name: cluster-conf - items: - - key: client - path: client.yaml - diff --git a/deploy/commonk8s/README.md b/deploy/commonk8s/README.md deleted file mode 100644 index 22042f6..0000000 --- a/deploy/commonk8s/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# Common setup assets for deploying on kubernetes - -Assets required by deploying prover-cluster on kubernetes. Not like compose, there maybe many options and customizations when ops is facing a provided kubernetes system and try to accomplish his task. Things put here is far from a "one-key" solution and just act as templates and references - -## Notes and considerations before start - -### Prepare your images - -We need to prepare the coordinator and client images build from `images/cluster_coordinator.docker` and `images/cluster_client.docker` and being avaliable in the image repo. service of your k8s. In this example we provide these images with aliyun's repo service. - -### Tagging and tainting nodes - -Prover client require dedicated, bold nodes to running on. We have to mark these nodes inside k8s node pools by both tagging and taintings. - -Inside this deployment we tag these nodes with `fluidexnode=compoutation` and tainting them by `dedicated=computation:NoSchedule` - -Tainting and tagging can be executed by commands like `kubectl taint nodes dedicated=computation:NoSchedule` - -### Deploy database outside kubernetes - -It is often not a good practice to delpoy the database in the same k8s cluster. But we still provide a deloyment asset inside `prerequisite` directory, in which we use peristent volume for data persistent. It is also possible to bind the db pod into a single node and use hostpath as data directory. - - -## Do the deployment - -### Apply config assets - -The config assets (`0_configmap.yaml` and `0_secrets.yaml`) should be customized and apply first, which provide the setup data for accesing db, coordinator etc. - -### Deploy coordinator - -Appling `1_coordinator.yaml` and `2_services.yaml` to setup the coordinator instance, and expose its service inside k8s. - -### Deploy clients - -Appling `3_client.yaml` to setup mutiple client instances. - -## Test and verification - -After applied all assets onto k8s, we can verify the running of prover-cluster by following setups - -1. The logs of coordinator and client - -2. Check if all client pods are running on expected nodes, and each dedicated node should have only one client pod - -3. Access the database, insert some test data, for example, for 'poseidon' circuit you could insert - -```sql - -insert into task (task_id, circuit, input) values - ('6', 'block', '{ "foo": 13, "bar": 4 }::jsonb'), - ('7', 'block', '{ "foo": 14, "bar": 4 }::jsonb'), - ('8', 'block', '{ "foo": 15, "bar": 4 }::jsonb'); - -``` - -4. check if the status column in all lines added into database become "proved" - -## Setup the cluster for production - -The prover-cluster deployed by these assets use the demo circuit and we need to replace it with the real "block" circuit diff --git a/deploy/commonk8s/prerequisite/0_persistent-vol-claim.yaml b/deploy/commonk8s/prerequisite/0_persistent-vol-claim.yaml deleted file mode 100644 index 238fca9..0000000 --- a/deploy/commonk8s/prerequisite/0_persistent-vol-claim.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: db-pvc -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 20Gi - storageClassName: alicloud-disk-efficiency diff --git a/deploy/commonk8s/prerequisite/1_db.yaml b/deploy/commonk8s/prerequisite/1_db.yaml deleted file mode 100644 index 8ac29f1..0000000 --- a/deploy/commonk8s/prerequisite/1_db.yaml +++ /dev/null @@ -1,69 +0,0 @@ -apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1 -kind: Deployment -metadata: - name: exchange-pq - labels: - app: db -spec: - replicas: 1 - selector: - matchLabels: - app: db - template: - metadata: - labels: - app: db - spec: - containers: - - name: exchange-pq - image: timescale/timescaledb:2.1.0-pg13 - ports: - - containerPort: 5432 - name: tcp-postgresql - protocol: TCP - livenessProbe: - exec: - command: - - /bin/sh - - -c - - pg_isready --username=${POSTGRES_USER} --dbname=${POSTGRES_DB} - failureThreshold: 3 - initialDelaySeconds: 30 - periodSeconds: 30 - successThreshold: 1 - timeoutSeconds: 5 - readinessProbe: - exec: - command: - - /bin/sh - - -c - - pg_isready --username=${POSTGRES_USER} --dbname=${POSTGRES_DB} - failureThreshold: 6 - initialDelaySeconds: 5 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - env: - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: db-secrects - key: username - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: db-secrects - key: password - - name: POSTGRES_DB - valueFrom: - configMapKeyRef: - name: db-conf - key: prover_db - # configMap volume - volumeMounts: - - name: data-vol - mountPath: /var/lib/postgresql - volumes: - - name: data-vol - persistentVolumeClaim: - claimName: db-pvc diff --git a/deploy/commonk8s/prerequisite/2_db-service.yaml b/deploy/commonk8s/prerequisite/2_db-service.yaml deleted file mode 100644 index a3b704b..0000000 --- a/deploy/commonk8s/prerequisite/2_db-service.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: db -spec: - ports: - - protocol: TCP - name: pq-port - port: 5432 - targetPort: 5432 - type: ClusterIP diff --git a/deploy/config/client.yaml b/deploy/config/client.yaml deleted file mode 100644 index 728195d..0000000 --- a/deploy/config/client.yaml +++ /dev/null @@ -1,8 +0,0 @@ -prover_id: 1 -upstream: "http://cluster_coordinator:50055" -poll_interval: 10000 -circuit: "block" -r1cs: "/opt/test/circuit.r1cs" -srs_monomial_form: "/opt/mon.key" -srs_lagrange_form: "/opt/test/lag.key" -vk: "/opt/test/vk.bin" diff --git a/deploy/config/coordinator.yaml b/deploy/config/coordinator.yaml deleted file mode 100644 index 39d7ea0..0000000 --- a/deploy/config/coordinator.yaml +++ /dev/null @@ -1,8 +0,0 @@ -listenaddr: 0.0.0.0 -port: 50055 -db: postgres://coordinator:coordinator_AA9944@exchange_pq/prover_cluster -witgen: - interval: 10000 - n_workers: 5 - circuits: - block: "/opt/circuit_test/circuit.fast" diff --git a/deploy/docker-compose.yaml b/deploy/docker-compose.yaml deleted file mode 100644 index 1f47739..0000000 --- a/deploy/docker-compose.yaml +++ /dev/null @@ -1,64 +0,0 @@ -version: '3.4' - -x-envs: - &log-env - RUST_LOG: info,sqlx=warn - RUST_BACKTRACE: 1 - -x-clients: - &client-config - image: prover-cli - build: - context: . - dockerfile: ./images/cluster_client_test.docker - depends_on: - - "coordinator" - volumes: - - ./config/client.yaml:/opt/client.yaml - -services: - db: - image: timescale/timescaledb:2.1.0-pg13 - container_name: exchange_pq - restart: always - volumes: - - ~/data/volumes/postgres_data:/var/lib/postgresql/data - ports: - - "5432:5432" - environment: - POSTGRES_DB: prover_cluster - POSTGRES_USER: coordinator - POSTGRES_PASSWORD: coordinator_AA9944 - - coordinator: - image: prover-coordinator - build: - context: . - dockerfile: ./images/cluster_coordinator.docker - # args: - # buildno: 1 - depends_on: - - "db" - container_name: cluster_coordinator - environment: - << : *log-env - volumes: - - ./config/coordinator.yaml:/opt/coordinator.yaml - - client1: - << : *client-config - environment: - << : *log-env - CLIENT_PROVER_ID: x1 - - client2: - << : *client-config - environment: - << : *log-env - CLIENT_PROVER_ID: x2 - - client3: - << : *client-config - environment: - << : *log-env - CLIENT_PROVER_ID: x3 \ No newline at end of file diff --git a/deploy/images/build.sh b/deploy/images/build.sh deleted file mode 100755 index e5f232e..0000000 --- a/deploy/images/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -docker build -f setup.docker . -t setup -docker build -f plonkit.docker . -t plonkit -docker build -f prover.docker . -t prover -docker build -f cluster_client.docker . -t cluster_client -docker build -f cluster_client_test.docker . -t cluster_client_test -docker build -f cluster_coordinator.docker . -t cluster_coordinator diff --git a/deploy/images/cluster_client.docker b/deploy/images/cluster_client.docker deleted file mode 100644 index 495a1fe..0000000 --- a/deploy/images/cluster_client.docker +++ /dev/null @@ -1,14 +0,0 @@ -FROM prover -WORKDIR /opt -COPY --from=setup /opt/block /opt -COPY --from=setup /opt/test /opt -COPY ./setup/mon.key /opt/mon.key -RUN plonkit setup --power 20 --srs_monomial_form mon.key -RUN cd block \ - && plonkit dump-lagrange -c circuit.r1cs --srs_monomial_form /opt/mon.key --srs_lagrange_form lag.key \ - && plonkit export-verification-key -c circuit.r1cs --srs_monomial_form /opt/mon.key -RUN cd test \ - && plonkit dump-lagrange -c circuit.r1cs --srs_monomial_form /opt/mon.key --srs_lagrange_form lag.key \ - && plonkit export-verification-key -c circuit.r1cs --srs_monomial_form /opt/mon.key - -CMD client \ No newline at end of file diff --git a/deploy/images/cluster_client_test.docker b/deploy/images/cluster_client_test.docker deleted file mode 100644 index 4bcef5d..0000000 --- a/deploy/images/cluster_client_test.docker +++ /dev/null @@ -1,19 +0,0 @@ -FROM plonkit as KeySetup -WORKDIR /opt -COPY --from=setup /opt/block /opt/block -COPY --from=setup /opt/test /opt/test -RUN plonkit setup --power 20 --srs_monomial_form mon.key -RUN cd block \ - && plonkit dump-lagrange -c circuit.r1cs --srs_monomial_form /opt/mon.key --srs_lagrange_form lag.key \ - && plonkit export-verification-key -c circuit.r1cs --srs_monomial_form /opt/mon.key -RUN cd test \ - && plonkit dump-lagrange -c circuit.r1cs --srs_monomial_form /opt/mon.key --srs_lagrange_form lag.key \ - && plonkit export-verification-key -c circuit.r1cs --srs_monomial_form /opt/mon.key - -FROM prover -WORKDIR /opt -COPY --from=KeySetup /opt/block/*.r1cs /opt/block/*.key /opt/block/*.bin /opt/block/ -COPY --from=KeySetup /opt/test/*.r1cs /opt/test/*.key /opt/test/*.bin /opt/test/ -COPY --from=KeySetup /opt/mon.key /opt -ENV CLIENT_CONFIG=client.yaml -CMD client \ No newline at end of file diff --git a/deploy/images/cluster_coordinator.docker b/deploy/images/cluster_coordinator.docker deleted file mode 100644 index aa53442..0000000 --- a/deploy/images/cluster_coordinator.docker +++ /dev/null @@ -1,6 +0,0 @@ -FROM prover -WORKDIR /opt -COPY --from=setup /opt/block /opt/circuit_block -COPY --from=setup /opt/test /opt/circuit_test -ENV COORDINATOR_CONFIG=coordinator.yaml -CMD coordinator \ No newline at end of file diff --git a/deploy/images/plonkit.docker b/deploy/images/plonkit.docker deleted file mode 100644 index 750bd8f..0000000 --- a/deploy/images/plonkit.docker +++ /dev/null @@ -1,20 +0,0 @@ -FROM rust:1.51.0-buster - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - git \ - ssh \ - libssl-dev \ - apt-utils \ - pkg-config \ - python \ - libgmp-dev \ - nasm \ - nlohmann-json3-dev \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* -RUN cargo install --git https://github.com/fluidex/plonkit && rm -rf /usr/local/cargo/registry -CMD plonkit diff --git a/deploy/images/prover.docker b/deploy/images/prover.docker deleted file mode 100644 index 702de7f..0000000 --- a/deploy/images/prover.docker +++ /dev/null @@ -1,25 +0,0 @@ -FROM rust:1.51.0-buster - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - git \ - ssh \ - libssl-dev \ - apt-utils \ - pkg-config \ - python \ - libgmp-dev \ - nasm \ - nlohmann-json3-dev \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* -RUN rustup component add rustfmt -WORKDIR /opt -RUN git clone https://github.com/fluidex/prover-cluster.git -RUN cd prover-cluster && rustup override set 1.51.0 && cargo build --release - -FROM rust:1.51.0-buster -COPY --from=0 /opt/prover-cluster/target/release/client /opt/prover-cluster/target/release/coordinator /usr/local/bin \ No newline at end of file diff --git a/deploy/images/setup.docker b/deploy/images/setup.docker deleted file mode 100644 index a8fc701..0000000 --- a/deploy/images/setup.docker +++ /dev/null @@ -1,66 +0,0 @@ -FROM rust:1.51.0-buster as plonkit - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - git \ - ssh \ - libssl-dev \ - apt-utils \ - pkg-config \ - python \ - libgmp-dev \ - nasm \ - nlohmann-json3-dev \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* -RUN cargo install --git https://github.com/fluidex/plonkit && rm -rf /usr/local/cargo/registry -CMD plonkit - -FROM node:lts-buster as circuit - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - libgmp-dev \ - nasm \ - nlohmann-json3-dev \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -RUN npm -g install snarkit - -WORKDIR /opt -RUN git clone https://github.com/fluidex/circuits -# the first install is trick to avoid a npm i failure ... -RUN cd circuits \ - && rm package-lock.json \ - && npm i blake2b-wasm@2.1.0 \ - && npm i \ - && cp src block -r \ - && mv block/block.circom block/circuit.circom \ - && printf 'component main = Block(%d, %d, %d, %d);' \ - ${N_TXS:=2} ${BALANCE_LEVELS:-2} ${ORDER_LEVELS:-7} ${ACCOUNT_LEVELS:-2} >> block/circuit.circom \ - && snarkit compile block -# also add an simple circuit for test... -RUN git clone https://github.com/fluidex/plonkit -RUN cd plonkit && npm i \ - && cd test/circuits \ - && snarkit compile poseidon - -FROM plonkit -WORKDIR /opt -COPY --from=circuit /opt/circuits/block ./block -COPY --from=circuit /opt/plonkit/test/circuits/poseidon ./test - -#RUN plonkit setup --power 20 --srs_monomial_form mon.key -#RUN cd block \ -# && plonkit dump-lagrange -c circuit.r1cs --srs_monomial_form /opt/mon.key --srs_lagrange_form lag.key \ -# && plonkit export-verification-key -c circuit.r1cs --srs_monomial_form /opt/mon.key - -#RUN cd test \ -# && plonkit dump-lagrange -c circuit.r1cs --srs_monomial_form /opt/mon.key --srs_lagrange_form lag.key \ -# && plonkit export-verification-key -c circuit.r1cs --srs_monomial_form /opt/mon.key - - diff --git a/deploy/scripts/deploy-coordinator.sh b/deploy/scripts/deploy-coordinator.sh deleted file mode 100644 index a3cd9d2..0000000 --- a/deploy/scripts/deploy-coordinator.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -# example usage: ./deploy-coordinator.sh 2 2 7 2 50055 postgres://coordinator:coordinator_AA9944@127.0.0.1/prover_cluster - -N_TXS=${1:-2} -BALANCE_LEVELS=${2:-2} -ORDER_LEVELS=${3:-7} -ACCOUNT_LEVELS=${4:-2} - -PORT=${5:-50055} -DB_URL=${6:-postgres://coordinator:coordinator_AA9944@127.0.0.1/prover_cluster} - -apt-get update -apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - git \ - ssh \ - libssl-dev \ - apt-utils \ - pkg-config \ - python \ - libgmp-dev \ - nasm \ - nlohmann-json3-dev -apt-get clean -rm -rf /var/lib/apt/lists/* -apt-get update - -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -echo 'source $HOME/.cargo/env' >> $HOME/.bashrc -source $HOME/.cargo/env - -# echo ' -# [source.crates-io] -# registry = "https://github.com/rust-lang/crates.io-index" -# replace-with = "tuna" -# [source.tuna] -# registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git" -# ' >> $HOME/.cargo/config - -# install snarkit -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sh -source $HOME/.bashrc -source $HOME/.bash_profile -source $HOME/.profile -source /root/.bashrc -source /root/.profile -nvm install --lts -nvm use --lts -npm -g install snarkit - -mkdir -p $HOME/repos -git clone https://github.com/fluidex/circuits.git $HOME/repos/fluidex/circuits -git clone https://github.com/fluidex/prover-cluster.git $HOME/repos/fluidex/prover-cluster - -cd $HOME/repos/fluidex/circuits -npm install -cp src block -r -mv block/block.circom block/circuit.circom -printf ' -component main = Block(%d, %d, %d, %d); -' $N_TXS $BALANCE_LEVELS $ORDER_LEVELS $ACCOUNT_LEVELS >> block/circuit.circom -snarkit compile block - -cd $HOME/repos/fluidex/prover-cluster -cargo build --release -printf ' -port: %d -db: "%s" -witgen: - interval: 10000 - n_workers: 5 - circuits: - block: "%s/repos/fluidex/circuits/block/circuit" -' $PORT $DB_URL $HOME > $HOME/repos/fluidex/prover-cluster/config/coordinator.yaml - -# $HOME/repos/fluidex/prover-cluster/target/release/coordinator -nohup $HOME/repos/fluidex/prover-cluster/target/release/coordinator >> $HOME/repos/fluidex/prover-cluster/log-coordinator.txt 2>&1 & diff --git a/deploy/scripts/deploy-prover.sh b/deploy/scripts/deploy-prover.sh deleted file mode 100644 index 5bb4f16..0000000 --- a/deploy/scripts/deploy-prover.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -# example usage: ./deploy-prover.sh 2 2 7 2 1 http://[::1]:50055 - -N_TXS=${1:-2} -BALANCE_LEVELS=${2:-2} -ORDER_LEVELS=${3:-7} -ACCOUNT_LEVELS=${4:-2} - -PROVER_ID=${5:-1} -UPSTREAM=${6:-http://[::1]:50055} - -apt-get update -apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - git \ - ssh \ - libssl-dev \ - apt-utils \ - pkg-config \ - python \ - libgmp-dev \ - nasm \ - nlohmann-json3-dev -apt-get clean -rm -rf /var/lib/apt/lists/* -apt-get update - -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -echo 'source $HOME/.cargo/env' >> $HOME/.bashrc -source $HOME/.cargo/env - -# echo ' -# [source.crates-io] -# registry = "https://github.com/rust-lang/crates.io-index" -# replace-with = "tuna" -# [source.tuna] -# registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git" -# ' >> $HOME/.cargo/config - -# install plonkit -cargo install --git https://github.com/fluidex/plonkit - -# install snarkit -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sh -source $HOME/.bashrc -source $HOME/.bash_profile -source $HOME/.profile -source /root/.bashrc -source /root/.profile -nvm install --lts -nvm use --lts -npm -g install snarkit - -mkdir -p $HOME/repos -git clone https://github.com/fluidex/circuits.git $HOME/repos/fluidex/circuits -git clone https://github.com/fluidex/prover-cluster.git $HOME/repos/fluidex/prover-cluster - -cd $HOME/repos/fluidex/circuits -npm install -cp src block -r -mv block/block.circom block/circuit.circom -printf ' -component main = Block(%d, %d, %d, %d); -' $N_TXS $BALANCE_LEVELS $ORDER_LEVELS $ACCOUNT_LEVELS >> block/circuit.circom -snarkit compile block - -cd $HOME/repos/fluidex/circuits/block -plonkit setup --power 20 --srs_monomial_form mon.key -plonkit dump-lagrange -c circuit.r1cs --srs_monomial_form mon.key --srs_lagrange_form lag.key -plonkit export-verification-key -c circuit.r1cs --srs_monomial_form mon.key - -cd $HOME/repos/fluidex/prover-cluster -cargo build --release -printf ' -prover_id: %s -upstream: "%s" -poll_interval: 10000 -circuit: "block" -r1cs: "%s/repos/fluidex/circuits/block/circuit.r1cs" -srs_monomial_form: "%s/repos/fluidex/circuits/block/mon.key" -srs_lagrange_form: "%s/repos/fluidex/circuits/block/lag.key" -vk: "%s/repos/fluidex/circuits/block/vk.bin" -' $PROVER_ID $UPSTREAM $HOME $HOME $HOME $HOME > $HOME/repos/fluidex/prover-cluster/config/client.yaml - -# $HOME/repos/fluidex/prover-cluster/target/release/client -nohup $HOME/repos/fluidex/prover-cluster/target/release/client >> $HOME/repos/fluidex/prover-cluster/log-client.txt 2>&1 &