fix conflicts
This commit is contained in:
commit
ae0fb0b993
|
@ -3,7 +3,7 @@
|
||||||
#include "primitives/block.h"
|
#include "primitives/block.h"
|
||||||
|
|
||||||
|
|
||||||
TEST(block_tests, header_size_is_expected) {
|
TEST(BlockTests, HeaderSizeIsExpected) {
|
||||||
// Dummy header with an empty Equihash solution.
|
// Dummy header with an empty Equihash solution.
|
||||||
CBlockHeader header;
|
CBlockHeader header;
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
extern ZCJoinSplit* params;
|
extern ZCJoinSplit* params;
|
||||||
|
|
||||||
TEST(checktransaction_tests, check_vpub_not_both_nonzero) {
|
TEST(ChecktransactionTests, CheckVpubNotBothNonzero) {
|
||||||
CMutableTransaction tx;
|
CMutableTransaction tx;
|
||||||
tx.nVersion = 2;
|
tx.nVersion = 2;
|
||||||
|
|
||||||
|
@ -96,14 +96,14 @@ void CreateJoinSplitSignature(CMutableTransaction& mtx, uint32_t consensusBranch
|
||||||
) == 0);
|
) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, valid_transaction) {
|
TEST(ChecktransactionTests, ValidTransaction) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
CTransaction tx(mtx);
|
CTransaction tx(mtx);
|
||||||
MockCValidationState state;
|
MockCValidationState state;
|
||||||
EXPECT_TRUE(CheckTransactionWithoutProofVerification(tx, state));
|
EXPECT_TRUE(CheckTransactionWithoutProofVerification(tx, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, BadVersionTooLow) {
|
TEST(ChecktransactionTests, BadVersionTooLow) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.nVersion = 0;
|
mtx.nVersion = 0;
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ TEST(checktransaction_tests, BadVersionTooLow) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vin_empty) {
|
TEST(ChecktransactionTests, BadTxnsVinEmpty) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.vin.resize(0);
|
mtx.vin.resize(0);
|
||||||
|
@ -124,7 +124,7 @@ TEST(checktransaction_tests, bad_txns_vin_empty) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vout_empty) {
|
TEST(ChecktransactionTests, BadTxnsVoutEmpty) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.vout.resize(0);
|
mtx.vout.resize(0);
|
||||||
|
@ -136,7 +136,7 @@ TEST(checktransaction_tests, bad_txns_vout_empty) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, BadTxnsOversize) {
|
TEST(ChecktransactionTests, BadTxnsOversize) {
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
SelectParams(CBaseChainParams::REGTEST);
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ TEST(checktransaction_tests, BadTxnsOversize) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, OversizeSaplingTxns) {
|
TEST(ChecktransactionTests, OversizeSaplingTxns) {
|
||||||
RegtestActivateSapling();
|
RegtestActivateSapling();
|
||||||
|
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
|
@ -252,7 +252,7 @@ TEST(checktransaction_tests, OversizeSaplingTxns) {
|
||||||
RegtestDeactivateSapling();
|
RegtestDeactivateSapling();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vout_negative) {
|
TEST(ChecktransactionTests, BadTxnsVoutNegative) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vout[0].nValue = -1;
|
mtx.vout[0].nValue = -1;
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ TEST(checktransaction_tests, bad_txns_vout_negative) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vout_toolarge) {
|
TEST(ChecktransactionTests, BadTxnsVoutToolarge) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vout[0].nValue = MAX_MONEY + 1;
|
mtx.vout[0].nValue = MAX_MONEY + 1;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ TEST(checktransaction_tests, bad_txns_vout_toolarge) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_txouttotal_toolarge_outputs) {
|
TEST(ChecktransactionTests, BadTxnsTxouttotalToolargeOutputs) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vout[0].nValue = MAX_MONEY;
|
mtx.vout[0].nValue = MAX_MONEY;
|
||||||
mtx.vout[1].nValue = 1;
|
mtx.vout[1].nValue = 1;
|
||||||
|
@ -286,7 +286,7 @@ TEST(checktransaction_tests, bad_txns_txouttotal_toolarge_outputs) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, ValueBalanceNonZero) {
|
TEST(ChecktransactionTests, ValueBalanceNonZero) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.valueBalance = 10;
|
mtx.valueBalance = 10;
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ TEST(checktransaction_tests, ValueBalanceNonZero) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, PositiveValueBalanceTooLarge) {
|
TEST(ChecktransactionTests, PositiveValueBalanceTooLarge) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vShieldedSpend.resize(1);
|
mtx.vShieldedSpend.resize(1);
|
||||||
mtx.valueBalance = MAX_MONEY + 1;
|
mtx.valueBalance = MAX_MONEY + 1;
|
||||||
|
@ -309,7 +309,7 @@ TEST(checktransaction_tests, PositiveValueBalanceTooLarge) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, NegativeValueBalanceTooLarge) {
|
TEST(ChecktransactionTests, NegativeValueBalanceTooLarge) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vShieldedSpend.resize(1);
|
mtx.vShieldedSpend.resize(1);
|
||||||
mtx.valueBalance = -(MAX_MONEY + 1);
|
mtx.valueBalance = -(MAX_MONEY + 1);
|
||||||
|
@ -321,7 +321,7 @@ TEST(checktransaction_tests, NegativeValueBalanceTooLarge) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, ValueBalanceOverflowsTotal) {
|
TEST(ChecktransactionTests, ValueBalanceOverflowsTotal) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vShieldedSpend.resize(1);
|
mtx.vShieldedSpend.resize(1);
|
||||||
mtx.vout[0].nValue = 1;
|
mtx.vout[0].nValue = 1;
|
||||||
|
@ -334,7 +334,7 @@ TEST(checktransaction_tests, ValueBalanceOverflowsTotal) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_txouttotal_toolarge_joinsplit) {
|
TEST(ChecktransactionTests, BadTxnsTxouttotalToolargeJoinsplit) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vout[0].nValue = 1;
|
mtx.vout[0].nValue = 1;
|
||||||
mtx.vJoinSplit[0].vpub_old = MAX_MONEY;
|
mtx.vJoinSplit[0].vpub_old = MAX_MONEY;
|
||||||
|
@ -346,7 +346,7 @@ TEST(checktransaction_tests, bad_txns_txouttotal_toolarge_joinsplit) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_txintotal_toolarge_joinsplit) {
|
TEST(ChecktransactionTests, BadTxnsTxintotalToolargeJoinsplit) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].vpub_new = MAX_MONEY - 1;
|
mtx.vJoinSplit[0].vpub_new = MAX_MONEY - 1;
|
||||||
mtx.vJoinSplit[1].vpub_new = MAX_MONEY - 1;
|
mtx.vJoinSplit[1].vpub_new = MAX_MONEY - 1;
|
||||||
|
@ -358,7 +358,7 @@ TEST(checktransaction_tests, bad_txns_txintotal_toolarge_joinsplit) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vpub_old_negative) {
|
TEST(ChecktransactionTests, BadTxnsVpubOldNegative) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].vpub_old = -1;
|
mtx.vJoinSplit[0].vpub_old = -1;
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ TEST(checktransaction_tests, bad_txns_vpub_old_negative) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vpub_new_negative) {
|
TEST(ChecktransactionTests, BadTxnsVpubNewNegative) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].vpub_new = -1;
|
mtx.vJoinSplit[0].vpub_new = -1;
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ TEST(checktransaction_tests, bad_txns_vpub_new_negative) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vpub_old_toolarge) {
|
TEST(ChecktransactionTests, BadTxnsVpubOldToolarge) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].vpub_old = MAX_MONEY + 1;
|
mtx.vJoinSplit[0].vpub_old = MAX_MONEY + 1;
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ TEST(checktransaction_tests, bad_txns_vpub_old_toolarge) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vpub_new_toolarge) {
|
TEST(ChecktransactionTests, BadTxnsVpubNewToolarge) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].vpub_new = MAX_MONEY + 1;
|
mtx.vJoinSplit[0].vpub_new = MAX_MONEY + 1;
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ TEST(checktransaction_tests, bad_txns_vpub_new_toolarge) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_vpubs_both_nonzero) {
|
TEST(ChecktransactionTests, BadTxnsVpubsBothNonzero) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].vpub_old = 1;
|
mtx.vJoinSplit[0].vpub_old = 1;
|
||||||
mtx.vJoinSplit[0].vpub_new = 1;
|
mtx.vJoinSplit[0].vpub_new = 1;
|
||||||
|
@ -414,7 +414,7 @@ TEST(checktransaction_tests, bad_txns_vpubs_both_nonzero) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_inputs_duplicate) {
|
TEST(ChecktransactionTests, BadTxnsInputsDuplicate) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vin[1].prevout.hash = mtx.vin[0].prevout.hash;
|
mtx.vin[1].prevout.hash = mtx.vin[0].prevout.hash;
|
||||||
mtx.vin[1].prevout.n = mtx.vin[0].prevout.n;
|
mtx.vin[1].prevout.n = mtx.vin[0].prevout.n;
|
||||||
|
@ -426,7 +426,7 @@ TEST(checktransaction_tests, bad_txns_inputs_duplicate) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_joinsplits_nullifiers_duplicate_same_joinsplit) {
|
TEST(ChecktransactionTests, BadJoinsplitsNullifiersDuplicateSameJoinsplit) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
mtx.vJoinSplit[0].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
||||||
mtx.vJoinSplit[0].nullifiers.at(1) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
mtx.vJoinSplit[0].nullifiers.at(1) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
||||||
|
@ -438,7 +438,7 @@ TEST(checktransaction_tests, bad_joinsplits_nullifiers_duplicate_same_joinsplit)
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_joinsplits_nullifiers_duplicate_different_joinsplit) {
|
TEST(ChecktransactionTests, BadJoinsplitsNullifiersDuplicateDifferentJoinsplit) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit[0].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
mtx.vJoinSplit[0].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
||||||
mtx.vJoinSplit[1].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
mtx.vJoinSplit[1].nullifiers.at(0) = uint256S("0000000000000000000000000000000000000000000000000000000000000000");
|
||||||
|
@ -450,7 +450,7 @@ TEST(checktransaction_tests, bad_joinsplits_nullifiers_duplicate_different_joins
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_cb_has_joinsplits) {
|
TEST(ChecktransactionTests, BadCbHasJoinsplits) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
// Make it a coinbase.
|
// Make it a coinbase.
|
||||||
mtx.vin.resize(1);
|
mtx.vin.resize(1);
|
||||||
|
@ -466,7 +466,7 @@ TEST(checktransaction_tests, bad_cb_has_joinsplits) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_cb_empty_scriptsig) {
|
TEST(ChecktransactionTests, BadCbEmptyScriptsig) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
// Make it a coinbase.
|
// Make it a coinbase.
|
||||||
mtx.vin.resize(1);
|
mtx.vin.resize(1);
|
||||||
|
@ -482,7 +482,7 @@ TEST(checktransaction_tests, bad_cb_empty_scriptsig) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_prevout_null) {
|
TEST(ChecktransactionTests, BadTxnsPrevoutNull) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vin[1].prevout.SetNull();
|
mtx.vin[1].prevout.SetNull();
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ TEST(checktransaction_tests, bad_txns_prevout_null) {
|
||||||
CheckTransactionWithoutProofVerification(tx, state);
|
CheckTransactionWithoutProofVerification(tx, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, bad_txns_invalid_joinsplit_signature) {
|
TEST(ChecktransactionTests, BadTxnsInvalidJoinsplitSignature) {
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
SelectParams(CBaseChainParams::REGTEST);
|
||||||
auto chainparams = Params();
|
auto chainparams = Params();
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ TEST(checktransaction_tests, bad_txns_invalid_joinsplit_signature) {
|
||||||
ContextualCheckTransaction(tx, state, chainparams, 0, 100, [](const CChainParams&) { return false; });
|
ContextualCheckTransaction(tx, state, chainparams, 0, 100, [](const CChainParams&) { return false; });
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, non_canonical_ed25519_signature) {
|
TEST(ChecktransactionTests, NonCanonicalEd25519Signature) {
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
SelectParams(CBaseChainParams::REGTEST);
|
||||||
auto chainparams = Params();
|
auto chainparams = Params();
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ TEST(checktransaction_tests, non_canonical_ed25519_signature) {
|
||||||
ContextualCheckTransaction(tx, state, chainparams, 0, 100, [](const CChainParams&) { return false; });
|
ContextualCheckTransaction(tx, state, chainparams, 0, 100, [](const CChainParams&) { return false; });
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, OverwinterConstructors) {
|
TEST(ChecktransactionTests, OverwinterConstructors) {
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
mtx.nVersion = OVERWINTER_TX_VERSION;
|
mtx.nVersion = OVERWINTER_TX_VERSION;
|
||||||
|
@ -578,7 +578,7 @@ TEST(checktransaction_tests, OverwinterConstructors) {
|
||||||
EXPECT_TRUE(tx2 == tx);
|
EXPECT_TRUE(tx2 == tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, OverwinterSerialization) {
|
TEST(ChecktransactionTests, OverwinterSerialization) {
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
mtx.nVersion = OVERWINTER_TX_VERSION;
|
mtx.nVersion = OVERWINTER_TX_VERSION;
|
||||||
|
@ -631,7 +631,7 @@ TEST(checktransaction_tests, OverwinterSerialization) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, OverwinterDefaultValues) {
|
TEST(ChecktransactionTests, OverwinterDefaultValues) {
|
||||||
// Check default values (this will fail when defaults change; test should then be updated)
|
// Check default values (this will fail when defaults change; test should then be updated)
|
||||||
CTransaction tx;
|
CTransaction tx;
|
||||||
EXPECT_EQ(tx.nVersion, 1);
|
EXPECT_EQ(tx.nVersion, 1);
|
||||||
|
@ -641,7 +641,7 @@ TEST(checktransaction_tests, OverwinterDefaultValues) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// A valid v3 transaction with no joinsplits
|
// A valid v3 transaction with no joinsplits
|
||||||
TEST(checktransaction_tests, OverwinterValidTx) {
|
TEST(ChecktransactionTests, OverwinterValidTx) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
|
@ -653,7 +653,7 @@ TEST(checktransaction_tests, OverwinterValidTx) {
|
||||||
EXPECT_TRUE(CheckTransactionWithoutProofVerification(tx, state));
|
EXPECT_TRUE(CheckTransactionWithoutProofVerification(tx, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(checktransaction_tests, OverwinterExpiryHeight) {
|
TEST(ChecktransactionTests, OverwinterExpiryHeight) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
|
@ -702,7 +702,7 @@ TEST(checktransaction_tests, BlossomExpiryHeight) {
|
||||||
|
|
||||||
// Test that a Sprout tx with a negative version number is detected
|
// Test that a Sprout tx with a negative version number is detected
|
||||||
// given the new Overwinter logic
|
// given the new Overwinter logic
|
||||||
TEST(checktransaction_tests, SproutTxVersionTooLow) {
|
TEST(ChecktransactionTests, SproutTxVersionTooLow) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.fOverwintered = false;
|
mtx.fOverwintered = false;
|
||||||
|
@ -724,7 +724,7 @@ class UNSAFE_CTransaction : public CTransaction {
|
||||||
UNSAFE_CTransaction(const CMutableTransaction &tx) : CTransaction(tx, true) {}
|
UNSAFE_CTransaction(const CMutableTransaction &tx) : CTransaction(tx, true) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(checktransaction_tests, SaplingSproutInputSumsTooLarge) {
|
TEST(ChecktransactionTests, SaplingSproutInputSumsTooLarge) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
|
@ -777,7 +777,7 @@ TEST(checktransaction_tests, SaplingSproutInputSumsTooLarge) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test bad Overwinter version number in CheckTransactionWithoutProofVerification
|
// Test bad Overwinter version number in CheckTransactionWithoutProofVerification
|
||||||
TEST(checktransaction_tests, OverwinterVersionNumberLow) {
|
TEST(ChecktransactionTests, OverwinterVersionNumberLow) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
|
@ -792,7 +792,7 @@ TEST(checktransaction_tests, OverwinterVersionNumberLow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test bad Overwinter version number in ContextualCheckTransaction
|
// Test bad Overwinter version number in ContextualCheckTransaction
|
||||||
TEST(checktransaction_tests, OverwinterVersionNumberHigh) {
|
TEST(ChecktransactionTests, OverwinterVersionNumberHigh) {
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
SelectParams(CBaseChainParams::REGTEST);
|
||||||
UpdateNetworkUpgradeParameters(Consensus::UPGRADE_OVERWINTER, Consensus::NetworkUpgrade::ALWAYS_ACTIVE);
|
UpdateNetworkUpgradeParameters(Consensus::UPGRADE_OVERWINTER, Consensus::NetworkUpgrade::ALWAYS_ACTIVE);
|
||||||
|
|
||||||
|
@ -814,7 +814,7 @@ TEST(checktransaction_tests, OverwinterVersionNumberHigh) {
|
||||||
|
|
||||||
|
|
||||||
// Test bad Overwinter version group id
|
// Test bad Overwinter version group id
|
||||||
TEST(checktransaction_tests, OverwinterBadVersionGroupId) {
|
TEST(ChecktransactionTests, OverwinterBadVersionGroupId) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.vJoinSplit.resize(0);
|
mtx.vJoinSplit.resize(0);
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
|
@ -829,7 +829,7 @@ TEST(checktransaction_tests, OverwinterBadVersionGroupId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This tests an Overwinter transaction checked against Sprout
|
// This tests an Overwinter transaction checked against Sprout
|
||||||
TEST(checktransaction_tests, OverwinterNotActive) {
|
TEST(ChecktransactionTests, OverwinterNotActive) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
auto chainparams = Params();
|
auto chainparams = Params();
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ TEST(checktransaction_tests, OverwinterNotActive) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This tests a transaction without the fOverwintered flag set, against the Overwinter consensus rule set.
|
// This tests a transaction without the fOverwintered flag set, against the Overwinter consensus rule set.
|
||||||
TEST(checktransaction_tests, OverwinterFlagNotSet) {
|
TEST(ChecktransactionTests, OverwinterFlagNotSet) {
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
SelectParams(CBaseChainParams::REGTEST);
|
||||||
UpdateNetworkUpgradeParameters(Consensus::UPGRADE_OVERWINTER, Consensus::NetworkUpgrade::ALWAYS_ACTIVE);
|
UpdateNetworkUpgradeParameters(Consensus::UPGRADE_OVERWINTER, Consensus::NetworkUpgrade::ALWAYS_ACTIVE);
|
||||||
|
|
||||||
|
@ -870,7 +870,7 @@ TEST(checktransaction_tests, OverwinterFlagNotSet) {
|
||||||
|
|
||||||
|
|
||||||
// Overwinter (NU0) does not allow soft fork to version 4 Overwintered tx.
|
// Overwinter (NU0) does not allow soft fork to version 4 Overwintered tx.
|
||||||
TEST(checktransaction_tests, OverwinterInvalidSoftForkVersion) {
|
TEST(ChecktransactionTests, OverwinterInvalidSoftForkVersion) {
|
||||||
CMutableTransaction mtx = GetValidTransaction();
|
CMutableTransaction mtx = GetValidTransaction();
|
||||||
mtx.fOverwintered = true;
|
mtx.fOverwintered = true;
|
||||||
mtx.nVersion = 4; // This is not allowed
|
mtx.nVersion = 4; // This is not allowed
|
||||||
|
@ -902,7 +902,7 @@ static void ContextualCreateTxCheck(const Consensus::Params& params, int nHeight
|
||||||
|
|
||||||
|
|
||||||
// Test CreateNewContextualCMutableTransaction sets default values based on height
|
// Test CreateNewContextualCMutableTransaction sets default values based on height
|
||||||
TEST(checktransaction_tests, OverwinteredContextualCreateTx) {
|
TEST(ChecktransactionTests, OverwinteredContextualCreateTx) {
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
SelectParams(CBaseChainParams::REGTEST);
|
||||||
const Consensus::Params& params = Params().GetConsensus();
|
const Consensus::Params& params = Params().GetConsensus();
|
||||||
int overwinterActivationHeight = 5;
|
int overwinterActivationHeight = 5;
|
||||||
|
@ -946,7 +946,7 @@ TEST(checktransaction_tests, OverwinteredContextualCreateTx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test a v1 transaction which has a malformed header, perhaps modified in-flight
|
// Test a v1 transaction which has a malformed header, perhaps modified in-flight
|
||||||
TEST(checktransaction_tests, BadTxReceivedOverNetwork)
|
TEST(ChecktransactionTests, BadTxReceivedOverNetwork)
|
||||||
{
|
{
|
||||||
// First four bytes <01 00 00 00> have been modified to be <FC FF FF FF> (-4 as an int32)
|
// First four bytes <01 00 00 00> have been modified to be <FC FF FF FF> (-4 as an int32)
|
||||||
std::string goodPrefix = "01000000";
|
std::string goodPrefix = "01000000";
|
||||||
|
|
|
@ -25,7 +25,7 @@ void TestExpandAndCompress(const std::string &scope, size_t bit_len, size_t byte
|
||||||
EXPECT_EQ(compact, out);
|
EXPECT_EQ(compact, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(equihash_tests, expand_and_contract_arrays) {
|
TEST(EquihashTests, ExpandAndContractArrays) {
|
||||||
TestExpandAndCompress("8 11-bit chunks, all-ones", 11, 0,
|
TestExpandAndCompress("8 11-bit chunks, all-ones", 11, 0,
|
||||||
ParseHex("ffffffffffffffffffffff"),
|
ParseHex("ffffffffffffffffffffff"),
|
||||||
ParseHex("07ff07ff07ff07ff07ff07ff07ff07ff"));
|
ParseHex("07ff07ff07ff07ff07ff07ff07ff07ff"));
|
||||||
|
@ -54,7 +54,7 @@ void TestMinimalSolnRepr(const std::string &scope, size_t cBitLen,
|
||||||
EXPECT_EQ(minimal, GetMinimalFromIndices(indices, cBitLen));
|
EXPECT_EQ(minimal, GetMinimalFromIndices(indices, cBitLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(equihash_tests, minimal_solution_representation) {
|
TEST(EquihashTests, MinimalSolutionRepresentation) {
|
||||||
TestMinimalSolnRepr("Test 1", 20,
|
TestMinimalSolnRepr("Test 1", 20,
|
||||||
{1, 1, 1, 1, 1, 1, 1, 1},
|
{1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
ParseHex("000008000040000200001000008000040000200001"));
|
ParseHex("000008000040000200001000008000040000200001"));
|
||||||
|
@ -70,7 +70,7 @@ TEST(equihash_tests, minimal_solution_representation) {
|
||||||
ParseHex("000220000a7ffffe004d10014c800ffc00002fffff"));
|
ParseHex("000220000a7ffffe004d10014c800ffc00002fffff"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(equihash_tests, is_probably_duplicate) {
|
TEST(EquihashTests, IsProbablyDuplicate) {
|
||||||
std::shared_ptr<eh_trunc> p1 (new eh_trunc[4] {0, 1, 2, 3}, std::default_delete<eh_trunc[]>());
|
std::shared_ptr<eh_trunc> p1 (new eh_trunc[4] {0, 1, 2, 3}, std::default_delete<eh_trunc[]>());
|
||||||
std::shared_ptr<eh_trunc> p2 (new eh_trunc[4] {0, 1, 1, 3}, std::default_delete<eh_trunc[]>());
|
std::shared_ptr<eh_trunc> p2 (new eh_trunc[4] {0, 1, 1, 3}, std::default_delete<eh_trunc[]>());
|
||||||
std::shared_ptr<eh_trunc> p3 (new eh_trunc[4] {3, 1, 1, 3}, std::default_delete<eh_trunc[]>());
|
std::shared_ptr<eh_trunc> p3 (new eh_trunc[4] {3, 1, 1, 3}, std::default_delete<eh_trunc[]>());
|
||||||
|
@ -81,7 +81,7 @@ TEST(equihash_tests, is_probably_duplicate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MINING
|
#ifdef ENABLE_MINING
|
||||||
TEST(equihash_tests, check_basic_solver_cancelled) {
|
TEST(EquihashTests, CheckBasicSolverCancelled) {
|
||||||
Equihash<48,5> Eh48_5;
|
Equihash<48,5> Eh48_5;
|
||||||
crypto_generichash_blake2b_state state;
|
crypto_generichash_blake2b_state state;
|
||||||
Eh48_5.InitialiseState(state);
|
Eh48_5.InitialiseState(state);
|
||||||
|
@ -185,7 +185,7 @@ TEST(equihash_tests, check_basic_solver_cancelled) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(equihash_tests, check_optimised_solver_cancelled) {
|
TEST(EquihashTests, CheckOptimisedSolverCancelled) {
|
||||||
Equihash<48,5> Eh48_5;
|
Equihash<48,5> Eh48_5;
|
||||||
crypto_generichash_blake2b_state state;
|
crypto_generichash_blake2b_state state;
|
||||||
Eh48_5.InitialiseState(state);
|
Eh48_5.InitialiseState(state);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "utiltest.h"
|
#include "utiltest.h"
|
||||||
|
|
||||||
// To run tests:
|
// To run tests:
|
||||||
// ./zcash-gtest --gtest_filter="founders_reward_test.*"
|
// ./zcash-gtest --gtest_filter="FoundersRewardTest.*"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enable this test to generate and print 48 testnet 2-of-3 multisig addresses.
|
// Enable this test to generate and print 48 testnet 2-of-3 multisig addresses.
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
// The temporary wallet file can be renamed as wallet.dat and used for testing with zcashd.
|
// The temporary wallet file can be renamed as wallet.dat and used for testing with zcashd.
|
||||||
//
|
//
|
||||||
#if 0
|
#if 0
|
||||||
TEST(founders_reward_test, create_testnet_2of3multisig) {
|
TEST(FoundersRewardTest, create_testnet_2of3multisig) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
boost::filesystem::path pathTemp = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
boost::filesystem::path pathTemp = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
||||||
boost::filesystem::create_directories(pathTemp);
|
boost::filesystem::create_directories(pathTemp);
|
||||||
|
@ -100,7 +100,7 @@ void checkNumberOfUniqueAddresses(int nUnique) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(founders_reward_test, general) {
|
TEST(FoundersRewardTest, General) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
|
|
||||||
CChainParams params = Params();
|
CChainParams params = Params();
|
||||||
|
@ -144,7 +144,7 @@ TEST(founders_reward_test, mainnet_get_last_block) {
|
||||||
|
|
||||||
#define NUM_MAINNET_FOUNDER_ADDRESSES 48
|
#define NUM_MAINNET_FOUNDER_ADDRESSES 48
|
||||||
|
|
||||||
TEST(founders_reward_test, mainnet) {
|
TEST(FoundersRewardTest, Mainnet) {
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
checkNumberOfUniqueAddresses(NUM_MAINNET_FOUNDER_ADDRESSES);
|
checkNumberOfUniqueAddresses(NUM_MAINNET_FOUNDER_ADDRESSES);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ TEST(founders_reward_test, mainnet) {
|
||||||
|
|
||||||
#define NUM_TESTNET_FOUNDER_ADDRESSES 48
|
#define NUM_TESTNET_FOUNDER_ADDRESSES 48
|
||||||
|
|
||||||
TEST(founders_reward_test, testnet) {
|
TEST(FoundersRewardTest, Testnet) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
checkNumberOfUniqueAddresses(NUM_TESTNET_FOUNDER_ADDRESSES);
|
checkNumberOfUniqueAddresses(NUM_TESTNET_FOUNDER_ADDRESSES);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ TEST(founders_reward_test, testnet) {
|
||||||
|
|
||||||
#define NUM_REGTEST_FOUNDER_ADDRESSES 1
|
#define NUM_REGTEST_FOUNDER_ADDRESSES 1
|
||||||
|
|
||||||
TEST(founders_reward_test, regtest) {
|
TEST(FoundersRewardTest, Regtest) {
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
SelectParams(CBaseChainParams::REGTEST);
|
||||||
checkNumberOfUniqueAddresses(NUM_REGTEST_FOUNDER_ADDRESSES);
|
checkNumberOfUniqueAddresses(NUM_REGTEST_FOUNDER_ADDRESSES);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ TEST(founders_reward_test, regtest) {
|
||||||
|
|
||||||
// Test that 10% founders reward is fully rewarded after the first halving and slow start shift.
|
// Test that 10% founders reward is fully rewarded after the first halving and slow start shift.
|
||||||
// On Mainnet, this would be 2,100,000 ZEC after 850,000 blocks (840,000 + 10,000).
|
// On Mainnet, this would be 2,100,000 ZEC after 850,000 blocks (840,000 + 10,000).
|
||||||
TEST(founders_reward_test, slow_start_subsidy) {
|
TEST(FoundersRewardTest, SlowStartSubsidy) {
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
CChainParams params = Params();
|
CChainParams params = Params();
|
||||||
|
|
||||||
|
@ -206,13 +206,13 @@ void verifyNumberOfRewards() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the number of rewards going to each mainnet address
|
// Verify the number of rewards going to each mainnet address
|
||||||
TEST(founders_reward_test, per_address_reward_mainnet) {
|
TEST(FoundersRewardTest, PerAddressRewardMainnet) {
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
verifyNumberOfRewards();
|
verifyNumberOfRewards();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the number of rewards going to each testnet address
|
// Verify the number of rewards going to each testnet address
|
||||||
TEST(founders_reward_test, per_address_reward_testnet) {
|
TEST(FoundersRewardTest, PerAddressRewardTestnet) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
verifyNumberOfRewards();
|
verifyNumberOfRewards();
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ void invokeAPIFailure(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(joinsplit, h_sig)
|
TEST(Joinsplit, HSig)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// by Taylor Hornby
|
// by Taylor Hornby
|
||||||
|
@ -307,7 +307,7 @@ void increment_note_witnesses(
|
||||||
witnesses.push_back(tree.witness());
|
witnesses.push_back(tree.witness());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(joinsplit, full_api_test)
|
TEST(Joinsplit, FullApiTest)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::vector<SproutWitness> witnesses;
|
std::vector<SproutWitness> witnesses;
|
||||||
|
@ -509,7 +509,7 @@ TEST(joinsplit, full_api_test)
|
||||||
test_full_api(params);
|
test_full_api(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(joinsplit, note_plaintexts)
|
TEST(Joinsplit, NotePlaintexts)
|
||||||
{
|
{
|
||||||
uint252 a_sk = uint252(uint256S("f6da8716682d600f74fc16bd0187faad6a26b4aa4c24d5c055b216d94516840e"));
|
uint252 a_sk = uint252(uint256S("f6da8716682d600f74fc16bd0187faad6a26b4aa4c24d5c055b216d94516840e"));
|
||||||
uint256 a_pk = PRF_addr_a_pk(a_sk);
|
uint256 a_pk = PRF_addr_a_pk(a_sk);
|
||||||
|
@ -562,7 +562,7 @@ TEST(joinsplit, note_plaintexts)
|
||||||
ASSERT_EQ(note_pt.r, note_pt2.r);
|
ASSERT_EQ(note_pt.r, note_pt2.r);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(joinsplit, note_class)
|
TEST(Joinsplit, NoteClass)
|
||||||
{
|
{
|
||||||
uint252 a_sk = uint252(uint256S("f6da8716682d600f74fc16bd0187faad6a26b4aa4c24d5c055b216d94516840e"));
|
uint252 a_sk = uint252(uint256S("f6da8716682d600f74fc16bd0187faad6a26b4aa4c24d5c055b216d94516840e"));
|
||||||
uint256 a_pk = PRF_addr_a_pk(a_sk);
|
uint256 a_pk = PRF_addr_a_pk(a_sk);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#define MAKE_STRING(x) std::string((x), (x)+sizeof(x))
|
#define MAKE_STRING(x) std::string((x), (x)+sizeof(x))
|
||||||
|
|
||||||
TEST(keystore_tests, StoreAndRetrieveHDSeed) {
|
TEST(KeystoreTests, StoreAndRetrieveHDSeed) {
|
||||||
CBasicKeyStore keyStore;
|
CBasicKeyStore keyStore;
|
||||||
HDSeed seedOut;
|
HDSeed seedOut;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ TEST(keystore_tests, StoreAndRetrieveHDSeed) {
|
||||||
EXPECT_EQ(seed, seedOut);
|
EXPECT_EQ(seed, seedOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(keystore_tests, sapling_keys) {
|
TEST(KeystoreTests, SaplingKeys) {
|
||||||
// ["sk, ask, nsk, ovk, ak, nk, ivk, default_d, default_pk_d, note_v, note_r, note_cm, note_pos, note_nf"],
|
// ["sk, ask, nsk, ovk, ak, nk, ivk, default_d, default_pk_d, note_v, note_r, note_cm, note_pos, note_nf"],
|
||||||
UniValue sapling_keys = read_json(MAKE_STRING(json_tests::sapling_key_components));
|
UniValue sapling_keys = read_json(MAKE_STRING(json_tests::sapling_key_components));
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ TEST(keystore_tests, sapling_keys) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(keystore_tests, store_and_retrieve_spending_key) {
|
TEST(KeystoreTests, StoreAndRetrieveSpendingKey) {
|
||||||
CBasicKeyStore keyStore;
|
CBasicKeyStore keyStore;
|
||||||
libzcash::SproutSpendingKey skOut;
|
libzcash::SproutSpendingKey skOut;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ TEST(keystore_tests, store_and_retrieve_spending_key) {
|
||||||
EXPECT_EQ(1, addrs.count(addr));
|
EXPECT_EQ(1, addrs.count(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(keystore_tests, store_and_retrieve_note_decryptor) {
|
TEST(KeystoreTests, StoreAndRetrieveNoteDecryptor) {
|
||||||
CBasicKeyStore keyStore;
|
CBasicKeyStore keyStore;
|
||||||
ZCNoteDecryption decOut;
|
ZCNoteDecryption decOut;
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ TEST(keystore_tests, store_and_retrieve_note_decryptor) {
|
||||||
EXPECT_EQ(ZCNoteDecryption(sk.receiving_key()), decOut);
|
EXPECT_EQ(ZCNoteDecryption(sk.receiving_key()), decOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(keystore_tests, StoreAndRetrieveViewingKey) {
|
TEST(KeystoreTests, StoreAndRetrieveViewingKey) {
|
||||||
CBasicKeyStore keyStore;
|
CBasicKeyStore keyStore;
|
||||||
libzcash::SproutViewingKey vkOut;
|
libzcash::SproutViewingKey vkOut;
|
||||||
libzcash::SproutSpendingKey skOut;
|
libzcash::SproutSpendingKey skOut;
|
||||||
|
@ -193,7 +193,7 @@ TEST(keystore_tests, StoreAndRetrieveViewingKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sapling
|
// Sapling
|
||||||
TEST(keystore_tests, StoreAndRetrieveSaplingSpendingKey) {
|
TEST(KeystoreTests, StoreAndRetrieveSaplingSpendingKey) {
|
||||||
CBasicKeyStore keyStore;
|
CBasicKeyStore keyStore;
|
||||||
libzcash::SaplingExtendedSpendingKey skOut;
|
libzcash::SaplingExtendedSpendingKey skOut;
|
||||||
libzcash::SaplingFullViewingKey fvkOut;
|
libzcash::SaplingFullViewingKey fvkOut;
|
||||||
|
@ -235,7 +235,7 @@ public:
|
||||||
bool Unlock(const CKeyingMaterial& vMasterKeyIn) { return CCryptoKeyStore::Unlock(vMasterKeyIn); }
|
bool Unlock(const CKeyingMaterial& vMasterKeyIn) { return CCryptoKeyStore::Unlock(vMasterKeyIn); }
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(keystore_tests, StoreAndRetrieveHDSeedInEncryptedStore) {
|
TEST(KeystoreTests, StoreAndRetrieveHDSeedInEncryptedStore) {
|
||||||
TestCCryptoKeyStore keyStore;
|
TestCCryptoKeyStore keyStore;
|
||||||
CKeyingMaterial vMasterKey(32, 0);
|
CKeyingMaterial vMasterKey(32, 0);
|
||||||
GetRandBytes(vMasterKey.data(), 32);
|
GetRandBytes(vMasterKey.data(), 32);
|
||||||
|
@ -295,7 +295,7 @@ TEST(keystore_tests, StoreAndRetrieveHDSeedInEncryptedStore) {
|
||||||
EXPECT_EQ(seed3, seedOut);
|
EXPECT_EQ(seed3, seedOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(keystore_tests, store_and_retrieve_spending_key_in_encrypted_store) {
|
TEST(KeystoreTests, StoreAndRetrieveSpendingKeyInEncryptedStore) {
|
||||||
TestCCryptoKeyStore keyStore;
|
TestCCryptoKeyStore keyStore;
|
||||||
uint256 r {GetRandHash()};
|
uint256 r {GetRandHash()};
|
||||||
CKeyingMaterial vMasterKey (r.begin(), r.end());
|
CKeyingMaterial vMasterKey (r.begin(), r.end());
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "zcash/util.h"
|
#include "zcash/util.h"
|
||||||
|
|
||||||
TEST(libzcash_utils, convertBytesVectorToVector)
|
TEST(LibzcashUtils, ConvertBytesVectorToVector)
|
||||||
{
|
{
|
||||||
std::vector<unsigned char> bytes = {0x00, 0x01, 0x03, 0x12, 0xFF};
|
std::vector<unsigned char> bytes = {0x00, 0x01, 0x03, 0x12, 0xFF};
|
||||||
std::vector<bool> expected_bits = {
|
std::vector<bool> expected_bits = {
|
||||||
|
@ -19,7 +19,7 @@ TEST(libzcash_utils, convertBytesVectorToVector)
|
||||||
ASSERT_TRUE(convertBytesVectorToVector(bytes) == expected_bits);
|
ASSERT_TRUE(convertBytesVectorToVector(bytes) == expected_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(libzcash_utils, convertVectorToInt)
|
TEST(LibzcashUtils, convertVectorToInt)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(convertVectorToInt({0}) == 0);
|
ASSERT_TRUE(convertVectorToInt({0}) == 0);
|
||||||
ASSERT_TRUE(convertVectorToInt({1}) == 1);
|
ASSERT_TRUE(convertVectorToInt({1}) == 1);
|
||||||
|
|
|
@ -446,7 +446,7 @@ uint256 test_prf(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(noteencryption, prf_addr)
|
TEST(noteencryption, PrfAddr)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 100; i++) {
|
for (size_t i = 0; i < 100; i++) {
|
||||||
uint252 a_sk = libzcash::random_uint252();
|
uint252 a_sk = libzcash::random_uint252();
|
||||||
|
@ -466,7 +466,7 @@ TEST(noteencryption, prf_addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(noteencryption, prf_nf)
|
TEST(noteencryption, PrfNf)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 100; i++) {
|
for (size_t i = 0; i < 100; i++) {
|
||||||
uint252 a_sk = libzcash::random_uint252();
|
uint252 a_sk = libzcash::random_uint252();
|
||||||
|
@ -477,7 +477,7 @@ TEST(noteencryption, prf_nf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(noteencryption, prf_pk)
|
TEST(noteencryption, PrfPk)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 100; i++) {
|
for (size_t i = 0; i < 100; i++) {
|
||||||
uint252 a_sk = libzcash::random_uint252();
|
uint252 a_sk = libzcash::random_uint252();
|
||||||
|
@ -500,7 +500,7 @@ TEST(noteencryption, prf_pk)
|
||||||
ASSERT_THROW(PRF_pk(dummy_a, 2, dummy_b), std::domain_error);
|
ASSERT_THROW(PRF_pk(dummy_a, 2, dummy_b), std::domain_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(noteencryption, prf_rho)
|
TEST(noteencryption, PrfRho)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 100; i++) {
|
for (size_t i = 0; i < 100; i++) {
|
||||||
uint252 phi = libzcash::random_uint252();
|
uint252 phi = libzcash::random_uint252();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
extern UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false);
|
extern UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false);
|
||||||
|
|
||||||
TEST(rpc, check_blockToJSON_returns_minified_solution) {
|
TEST(rpc, CheckBlockToJSONReturnsMinifiedSolution) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
|
|
||||||
// Testnet block 006a87f9f91c1f51c7549e2c8965c0fd4fe8c212798f932efc54dc7bccbec780
|
// Testnet block 006a87f9f91c1f51c7549e2c8965c0fd4fe8c212798f932efc54dc7bccbec780
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
TEST(tautologies, seven_eq_seven) {
|
TEST(tautologies, SevenEqSeven) {
|
||||||
ASSERT_EQ(7, 7);
|
ASSERT_EQ(7, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
/*
|
/*
|
||||||
Test that removing #1144 succeeded by verifying the hash of a transaction is over the entire serialized form.
|
Test that removing #1144 succeeded by verifying the hash of a transaction is over the entire serialized form.
|
||||||
*/
|
*/
|
||||||
TEST(txid_tests, check_txid_and_hash_are_same) {
|
TEST(TxidTests, CheckTxidAndHashAreSame) {
|
||||||
// Random zcash transaction aacaa62d40fcdd9192ed35ea9df31660ccf7f6c60566530faaa444fb5d0d410e
|
// Random zcash transaction aacaa62d40fcdd9192ed35ea9df31660ccf7f6c60566530faaa444fb5d0d410e
|
||||||
CTransaction tx;
|
CTransaction tx;
|
||||||
CDataStream stream(ParseHex("01000000015ad78be5497476bbf84869d8156761ca850b6e82e48ad1315069a3726516a3d1010000006b483045022100ba5e90204e83c5f961b67c6232c1cc6c360afd36d43fcfae0de7af2e75f4cda7022012fec415a12048dbb70511fda6195b090b56735232281dc1144409833a092edc012102c322382e17c9ed4f47183f219cc5dd7853f939fb8eebae3c943622e0abf8d5e5feffffff0280969800000000001976a91430271a250e92135ce0db0783ebb63aaeb58e47f988acd694693a000000001976a9145f0d00adba6489150808feb4108d7be582cbb2e188ac0a000000"), SER_DISK, CLIENT_VERSION);
|
CDataStream stream(ParseHex("01000000015ad78be5497476bbf84869d8156761ca850b6e82e48ad1315069a3726516a3d1010000006b483045022100ba5e90204e83c5f961b67c6232c1cc6c360afd36d43fcfae0de7af2e75f4cda7022012fec415a12048dbb70511fda6195b090b56735232281dc1144409833a092edc012102c322382e17c9ed4f47183f219cc5dd7853f939fb8eebae3c943622e0abf8d5e5feffffff0280969800000000001976a91430271a250e92135ce0db0783ebb63aaeb58e47f988acd694693a000000001976a9145f0d00adba6489150808feb4108d7be582cbb2e188ac0a000000"), SER_DISK, CLIENT_VERSION);
|
||||||
|
@ -20,7 +20,7 @@ TEST(txid_tests, check_txid_and_hash_are_same) {
|
||||||
ASSERT_TRUE(hash == tx.GetHash());
|
ASSERT_TRUE(hash == tx.GetHash());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(txid_tests, check_txid_and_hash_are_same_coinbase) {
|
TEST(TxidTests, CheckTxidAndHashAreSameCoinbase) {
|
||||||
// Random zcash coinbase transaction 6041357de59ba64959d1b60f93de24dfe5ea1e26ed9e8a73d35b225a1845bad5
|
// Random zcash coinbase transaction 6041357de59ba64959d1b60f93de24dfe5ea1e26ed9e8a73d35b225a1845bad5
|
||||||
CTransaction tx;
|
CTransaction tx;
|
||||||
CDataStream stream(ParseHex("01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03530101ffffffff02f049020000000000232102f2df427fd4f76552ed0e86b17da8cf9b07754ea23ddc05799410a4a3a5d806ccac7c9200000000000017a9146708e6670db0b950dac68031025cc5b63213a4918700000000"), SER_DISK, CLIENT_VERSION);
|
CDataStream stream(ParseHex("01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03530101ffffffff02f049020000000000232102f2df427fd4f76552ed0e86b17da8cf9b07754ea23ddc05799410a4a3a5d806ccac7c9200000000000017a9146708e6670db0b950dac68031025cc5b63213a4918700000000"), SER_DISK, CLIENT_VERSION);
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
* LoadSaplingIncomingViewingKey()
|
* LoadSaplingIncomingViewingKey()
|
||||||
* LoadSaplingZKeyMetadata()
|
* LoadSaplingZKeyMetadata()
|
||||||
*/
|
*/
|
||||||
TEST(wallet_zkeys_tests, StoreAndLoadSaplingZkeys) {
|
|
||||||
|
TEST(WalletZkeysTest, StoreAndLoadSaplingZkeys) {
|
||||||
|
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
|
|
||||||
CWallet wallet;
|
CWallet wallet;
|
||||||
|
@ -110,7 +112,7 @@ TEST(wallet_zkeys_tests, StoreAndLoadSaplingZkeys) {
|
||||||
* LoadZKey()
|
* LoadZKey()
|
||||||
* LoadZKeyMetadata()
|
* LoadZKeyMetadata()
|
||||||
*/
|
*/
|
||||||
TEST(wallet_zkeys_tests, store_and_load_zkeys) {
|
TEST(WalletZkeysTest, StoreAndLoadZkeys) {
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
|
|
||||||
CWallet wallet;
|
CWallet wallet;
|
||||||
|
@ -167,7 +169,7 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) {
|
||||||
* RemoveSproutViewingKey()
|
* RemoveSproutViewingKey()
|
||||||
* LoadSproutViewingKey()
|
* LoadSproutViewingKey()
|
||||||
*/
|
*/
|
||||||
TEST(wallet_zkeys_tests, StoreAndLoadViewingKeys) {
|
TEST(WalletZkeysTest, StoreAndLoadViewingKeys) {
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
|
|
||||||
CWallet wallet;
|
CWallet wallet;
|
||||||
|
@ -212,7 +214,7 @@ TEST(wallet_zkeys_tests, StoreAndLoadViewingKeys) {
|
||||||
* This test covers methods on CWalletDB
|
* This test covers methods on CWalletDB
|
||||||
* WriteZKey()
|
* WriteZKey()
|
||||||
*/
|
*/
|
||||||
TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
|
TEST(WalletZkeysTest, WriteZkeyDirectToDb) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
|
|
||||||
// Get temporary and unique path for file.
|
// Get temporary and unique path for file.
|
||||||
|
@ -284,7 +286,7 @@ TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
|
||||||
* This test covers methods on CWalletDB
|
* This test covers methods on CWalletDB
|
||||||
* WriteSproutViewingKey()
|
* WriteSproutViewingKey()
|
||||||
*/
|
*/
|
||||||
TEST(wallet_zkeys_tests, WriteViewingKeyDirectToDB) {
|
TEST(WalletZkeysTest, WriteViewingKeyDirectToDB) {
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
|
|
||||||
// Get temporary and unique path for file.
|
// Get temporary and unique path for file.
|
||||||
|
@ -329,7 +331,9 @@ TEST(wallet_zkeys_tests, WriteViewingKeyDirectToDB) {
|
||||||
/**
|
/**
|
||||||
* This test covers methods on CWalletDB to load/save crypted z keys.
|
* This test covers methods on CWalletDB to load/save crypted z keys.
|
||||||
*/
|
*/
|
||||||
TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
|
/* TODO: Uncomment during PR for #3388
|
||||||
|
TEST(WalletZkeysTest, WriteCryptedzkeyDirectToDb) {
|
||||||
|
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
|
|
||||||
// Get temporary and unique path for file.
|
// Get temporary and unique path for file.
|
||||||
|
|
Loading…
Reference in New Issue