aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-03-31 10:49:53 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-11 13:37:39 +0000
commitc444b1b22922b423256c6d15887a27e77d060d7f (patch)
tree12f8b12ff7981befbde1173be6985137ad1eb292 /tests
parentAdd a define for the max number of bulletproof multi-outputs (diff)
downloadmonero-c444b1b22922b423256c6d15887a27e77d060d7f.tar.xz
require canonical multi output bulletproof layout
Diffstat (limited to 'tests')
-rw-r--r--tests/core_tests/bulletproofs.cpp14
-rw-r--r--tests/core_tests/bulletproofs.h8
-rw-r--r--tests/core_tests/chaingen_main.cpp4
3 files changed, 13 insertions, 13 deletions
diff --git a/tests/core_tests/bulletproofs.cpp b/tests/core_tests/bulletproofs.cpp
index 3f2a2567c..a675b2c59 100644
--- a/tests/core_tests/bulletproofs.cpp
+++ b/tests/core_tests/bulletproofs.cpp
@@ -215,14 +215,14 @@ bool gen_bp_tx_valid_1::generate(std::vector<test_event_entry>& events) const
return generate_with(events, out_idx, mixin, 1, amounts_paid, true, multi_out, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_tx_valid_1"); });
}
-bool gen_bp_tx_valid_1_1::generate(std::vector<test_event_entry>& events) const
+bool gen_bp_tx_invalid_1_1::generate(std::vector<test_event_entry>& events) const
{
const int mixin = 6;
const int out_idx[] = {1, -1};
const uint64_t amounts_paid[] = {5000, 5000, (uint64_t)-1};
const size_t bp_sizes[] = {1, 1, (size_t)-1};
const bool multi_out[] = {false};
- return generate_with(events, out_idx, mixin, 1, amounts_paid, true, multi_out, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_tx_valid_1_1"); });
+ return generate_with(events, out_idx, mixin, 1, amounts_paid, false, multi_out, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_tx_invalid_1_1"); });
}
bool gen_bp_tx_valid_2::generate(std::vector<test_event_entry>& events) const
@@ -265,13 +265,13 @@ bool gen_bp_txs_valid_2_and_2::generate(std::vector<test_event_entry>& events) c
return generate_with(events, out_idx, mixin, 2, amounts_paid, true, multi_out, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_txs_valid_2_2"); });
}
-bool gen_bp_txs_valid_1_1_and_8_2_and_16_16_1::generate(std::vector<test_event_entry>& events) const
+bool gen_bp_txs_valid_2_and_8_2_and_16_16_1::generate(std::vector<test_event_entry>& events) const
{
const int mixin = 6;
const int out_idx[] = {1, -1};
const uint64_t amounts_paid[] = {1000, 1000, (uint64_t)-1, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, (uint64_t)-1, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, (uint64_t)-1};
- const bool multi_out[] = {false, true, true};
- const size_t bp_sizes[] = {1, 1, (size_t)-1, 8, 2, (size_t)-1, 16, 16, 1, (size_t)-1};
+ const bool multi_out[] = {true, true, true};
+ const size_t bp_sizes[] = {2, (size_t)-1, 8, 2, (size_t)-1, 16, 16, 1, (size_t)-1};
return generate_with(events, out_idx, mixin, 3, amounts_paid, true, multi_out, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_txs_valid_1_1_and_8_2_and_16_16_1"); });
}
@@ -325,8 +325,8 @@ bool gen_bp_tx_invalid_switched::generate(std::vector<test_event_entry>& events)
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_switched");
const int mixin = 6;
const int out_idx[] = {1, -1};
- const uint64_t amounts_paid[] = {5000, 5000, (uint64_t)-1};
- const bool multi_out[] = {false};
+ const uint64_t amounts_paid[] = {1001, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, (uint64_t)-1};
+ const bool multi_out[] = {true};
return generate_with(events, out_idx, mixin, 1, amounts_paid, false, multi_out, NULL, [&](cryptonote::transaction &tx, size_t tx_idx){
CHECK_TEST_CONDITION(tx.rct_signatures.type == rct::RCTTypeBulletproof);
CHECK_TEST_CONDITION(tx.rct_signatures.p.bulletproofs.size() == 2);
diff --git a/tests/core_tests/bulletproofs.h b/tests/core_tests/bulletproofs.h
index 25d1cbb8b..d3b65f5bd 100644
--- a/tests/core_tests/bulletproofs.h
+++ b/tests/core_tests/bulletproofs.h
@@ -108,11 +108,11 @@ struct gen_bp_tx_valid_1 : public gen_bp_tx_validation_base
};
template<> struct get_test_options<gen_bp_tx_valid_1>: public get_test_options<gen_bp_tx_validation_base> {};
-struct gen_bp_tx_valid_1_1 : public gen_bp_tx_validation_base
+struct gen_bp_tx_invalid_1_1 : public gen_bp_tx_validation_base
{
bool generate(std::vector<test_event_entry>& events) const;
};
-template<> struct get_test_options<gen_bp_tx_valid_1_1>: public get_test_options<gen_bp_tx_validation_base> {};
+template<> struct get_test_options<gen_bp_tx_invalid_1_1>: public get_test_options<gen_bp_tx_validation_base> {};
struct gen_bp_tx_valid_2 : public gen_bp_tx_validation_base
{
@@ -138,11 +138,11 @@ struct gen_bp_txs_valid_2_and_2 : public gen_bp_tx_validation_base
};
template<> struct get_test_options<gen_bp_txs_valid_2_and_2>: public get_test_options<gen_bp_tx_validation_base> {};
-struct gen_bp_txs_valid_1_1_and_8_2_and_16_16_1 : public gen_bp_tx_validation_base
+struct gen_bp_txs_valid_2_and_8_2_and_16_16_1 : public gen_bp_tx_validation_base
{
bool generate(std::vector<test_event_entry>& events) const;
};
-template<> struct get_test_options<gen_bp_txs_valid_1_1_and_8_2_and_16_16_1>: public get_test_options<gen_bp_tx_validation_base> {};
+template<> struct get_test_options<gen_bp_txs_valid_2_and_8_2_and_16_16_1>: public get_test_options<gen_bp_tx_validation_base> {};
struct gen_bp_tx_invalid_not_enough_proofs : public gen_bp_tx_validation_base
{
diff --git a/tests/core_tests/chaingen_main.cpp b/tests/core_tests/chaingen_main.cpp
index f662c68df..60de110fa 100644
--- a/tests/core_tests/chaingen_main.cpp
+++ b/tests/core_tests/chaingen_main.cpp
@@ -225,12 +225,12 @@ int main(int argc, char* argv[])
GENERATE_AND_PLAY(gen_multisig_tx_invalid_33_1_3_no_threshold);
GENERATE_AND_PLAY(gen_bp_tx_valid_1);
- GENERATE_AND_PLAY(gen_bp_tx_valid_1_1);
+ GENERATE_AND_PLAY(gen_bp_tx_invalid_1_1);
GENERATE_AND_PLAY(gen_bp_tx_valid_2);
GENERATE_AND_PLAY(gen_bp_tx_valid_4_2_1);
GENERATE_AND_PLAY(gen_bp_tx_valid_16_16);
GENERATE_AND_PLAY(gen_bp_txs_valid_2_and_2);
- GENERATE_AND_PLAY(gen_bp_txs_valid_1_1_and_8_2_and_16_16_1);
+ GENERATE_AND_PLAY(gen_bp_txs_valid_2_and_8_2_and_16_16_1);
GENERATE_AND_PLAY(gen_bp_tx_invalid_not_enough_proofs);
GENERATE_AND_PLAY(gen_bp_tx_invalid_too_many_proofs);
GENERATE_AND_PLAY(gen_bp_tx_invalid_wrong_amount);