Remove more remnants of JoinSplits
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include "pubkey.h"
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include "util.h"
|
||||
|
||||
#include "librustzcash.h"
|
||||
|
||||
struct ECCryptoClosure
|
||||
@@ -17,21 +16,17 @@ struct ECCryptoClosure
|
||||
|
||||
ECCryptoClosure instance_of_eccryptoclosure;
|
||||
|
||||
ZCJoinSplit* params;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
assert(init_and_check_sodium() != -1);
|
||||
ECC_Start();
|
||||
|
||||
params = ZCJoinSplit::Prepared();
|
||||
|
||||
boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params";
|
||||
boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params";
|
||||
|
||||
static_assert(
|
||||
sizeof(boost::filesystem::path::value_type) == sizeof(codeunit),
|
||||
"librustzcash not configured correctly");
|
||||
auto sapling_spend_str = sapling_spend.native();
|
||||
auto sapling_spend_str = sapling_spend.native();
|
||||
auto sapling_output_str = sapling_output.native();
|
||||
|
||||
librustzcash_init_zksnark_params(
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include <sodium.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "consensus/validation.h"
|
||||
|
||||
extern ZCJoinSplit* params;
|
||||
|
||||
//TODO: Update these tests for Sapling
|
||||
/*
|
||||
TEST(checktransaction_tests, check_vpub_not_both_nonzero) {
|
||||
CMutableTransaction tx;
|
||||
tx.nVersion = 2;
|
||||
@@ -733,16 +732,16 @@ TEST(checktransaction_tests, SaplingSproutInputSumsTooLarge) {
|
||||
// create JSDescription
|
||||
uint256 rt;
|
||||
uint256 joinSplitPubKey;
|
||||
std::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
|
||||
std::array<libzcash::JSInput, HUSH_NUM_JS_INPUTS> inputs = {
|
||||
libzcash::JSInput(),
|
||||
libzcash::JSInput()
|
||||
};
|
||||
std::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs = {
|
||||
std::array<libzcash::JSOutput, HUSH_NUM_JS_OUTPUTS> outputs = {
|
||||
libzcash::JSOutput(),
|
||||
libzcash::JSOutput()
|
||||
};
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
std::array<size_t, HUSH_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, HUSH_NUM_JS_OUTPUTS> outputMap;
|
||||
|
||||
auto jsdesc = JSDescription::Randomized(
|
||||
true,
|
||||
@@ -1037,3 +1036,4 @@ TEST(checktransaction_tests, BadTxReceivedOverNetwork)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "consensus/upgrades.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "main.h"
|
||||
#include "utiltest.h"
|
||||
|
||||
extern ZCJoinSplit* params;
|
||||
|
||||
extern bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos);
|
||||
|
||||
void ExpectOptionalAmount(CAmount expected, boost::optional<CAmount> actual) {
|
||||
@@ -88,77 +85,3 @@ TEST(Validation, ContextualCheckInputsPassesWithCoinbase) {
|
||||
EXPECT_TRUE(ContextualCheckInputs(tx, state, view, false, 0, false, txdata, Params(CBaseChainParams::MAIN).GetConsensus(), consensusBranchId));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Validation, ReceivedBlockTransactions) {
|
||||
auto sk = libzcash::SproutSpendingKey::random();
|
||||
|
||||
// Create a fake genesis block
|
||||
CBlock block1;
|
||||
block1.vtx.push_back(GetValidReceive(*params, sk, 5, true));
|
||||
block1.hashMerkleRoot = block1.BuildMerkleTree();
|
||||
CBlockIndex fakeIndex1 {block1};
|
||||
|
||||
// Create a fake child block
|
||||
CBlock block2;
|
||||
block2.hashPrevBlock = block1.GetHash();
|
||||
block2.vtx.push_back(GetValidReceive(*params, sk, 10, true));
|
||||
block2.hashMerkleRoot = block2.BuildMerkleTree();
|
||||
CBlockIndex fakeIndex2 {block2};
|
||||
fakeIndex2.pprev = &fakeIndex1;
|
||||
|
||||
CDiskBlockPos pos1;
|
||||
CDiskBlockPos pos2;
|
||||
|
||||
// Set initial state of indices
|
||||
ASSERT_TRUE(fakeIndex1.RaiseValidity(BLOCK_VALID_TREE));
|
||||
ASSERT_TRUE(fakeIndex2.RaiseValidity(BLOCK_VALID_TREE));
|
||||
EXPECT_TRUE(fakeIndex1.IsValid(BLOCK_VALID_TREE));
|
||||
EXPECT_TRUE(fakeIndex2.IsValid(BLOCK_VALID_TREE));
|
||||
EXPECT_FALSE(fakeIndex1.IsValid(BLOCK_VALID_TRANSACTIONS));
|
||||
EXPECT_FALSE(fakeIndex2.IsValid(BLOCK_VALID_TRANSACTIONS));
|
||||
|
||||
// Sprout pool values should not be set
|
||||
EXPECT_FALSE((bool)fakeIndex1.nSproutValue);
|
||||
EXPECT_FALSE((bool)fakeIndex1.nChainSproutValue);
|
||||
EXPECT_FALSE((bool)fakeIndex2.nSproutValue);
|
||||
EXPECT_FALSE((bool)fakeIndex2.nChainSproutValue);
|
||||
|
||||
// Mark the second block's transactions as received first
|
||||
CValidationState state;
|
||||
EXPECT_TRUE(ReceivedBlockTransactions(block2, state, &fakeIndex2, pos2));
|
||||
EXPECT_FALSE(fakeIndex1.IsValid(BLOCK_VALID_TRANSACTIONS));
|
||||
EXPECT_TRUE(fakeIndex2.IsValid(BLOCK_VALID_TRANSACTIONS));
|
||||
|
||||
// Sprout pool value delta should now be set for the second block,
|
||||
// but not any chain totals
|
||||
EXPECT_FALSE((bool)fakeIndex1.nSproutValue);
|
||||
EXPECT_FALSE((bool)fakeIndex1.nChainSproutValue);
|
||||
{
|
||||
SCOPED_TRACE("ExpectOptionalAmount call");
|
||||
ExpectOptionalAmount(20, fakeIndex2.nSproutValue);
|
||||
}
|
||||
EXPECT_FALSE((bool)fakeIndex2.nChainSproutValue);
|
||||
|
||||
// Now mark the first block's transactions as received
|
||||
EXPECT_TRUE(ReceivedBlockTransactions(block1, state, &fakeIndex1, pos1));
|
||||
EXPECT_TRUE(fakeIndex1.IsValid(BLOCK_VALID_TRANSACTIONS));
|
||||
EXPECT_TRUE(fakeIndex2.IsValid(BLOCK_VALID_TRANSACTIONS));
|
||||
|
||||
// Sprout pool values should now be set for both blocks
|
||||
{
|
||||
SCOPED_TRACE("ExpectOptionalAmount call");
|
||||
ExpectOptionalAmount(10, fakeIndex1.nSproutValue);
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("ExpectOptionalAmount call");
|
||||
ExpectOptionalAmount(10, fakeIndex1.nChainSproutValue);
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("ExpectOptionalAmount call");
|
||||
ExpectOptionalAmount(20, fakeIndex2.nSproutValue);
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("ExpectOptionalAmount call");
|
||||
ExpectOptionalAmount(30, fakeIndex2.nChainSproutValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user