Przeglądaj źródła

general cleanup, clippy & update VKS/PKS in test-harness

x 2 lat temu
rodzic
commit
c3587c0c6f

+ 50 - 50
src/contract/consensus/proof/consensus_burn_v1.zk

@@ -2,65 +2,65 @@ k = 13;
 field = "pallas";
 
 constant "ConsensusBurn_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 witness "ConsensusBurn_V1" {
-	# The value of this coin
-	Base value,
-	# The epoch this coin was minted on
-	Base epoch,
-	# Unique serial number corresponding to this coin
-	Base serial,
-	# Random blinding factor for value commitment
-	Scalar value_blind,
-	# Secret key used to derive nullifier and coins' public key
-	Base secret,
-	# Leaf position of the coin in the Merkle tree of coins
-	Uint32 leaf_pos,
-	# Merkle path to the coin
-	MerklePath path,
+    # The value of this coin
+    Base value,
+    # The epoch this coin was minted on
+    Base epoch,
+    # Unique serial number corresponding to this coin
+    Base serial,
+    # Random blinding factor for value commitment
+    Scalar value_blind,
+    # Secret key used to derive nullifier and coins' public key
+    Base secret,
+    # Leaf position of the coin in the Merkle tree of coins
+    Uint32 leaf_pos,
+    # Merkle path to the coin
+    MerklePath path,
 }
 
 circuit "ConsensusBurn_V1" {
-	# Poseidon hash of the nullifier
-	nullifier = poseidon_hash(secret, serial);
-	constrain_instance(nullifier);
+    # Poseidon hash of the nullifier
+    nullifier = poseidon_hash(secret, serial);
+    constrain_instance(nullifier);
 
-	# Constrain the epoch this coin was minted on
-	constrain_instance(epoch);
+    # Constrain the epoch this coin was minted on
+    constrain_instance(epoch);
 
-	# We derive coins' public key for the signature and
-	# constrain its coordinates:
-	pub = ec_mul_base(secret, NULLIFIER_K);
-	pub_x = ec_get_x(pub);
-	pub_y = ec_get_y(pub);
-	constrain_instance(pub_x);
-	constrain_instance(pub_y);
+    # We derive coins' public key for the signature and
+    # constrain its coordinates:
+    pub = ec_mul_base(secret, NULLIFIER_K);
+    pub_x = ec_get_x(pub);
+    pub_y = ec_get_y(pub);
+    constrain_instance(pub_x);
+    constrain_instance(pub_y);
 
-	# Coin hash	
-	C = poseidon_hash(
-		pub_x,
-		pub_y,
-		value,
-		epoch,
-		serial,
-	);
+    # Coin hash    
+    C = poseidon_hash(
+        pub_x,
+        pub_y,
+        value,
+        epoch,
+        serial,
+    );
 
-	# Merkle root
-	root = merkle_root(leaf_pos, path, C);
-	constrain_instance(root);
-	
-	# Pedersen commitment for coin's value
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	# Since value_commit is a curve point, we fetch its coordinates
-	# and constrain them:
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
+    # Merkle root
+    root = merkle_root(leaf_pos, path, C);
+    constrain_instance(root);
+    
+    # Pedersen commitment for coin's value
+    vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    # Since value_commit is a curve point, we fetch its coordinates
+    # and constrain them:
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
 
-	# At this point we've enforced all of our public inputs.
+    # At this point we've enforced all of our public inputs.
 }

+ 34 - 34
src/contract/consensus/proof/consensus_mint_v1.zk

@@ -2,47 +2,47 @@ k = 13;
 field = "pallas";
 
 constant "ConsensusMint_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
 }
 
 witness "ConsensusMint_V1" {
-	# X coordinate for public key
-	Base pub_x,
-	# Y coordinate for public key
-	Base pub_y,
-	# The value of this coin
-	Base value,
-	# The epoch this coin was minted on
-	Base epoch,
-	# Unique serial number corresponding to this coin
-	Base serial,
-	# Random blinding factor for the value commitment
-	Scalar value_blind,
+    # X coordinate for public key
+    Base pub_x,
+    # Y coordinate for public key
+    Base pub_y,
+    # The value of this coin
+    Base value,
+    # The epoch this coin was minted on
+    Base epoch,
+    # Unique serial number corresponding to this coin
+    Base serial,
+    # Random blinding factor for the value commitment
+    Scalar value_blind,
 }
 
 circuit "ConsensusMint_V1" {
-	# Constrain the epoch this coin was minted on
-	constrain_instance(epoch);
+    # Constrain the epoch this coin was minted on
+    constrain_instance(epoch);
 
-	# Poseidon hash of the coin
-	C = poseidon_hash(
-		pub_x,
-		pub_y,
-		value,
-		epoch,
-		serial,
-	);
-	constrain_instance(C);
+    # Poseidon hash of the coin
+    C = poseidon_hash(
+        pub_x,
+        pub_y,
+        value,
+        epoch,
+        serial,
+    );
+    constrain_instance(C);
 
-	# Pedersen commitment for coin's value
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	# Since the value commit is a curve point, we fetch its coordinates
-	# and constrain them:
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
+    # Pedersen commitment for coin's value
+    vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    # Since the value commit is a curve point, we fetch its coordinates
+    # and constrain them:
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
 
-	# At this point we've enforced all of our public inputs.
+    # At this point we've enforced all of our public inputs.
 }

+ 145 - 145
src/contract/consensus/proof/consensus_proposal_v1.zk

@@ -2,156 +2,156 @@ k = 13;
 field = "pallas";
 
 constant "ConsensusProposal_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 witness "ConsensusProposal_V1" {
