Improve/Fix variable names

ZCProof was too general. pubKeyHash was actually the JoinSplit pubkey
itself.
This commit is contained in:
Ariel Gabizon
2018-06-09 20:27:07 -07:00
parent 847df81f09
commit e1a3461cc2
13 changed files with 82 additions and 81 deletions

View File

@@ -39,7 +39,7 @@ void test_full_api(ZCJoinSplit* js)
uint256 randomSeed;
uint64_t vpub_old = 10;
uint64_t vpub_new = 0;
uint256 pubKeyHash = random_uint256();
uint256 joinSplitPubKey = random_uint256();
std::array<uint256, 2> macs;
std::array<uint256, 2> nullifiers;
std::array<uint256, 2> commitments;
@@ -68,7 +68,7 @@ void test_full_api(ZCJoinSplit* js)
output_notes,
ciphertexts,
ephemeralKey,
pubKeyHash,
joinSplitPubKey,
randomSeed,
macs,
nullifiers,
@@ -79,13 +79,13 @@ void test_full_api(ZCJoinSplit* js)
);
}
auto sprout_proof = boost::get<ZCProof>(proof);
auto sprout_proof = boost::get<PHGRProof>(proof);
// Verify the transaction:
ASSERT_TRUE(js->verify(
sprout_proof,
verifier,
pubKeyHash,
joinSplitPubKey,
randomSeed,
macs,
nullifiers,
@@ -97,7 +97,7 @@ void test_full_api(ZCJoinSplit* js)
// Recipient should decrypt
// Now the recipient should spend the money again
auto h_sig = js->h_sig(randomSeed, nullifiers, pubKeyHash);
auto h_sig = js->h_sig(randomSeed, nullifiers, joinSplitPubKey);
ZCNoteDecryption decryptor(recipient_key.receiving_key());
auto note_pt = SproutNotePlaintext::decrypt(
@@ -120,7 +120,7 @@ void test_full_api(ZCJoinSplit* js)
vpub_old = 0;
vpub_new = 1;
rt = tree.root();
pubKeyHash = random_uint256();
joinSplitPubKey = random_uint256();
{
std::array<JSInput, 2> inputs = {
@@ -146,7 +146,7 @@ void test_full_api(ZCJoinSplit* js)
output_notes,
ciphertexts,
ephemeralKey,
pubKeyHash,
joinSplitPubKey,
randomSeed,
macs,
nullifiers,
@@ -157,13 +157,13 @@ void test_full_api(ZCJoinSplit* js)
);
}
sprout_proof = boost::get<ZCProof>(proof);
sprout_proof = boost::get<PHGRProof>(proof);
// Verify the transaction:
ASSERT_TRUE(js->verify(
sprout_proof,
verifier,
pubKeyHash,
joinSplitPubKey,
randomSeed,
macs,
nullifiers,
@@ -186,7 +186,7 @@ void invokeAPI(
) {
uint256 ephemeralKey;
uint256 randomSeed;
uint256 pubKeyHash = random_uint256();
uint256 joinSplitPubKey = random_uint256();
std::array<uint256, 2> macs;
std::array<uint256, 2> nullifiers;
std::array<uint256, 2> commitments;
@@ -201,7 +201,7 @@ void invokeAPI(
output_notes,
ciphertexts,
ephemeralKey,
pubKeyHash,
joinSplitPubKey,
randomSeed,
macs,
nullifiers,
@@ -241,9 +241,9 @@ TEST(joinsplit, h_sig)
import pyblake2
import binascii
def hSig(randomSeed, nf1, nf2, pubKeyHash):
def hSig(randomSeed, nf1, nf2, joinSplitPubKey):
return pyblake2.blake2b(
data=(randomSeed + nf1 + nf2 + pubKeyHash),
data=(randomSeed + nf1 + nf2 + joinSplitPubKey),
digest_size=32,
person=b"ZcashComputehSig"
).digest()