mirror of
https://github.com/monero-project/monero.git
synced 2025-05-12 18:52:16 -04:00
plug bulletproofs plus into consensus
This commit is contained in:
parent
b535d662b9
commit
a0d80b1f95
28 changed files with 1139 additions and 161 deletions
|
@ -158,7 +158,7 @@ bool gen_bp_tx_validation_base::generate_with(std::vector<test_event_entry>& eve
|
|||
crypto::derivation_to_scalar(derivation, o, amount_key);
|
||||
rct::key rct_tx_mask;
|
||||
const uint8_t type = rct_txes.back().rct_signatures.type;
|
||||
if (type == rct::RCTTypeSimple || type == rct::RCTTypeBulletproof || type == rct::RCTTypeBulletproof2 || type == rct::RCTTypeCLSAG)
|
||||
if (rct::is_rct_simple(type))
|
||||
rct::decodeRctSimple(rct_txes.back().rct_signatures, rct::sk2rct(amount_key), o, rct_tx_mask, hw::get_device("default"));
|
||||
else
|
||||
rct::decodeRct(rct_txes.back().rct_signatures, rct::sk2rct(amount_key), o, rct_tx_mask, hw::get_device("default"));
|
||||
|
@ -232,7 +232,7 @@ bool gen_bp_tx_invalid_1_1::generate(std::vector<test_event_entry>& events) cons
|
|||
{
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {5000, 5000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof , 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof , 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ bool gen_bp_tx_valid_2::generate(std::vector<test_event_entry>& events) const
|
|||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {5000, 5000, (uint64_t)-1};
|
||||
const size_t bp_sizes[] = {2, (size_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof, 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, true, rct_config, HF_VERSION_CLSAG, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_tx_valid_2"); });
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ bool gen_bp_tx_valid_3::generate(std::vector<test_event_entry>& events) const
|
|||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {5000, 5000, 5000, (uint64_t)-1};
|
||||
const size_t bp_sizes[] = {4, (size_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof , 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, true, rct_config, HF_VERSION_CLSAG, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_tx_valid_3"); });
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ bool gen_bp_tx_valid_16::generate(std::vector<test_event_entry>& events) const
|
|||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, (uint64_t)-1};
|
||||
const size_t bp_sizes[] = {16, (size_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof , 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, true, rct_config, HF_VERSION_CLSAG, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_tx_valid_16"); });
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ bool gen_bp_tx_invalid_4_2_1::generate(std::vector<test_event_entry>& events) co
|
|||
{
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {1000, 1000, 1000, 1000, 1000, 1000, 1000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofMultiOutputBulletproof , 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofMultiOutputBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ bool gen_bp_tx_invalid_16_16::generate(std::vector<test_event_entry>& events) co
|
|||
{
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {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 rct::RCTConfig rct_config[] = { { rct::RangeProofMultiOutputBulletproof , 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofMultiOutputBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ bool gen_bp_txs_valid_2_and_2::generate(std::vector<test_event_entry>& events) c
|
|||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {1000, 1000, (size_t)-1, 1000, 1000, (uint64_t)-1};
|
||||
const size_t bp_sizes[] = {2, (size_t)-1, 2, (size_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof, 0 }, {rct::RangeProofPaddedBulletproof, 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof, 3 }, {rct::RangeProofPaddedBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 2, amounts_paid, true, rct_config, HF_VERSION_CLSAG, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx){ return check_bp(tx, tx_idx, bp_sizes, "gen_bp_txs_valid_2_and_2"); });
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ bool gen_bp_txs_invalid_2_and_8_2_and_16_16_1::generate(std::vector<test_event_e
|
|||
{
|
||||
const size_t mixin = 10;
|
||||
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 rct::RCTConfig rct_config[] = {{rct::RangeProofMultiOutputBulletproof, 0}, {rct::RangeProofMultiOutputBulletproof, 0}, {rct::RangeProofMultiOutputBulletproof, 0}};
|
||||
const rct::RCTConfig rct_config[] = {{rct::RangeProofMultiOutputBulletproof, 3}, {rct::RangeProofMultiOutputBulletproof, 3}, {rct::RangeProofMultiOutputBulletproof, 3}};
|
||||
return generate_with(events, mixin, 3, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ bool gen_bp_txs_valid_2_and_3_and_2_and_4::generate(std::vector<test_event_entry
|
|||
{
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {11111115000, 11111115000, (uint64_t)-1, 11111115000, 11111115000, 11111115001, (uint64_t)-1, 11111115000, 11111115002, (uint64_t)-1, 11111115000, 11111115000, 11111115000, 11111115003, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = {{rct::RangeProofPaddedBulletproof, 0}, {rct::RangeProofPaddedBulletproof, 0}, {rct::RangeProofPaddedBulletproof, 0}, {rct::RangeProofPaddedBulletproof, 0}};
|
||||
const rct::RCTConfig rct_config[] = {{rct::RangeProofPaddedBulletproof, 3}, {rct::RangeProofPaddedBulletproof, 3}, {rct::RangeProofPaddedBulletproof, 3}, {rct::RangeProofPaddedBulletproof, 3}};
|
||||
const size_t bp_sizes[] = {2, (size_t)-1, 4, (size_t)-1, 2, (size_t)-1, 4, (size_t)-1};
|
||||
return generate_with(events, mixin, 4, amounts_paid, true, rct_config, HF_VERSION_CLSAG, NULL, [&](const cryptonote::transaction &tx, size_t tx_idx) { return check_bp(tx, tx_idx, bp_sizes, "gen_bp_txs_valid_2_and_3_and_2_and_4"); });
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ bool gen_bp_tx_invalid_not_enough_proofs::generate(std::vector<test_event_entry>
|
|||
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_not_enough_proofs");
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {5000, 5000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, [&](cryptonote::transaction &tx, size_t idx){
|
||||
CHECK_TEST_CONDITION(tx.rct_signatures.type == rct::RCTTypeBulletproof || tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG);
|
||||
CHECK_TEST_CONDITION(!tx.rct_signatures.p.bulletproofs.empty());
|
||||
|
@ -325,7 +325,7 @@ bool gen_bp_tx_invalid_empty_proofs::generate(std::vector<test_event_entry>& eve
|
|||
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_empty_proofs");
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {50000, 50000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, [&](cryptonote::transaction &tx, size_t idx){
|
||||
CHECK_TEST_CONDITION(tx.rct_signatures.type == rct::RCTTypeBulletproof || tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG);
|
||||
tx.rct_signatures.p.bulletproofs.clear();
|
||||
|
@ -338,7 +338,7 @@ bool gen_bp_tx_invalid_too_many_proofs::generate(std::vector<test_event_entry>&
|
|||
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_too_many_proofs");
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {10000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, [&](cryptonote::transaction &tx, size_t idx){
|
||||
CHECK_TEST_CONDITION(tx.rct_signatures.type == rct::RCTTypeBulletproof || tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG);
|
||||
CHECK_TEST_CONDITION(!tx.rct_signatures.p.bulletproofs.empty());
|
||||
|
@ -352,7 +352,7 @@ bool gen_bp_tx_invalid_wrong_amount::generate(std::vector<test_event_entry>& eve
|
|||
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_wrong_amount");
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {10000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_CLSAG, NULL, [&](cryptonote::transaction &tx, size_t idx){
|
||||
CHECK_TEST_CONDITION(tx.rct_signatures.type == rct::RCTTypeBulletproof || tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG);
|
||||
CHECK_TEST_CONDITION(!tx.rct_signatures.p.bulletproofs.empty());
|
||||
|
@ -366,7 +366,7 @@ bool gen_bp_tx_invalid_borromean_type::generate(std::vector<test_event_entry>& e
|
|||
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_borromean_type");
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {5000, 5000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBorromean, 0 } };
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofBorromean, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, 11, NULL, [&](cryptonote::transaction &tx, size_t tx_idx){
|
||||
return true;
|
||||
});
|
||||
|
@ -382,3 +382,14 @@ bool gen_bp_tx_invalid_bulletproof2_type::generate(std::vector<test_event_entry>
|
|||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool gen_bp_tx_invalid_clsag_type::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
DEFINE_TESTS_ERROR_CONTEXT("gen_bp_tx_invalid_clsag_type");
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amounts_paid[] = {5000, 5000, (uint64_t)-1};
|
||||
const rct::RCTConfig rct_config[] = { { rct::RangeProofPaddedBulletproof, 3 } };
|
||||
return generate_with(events, mixin, 1, amounts_paid, false, rct_config, HF_VERSION_BULLETPROOF_PLUS + 1, NULL, [&](cryptonote::transaction &tx, size_t tx_idx){
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue