From 5fcb03a965fe266fc45ae597c25b1022c74a0d6b Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Mon, 1 Feb 2021 19:03:27 +0000 Subject: [PATCH] Adapt code to work with MP-SPDZ git submodule --- .dockerignore | 1 + .gitignore | 1 + docker-compose.yml | 34 +++++++++++++++++----------------- hbswap.Dockerfile | 40 ++++++++++++++++++---------------------- liquidity-provider.yml | 2 +- trader.yml | 12 ++++++------ 6 files changed, 44 insertions(+), 46 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..98ba82d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +poa/data diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..98ba82d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +poa/data diff --git a/docker-compose.yml b/docker-compose.yml index 161b6044..bf676d42 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,7 +47,7 @@ services: command: sh chain-latest.sh deploy.contract: - image: hbswap-go-x + image: hbswap-go-z build: context: . dockerfile: contract.Dockerfile @@ -66,14 +66,14 @@ services: command: ["wait-for-it", "eth.chain:8545", "--", "go", "run", "deploy/deploy.go", "eth.chain"] mpc.trusted.setup: - image: hbswap-setup-x + image: hbswap-setup-z build: context: . dockerfile: setup.Dockerfile networks: - hbswap volumes: - - ../../Scripts/setup-ssl.sh:/usr/src/setup-ssl.sh + - ./MP-SPDZ/Scripts/setup-ssl.sh:/usr/src/setup-ssl.sh - ./scripts/generate-keys.sh:/usr/src/generate-keys.sh - public-keys:/usr/src/Player-Data - secrets-p0:/usr/src/Secrets-P0 @@ -91,8 +91,8 @@ services: networks: - hbswap volumes: - - ../../compile.py:/usr/src/compile.py - - ../../Compiler:/usr/src/Compiler + - ./MP-SPDZ/compile.py:/usr/src/compile.py + - ./MP-SPDZ/Compiler:/usr/src/Compiler - ./src/mpc:/usr/src/Programs/Source - ./scripts/compile.sh:/usr/src/compile.sh - mpc-bytecodes:/usr/src/Programs/Bytecode @@ -101,10 +101,10 @@ services: command: ["bash", "compile.sh"] mpc.node.0: - image: hbswap-mpc-x + image: hbswap-mpc-z build: - context: ../.. - dockerfile: Scripts/hbswap/hbswap.Dockerfile + context: . + dockerfile: hbswap.Dockerfile target: hbswap environment: POADIR: /opt/poa @@ -130,10 +130,10 @@ services: command: ["wait-for-it", "eth.chain:8545", "--", "bash", "mpc-node.sh", "0", "eth.chain", "mpc.node.0"] mpc.node.1: - image: hbswap-mpc-x + image: hbswap-mpc-z build: - context: ../.. - dockerfile: Scripts/hbswap/hbswap.Dockerfile + context: . + dockerfile: hbswap.Dockerfile target: hbswap environment: POADIR: /opt/poa @@ -156,10 +156,10 @@ services: command: ["wait-for-it", "eth.chain:8545", "--", "bash", "mpc-node.sh", "1", "eth.chain", "mpc.node.0"] mpc.node.2: - image: hbswap-mpc-x + image: hbswap-mpc-z build: - context: ../.. - dockerfile: Scripts/hbswap/hbswap.Dockerfile + context: . + dockerfile: hbswap.Dockerfile target: hbswap environment: POADIR: /opt/poa @@ -182,10 +182,10 @@ services: command: ["wait-for-it", "eth.chain:8545", "--", "bash", "mpc-node.sh", "2", "eth.chain", "mpc.node.0"] mpc.node.3: - image: hbswap-mpc-x + image: hbswap-mpc-z build: - context: ../.. - dockerfile: Scripts/hbswap/hbswap.Dockerfile + context: . + dockerfile: hbswap.Dockerfile target: hbswap environment: POADIR: /opt/poa diff --git a/hbswap.Dockerfile b/hbswap.Dockerfile index 418453e1..8d1af7fe 100644 --- a/hbswap.Dockerfile +++ b/hbswap.Dockerfile @@ -35,25 +35,20 @@ RUN set -ex \ && ln -s libmpirxx.so.8.4.3 libmpirxx.so \ && ln -s libmpirxx.so.8.4.3 libmpirxx.so.8 -COPY Makefile . -COPY CONFIG . -COPY BMR BMR -#COPY ECDSA ECDSA -COPY Exceptions Exceptions -#COPY ExternalIO ExternalIO -#COPY FHE FHE -#COPY FHEOffline FHEOffline -COPY GC GC -COPY Machines Machines -COPY Math Math -COPY Networking Networking -COPY OT OT -COPY Processor Processor -COPY Protocols Protocols -COPY SimpleOT SimpleOT -COPY Tools Tools -COPY Utils Utils -#COPY Yao Yao +COPY MP-SPDZ/Makefile . +COPY MP-SPDZ/CONFIG . +COPY MP-SPDZ/BMR BMR +COPY MP-SPDZ/Exceptions Exceptions +COPY MP-SPDZ/GC GC +COPY MP-SPDZ/Machines Machines +COPY MP-SPDZ/Math Math +COPY MP-SPDZ/Networking Networking +COPY MP-SPDZ/OT OT +COPY MP-SPDZ/Processor Processor +COPY MP-SPDZ/Protocols Protocols +COPY MP-SPDZ/SimpleOT SimpleOT +COPY MP-SPDZ/Tools Tools +COPY MP-SPDZ/Utils Utils RUN make clean @@ -98,13 +93,13 @@ RUN go get -d -v github.com/ethereum/go-ethereum WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum RUN git checkout cfbb969da -COPY Scripts/hbswap/src /go/src/github.com/initc3/MP-SPDZ/Scripts/hbswap +COPY src /go/src/github.com/initc3/MP-SPDZ/Scripts/hbswap WORKDIR /go/src/github.com/initc3/MP-SPDZ/Scripts/hbswap RUN go get -d -v ./... -COPY Scripts /usr/src/MP-SPDZ/Scripts +COPY MP-SPDZ/Scripts /usr/src/MP-SPDZ/Scripts # MP-SPDZ WORKDIR $MP_SPDZ_HOME @@ -124,5 +119,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libmpc-dev \ && rm -rf /var/lib/apt/lists/* -WORKDIR /usr/src/MP-SPDZ/Scripts/hbswap/src/python +COPY src/python /usr/src/honeybadgerswap-python +WORKDIR /usr/src/honeybadgerswap-python RUN pip install --editable . diff --git a/liquidity-provider.yml b/liquidity-provider.yml index a4b16921..a449125c 100644 --- a/liquidity-provider.yml +++ b/liquidity-provider.yml @@ -2,7 +2,7 @@ version: '3.8' services: init.pool: - image: hbswap-go-x + image: hbswap-go-z build: context: . dockerfile: contract.Dockerfile diff --git a/trader.yml b/trader.yml index c2887b7c..2d8f8895 100644 --- a/trader.yml +++ b/trader.yml @@ -2,7 +2,7 @@ version: '3.8' services: public.deposit: - image: hbswap-go-x + image: hbswap-go-z build: context: . dockerfile: contract.Dockerfile @@ -24,7 +24,7 @@ services: command: ["bash", "client-public-deposit.sh", "eth.chain"] secret.deposit: - image: hbswap-go-x + image: hbswap-go-z build: context: . dockerfile: contract.Dockerfile @@ -46,9 +46,9 @@ services: command: ["bash", "client-secret-deposit.sh", "eth.chain"] trade-1: - image: hbswap-mpc-x + image: hbswap-mpc-z build: - context: ../.. + context: . dockerfile: hbswap.Dockerfile target: hbswap # FIXME is the poa stuff needed? @@ -70,9 +70,9 @@ services: #command: ["wait-for-it", "mpc.node.3:8080", "--", "bash", "trade.sh", "eth.chain", "0", "-1.1", "2"] trade-2: - image: hbswap-mpc-x + image: hbswap-mpc-z build: - context: ../.. + context: . dockerfile: hbswap.Dockerfile target: hbswap # FIXME is the poa stuff needed?