Update zkas proofs merkle root opcode.

This commit is contained in:
Luther Blissett
2022-08-29 22:14:19 +02:00
parent 7c1ed1f0ef
commit deaed0bdc8
6 changed files with 19 additions and 16 deletions

View File

@@ -21,7 +21,17 @@ BINDEPS = \
$(shell find script/sql -type f) \
$(shell find contrib/token -type f)
all: $(BINS)
# ZK proofs to compile with zkas
PROOFS = \
$(shell find bin/daod/proof -type f -name '*.zk') \
$(shell find proof -type f -name '*.zk')
PROOFS_BIN = $(PROOFS:=.bin)
all: $(PROOFS_BIN) $(BINS)
$(PROOFS_BIN): zkas $(PROOFS)
./zkas $(basename $@) -o $@
token_lists:
$(MAKE) -C contrib/token all
@@ -43,14 +53,7 @@ rustdoc: token_lists
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) doc --release --workspace --all-features \
--no-deps --document-private-items
# zkas source files which we want to compile for tests
VM_SRC = proof/arithmetic.zk proof/mint.zk proof/burn.zk example/simple.zk
VM_BIN = $(VM_SRC:=.bin)
$(VM_BIN): zkas $(VM_SRC)
./zkas $(basename $@) -o $@
test: token_lists $(VM_BIN) test-tx
test: token_lists $(PROOFS_BIN) test-tx
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --release --all-features --all
test-tx:

View File

@@ -46,7 +46,7 @@ circuit "DaoProposeInput" {
C = poseidon_hash(pub_x, pub_y, value, token, serial, spend_hook, user_data, coin_blind);
# Merkle root
root = calculate_merkle_root(leaf_pos, path, C);
root = merkle_root(leaf_pos, path, C);
constrain_instance(root);
# Finally, we derive a public key for the signature and

View File

@@ -47,7 +47,7 @@ circuit "DaoProposeMain" {
# @tmp-workaround
dao_bulla_blind,
);
dao_root = calculate_merkle_root(dao_leaf_pos, dao_path, dao_bulla);
dao_root = merkle_root(dao_leaf_pos, dao_path, dao_bulla);
constrain_instance(dao_root);
# Proves this DAO is valid

View File

@@ -46,7 +46,7 @@ circuit "DaoVoteInput" {
C = poseidon_hash(pub_x, pub_y, value, gov_token_id, serial, spend_hook, user_data, coin_blind);
# Merkle root
root = calculate_merkle_root(leaf_pos, path, C);
root = merkle_root(leaf_pos, path, C);
constrain_instance(root);
# Finally, we derive a public key for the signature and

View File

@@ -51,7 +51,7 @@ circuit "Burn" {
C = poseidon_hash(pub_x, pub_y, value, token, serial, coin_blind);
# Merkle root
root = calculate_merkle_root(leaf_pos, path, C);
root = merkle_root(leaf_pos, path, C);
constrain_instance(root);
# Finally, we derive a public key for the signature and

View File

@@ -1,7 +1,7 @@
constant "Vote" {
EcFixedPoint VALUE_COMMIT_VALUE,
EcFixedPointShort VALUE_COMMIT_VALUE,
EcFixedPoint VALUE_COMMIT_RANDOM,
EcFixedPoint NULLIFIER_K,
EcFixedPointBase NULLIFIER_K,
}
contract "Vote" {
@@ -27,7 +27,7 @@ circuit "Vote" {
pk_hash = poseidon_hash(public_x, public_y);
# Merkle root
root = calculate_merkle_root(leaf_pos, path, pk_hash);
root = merkle_root(leaf_pos, path, pk_hash);
constrain_instance(root);
# Pedersen commitment for vote