-	# Burnt coin secret key
-	Base input_secret_key,
-	# Unique serial number corresponding to the burnt coin
-	Base input_serial,
-	# The value of the burnt coin
-	Base input_value,
-	# The epoch the burnt coin was minted on
-	Base epoch,
-	# The reward value
-	Base reward,
-	# Random blinding factor for the value commitment
-	Scalar input_value_blind,
-	# Leaf position of the coin in the Merkle tree of coins
-	Uint32 leaf_pos,
-	# Merkle path to the coin
-	MerklePath path,
-	# Random blinding factor for the value commitment of the new coin
-	Scalar output_value_blind,
-	# Election seed y
-	Base mu_y,
-	# Election seed rho
-	Base mu_rho,
-	# Sigma1
-	Base sigma1,
-	# Sigma2
-	Base sigma2,
-	# Lottery headstart
-	Base headstart,
+    # Burnt coin secret key
+    Base input_secret_key,
+    # Unique serial number corresponding to the burnt coin
+    Base input_serial,
+    # The value of the burnt coin
+    Base input_value,
+    # The epoch the burnt coin was minted on
+    Base epoch,
+    # The reward value
+    Base reward,
+    # Random blinding factor for the value commitment
+    Scalar input_value_blind,
+    # Leaf position of the coin in the Merkle tree of coins
+    Uint32 leaf_pos,
+    # Merkle path to the coin
+    MerklePath path,
+    # Random blinding factor for the value commitment of the new coin
+    Scalar output_value_blind,
+    # Election seed y
+    Base mu_y,
+    # Election seed rho
+    Base mu_rho,
+    # Sigma1
+    Base sigma1,
+    # Sigma2
+    Base sigma2,
+    # Lottery headstart
+    Base headstart,
 }
 
 circuit "ConsensusProposal_V1" {
-	# Witnessed constants
-	ZERO = witness_base(0);
-	SERIAL_PREFIX = witness_base(2);
-	SEED_PREFIX = witness_base(3);
-	SECRET_PREFIX = witness_base(4);
-
-	# =============
-	# Burn old coin
-	# =============
-
-	# Poseidon hash of the nullifier
-	nullifier = poseidon_hash(input_secret_key, input_serial);
-	constrain_instance(nullifier);
-
-	# Constrain the epoch this coin was minted on.
-	# We use this as our timelock mechanism.
-	constrain_instance(epoch);
-
-	# We derive the coin's public key for the signature and
-	# VRF proof verification and constrain its coordinates:
-	input_pub = ec_mul_base(input_secret_key, NULLIFIER_K);
-	pub_x = ec_get_x(input_pub);
-	pub_y = ec_get_y(input_pub);
-	constrain_instance(pub_x);
-	constrain_instance(pub_y);
-
-	# Construct the burned coin
-	C = poseidon_hash(
-		pub_x,
-		pub_y,
-		input_value,
-		epoch,
-		input_serial,
-	);
-
-	# Merkle inclusion proof
-	root = merkle_root(leaf_pos, path, C);
-	constrain_instance(root);
-	
-	# Pedersen commitment for burned coin's value
-	vcv = ec_mul_short(input_value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(input_value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	# Since value_commit is a curve point, we fetch its coordinates
-	# and constrain them:
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
-
-	# =============
-	# Mint new coin
-	# =============
-
-	# Constrain reward value
-	constrain_instance(reward);
-
-	# Pedersen commitment for new coin's value (old value + reward)
-	output_value = base_add(input_value, reward);
-	nvcv = ec_mul_short(output_value, VALUE_COMMIT_VALUE);
-	nvcr = ec_mul(output_value_blind, VALUE_COMMIT_RANDOM);
-	output_value_commit = ec_add(nvcv, nvcr);
-	# Since the new value commit is also a curve point, we'll do the same
-	# coordinate dance:
-	constrain_instance(ec_get_x(output_value_commit));
-	constrain_instance(ec_get_y(output_value_commit));
-
-	# The serial of the new coin is derived from the old coin
-	output_serial = poseidon_hash(SERIAL_PREFIX, input_secret_key, input_serial);
-
-	# The secret key of the new coin is derived from old coin
-	output_secret_key = poseidon_hash(SECRET_PREFIX, input_secret_key);
-	output_pub = ec_mul_base(output_secret_key, NULLIFIER_K);
-	output_pub_x = ec_get_x(output_pub);
-	output_pub_y = ec_get_y(output_pub);
+    # Witnessed constants
+    ZERO = witness_base(0);
+    SERIAL_PREFIX = witness_base(2);
+    SEED_PREFIX = witness_base(3);
+    SECRET_PREFIX = witness_base(4);
+
+    # =============
+    # Burn old coin
+    # =============
+
+    # Poseidon hash of the nullifier
+    nullifier = poseidon_hash(input_secret_key, input_serial);
+    constrain_instance(nullifier);
+
+    # Constrain the epoch this coin was minted on.
+    # We use this as our timelock mechanism.
+    constrain_instance(epoch);
+
+    # We derive the coin's public key for the signature and
+    # VRF proof verification and constrain its coordinates:
+    input_pub = ec_mul_base(input_secret_key, NULLIFIER_K);
+    pub_x = ec_get_x(input_pub);
+    pub_y = ec_get_y(input_pub);
+    constrain_instance(pub_x);
+    constrain_instance(pub_y);
+
+    # Construct the burned coin
+    C = poseidon_hash(
+        pub_x,
+        pub_y,
+        input_value,
+        epoch,
+        input_serial,
+    );
+
+    # Merkle inclusion proof
+    root = merkle_root(leaf_pos, path, C);
+    constrain_instance(root);
+    
+    # Pedersen commitment for burned coin's value
+    vcv = ec_mul_short(input_value, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(input_value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    # Since value_commit is a curve point, we fetch its coordinates
+    # and constrain them:
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
+
+    # =============
+    # Mint new coin
+    # =============
+
+    # Constrain reward value
+    constrain_instance(reward);
+
+    # Pedersen commitment for new coin's value (old value + reward)
+    output_value = base_add(input_value, reward);
+    nvcv = ec_mul_short(output_value, VALUE_COMMIT_VALUE);
+    nvcr = ec_mul(output_value_blind, VALUE_COMMIT_RANDOM);
+    output_value_commit = ec_add(nvcv, nvcr);
+    # Since the new value commit is also a curve point, we'll do the same
+    # coordinate dance:
+    constrain_instance(ec_get_x(output_value_commit));
+    constrain_instance(ec_get_y(output_value_commit));
+
+    # The serial of the new coin is derived from the old coin
+    output_serial = poseidon_hash(SERIAL_PREFIX, input_secret_key, input_serial);
+
+    # The secret key of the new coin is derived from old coin
+    output_secret_key = poseidon_hash(SECRET_PREFIX, input_secret_key);
+    output_pub = ec_mul_base(output_secret_key, NULLIFIER_K);
+    output_pub_x = ec_get_x(output_pub);
+    output_pub_y = ec_get_y(output_pub);
         
-	# Poseidon hash of the new coin
-	# In here we set the new epoch as ZERO, thus removing a
-	# potentially existing timelock.
-	output_coin = poseidon_hash(
-		output_pub_x,
-		output_pub_y,
-		output_value,
-		ZERO,
-		output_serial,
-	);
-	constrain_instance(output_coin);
-
-	# ============================
-	# Constrain lottery parameters
-	# ============================
-
-	# Coin y, constructed with the old serial for seeding:
-	seed = poseidon_hash(SEED_PREFIX, input_serial);
-	y = poseidon_hash(seed, mu_y);
-	constrain_instance(mu_y);
-	constrain_instance(y);
-
-	# Coin rho (seed):
-	rho = poseidon_hash(seed, mu_rho);
-	constrain_instance(mu_rho);
-	constrain_instance(rho);
-
-	# Calculate lottery target
-	term_1 = base_mul(sigma1, input_value);
-	term_2 = base_mul(sigma2, input_value);
-	shifted_term_2 = base_mul(term_2, input_value);
-	target = base_add(term_1, shifted_term_2);
-	shifted_target = base_add(target, headstart);
-	constrain_instance(sigma1);
-	constrain_instance(sigma2);
-	constrain_instance(headstart);
-
-	# Play lottery
-	less_than_strict(y, shifted_target);
-
-	# At this point we've enforced all of our public inputs.
+    # Poseidon hash of the new coin
+    # In here we set the new epoch as ZERO, thus removing a
+    # potentially existing timelock.
+    output_coin = poseidon_hash(
+        output_pub_x,
+        output_pub_y,
+        output_value,
+        ZERO,
+        output_serial,
+    );
+    constrain_instance(output_coin);
+
+    # ============================
+    # Constrain lottery parameters
+    # ============================
+
+    # Coin y, constructed with the old serial for seeding:
+    seed = poseidon_hash(SEED_PREFIX, input_serial);
+    y = poseidon_hash(seed, mu_y);
+    constrain_instance(mu_y);
+    constrain_instance(y);
+
+    # Coin rho (seed):
+    rho = poseidon_hash(seed, mu_rho);
+    constrain_instance(mu_rho);
+    constrain_instance(rho);
+
+    # Calculate lottery target
+    term_1 = base_mul(sigma1, input_value);
+    term_2 = base_mul(sigma2, input_value);
+    shifted_term_2 = base_mul(term_2, input_value);
+    target = base_add(term_1, shifted_term_2);
+    shifted_target = base_add(target, headstart);
+    constrain_instance(sigma1);
+    constrain_instance(sigma2);
+    constrain_instance(headstart);
+
+    # Play lottery
+    less_than_strict(y, shifted_target);
+
+    # At this point we've enforced all of our public inputs.
 }

+ 48 - 48
src/contract/dao/proof/dao-auth-money-transfer.zk

@@ -2,84 +2,84 @@ k = 13;
 field = "pallas";
 
 constant "DaoAuthMoneyTransfer" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
 }
 
 witness "DaoAuthMoneyTransfer" {
-	# Proposal parameters
+    # Proposal parameters
     Base proposal_auth_calls_commit,
     Base proposal_user_data,
-	Base proposal_blind,
+    Base proposal_blind,
 
-	# DAO parameters
-	Base dao_proposer_limit,
-	Base dao_quorum,
-	Base dao_approval_ratio_quot,
-	Base dao_approval_ratio_base,
-	Base gov_token_id,
-	Base dao_public_x,
-	Base dao_public_y,
-	Base dao_bulla_blind,
+    # DAO parameters
+    Base dao_proposer_limit,
+    Base dao_quorum,
+    Base dao_approval_ratio_quot,
+    Base dao_approval_ratio_base,
+    Base gov_token_id,
+    Base dao_public_x,
+    Base dao_public_y,
+    Base dao_bulla_blind,
 
     # Dao input(s) user data blind
     Base input_user_data_blind,
 
-	# Dao output coin attrs
-	Base dao_value,
-	Base dao_token,
-	Base dao_serial,
+    # Dao output coin attrs
+    Base dao_value,
+    Base dao_token,
+    Base dao_serial,
 
     # Should be set to DAO_CONTRACT_ID
     Base dao_contract_id,
 }
 
 circuit "DaoAuthMoneyTransfer" {
-	dao_bulla = poseidon_hash(
-		dao_proposer_limit,
-		dao_quorum,
-		dao_approval_ratio_quot,
-		dao_approval_ratio_base,
-		gov_token_id,
-		dao_public_x,
-		dao_public_y,
-		dao_bulla_blind,
-	);
+    dao_bulla = poseidon_hash(
+        dao_proposer_limit,
+        dao_quorum,
+        dao_approval_ratio_quot,
+        dao_approval_ratio_base,
+        gov_token_id,
+        dao_public_x,
+        dao_public_y,
+        dao_bulla_blind,
+    );
 
-	# Proposal bulla being valid means DAO bulla is also valid because
-	# dao-propose-main.zk already checks that when we first create the
-	# proposal - so it is redundant to check DAO bulla exists here.
-	proposal_bulla = poseidon_hash(
+    # Proposal bulla being valid means DAO bulla is also valid because
+    # dao-propose-main.zk already checks that when we first create the
+    # proposal - so it is redundant to check DAO bulla exists here.
+    proposal_bulla = poseidon_hash(
         proposal_auth_calls_commit,
         proposal_user_data,
-		dao_bulla,
-		proposal_blind,
-	);
-	constrain_instance(proposal_bulla);
+        dao_bulla,
+        proposal_blind,
+    );
+    constrain_instance(proposal_bulla);
 
     # Check inputs are spending from the correct DAO
     input_user_data_enc = poseidon_hash(dao_bulla, input_user_data_blind);
-	constrain_instance(input_user_data_enc);
+    constrain_instance(input_user_data_enc);
 
     # Change output should be sending back to the DAO
-	dao_change_coin = poseidon_hash(
-		dao_public_x,
-		dao_public_y,
+    dao_change_coin = poseidon_hash(
+        dao_public_x,
+        dao_public_y,
         # We don't need to check this value.
         # money::transfer() checks that sum(input values) = sum(output values)
         # which ensures it will be correct.
-		dao_value,
+        dao_value,
         # Likewise the token_id must match the other output coins.
-		dao_token,
-		dao_serial,
-		dao_contract_id,
-		dao_bulla,
-	);
-	constrain_instance(dao_change_coin);
-	constrain_instance(dao_contract_id);
+        dao_token,
+        dao_serial,
+        dao_contract_id,
+        dao_bulla,
+    );
+    constrain_instance(dao_change_coin);
+    constrain_instance(dao_contract_id);
 
     # Reveal content commit. This should contain the set of coins.
     # We check these are set in the runtime.
-	constrain_instance(proposal_auth_calls_commit);
+    constrain_instance(proposal_auth_calls_commit);
 }
 

+ 65 - 65
src/contract/dao/proof/dao-exec.zk

@@ -2,87 +2,87 @@ k = 13;
 field = "pallas";
 
 constant "DaoExec" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
 }
 
 witness "DaoExec" {
-	# Proposal parameters
+    # Proposal parameters
     Base proposal_auth_calls_commit,
     Base proposal_user_data,
-	Base proposal_blind,
+    Base proposal_blind,
 
-	# DAO parameters
-	Base dao_proposer_limit,
-	Base dao_quorum,
-	Base dao_approval_ratio_quot,
-	Base dao_approval_ratio_base,
-	Base gov_token_id,
-	Base dao_public_x,
-	Base dao_public_y,
-	Base dao_bulla_blind,
+    # DAO parameters
+    Base dao_proposer_limit,
+    Base dao_quorum,
+    Base dao_approval_ratio_quot,
+    Base dao_approval_ratio_base,
+    Base gov_token_id,
+    Base dao_public_x,
+    Base dao_public_y,
+    Base dao_bulla_blind,
 
-	# Votes
-	Base yes_vote_value,
-	Base all_vote_value,
-	Scalar yes_vote_blind,
-	Scalar all_vote_blind,
+    # Votes
+    Base yes_vote_value,
+    Base all_vote_value,
+    Scalar yes_vote_blind,
+    Scalar all_vote_blind,
 }
 
 circuit "DaoExec" {
-	dao_bulla = poseidon_hash(
-		dao_proposer_limit,
-		dao_quorum,
-		dao_approval_ratio_quot,
-		dao_approval_ratio_base,
-		gov_token_id,
-		dao_public_x,
-		dao_public_y,
-		dao_bulla_blind,
-	);
+    dao_bulla = poseidon_hash(
+        dao_proposer_limit,
+        dao_quorum,
+        dao_approval_ratio_quot,
+        dao_approval_ratio_base,
+        gov_token_id,
+        dao_public_x,
+        dao_public_y,
+        dao_bulla_blind,
+    );
 
-	# Proposal bulla being valid means DAO bulla is also valid because
-	# dao-propose-main.zk already checks that when we first create the
-	# proposal - so it is redundant to check DAO bulla exists here.
-	proposal_bulla = poseidon_hash(
+    # Proposal bulla being valid means DAO bulla is also valid because
+    # dao-propose-main.zk already checks that when we first create the
+    # proposal - so it is redundant to check DAO bulla exists here.
+    proposal_bulla = poseidon_hash(
         proposal_auth_calls_commit,
         proposal_user_data,
-		dao_bulla,
-		proposal_blind,
-	);
-	constrain_instance(proposal_bulla);
-	constrain_instance(proposal_auth_calls_commit);
+        dao_bulla,
+        proposal_blind,
+    );
+    constrain_instance(proposal_bulla);
+    constrain_instance(proposal_auth_calls_commit);
 
-	# Create Pedersen commitments for win_votes and total_votes, and
-	# constrain the commitments' coordinates.
-	yes_vote_value_c = ec_mul_short(yes_vote_value, VALUE_COMMIT_VALUE);
-	yes_vote_blind_c = ec_mul(yes_vote_blind, VALUE_COMMIT_RANDOM);
-	yes_vote_commit = ec_add(yes_vote_value_c, yes_vote_blind_c);
-	constrain_instance(ec_get_x(yes_vote_commit));
-	constrain_instance(ec_get_y(yes_vote_commit));
+    # Create Pedersen commitments for win_votes and total_votes, and
+    # constrain the commitments' coordinates.
+    yes_vote_value_c = ec_mul_short(yes_vote_value, VALUE_COMMIT_VALUE);
+    yes_vote_blind_c = ec_mul(yes_vote_blind, VALUE_COMMIT_RANDOM);
+    yes_vote_commit = ec_add(yes_vote_value_c, yes_vote_blind_c);
+    constrain_instance(ec_get_x(yes_vote_commit));
+    constrain_instance(ec_get_y(yes_vote_commit));
 
-	all_vote_value_c = ec_mul_short(all_vote_value, VALUE_COMMIT_VALUE);
-	all_vote_blind_c = ec_mul(all_vote_blind, VALUE_COMMIT_RANDOM);
-	all_vote_commit = ec_add(all_vote_value_c, all_vote_blind_c);
-	constrain_instance(ec_get_x(all_vote_commit));
-	constrain_instance(ec_get_y(all_vote_commit));
+    all_vote_value_c = ec_mul_short(all_vote_value, VALUE_COMMIT_VALUE);
+    all_vote_blind_c = ec_mul(all_vote_blind, VALUE_COMMIT_RANDOM);
+    all_vote_commit = ec_add(all_vote_value_c, all_vote_blind_c);
+    constrain_instance(ec_get_x(all_vote_commit));
+    constrain_instance(ec_get_y(all_vote_commit));
 
-	# Check that dao_quorum is less than or equal to all_vote_value
-	one = witness_base(1);
-	all_vote_value_1 = base_add(all_vote_value, one);
-	less_than_strict(dao_quorum, all_vote_value_1);
+    # Check that dao_quorum is less than or equal to all_vote_value
+    one = witness_base(1);
+    all_vote_value_1 = base_add(all_vote_value, one);
+    less_than_strict(dao_quorum, all_vote_value_1);
 
-	# approval_ratio_quot / approval_ratio_base <= yes_vote / all_vote
-	#
-	# The above is also equivalent to this:
-	#
-	# all_vote * approval_ratio_quot <= yes_vote * approval_ratio_base
-	lhs = base_mul(all_vote_value, dao_approval_ratio_quot);
-	rhs = base_mul(yes_vote_value, dao_approval_ratio_base);
-	rhs_1 = base_add(rhs, one);
-	less_than_strict(lhs, rhs_1);
+    # approval_ratio_quot / approval_ratio_base <= yes_vote / all_vote
+    #
+    # The above is also equivalent to this:
+    #
+    # all_vote * approval_ratio_quot <= yes_vote * approval_ratio_base
+    lhs = base_mul(all_vote_value, dao_approval_ratio_quot);
+    rhs = base_mul(yes_vote_value, dao_approval_ratio_base);
+    rhs_1 = base_add(rhs, one);
+    less_than_strict(lhs, rhs_1);
 
-	# NOTE: There is a vulnerability here where someone can create the exec
-	# transaction with a bad note so it cannot be decrypted by the receiver
-	# TODO: Research verifiable encryption inside ZK
+    # NOTE: There is a vulnerability here where someone can create the exec
+    # transaction with a bad note so it cannot be decrypted by the receiver
+    # TODO: Research verifiable encryption inside ZK
 }

+ 26 - 26
src/contract/dao/proof/dao-mint.zk

@@ -2,39 +2,39 @@ k = 13;
 field = "pallas";
 
 constant "DaoMint" {
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 witness "DaoMint" {
-	Base dao_proposer_limit,
-	Base dao_quorum,
-	Base dao_approval_ratio_quot,
-	Base dao_approval_ratio_base,
-	Base gov_token_id,
-	Base dao_secret,
-	Base dao_bulla_blind,
+    Base dao_proposer_limit,
+    Base dao_quorum,
+    Base dao_approval_ratio_quot,
+    Base dao_approval_ratio_base,
+    Base gov_token_id,
+    Base dao_secret,
+    Base dao_bulla_blind,
 }
 
 circuit "DaoMint" {
-	# This circuit states that the bulla is a hash of 8 values
+    # This circuit states that the bulla is a hash of 8 values
 
-	dao_public = ec_mul_base(dao_secret, NULLIFIER_K);
-	dao_public_x = ec_get_x(dao_public);
-	dao_public_y = ec_get_y(dao_public);
-	constrain_instance(dao_public_x);
-	constrain_instance(dao_public_y);
+    dao_public = ec_mul_base(dao_secret, NULLIFIER_K);
+    dao_public_x = ec_get_x(dao_public);
+    dao_public_y = ec_get_y(dao_public);
+    constrain_instance(dao_public_x);
+    constrain_instance(dao_public_y);
 
-	bulla = poseidon_hash(
-		dao_proposer_limit,
-		dao_quorum,
-		dao_approval_ratio_quot,
-		dao_approval_ratio_base,
-		gov_token_id,
-		dao_public_x,
-		dao_public_y,
-		dao_bulla_blind,
-	);
+    bulla = poseidon_hash(
+        dao_proposer_limit,
+        dao_quorum,
+        dao_approval_ratio_quot,
+        dao_approval_ratio_base,
+        gov_token_id,
+        dao_public_x,
+        dao_public_y,
+        dao_bulla_blind,
+    );
 
-	constrain_instance(bulla);
+    constrain_instance(bulla);
 }

+ 51 - 51
src/contract/dao/proof/dao-propose-burn.zk

@@ -2,61 +2,61 @@ k = 13;
 field = "pallas";
 
 constant "DaoProposeInput" {
-	EcFixedPointBase NULLIFIER_K,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPointBase NULLIFIER_K,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
 }
 
 witness "DaoProposeInput" {
-	Base secret,
-	Base serial,
-	Base spend_hook,
-	Base user_data,
-	Base value,
-	Base token,
-	Scalar value_blind,
-	Base token_blind,
-	Uint32 leaf_pos,
-	MerklePath path,
-	Base signature_secret,
+    Base secret,
+    Base serial,
+    Base spend_hook,
+    Base user_data,
+    Base value,
+    Base token,
+    Scalar value_blind,
+    Base token_blind,
+    Uint32 leaf_pos,
+    MerklePath path,
+    Base signature_secret,
 }
 
 circuit "DaoProposeInput" {
-	#nullifier = poseidon_hash(secret, serial);
-	#constrain_instance(nullifier);
-
-	# Pedersen commitment for coin's value
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
-
-	# Commitment for coin's token ID
-	token_commit = poseidon_hash(token, token_blind);
-	constrain_instance(token_commit);
-
-	# Coin hash
-	pub = ec_mul_base(secret, NULLIFIER_K);
-	pub_x = ec_get_x(pub);
-	pub_y = ec_get_y(pub);
-	C = poseidon_hash(
-		pub_x,
-		pub_y,
-		value,
-		token,
-		serial,
-		spend_hook,
-		user_data,
-	);
-
-	# Merkle root
-	root = merkle_root(leaf_pos, path, C);
-	constrain_instance(root);
-
-	# Finally we derive a public key for the signature and constrain
-	# its coordinates:
-	signature_public = ec_mul_base(signature_secret, NULLIFIER_K);
-	constrain_instance(ec_get_x(signature_public));
-	constrain_instance(ec_get_y(signature_public));
+    #nullifier = poseidon_hash(secret, serial);
+    #constrain_instance(nullifier);
+
+    # Pedersen commitment for coin's value
+    vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
+
+    # Commitment for coin's token ID
+    token_commit = poseidon_hash(token, token_blind);
+    constrain_instance(token_commit);
+
+    # Coin hash
+    pub = ec_mul_base(secret, NULLIFIER_K);
+    pub_x = ec_get_x(pub);
+    pub_y = ec_get_y(pub);
+    C = poseidon_hash(
+        pub_x,
+        pub_y,
+        value,
+        token,
+        serial,
+        spend_hook,
+        user_data,
+    );
+
+    # Merkle root
+    root = merkle_root(leaf_pos, path, C);
+    constrain_instance(root);
+
+    # Finally we derive a public key for the signature and constrain
+    # its coordinates:
+    signature_public = ec_mul_base(signature_secret, NULLIFIER_K);
+    constrain_instance(ec_get_x(signature_public));
+    constrain_instance(ec_get_y(signature_public));
 }

+ 51 - 51
src/contract/dao/proof/dao-propose-main.zk

@@ -2,74 +2,74 @@ k = 13;
 field = "pallas";
 
 constant "DaoProposeMain" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
 }
 
 witness "DaoProposeMain" {
-	# Proposers total number of governance tokens
-	Base total_funds,
-	Scalar total_funds_blind,
+    # Proposers total number of governance tokens
+    Base total_funds,
+    Scalar total_funds_blind,
 
-	# Check the inputs and this proof are for the same token
-	Base gov_token_blind,
+    # Check the inputs and this proof are for the same token
+    Base gov_token_blind,
 
-	# Proposal parameters
+    # Proposal parameters
     Base proposal_auth_calls_commit,
     Base proposal_user_data,
-	Base proposal_blind,
+    Base proposal_blind,
 
-	# DAO params
-	Base dao_proposer_limit,
-	Base dao_quorum,
-	Base dao_approval_ratio_quot,
-	Base dao_approval_ratio_base,
-	Base gov_token_id,
-	Base dao_public_x,
-	Base dao_public_y,
-	Base dao_bulla_blind,
+    # DAO params
+    Base dao_proposer_limit,
+    Base dao_quorum,
+    Base dao_approval_ratio_quot,
+    Base dao_approval_ratio_base,
+    Base gov_token_id,
+    Base dao_public_x,
+    Base dao_public_y,
+    Base dao_bulla_blind,
 
-	Uint32 dao_leaf_pos,
-	MerklePath dao_path,
+    Uint32 dao_leaf_pos,
+    MerklePath dao_path,
 }
 
 circuit "DaoProposeMain" {
-	token_commit = poseidon_hash(gov_token_id, gov_token_blind);
-	constrain_instance(token_commit);
+    token_commit = poseidon_hash(gov_token_id, gov_token_blind);
+    constrain_instance(token_commit);
 
-	dao_bulla = poseidon_hash(
-		dao_proposer_limit,
-		dao_quorum,
-		dao_approval_ratio_quot,
-		dao_approval_ratio_base,
-		gov_token_id,
-		dao_public_x,
-		dao_public_y,
-		dao_bulla_blind,
-	);
+    dao_bulla = poseidon_hash(
+        dao_proposer_limit,
+        dao_quorum,
+        dao_approval_ratio_quot,
+        dao_approval_ratio_base,
+        gov_token_id,
+        dao_public_x,
+        dao_public_y,
+        dao_bulla_blind,
+    );
 
-	dao_root = merkle_root(dao_leaf_pos, dao_path, dao_bulla);
-	constrain_instance(dao_root);
-	# Proves this DAO is valid
+    dao_root = merkle_root(dao_leaf_pos, dao_path, dao_bulla);
+    constrain_instance(dao_root);
+    # Proves this DAO is valid
 
-	proposal_bulla = poseidon_hash(
+    proposal_bulla = poseidon_hash(
         proposal_auth_calls_commit,
         proposal_user_data,
-		dao_bulla,
-		proposal_blind,
-	);
-	constrain_instance(proposal_bulla);
+        dao_bulla,
+        proposal_blind,
+    );
+    constrain_instance(proposal_bulla);
 
-	# This is the main check
-	# We check that dao_proposer_limit <= total_funds
-	one = witness_base(1);
-	total_funds_1 = base_add(total_funds, one);
-	less_than_strict(dao_proposer_limit, total_funds_1);
+    # This is the main check
+    # We check that dao_proposer_limit <= total_funds
+    one = witness_base(1);
+    total_funds_1 = base_add(total_funds, one);
+    less_than_strict(dao_proposer_limit, total_funds_1);
 
-	# Pedersen commitment for coin's value
-	vcv = ec_mul_short(total_funds, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(total_funds_blind, VALUE_COMMIT_RANDOM);
-	total_funds_commit = ec_add(vcv, vcr);
-	constrain_instance(ec_get_x(total_funds_commit));
-	constrain_instance(ec_get_y(total_funds_commit));
+    # Pedersen commitment for coin's value
+    vcv = ec_mul_short(total_funds, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(total_funds_blind, VALUE_COMMIT_RANDOM);
+    total_funds_commit = ec_add(vcv, vcr);
+    constrain_instance(ec_get_x(total_funds_commit));
+    constrain_instance(ec_get_y(total_funds_commit));
 }

+ 46 - 46
src/contract/dao/proof/dao-vote-burn.zk

@@ -2,56 +2,56 @@ k = 13;
 field = "pallas";
 
 constant "DaoVoteInput" {
-	EcFixedPointBase NULLIFIER_K,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPointBase NULLIFIER_K,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
 }
 
 witness "DaoVoteInput" {
-	Base secret,
-	Base serial,
-	Base spend_hook,
-	Base user_data,
-	Base value,
-	Base gov_token_id,
-	Scalar value_blind,
-	Base gov_token_blind,
-	Uint32 leaf_pos,
-	MerklePath path,
-	Base signature_secret,
+    Base secret,
+    Base serial,
+    Base spend_hook,
+    Base user_data,
+    Base value,
+    Base gov_token_id,
+    Scalar value_blind,
+    Base gov_token_blind,
+    Uint32 leaf_pos,
+    MerklePath path,
+    Base signature_secret,
 }
 
 circuit "DaoVoteInput" {
-	nullifier = poseidon_hash(secret, serial);
-	constrain_instance(nullifier);
-
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
-
-	token_commit = poseidon_hash(gov_token_id, gov_token_blind);
-	constrain_instance(token_commit);
-
-	pub = ec_mul_base(secret, NULLIFIER_K);
-	pub_x = ec_get_x(pub);
-	pub_y = ec_get_y(pub);
-	C = poseidon_hash(
-		pub_x,
-		pub_y,
-		value,
-		gov_token_id,
-		serial,
-		spend_hook,
-		user_data,
-	);
-
-	# Merkle root
-	root = merkle_root(leaf_pos, path, C);
-	constrain_instance(root);
-
-	signature_public = ec_mul_base(signature_secret, NULLIFIER_K);
-	constrain_instance(ec_get_x(signature_public));
-	constrain_instance(ec_get_y(signature_public));
+    nullifier = poseidon_hash(secret, serial);
+    constrain_instance(nullifier);
+
+    vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
+
+    token_commit = poseidon_hash(gov_token_id, gov_token_blind);
+    constrain_instance(token_commit);
+
+    pub = ec_mul_base(secret, NULLIFIER_K);
+    pub_x = ec_get_x(pub);
+    pub_y = ec_get_y(pub);
+    C = poseidon_hash(
+        pub_x,
+        pub_y,
+        value,
+        gov_token_id,
+        serial,
+        spend_hook,
+        user_data,
+    );
+
+    # Merkle root
+    root = merkle_root(leaf_pos, path, C);
+    constrain_instance(root);
+
+    signature_public = ec_mul_base(signature_secret, NULLIFIER_K);
+    constrain_instance(ec_get_x(signature_public));
+    constrain_instance(ec_get_y(signature_public));
 }

+ 54 - 54
src/contract/dao/proof/dao-vote-main.zk

@@ -2,77 +2,77 @@ k = 13;
 field = "pallas";
 
 constant "DaoVoteMain" {
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
 }
 
 witness "DaoVoteMain" {
-	# Proposal parameters
+    # Proposal parameters
     Base proposal_auth_calls_commit,
     Base proposal_user_data,
-	Base proposal_blind,
+    Base proposal_blind,
 
-	# DAO parameters
-	Base dao_proposer_limit,
-	Base dao_quorum,
-	Base dao_approval_ratio_quot,
-	Base dao_approval_ratio_base,
-	Base gov_token_id,
-	Base dao_public_x,
-	Base dao_public_y,
-	Base dao_bulla_blind,
+    # DAO parameters
+    Base dao_proposer_limit,
+    Base dao_quorum,
+    Base dao_approval_ratio_quot,
+    Base dao_approval_ratio_base,
+    Base gov_token_id,
+    Base dao_public_x,
+    Base dao_public_y,
+    Base dao_bulla_blind,
 
-	# Is the vote yes or no
-	Base vote_option,
-	Scalar yes_vote_blind,
+    # Is the vote yes or no
+    Base vote_option,
+    Scalar yes_vote_blind,
 
-	# Total amount of capital allocated to vote
-	Base all_vote_value,
-	Scalar all_vote_blind,
+    # Total amount of capital allocated to vote
+    Base all_vote_value,
+    Scalar all_vote_blind,
 
-	# Check the inputs and this proof are for the same token
-	Base gov_token_blind,
+    # Check the inputs and this proof are for the same token
+    Base gov_token_blind,
 }
 
 circuit "DaoVoteMain" {
-	token_commit = poseidon_hash(gov_token_id, gov_token_blind);
-	constrain_instance(token_commit);
+    token_commit = poseidon_hash(gov_token_id, gov_token_blind);
+    constrain_instance(token_commit);
 
-	dao_bulla = poseidon_hash(
-		dao_proposer_limit,
-		dao_quorum,
-		dao_approval_ratio_quot,
-		dao_approval_ratio_base,
-		gov_token_id,
-		dao_public_x,
-		dao_public_y,
-		dao_bulla_blind,
-	);
+    dao_bulla = poseidon_hash(
+        dao_proposer_limit,
+        dao_quorum,
+        dao_approval_ratio_quot,
+        dao_approval_ratio_base,
+        gov_token_id,
+        dao_public_x,
+        dao_public_y,
+        dao_bulla_blind,
+    );
 
-	proposal_bulla = poseidon_hash(
+    proposal_bulla = poseidon_hash(
         proposal_auth_calls_commit,
         proposal_user_data,
-		dao_bulla,
-		proposal_blind,
-	);
-	constrain_instance(proposal_bulla);
+        dao_bulla,
+        proposal_blind,
+    );
+    constrain_instance(proposal_bulla);
 
-	# Normally we call this yes vote
-	# Pedersen commitment for vote option
-	yes_vote_value = base_mul(vote_option, all_vote_value);
-	yes_vote_value_c = ec_mul_short(yes_vote_value, VALUE_COMMIT_VALUE);
-	yes_vote_blind_c = ec_mul(yes_vote_blind, VALUE_COMMIT_RANDOM);
-	yes_vote_commit = ec_add(yes_vote_value_c, yes_vote_blind_c);
-	constrain_instance(ec_get_x(yes_vote_commit));
-	constrain_instance(ec_get_y(yes_vote_commit));
+    # Normally we call this yes vote
+    # Pedersen commitment for vote option
+    yes_vote_value = base_mul(vote_option, all_vote_value);
+    yes_vote_value_c = ec_mul_short(yes_vote_value, VALUE_COMMIT_VALUE);
+    yes_vote_blind_c = ec_mul(yes_vote_blind, VALUE_COMMIT_RANDOM);
+    yes_vote_commit = ec_add(yes_vote_value_c, yes_vote_blind_c);
+    constrain_instance(ec_get_x(yes_vote_commit));
+    constrain_instance(ec_get_y(yes_vote_commit));
 
-	# Pedersen commitment for vote value
-	all_vote_c = ec_mul_short(all_vote_value, VALUE_COMMIT_VALUE);
-	all_vote_blind_c = ec_mul(all_vote_blind, VALUE_COMMIT_RANDOM);
-	all_vote_commit = ec_add(all_vote_c, all_vote_blind_c);
-	constrain_instance(ec_get_x(all_vote_commit));
-	constrain_instance(ec_get_y(all_vote_commit));
+    # Pedersen commitment for vote value
+    all_vote_c = ec_mul_short(all_vote_value, VALUE_COMMIT_VALUE);
+    all_vote_blind_c = ec_mul(all_vote_blind, VALUE_COMMIT_RANDOM);
+    all_vote_commit = ec_add(all_vote_c, all_vote_blind_c);
+    constrain_instance(ec_get_x(all_vote_commit));
+    constrain_instance(ec_get_y(all_vote_commit));
 
-	# Vote option should be 0 or 1
-	bool_check(vote_option);
+    # Vote option should be 0 or 1
+    bool_check(vote_option);
 }

+ 2 - 7
src/contract/dao/src/client/auth_xfer.rs

@@ -18,13 +18,10 @@
 
 use darkfi_money_contract::model::CoinAttributes;
 use darkfi_sdk::{
-    crypto::{
-        pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, SecretKey, DAO_CONTRACT_ID,
-    },
+    crypto::{poseidon_hash, DAO_CONTRACT_ID},
     pasta::pallas,
 };
 
-use log::debug;
 use rand::rngs::OsRng;
 
 use darkfi::{
@@ -33,9 +30,7 @@ use darkfi::{
     Result,
 };
 
-use crate::model::{
-    Dao, DaoAuthMoneyTransferParams, DaoBlindAggregateVote, DaoProposal, VecAuthCallCommit,
-};
+use crate::model::{Dao, DaoAuthMoneyTransferParams, DaoProposal, VecAuthCallCommit};
 
 pub struct DaoAuthMoneyTransferCall {
     pub proposal: DaoProposal,

+ 1 - 1
src/contract/dao/src/client/mint.rs

@@ -72,7 +72,7 @@ pub fn make_mint_call(
     let circuit = ZkCircuit::new(prover_witnesses, dao_mint_zkbin);
     let proof = Proof::create(dao_mint_pk, &[circuit], &public, &mut OsRng)?;
 
-    let dao_mint_params = DaoMintParams { dao_bulla: dao_bulla.into(), dao_pubkey: dao.public_key };
+    let dao_mint_params = DaoMintParams { dao_bulla, dao_pubkey: dao.public_key };
 
     Ok((dao_mint_params, vec![proof]))
 }

+ 0 - 1
src/contract/dao/src/client/propose.rs

@@ -26,7 +26,6 @@ use darkfi_sdk::{
     },
     pasta::pallas,
 };
-use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
 use rand::rngs::OsRng;
 
 use darkfi::{

+ 8 - 10
src/contract/dao/src/entrypoint/auth_xfer.rs

@@ -21,25 +21,24 @@ use darkfi_money_contract::{
     MoneyFunction,
 };
 use darkfi_sdk::{
-    crypto::{pasta_prelude::*, ContractId, PublicKey, DAO_CONTRACT_ID, MONEY_CONTRACT_ID},
+    crypto::{ContractId, PublicKey, DAO_CONTRACT_ID, MONEY_CONTRACT_ID},
     dark_tree::DarkLeaf,
-    db::{db_del, db_get, db_lookup},
-    error::{ContractError, ContractResult},
+    error::ContractError,
     msg,
     pasta::pallas,
     ContractCall,
 };
-use darkfi_serial::{deserialize, serialize, Encodable, WriteExt};
+use darkfi_serial::{deserialize, Encodable, WriteExt};
 
 use crate::{
     error::DaoError,
-    model::{DaoAuthCall, DaoAuthMoneyTransferParams, DaoExecParams, VecAuthCallCommit},
-    DaoFunction, DAO_CONTRACT_DB_PROPOSAL_BULLAS, DAO_CONTRACT_ZKAS_DAO_AUTH_MONEY_TRANSFER_NS,
+    model::{DaoAuthCall, DaoExecParams, VecAuthCallCommit},
+    DaoFunction, DAO_CONTRACT_ZKAS_DAO_AUTH_MONEY_TRANSFER_NS,
 };
 
 /// `get_metdata` function for `Dao::Exec`
 pub(crate) fn dao_authxfer_get_metadata(
-    cid: ContractId,
+    _cid: ContractId,
     call_idx: u32,
     calls: Vec<DarkLeaf<ContractCall>>,
 ) -> Result<Vec<u8>, ContractError> {
@@ -97,7 +96,7 @@ fn find_auth_in_parent(
 
 /// `process_instruction` function for `Dao::Exec`
 pub(crate) fn dao_authxfer_process_instruction(
-    cid: ContractId,
+    _cid: ContractId,
     call_idx: u32,
     calls: Vec<DarkLeaf<ContractCall>>,
 ) -> Result<Vec<u8>, ContractError> {
@@ -146,8 +145,7 @@ pub(crate) fn dao_authxfer_process_instruction(
     let exec_callnode = &calls[parent_idx];
     let exec_params: DaoExecParams = deserialize(&exec_callnode.data.data[1..])?;
 
-    let mut auth_call =
-        find_auth_in_parent(&exec_callnode, exec_params.proposal_auth_calls, call_idx);
+    let auth_call = find_auth_in_parent(&exec_callnode, exec_params.proposal_auth_calls, call_idx);
     if auth_call.is_none() {
         return Err(DaoError::AuthXferCallNotFoundInParent.into())
     }

+ 2 - 3
src/contract/dao/src/entrypoint/exec.rs

@@ -16,9 +16,8 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-use darkfi_money_contract::{model::MoneyTransferParamsV1, MoneyFunction};
 use darkfi_sdk::{
-    crypto::{contract_id::MONEY_CONTRACT_ID, pasta_prelude::*, ContractId, PublicKey},
+    crypto::{pasta_prelude::*, ContractId, PublicKey},
     dark_tree::DarkLeaf,
     db::{db_del, db_get, db_lookup},
     error::{ContractError, ContractResult},
@@ -36,7 +35,7 @@ use crate::{
 
 /// `get_metdata` function for `Dao::Exec`
 pub(crate) fn dao_exec_get_metadata(
-    cid: ContractId,
+    _cid: ContractId,
     call_idx: u32,
     calls: Vec<DarkLeaf<ContractCall>>,
 ) -> Result<Vec<u8>, ContractError> {

+ 1 - 3
src/contract/dao/src/entrypoint/mod.rs

@@ -22,15 +22,13 @@ use darkfi_sdk::{
     crypto::{ContractId, MerkleTree},
     dark_tree::DarkLeaf,
     db::{db_get, db_init, db_lookup, db_set, zkas_db_set},
-    error::{ContractError, ContractResult},
-    msg,
+    error::ContractResult,
     util::set_return_data,
     ContractCall,
 };
 use darkfi_serial::{deserialize, serialize, Decodable, Encodable, WriteExt};
 
 use crate::{
-    error::DaoError,
     model::{DaoExecUpdate, DaoMintUpdate, DaoProposeUpdate, DaoVoteUpdate},
     DaoFunction, DAO_CONTRACT_DB_DAO_BULLAS, DAO_CONTRACT_DB_DAO_MERKLE_ROOTS,
     DAO_CONTRACT_DB_INFO_TREE, DAO_CONTRACT_DB_PROPOSAL_BULLAS, DAO_CONTRACT_DB_VOTE_NULLIFIERS,

+ 0 - 1
src/contract/dao/src/model.rs

@@ -17,7 +17,6 @@
  */
 
 use core::str::FromStr;
-use std::io::Read;
 
 use darkfi_sdk::{
     crypto::{

+ 1 - 4
src/contract/dao/tests/integration.rs

@@ -24,10 +24,7 @@ use darkfi_dao_contract::{
 };
 use darkfi_money_contract::model::CoinAttributes;
 use darkfi_sdk::{
-    crypto::{
-        pasta_prelude::Field, pedersen_commitment_u64, poseidon_hash, DAO_CONTRACT_ID,
-        DARK_TOKEN_ID,
-    },
+    crypto::{pasta_prelude::Field, pedersen_commitment_u64, DAO_CONTRACT_ID, DARK_TOKEN_ID},
     pasta::pallas,
 };
 use log::info;

+ 14 - 14
src/contract/deployooor/proof/derive_contract_id.zk

@@ -2,26 +2,26 @@ k = 13;
 field = "pallas";
 
 constant "DeriveContractID" {
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 witness "DeriveContractID" {
-	# Deploy key used for signing and contract ID derivation
-	Base deploy_key,
+    # Deploy key used for signing and contract ID derivation
+    Base deploy_key,
 }
 
 circuit "DeriveContractID" {
-	# ContractID derivation path (See darkfi_sdk::crypto::ContractId)
-	derivation_path = witness_base(42);
+    # ContractID derivation path (See darkfi_sdk::crypto::ContractId)
+    derivation_path = witness_base(42);
 
-	# Derive the public key used for the signature
-	signature_public = ec_mul_base(deploy_key, NULLIFIER_K);
-	signature_x = ec_get_x(signature_public);
-	signature_y = ec_get_y(signature_public);
-	constrain_instance(signature_x);
-	constrain_instance(signature_y);
+    # Derive the public key used for the signature
+    signature_public = ec_mul_base(deploy_key, NULLIFIER_K);
+    signature_x = ec_get_x(signature_public);
+    signature_y = ec_get_y(signature_public);
+    constrain_instance(signature_x);
+    constrain_instance(signature_y);
 
-	# Derive the Contract ID
-	contract_id = poseidon_hash(derivation_path, signature_x, signature_y);
-	constrain_instance(contract_id);
+    # Derive the Contract ID
+    contract_id = poseidon_hash(derivation_path, signature_x, signature_y);
+    constrain_instance(contract_id);
 }

+ 74 - 74
src/contract/money/proof/burn_v1.zk

@@ -4,95 +4,95 @@ field = "pallas";
 
 # The constants we define for our circuit
 constant "Burn_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 # The witness values we define for our circuit
 witness "Burn_V1" {
-	# The value of this coin
-	Base value,
-	# The token ID
-	Base token,
-	# Random blinding factor for value commitment
-	Scalar value_blind,
-	# Random blinding factor for the token ID
-	Base token_blind,
-	# Unique serial number corresponding to this coin
-	Base serial,
-	# Allows composing this ZK proof to invoke other contracts
-	Base spend_hook,
-	# Data passed from this coin to the invoked contract
-	Base user_data,
-	# Blinding factor for the encrypted user_data
-	Base user_data_blind,
-	# Secret key used to derive nullifier and coin's public key
-	Base secret,
-	# Leaf position of the coin in the Merkle tree of coins
-	Uint32 leaf_pos,
-	# Merkle path to the coin
-	MerklePath path,
-	# Secret key used to derive public key for the tx signature
-	Base signature_secret,
+    # The value of this coin
+    Base value,
+    # The token ID
+    Base token,
+    # Random blinding factor for value commitment
+    Scalar value_blind,
+    # Random blinding factor for the token ID
+    Base token_blind,
+    # Unique serial number corresponding to this coin
+    Base serial,
+    # Allows composing this ZK proof to invoke other contracts
+    Base spend_hook,
+    # Data passed from this coin to the invoked contract
+    Base user_data,
+    # Blinding factor for the encrypted user_data
+    Base user_data_blind,
+    # Secret key used to derive nullifier and coin's public key
+    Base secret,
+    # Leaf position of the coin in the Merkle tree of coins
+    Uint32 leaf_pos,
+    # Merkle path to the coin
+    MerklePath path,
+    # Secret key used to derive public key for the tx signature
+    Base signature_secret,
 }
 
 # The definition of our circuit
 circuit "Burn_V1" {
-	# Poseidon hash of the nullifier
-	nullifier = poseidon_hash(secret, serial);
-	constrain_instance(nullifier);
+    # Poseidon hash of the nullifier
+    nullifier = poseidon_hash(secret, serial);
+    constrain_instance(nullifier);
 
-	# Pedersen commitment for coin's value
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	# Since value_commit is a curve point, we fetch its coordinates
-	# and constrain them:
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
+    # Pedersen commitment for coin's value
+    vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    # Since value_commit is a curve point, we fetch its coordinates
+    # and constrain them:
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
 
-	# Commitment for coin's token ID. We do a poseidon hash since it's
-	# cheaper than EC operations and doesn't need the homomorphic prop.
-	token_commit = poseidon_hash(token, token_blind);
-	constrain_instance(token_commit);
+    # Commitment for coin's token ID. We do a poseidon hash since it's
+    # cheaper than EC operations and doesn't need the homomorphic prop.
+    token_commit = poseidon_hash(token, token_blind);
+    constrain_instance(token_commit);
 
-	# Derive the public key used in the coin from its secret counterpart
-	pub = ec_mul_base(secret, NULLIFIER_K);
-	# Coin hash
-	C = poseidon_hash(
-		ec_get_x(pub),
-		ec_get_y(pub),
-		value,
-		token,
-		serial,
-		spend_hook,
-		user_data,
-	);
+    # Derive the public key used in the coin from its secret counterpart
+    pub = ec_mul_base(secret, NULLIFIER_K);
+    # Coin hash
+    C = poseidon_hash(
+        ec_get_x(pub),
+        ec_get_y(pub),
+        value,
+        token,
+        serial,
+        spend_hook,
+        user_data,
+    );
 
-	# With this, we can actually produce a fake coin of value 0
-	# above and use it as a dummy input. The inclusion merkle tree
-	# has a 0x00 leaf at position 0, so zero_cond will output value
-	# iff value is 0 - which is equivalent to 0x00 so that's the
-	# trick we use to make the inclusion proof.
-	coin_incl = zero_cond(value, C);
+    # With this, we can actually produce a fake coin of value 0
+    # above and use it as a dummy input. The inclusion merkle tree
+    # has a 0x00 leaf at position 0, so zero_cond will output value
+    # iff value is 0 - which is equivalent to 0x00 so that's the
+    # trick we use to make the inclusion proof.
+    coin_incl = zero_cond(value, C);
 
-	# Merkle root
-	root = merkle_root(leaf_pos, path, coin_incl);
-	constrain_instance(root);
+    # Merkle root
+    root = merkle_root(leaf_pos, path, coin_incl);
+    constrain_instance(root);
 
-	# Export user_data
-	user_data_enc = poseidon_hash(user_data, user_data_blind);
-	constrain_instance(user_data_enc);
+    # Export user_data
+    user_data_enc = poseidon_hash(user_data, user_data_blind);
+    constrain_instance(user_data_enc);
 
-	# Reveal spend_hook
-	constrain_instance(spend_hook);
+    # Reveal spend_hook
+    constrain_instance(spend_hook);
 
-	# Finally, we derive a public key for the signature and
-	# constrain its coordinates:
-	signature_public = ec_mul_base(signature_secret, NULLIFIER_K);
-	constrain_instance(ec_get_x(signature_public));
-	constrain_instance(ec_get_y(signature_public));
+    # Finally, we derive a public key for the signature and
+    # constrain its coordinates:
+    signature_public = ec_mul_base(signature_secret, NULLIFIER_K);
+    constrain_instance(ec_get_x(signature_public));
+    constrain_instance(ec_get_y(signature_public));
 
-	# At this point we've enforced all of our public inputs.
+    # At this point we've enforced all of our public inputs.
 }

+ 45 - 45
src/contract/money/proof/mint_v1.zk

@@ -4,60 +4,60 @@ field = "pallas";
 
 # The constants we define for our circuit
 constant "Mint_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 # The witness values we define for our circuit
 witness "Mint_V1" {
-	# X coordinate for public key
-	Base pub_x,
-	# Y coordinate for public key
-	Base pub_y,
-	# The value of this coin
-	Base value,
-	# The token ID
-	Base token,
-	# Unique serial number corresponding to this coin
-	Base serial,
-	# Allows composing this ZK proof to invoke other contracts
-	Base spend_hook,
-	# Data passed from this coin to the invoked contract
-	Base user_data,
-	# Random blinding factor for the value commitment
-	Scalar value_blind,
-	# Random blinding factor for the token ID
-	Base token_blind,
+    # X coordinate for public key
+    Base pub_x,
+    # Y coordinate for public key
+    Base pub_y,
+    # The value of this coin
+    Base value,
+    # The token ID
+    Base token,
+    # Unique serial number corresponding to this coin
+    Base serial,
+    # Allows composing this ZK proof to invoke other contracts
+    Base spend_hook,
+    # Data passed from this coin to the invoked contract
+    Base user_data,
+    # Random blinding factor for the value commitment
+    Scalar value_blind,
+    # Random blinding factor for the token ID
+    Base token_blind,
 }
 
 # The definition of our circuit
 circuit "Mint_V1" {
-	# Poseidon hash of the coin
-	C = poseidon_hash(
-		pub_x,
-		pub_y,
-		value,
-		token,
-		serial,
-		spend_hook,
-		user_data,
-	);
-	constrain_instance(C);
+    # Poseidon hash of the coin
+    C = poseidon_hash(
+        pub_x,
+        pub_y,
+        value,
+        token,
+        serial,
+        spend_hook,
+        user_data,
+    );
+    constrain_instance(C);
 
-	# Pedersen commitment for coin's value
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	# Since the value commit is a curve point, we fetch its coordinates
-	# and constrain them:
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
+    # Pedersen commitment for coin's value
+    vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    # Since the value commit is a curve point, we fetch its coordinates
+    # and constrain them:
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
 
-	# Commitment for coin's token ID. We do a poseidon hash since it's
-	# cheaper than EC operations and doesn't need the homomorphic prop.
-	token_commit = poseidon_hash(token, token_blind);
-	constrain_instance(token_commit);
+    # Commitment for coin's token ID. We do a poseidon hash since it's
+    # cheaper than EC operations and doesn't need the homomorphic prop.
+    token_commit = poseidon_hash(token, token_blind);
+    constrain_instance(token_commit);
 
-	# At this point we've enforced all of our public inputs.
+    # At this point we've enforced all of our public inputs.
 }

+ 14 - 14
src/contract/money/proof/token_freeze_v1.zk

@@ -2,26 +2,26 @@ k = 13;
 field = "pallas";
 
 constant "TokenFreeze_V1" {
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 witness "TokenFreeze_V1" {
-	# Token mint authority secret
-	Base mint_authority,
+    # Token mint authority secret
+    Base mint_authority,
 }
 
 circuit "TokenFreeze_V1" {
-	# TokenID derivation path (See darkfi_sdk::crypto::ContractId)
-	derivation_path = witness_base(69);
+    # TokenID derivation path (See darkfi_sdk::crypto::ContractId)
+    derivation_path = witness_base(69);
 
-	# Derive public key for the mint authority
-	mint_public = ec_mul_base(mint_authority, NULLIFIER_K);
-	mint_x = ec_get_x(mint_public);
-	mint_y = ec_get_y(mint_public);
-	constrain_instance(mint_x);
-	constrain_instance(mint_y);
+    # Derive public key for the mint authority
+    mint_public = ec_mul_base(mint_authority, NULLIFIER_K);
+    mint_x = ec_get_x(mint_public);
+    mint_y = ec_get_y(mint_public);
+    constrain_instance(mint_x);
+    constrain_instance(mint_y);
 
-	# Derive the token ID
-	token_id = poseidon_hash(derivation_path, mint_x, mint_y);
-	constrain_instance(token_id);
+    # Derive the token ID
+    token_id = poseidon_hash(derivation_path, mint_x, mint_y);
+    constrain_instance(token_id);
 }

+ 52 - 52
src/contract/money/proof/token_mint_v1.zk

@@ -3,67 +3,67 @@ k = 13;
 field = "pallas";
 
 constant "TokenMint_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
+    EcFixedPointShort VALUE_COMMIT_VALUE,
+    EcFixedPoint VALUE_COMMIT_RANDOM,
+    EcFixedPointBase NULLIFIER_K,
 }
 
 witness "TokenMint_V1" {
-	# Token mint authority secret
-	Base mint_authority,
-	# Token supply
-	Base supply,
-	# Recipient's public key x coordinate
-	Base rcpt_x,
-	# Recipient's public key y coordinate
-	Base rcpt_y,
-	# Unique serial number for the minted coin
-	Base serial,
-	# Allows composing this ZK proof to invoke other contracts
-	Base spend_hook,
-	# Data passed from this coin to the invoked contract
-	Base user_data,
-	# Random blinding factor for the value commitment
-	Scalar value_blind,
-	# Random blinding factor for the token ID
-	Base token_blind,
+    # Token mint authority secret
+    Base mint_authority,
+    # Token supply
+    Base supply,
+    # Recipient's public key x coordinate
+    Base rcpt_x,
+    # Recipient's public key y coordinate
+    Base rcpt_y,
+    # Unique serial number for the minted coin
+    Base serial,
+    # Allows composing this ZK proof to invoke other contracts
+    Base spend_hook,
+    # Data passed from this coin to the invoked contract
+    Base user_data,
+    # Random blinding factor for the value commitment
+    Scalar value_blind,
+    # Random blinding factor for the token ID
+    Base token_blind,
 }
 
 circuit "TokenMint_V1" {
-	# TokenID derivation path (See darkfi_sdk::crypto::TokenId)
-	derivation_path = witness_base(69);
+    # TokenID derivation path (See darkfi_sdk::crypto::TokenId)
+    derivation_path = witness_base(69);
 
-	# Derive public key for the mint authority
-	mint_public = ec_mul_base(mint_authority, NULLIFIER_K);
-	mint_x = ec_get_x(mint_public);
-	mint_y = ec_get_y(mint_public);
-	constrain_instance(mint_x);
-	constrain_instance(mint_y);
+    # Derive public key for the mint authority
+    mint_public = ec_mul_base(mint_authority, NULLIFIER_K);
+    mint_x = ec_get_x(mint_public);
+    mint_y = ec_get_y(mint_public);
+    constrain_instance(mint_x);
+    constrain_instance(mint_y);
 
-	# Derive the token ID
-	token_id = poseidon_hash(derivation_path, mint_x, mint_y);
-	constrain_instance(token_id);
+    # Derive the token ID
+    token_id = poseidon_hash(derivation_path, mint_x, mint_y);
+    constrain_instance(token_id);
 
-	# Poseidon hash of the minted coin
-	C = poseidon_hash(
-		rcpt_x,
-		rcpt_y,
-		supply,
-		token_id,
-		serial,
-		spend_hook,
-		user_data,
-	);
-	constrain_instance(C);
+    # Poseidon hash of the minted coin
+    C = poseidon_hash(
+        rcpt_x,
+        rcpt_y,
+        supply,
+        token_id,
+        serial,
+        spend_hook,
+        user_data,
+    );
+    constrain_instance(C);
 
-	# Pedersen commitment for the coin's value
-	vcv = ec_mul_short(supply, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
+    # Pedersen commitment for the coin's value
+    vcv = ec_mul_short(supply, VALUE_COMMIT_VALUE);
+    vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
+    value_commit = ec_add(vcv, vcr);
+    constrain_instance(ec_get_x(value_commit));
+    constrain_instance(ec_get_y(value_commit));
 
-	# Commitment for the coin's token ID
-	token_commit = poseidon_hash(token_id, token_blind);
-	constrain_instance(token_commit);
+    # Commitment for the coin's token ID
+    token_commit = poseidon_hash(token_id, token_blind);
+    constrain_instance(token_commit);
 }

+ 2 - 5
src/contract/test-harness/src/dao_exec.rs

@@ -18,10 +18,7 @@
 
 use std::time::Instant;
 
-use darkfi::{
-    tx::{ContractCallLeaf, Transaction, TransactionBuilder},
-    Result,
-};
+use darkfi::{tx::Transaction, Result};
 use darkfi_dao_contract::{
     client::{DaoAuthMoneyTransferCall, DaoExecCall},
     model::{Dao, DaoBulla, DaoExecParams, DaoProposal},
@@ -79,7 +76,7 @@ impl TestHarness {
         // TODO: FIXME: This is not checked anywhere!
         let exec_signature_secret = SecretKey::random(&mut OsRng);
 
-        assert!(proposal_coinattrs.len() > 0);
+        assert!(!proposal_coinattrs.is_empty());
         let proposal_token_id = proposal_coinattrs[0].token_id;
         assert!(proposal_coinattrs.iter().all(|c| c.token_id == proposal_token_id));
         let proposal_amount = proposal_coinattrs.iter().map(|c| c.value).sum();

+ 1 - 3
src/contract/test-harness/src/dao_propose.rs

@@ -29,9 +29,7 @@ use darkfi_dao_contract::{
 };
 use darkfi_money_contract::{client::OwnCoin, model::CoinAttributes, MoneyFunction};
 use darkfi_sdk::{
-    crypto::{
-        pasta_prelude::Field, MerkleNode, SecretKey, TokenId, DAO_CONTRACT_ID, MONEY_CONTRACT_ID,
-    },
+    crypto::{pasta_prelude::Field, MerkleNode, SecretKey, DAO_CONTRACT_ID, MONEY_CONTRACT_ID},
     pasta::pallas,
     ContractCall,
 };

+ 2 - 2
src/contract/test-harness/src/vks.rs

@@ -49,8 +49,8 @@ use darkfi_serial::{deserialize, serialize};
 use log::debug;
 
 /// Update this if any circuits are changed
-const VKS_HASH: &str = "2f00493f2d0ef54ef9a581c5fb833dd3d2ca6099583658c281fcd974455969f0";
-const PKS_HASH: &str = "fa584cf5ddf2a6905ada0f461ba21d6e4611812872a043b9d061bc82c6923f4b";
+const VKS_HASH: &str = "da690bdbf157a3e30abc173c69b74400bb032daf0ce6c0cab4c567fe9f0b361e";
+const PKS_HASH: &str = "a1c446da1c4df1ef26ff3abc41fe010a90452d9063dbf87789a20cdb900b487a";
 
 fn pks_path(typ: &str) -> Result<PathBuf> {
     let output = Command::new("git").arg("rev-parse").arg("--show-toplevel").output()?.stdout;

+ 2 - 2
src/runtime/memory.rs

@@ -48,7 +48,7 @@ mod tests {
         let mut store = Store::default();
         let m = Memory::new(&mut store, MemoryType::new(1, None, false)).unwrap();
         let value: [u8; 3] = [3, 0, 1];
-        let view = m.view(&mut store);
+        let view = m.view(&store);
         let res = view.write_slice(&value, 0);
         assert!(res.is_ok());
         let ptr: WasmPtr<u8> = WasmPtr::new(0);
@@ -63,7 +63,7 @@ mod tests {
         let mut store = Store::default();
         let m = Memory::new(&mut store, MemoryType::new(1, None, false)).unwrap();
         let value: [u8; 3] = [3, 0, 1];
-        let view = m.view(&mut store);
+        let view = m.view(&store);
         let res = view.write_slice(&value, 0);
         assert!(res.is_ok());
         let ptr: WasmPtr<u8> = WasmPtr::new(0);

+ 1 - 1
src/sdk/src/tx.rs

@@ -39,7 +39,7 @@ impl std::fmt::Debug for ContractCall {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         write!(f, "ContractCall(id={:?}", self.contract_id.inner())?;
         let calldata = &self.data;
-        if calldata.len() > 0 {
+        if !calldata.is_empty() {
             write!(f, ", function_code={}", calldata[0])?;
         }
         write!(f, ")")

+ 9 - 9
src/tx/mod.rs

@@ -169,19 +169,19 @@ impl Transaction {
 // Avoid showing the proofs and sigs in the debug output since often they are very long.
 impl std::fmt::Debug for Transaction {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        write!(f, "Transaction {{\n")?;
+        writeln!(f, "Transaction {{")?;
         for (i, call) in self.calls.iter().enumerate() {
-            write!(f, "  Call {} {{\n", i)?;
-            write!(f, "    contract_id: {:?}\n", call.data.contract_id.inner())?;
+            writeln!(f, "  Call {} {{", i)?;
+            writeln!(f, "    contract_id: {:?}", call.data.contract_id.inner())?;
             let calldata = &call.data.data;
-            if calldata.len() > 0 {
-                write!(f, "    function_code: {}\n", calldata[0])?;
+            if !calldata.is_empty() {
+                writeln!(f, "    function_code: {}", calldata[0])?;
             }
-            write!(f, "    parent: {:?}\n", call.parent_index)?;
-            write!(f, "    children: {:?}\n", call.children_indexes)?;
-            write!(f, "  }},\n")?;
+            writeln!(f, "    parent: {:?}", call.parent_index)?;
+            writeln!(f, "    children: {:?}", call.children_indexes)?;
+            writeln!(f, "  }},")?;
         }
-        write!(f, "}}\n")
+        writeln!(f, "}}")
     }
 }