This commit is contained in:
Erhan Tezcan
2023-04-08 00:20:05 +03:00
parent 77fa7cdd4a
commit 6dd9e86df0
7 changed files with 62 additions and 26 deletions

View File

@@ -67,7 +67,7 @@ case $FUNC in
clean $CIRCUIT
;;
compile)
compile $CIRCUIT $COMPILE_DIR
instantiate $CIRCUIT $COMPILE_DIR && compile $CIRCUIT $COMPILE_DIR
;;
instantiate)
instantiate $CIRCUIT $COMPILE_DIR
@@ -103,8 +103,8 @@ case $FUNC in
echo " verify Verify a proof & public signals"
echo " keygen Shorthand for compile & ptau"
echo " -c <circuit-name>"
echo " -d <directory-name>"
echo " -n <num-contributions> (default: 1)"
echo " -d <directory-name> (default: $COMPILE_DIR)"
echo " -n <num-contributions> (default: $NUM_CONTRIBS)"
echo " -i <input-name>"
echo " -p <phase1-ptau-path>"
;;

View File

@@ -5,7 +5,6 @@ instantiate() {
local DIR=$2
# generate the circuit main component
mkdir -p ./circuits/$DIR
npx ts-node ./utils/instantiate.ts $CIRCUIT $DIR
echo -e "${CIRCOMKIT_COLOR_LOG}Done!${CIRCOMKIT_COLOR_RESET}"

View File

@@ -1,18 +1,24 @@
## Parse the template circuit that you are using for your main component
## and generate TypeScript interfaces for it
## TODO: not sure i need this yet
type() {
set -e
echo -e "\n${CIRCOMKIT_COLOR_TITLE}=== Generating types ===${CIRCOMKIT_COLOR_RESET}"
local CIRCUIT=$1
local SYM=./build/$CIRCUIT/$CIRCUIT.sym
local TMP=./scripts/utils.tmp.txt
# choose lines with 1 dot only (these are the signals of the main component), extract their names
cat $SYM | awk -F '.' 'NF==2{print $2}'
local MAIN_SIGNALS=$(cat $SYM | awk -F '.' 'NF==2 {print $2}')
# get the unique signal names
local MAIN_SIGNAL_NAMES=$(echo "$MAIN_SIGNALS" | awk -F '[' '{print $1}' | uniq)
# get the last signal for each signal name
local SIGNALS=""
for SIGNAL in $MAIN_SIGNAL_NAMES; do
SIGNALS+="$(echo "$MAIN_SIGNALS" | grep $SIGNAL | tail -n 1) "
done
echo "$SIGNALS"
echo -e "\n${CIRCOMKIT_COLOR_LOG}Types generated!${CIRCOMKIT_COLOR_RESET}"
}
# cat ./build/multiplier3/multiplier3.sym | awk -F '.' 'NF==2{print $2}'