Skip to content

Commit

Permalink
Merge branch 'fix/kms-keygen' into fix/reduce-block-time
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zk committed Jun 26, 2024
2 parents 1bce475 + f81c9e5 commit bfe4ce9
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 23 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
build/_workspace
build/_bin
tests/testdata
./.git/lfs
2 changes: 1 addition & 1 deletion fhevm-go-coproc
24 changes: 10 additions & 14 deletions local-testnet/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
KMS_DEV_TAG = v0.3.3-pre-13
KMS_DEV_TAG = 9b94bec
PRYSM_VERSION = v5.0.3
ROOT_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TEST_KEYS_PATH = ${ROOT_DIR}/fhevm-keys
TEMP_KEY_GEN = ./.temp_keygen
TEMP_KEY_GEN = .temp_keygen
ifeq ($(shell uname),Darwin)
HOST_OS = darwin
else
Expand All @@ -16,23 +16,22 @@ endif
PRYSM_SUFFIX = $(HOST_OS)-$(HOST_ARCH)


${TEST_KEYS_PATH}/cks ${TEST_KEYS_PATH}/pks ${TEST_KEYS_PATH}/sks ${TEST_KEYS_PATH}/default-software-keys.bin:
.PHONY: gen-keys
gen-keys:
# make sure to have a fresh dir for keys
rm -rf ${TEMP_KEY_GEN}
mkdir ${TEMP_KEY_GEN}
# start a kms that will generate keys
docker run --rm -v ${ROOT_DIR}/${TEMP_KEY_GEN}:/keys ghcr.io/zama-ai/kms-dev:${KMS_DEV_TAG} /app/kms/bin/kms-gen /keys/
docker run --entrypoint=/bin/sh --rm -v $(shell pwd)/${TEMP_KEY_GEN}:/keys ghcr.io/zama-ai/kms-service-dev:${KMS_DEV_TAG} \
-c 'cd / && /app/kms/core/service/bin/kms-gen-keys centralized --param-path /app/kms/core/service/parameters/default_params.json --write-privkey'
# move keys
mkdir -p ${TEST_KEYS_PATH}
cp ${TEMP_KEY_GEN}/default-software-keys.bin ${TEST_KEYS_PATH}
cp ${TEMP_KEY_GEN}/cks.bin ${TEST_KEYS_PATH}/cks
cp ${TEMP_KEY_GEN}/cks.bin ${TEST_KEYS_PATH}/cks.bin
cp ${TEMP_KEY_GEN}/sks.bin ${TEST_KEYS_PATH}/sks
cp ${TEMP_KEY_GEN}/pks.bin ${TEST_KEYS_PATH}/pks
# clean
mv -f ${TEMP_KEY_GEN}/PRIV/FhePrivateKey/04a1aa8ba5e95fb4dc42e06add00b0c2ce3ea424 ${TEST_KEYS_PATH}/cks
mv -f ${TEMP_KEY_GEN}/PUB/ServerKey/04a1aa8ba5e95fb4dc42e06add00b0c2ce3ea424 ${TEST_KEYS_PATH}/sks
mv -f ${TEMP_KEY_GEN}/PUB/PublicKey/04a1aa8ba5e95fb4dc42e06add00b0c2ce3ea424 ${TEST_KEYS_PATH}/pks
# cleanup
rm -rf ${TEMP_KEY_GEN}

# TODO: download different executables for linux
prysm-beacon:
curl -L https://github.com/prysmaticlabs/prysm/releases/download/$(PRYSM_VERSION)/beacon-chain-$(PRYSM_VERSION)-$(PRYSM_SUFFIX) > prysm-beacon.tmp
chmod +x prysm-beacon.tmp
Expand All @@ -43,9 +42,6 @@ prysm-validator:
chmod +x prysm-validator.tmp
mv -f prysm-validator.tmp prysm-validator

.PHONY: gen-keys
gen-keys: ${TEST_KEYS_PATH}/cks ${TEST_KEYS_PATH}/pks ${TEST_KEYS_PATH}/sks ${TEST_KEYS_PATH}/default-software-keys.bin

.PHONY: clean
clean:
rm -rf node*
Expand Down
Binary file modified local-testnet/fhevm-keys/cks
Binary file not shown.
Binary file removed local-testnet/fhevm-keys/cks.bin
Binary file not shown.
3 changes: 0 additions & 3 deletions local-testnet/fhevm-keys/default-software-keys.bin

This file was deleted.

Binary file modified local-testnet/fhevm-keys/pks
Binary file not shown.
4 changes: 2 additions & 2 deletions local-testnet/fhevm-keys/sks
Git LFS file not shown
Binary file removed local-testnet/prep/consensus/genesis.ssz
Binary file not shown.
4 changes: 2 additions & 2 deletions local-testnet/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ make geth
go build ./cmd/bootnode
popd

make gen-keys
#make gen-keys

# build with 'make geth' in root directory
GETH=../build/bin/geth
Expand Down Expand Up @@ -107,7 +107,7 @@ RPC_PARAMS="FORCE_TRANSIENT_STORAGE=true FHEVM_GO_INIT_CKS=1 FHEVM_GO_KEYS_DIR=f

# rpc node
tmux new -s exec-rpc1 -d "$RPC_PARAMS $GETH $STATE_SCHEME --datadir $NODE_DIR --port 30308 --http --http.port 8745 \
--gcmode archive --vmdebug --http.api \"eth,net,web3,debug\" \
--gcmode archive --vmdebug --http.corsdomain='*' --http.api \"eth,net,web3,debug\" \
--bootnodes 'enode://0b7b41ca480f0ef4e1b9fa7323c3ece8ed42cb161eef5bf580c737fe2f33787de25a0c212c0ac7fdb429216baa3342c9b5493bd03122527ffb4c8c114d87f0a6@127.0.0.1:0?discport=30305' \
--authrpc.port 8553 2>&1 | tee $NODE_DIR/exec.log"

Expand Down
2 changes: 1 addition & 1 deletion scripts/run-single-node-devnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ FHEVM_GO_INIT_CKS=1 \
FHEVM_CONTRACT_ADDRESS=$COPROCESSOR_CONTRACT_ADDRESS \
FHEVM_COPROCESSOR_PRIVATE_KEY_FILE=$NODE_DIR/coprocessor.key \
FORCE_TRANSIENT_STORAGE=true \
geth --datadir $NODE_DIR --port 30308 --http --http.addr 0.0.0.0 --http.port 8545 \
geth --datadir $NODE_DIR --port 30308 --http --http.corsdomain='*' --http.addr 0.0.0.0 --http.port 8545 \
--bootnodes 'enode://0b7b41ca480f0ef4e1b9fa7323c3ece8ed42cb161eef5bf580c737fe2f33787de25a0c212c0ac7fdb429216baa3342c9b5493bd03122527ffb4c8c114d87f0a6@127.0.0.1:0?discport=30305' \
--authrpc.port 8553

0 comments on commit bfe4ce9

Please sign in to comment.