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()

View File

@@ -241,7 +241,7 @@ TEST(proofs, sqrt_fq2)
TEST(proofs, size_is_expected)
{
ZCProof p;
PHGRProof p;
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << p;
@@ -444,7 +444,7 @@ TEST(proofs, zksnark_serializes_properly)
auto vkprecomp = libsnark::r1cs_ppzksnark_verifier_process_vk(kp.vk);
for (size_t i = 0; i < 20; i++) {
auto badproof = ZCProof::random_invalid();
auto badproof = PHGRProof::random_invalid();
auto proof = badproof.to_libsnark_proof<libsnark::r1cs_ppzksnark_proof<curve_pp>>();
auto verifierEnabled = ProofVerifier::Strict();
@@ -496,12 +496,12 @@ TEST(proofs, zksnark_serializes_properly)
proof
));
ZCProof compressed_proof_0(proof);
PHGRProof compressed_proof_0(proof);
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << compressed_proof_0;
ZCProof compressed_proof_1;
PHGRProof compressed_proof_1;
ss >> compressed_proof_1;
ASSERT_TRUE(compressed_proof_0 == compressed_proof_1);

View File

@@ -31,7 +31,7 @@ TEST(Transaction, JSDescriptionRandomized) {
auto witness = merkleTree.witness();
// create JSDescription
uint256 pubKeyHash;
uint256 joinSplitPubKey;
std::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
libzcash::JSInput(witness, note, k),
libzcash::JSInput() // dummy input of zero value
@@ -46,7 +46,7 @@ TEST(Transaction, JSDescriptionRandomized) {
{
auto jsdesc = JSDescription::Randomized(
false,
*params, pubKeyHash, rt,
*params, joinSplitPubKey, rt,
inputs, outputs,
inputMap, outputMap,
0, 0, false);
@@ -63,7 +63,7 @@ TEST(Transaction, JSDescriptionRandomized) {
{
auto jsdesc = JSDescription::Randomized(
false,
*params, pubKeyHash, rt,
*params, joinSplitPubKey, rt,
inputs, outputs,
inputMap, outputMap,
0, 0, false, nullptr, GenZero);
@@ -77,7 +77,7 @@ TEST(Transaction, JSDescriptionRandomized) {
{
auto jsdesc = JSDescription::Randomized(
false,
*params, pubKeyHash, rt,
*params, joinSplitPubKey, rt,
inputs, outputs,
inputMap, outputMap,
0, 0, false, nullptr, GenMax);