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

gen key & update zkbnb-crypto dep #9

Open
wants to merge 5 commits into
base: testnet
Choose a base branch
from
Open
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
52 changes: 52 additions & 0 deletions gen-keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# write this script to a file eg: gen-key.sh
# then run gen-key.sh > ./genlog.log&
# the output of "go test -v" should be saved, because circuit constraints info is useful for mpc

#ZkBNB_REPO_PATH=$(cd `dirname $0`; pwd)

ZKBNB_OPTIONAL_BLOCK_SIZES=8,16,32,64
ZKBNB_R1CS_BATCH_SIZE=100000

OP_TIME=$(date "+%Y-%m-%d-%H:%M:%S")

mv ./deploy ./.deploy-"${OP_TIME}"

mkdir deploy
cd deploy
mkdir r1cs_keys
mkdir gen_sol
DEPLOY_PATH=$(pwd)
KEY_PATH=${DEPLOY_PATH}/r1cs_keys
SOL_PATH=${DEPLOY_PATH}/gen_sol

git clone --branch testnet https://github.com/node-real/zkbnb.git
git clone --branch qa https://github.com/bnb-chain/zkbnb-contract.git
git clone --branch testnet https://github.com/bnb-chain/zkbnb-crypto.git

echo "new pk vk env"
echo '2-1. start generate zkbnb.vk and zkbnb.pk'
cd ${DEPLOY_PATH}
cd zkbnb-crypto && go test -v ./circuit/solidity -timeout 99999s -run TestExportSol -blocksizes=${ZKBNB_OPTIONAL_BLOCK_SIZES} -batchsize=${ZKBNB_R1CS_BATCH_SIZE}
cd ${DEPLOY_PATH}
mkdir -p $KEY_PATH
cp -r ./zkbnb-crypto/circuit/solidity/* ${KEY_PATH}
rm ${KEY_PATH}/*.go

cp -r ${KEY_PATH}/*.sol ${SOL_PATH}

cd ${DEPLOY_PATH}/zkbnb/service/prover

contracts=()
keys=()
i=0
for size in $(echo $ZKBNB_OPTIONAL_BLOCK_SIZES | tr ',' ' '); do
contracts[$i]="${SOL_PATH}/ZkBNBVerifier${size}.sol"
keys[$i]="${KEY_PATH}/zkbnb${size}"
i=$((i+1))
done
VERIFIER_CONTRACTS=$(echo "${contracts[*]}" | tr ' ' ',')
PROVING_KEYS=$(echo "${keys[*]}" | tr ' ' ',')
python3 verifier_parse.py ${VERIFIER_CONTRACTS} ${ZKBNB_OPTIONAL_BLOCK_SIZES} ${DEPLOY_PATH}/zkbnb-contract/contracts/ZkBNBVerifier.sol

cp ${DEPLOY_PATH}/zkbnb-contract/contracts/ZkBNBVerifier.sol ${SOL_PATH}/ZkBNBVerifier.sol

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ require (
)

require (
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230605064829-ad6dbe39b843
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230616004420-99426a5be41a
github.com/bnb-chain/zkbnb-eth-rpc v0.0.3-0.20230605074525-1c3e46d3b694
github.com/bnb-chain/zkbnb-smt v0.0.3-0.20230519064631-0f9993341ee0
github.com/consensys/gnark v0.8.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ github.com/bnb-chain/gnark-crypto v0.8.1-0.20230412133626-30223a679fb7 h1:ME5Nif
github.com/bnb-chain/gnark-crypto v0.8.1-0.20230412133626-30223a679fb7/go.mod h1:a2DQL4+5ywF6safEeZFEPGRiiGbjzGFRUN2sg06VuU4=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230605064829-ad6dbe39b843 h1:mR62qjgA0HzH+Gal5DzjEYZ79zDGSwypko/LlwCIWhg=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230605064829-ad6dbe39b843/go.mod h1:Bi+kI5RYhV3Fgu6upQyAXz2HVxp+Ah9AzvwIBuBDYMM=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230616004420-99426a5be41a h1:znmaajiD3BtHzOgXK4B8jQyl8xg0N7hhAFZLBOfYe0s=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230616004420-99426a5be41a/go.mod h1:Bi+kI5RYhV3Fgu6upQyAXz2HVxp+Ah9AzvwIBuBDYMM=
github.com/bnb-chain/zkbnb-eth-rpc v0.0.3-0.20230605074525-1c3e46d3b694 h1:UeTRF5m2TmCXFTaMxbwhY5PYp5QYFyXv5+MGCCb1L28=
github.com/bnb-chain/zkbnb-eth-rpc v0.0.3-0.20230605074525-1c3e46d3b694/go.mod h1:zZ9uTj1GJOc5OxgojQbA8TZjEQhESUnp4MEWOYk/OVs=
github.com/bnb-chain/zkbnb-go-sdk v1.0.7-0.20230522134048-bcfa8070ef7e h1:jwUKimro0Rgv0kO7yenoVvL5BaEXxGZ7JZddX45m+FY=
Expand Down