Просмотр исходного кода

contract/consensus: removed ZERO suffixes on poseidon hashes

aggstam 3 лет назад
Родитель
Сommit
7c186422c9

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

@@ -90,7 +90,7 @@ circuit "ConsensusProposal_V1" {
 	constrain_instance(ec_get_y(value_commit));
 
 	# Derive new coin serial from burnt one and constrain the pedersen commitment
-	new_serial = poseidon_hash(SERIAL_PREFIX, secret_key, serial, ZERO);
+	new_serial = poseidon_hash(SERIAL_PREFIX, secret_key, serial);
 	scv = ec_mul_base(new_serial, NULLIFIER_K);
 	scr = ec_mul(new_serial_blind, VALUE_COMMIT_RANDOM);
 	serial_commit = ec_add(scv, scr);
@@ -124,7 +124,7 @@ circuit "ConsensusProposal_V1" {
 	constrain_instance(new_coin);
 
 	# Coin y:
-	seed = poseidon_hash(SEED_PREFIX, serial, ZERO);
+	seed = poseidon_hash(SEED_PREFIX, serial);
 	y = poseidon_hash(seed, mu_y);
 	constrain_instance(mu_y);
 	constrain_instance(y);

+ 2 - 2
src/contract/consensus/src/client/proposal_v1_2.rs

@@ -260,7 +260,7 @@ pub fn create_proposal_proof(
 
     // New coin
     let new_serial =
-        poseidon_hash([SERIAL_PREFIX, input.secret.inner(), input.note.serial, PALLAS_ZERO]);
+        poseidon_hash([SERIAL_PREFIX, input.secret.inner(), input.note.serial]);
     let new_serial_blind = pallas::Scalar::random(&mut OsRng);
     let new_serial_commit = pedersen_commitment_base(new_serial, new_serial_blind);
     let new_value_commit = pedersen_commitment_u64(output.value, output.value_blind);
@@ -277,7 +277,7 @@ pub fn create_proposal_proof(
     ]));
 
     let slot_pallas = pallas::Base::from(slot_checkpoint.slot);
-    let seed = poseidon_hash([SEED_PREFIX, input.note.serial, PALLAS_ZERO]);
+    let seed = poseidon_hash([SEED_PREFIX, input.note.serial]);
     // NOTE: slot checkpoint eta to be renamed to previous_eta,
     //       corresponding to previous block eta.
     let mut vrf_input = [0u8; 64];

+ 0 - 2
src/contract/consensus/tests/genesis_stake_unstake.rs

@@ -146,8 +146,6 @@ async fn consensus_contract_genesis_stake_unstake() -> Result<()> {
     // Verify values match
     assert!((alice_staked_oc.note.value + REWARD) == alice_rewarded_staked_oc.note.value);
 
-    let alice_rewarded_staked_oc = alice_staked_oc;
-
     // Now Alice can unstake her owncoin
     info!(target: "consensus", "[Alice] ===================");
     info!(target: "consensus", "[Alice] Building unstake tx");