Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(keygen): mount keys if KEY_GEN=true #18

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,9 @@ else
endif


check-all-test-repo: check-fhevm-solidity
check-all-test-repo: check-fhevm-solidity


change-running-node-owner:
@$(SUDO) chown -R $(USER): running_node/


init-ethermint-node:
@$(MAKE) init-ethermint-node-from-registry

init-ethermint-node-from-registry:
$(MAKE) generate-fhe-keys-registry-dev-image

generate-fhe-keys-registry:
ifeq ($(KEY_GEN),false)
@echo "KEY_GEN is false, executing corresponding commands..."
@bash ./scripts/copy_fhe_keys.sh $(KMS_DEV_VERSION) $(PWD)/running_node/node2/.ethermintd/zama/keys/network-fhe-keys $(PWD)/running_node/node2/.ethermintd/zama/keys/kms-fhe-keys
else ifeq ($(KEY_GEN),true)
@echo "KEY_GEN is true, executing corresponding commands..."
@bash ./scripts/prepare_volumes_from_kms_core.sh $(KMS_DEV_VERSION) $(PWD)/running_node/node2/.ethermintd/zama/keys/network-fhe-keys $(PWD)/running_node/node2/.ethermintd/zama/keys/kms-fhe-keys
else
@echo "KEY_GEN is set to an unrecognized value: $(KEY_GEN)"
endif

generate-fhe-keys-registry-dev-image:
ifeq ($(KEY_GEN),false)
@echo "KEY_GEN is false, executing corresponding commands..."
Expand All @@ -121,9 +100,18 @@ endif

run-full:
$(MAKE) generate-fhe-keys-registry-dev-image
ifeq ($(KEY_GEN),false)
@echo "KEY_GEN is false, executing corresponding commands..."
@docker compose -f docker-compose/docker-compose-full.yml up --detach
else ifeq ($(KEY_GEN),true)
@echo "KEY_GEN is true, mounting fhe keys into kms-core..."
@docker compose -f docker-compose/docker-compose-full.yml -f docker-compose/docker-compose-full.override.yml up --detach
else
@echo "KEY_GEN is set to an unrecognized value: $(KEY_GEN)"
endif

@echo 'sleep a little to let the docker start up'
sleep 10
sleep 5

stop-full:
@docker compose -f docker-compose/docker-compose-full.yml down
Expand Down Expand Up @@ -159,20 +147,18 @@ run-true-input-async-test:

e2e-test:
@$(MAKE) check-all-test-repo
@$(MAKE) init-ethermint-node-from-registry
$(MAKE) run-full
$(MAKE) run-e2e-test
$(MAKE) stop-full


clean-node-storage:
@echo 'clean node storage'
sudo rm -rf running_node

clean: clean-node-storage
clean:
$(MAKE) stop-full
rm -rf $(BUILDDIR)/
rm -rf $(WORKDIR)/
rm -rf network-fhe-keys
rm -rf kms-fhe-keys


print-info:
Expand Down
7 changes: 7 additions & 0 deletions docker-compose/docker-compose-full.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: zama-dev

services:

kms-core:
volumes:
- $PWD/res/keys:/app/kms/core/service/keys:Z
3 changes: 2 additions & 1 deletion docker-compose/docker-compose-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ services:

kms-core:
image: ghcr.io/zama-ai/kms-service-dev:v0.7.1
volumes:
- $PWD/res/keys:/app/kms/core/service/keys:Z
ports:
- "50051:50051"
healthcheck:
Expand Down Expand Up @@ -87,7 +89,6 @@ services:
- "26656-26657:26656-26657"
- "8545-8546:8545-8546"
volumes:
- $PWD/network-fhe-keys:/network-fhe-keys:Z
- ../setup.sh:/config/setup.sh:Z
security_opt:
- no-new-privileges:true
Expand Down