mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Integrate CLSAGs into monero
They are allowed from v12, and MLSAGs are rejected from v13.
This commit is contained in:
parent
8cd1d6df8f
commit
82ee01699c
31 changed files with 1083 additions and 195 deletions
|
@ -163,9 +163,9 @@ bool gen_multisig_tx_validation_base::generate_with(std::vector<test_event_entry
|
|||
|
||||
MAKE_GENESIS_BLOCK(events, blk_0, miner_account[creator], ts_start);
|
||||
|
||||
// create 8 miner accounts, and have them mine the next 8 blocks
|
||||
// create 16 miner accounts, and have them mine the next 16 blocks
|
||||
// they will have a coinbase with a single out that's pseudo rct
|
||||
constexpr size_t n_coinbases = 8;
|
||||
constexpr size_t n_coinbases = 16;
|
||||
cryptonote::account_base miner_accounts[n_coinbases];
|
||||
const cryptonote::block *prev_block = &blk_0;
|
||||
cryptonote::block blocks[n_coinbases];
|
||||
|
@ -175,7 +175,7 @@ bool gen_multisig_tx_validation_base::generate_with(std::vector<test_event_entry
|
|||
account_base &account = n < inputs ? miner_account[creator] : miner_accounts[n];
|
||||
CHECK_AND_ASSERT_MES(generator.construct_block_manually(blocks[n], *prev_block, account,
|
||||
test_generator::bf_major_ver | test_generator::bf_minor_ver | test_generator::bf_timestamp | test_generator::bf_hf_version | test_generator::bf_max_outs,
|
||||
4, 4, prev_block->timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN * 2, // v2 has blocks twice as long
|
||||
10, 10, prev_block->timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN * 2, // v2 has blocks twice as long
|
||||
crypto::hash(), 0, transaction(), std::vector<crypto::hash>(), 0, 1, 4),
|
||||
false, "Failed to generate block");
|
||||
events.push_back(blocks[n]);
|
||||
|
@ -191,7 +191,7 @@ bool gen_multisig_tx_validation_base::generate_with(std::vector<test_event_entry
|
|||
cryptonote::block blk;
|
||||
CHECK_AND_ASSERT_MES(generator.construct_block_manually(blk, blk_last, miner_accounts[0],
|
||||
test_generator::bf_major_ver | test_generator::bf_minor_ver | test_generator::bf_timestamp | test_generator::bf_hf_version | test_generator::bf_max_outs,
|
||||
4, 4, blk_last.timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN * 2, // v2 has blocks twice as long
|
||||
10, 10, blk_last.timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN * 2, // v2 has blocks twice as long
|
||||
crypto::hash(), 0, transaction(), std::vector<crypto::hash>(), 0, 1, 4),
|
||||
false, "Failed to generate block");
|
||||
events.push_back(blk);
|
||||
|
@ -363,7 +363,7 @@ bool gen_multisig_tx_validation_base::generate_with(std::vector<test_event_entry
|
|||
#endif
|
||||
std::vector<crypto::secret_key> additional_tx_secret_keys;
|
||||
auto sources_copy = sources;
|
||||
r = construct_tx_and_get_tx_key(miner_account[creator].get_keys(), subaddresses, sources, destinations, boost::none, std::vector<uint8_t>(), tx, 0, tx_key, additional_tx_secret_keys, true, { rct::RangeProofBorromean, 0 }, msoutp);
|
||||
r = construct_tx_and_get_tx_key(miner_account[creator].get_keys(), subaddresses, sources, destinations, boost::none, std::vector<uint8_t>(), tx, 0, tx_key, additional_tx_secret_keys, true, { rct::RangeProofPaddedBulletproof, 2 }, msoutp);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to construct transaction");
|
||||
|
||||
#ifndef NO_MULTISIG
|
||||
|
@ -453,7 +453,7 @@ bool gen_multisig_tx_validation_base::generate_with(std::vector<test_event_entry
|
|||
crypto::secret_key scalar1;
|
||||
crypto::derivation_to_scalar(derivation, n, scalar1);
|
||||
rct::ecdhTuple ecdh_info = tx.rct_signatures.ecdhInfo[n];
|
||||
rct::ecdhDecode(ecdh_info, rct::sk2rct(scalar1), tx.rct_signatures.type == rct::RCTTypeBulletproof2);
|
||||
rct::ecdhDecode(ecdh_info, rct::sk2rct(scalar1), tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG);
|
||||
rct::key C = tx.rct_signatures.outPk[n].mask;
|
||||
rct::addKeys2(Ctmp, ecdh_info.mask, ecdh_info.amount, rct::H);
|
||||
CHECK_AND_ASSERT_MES(rct::equalKeys(C, Ctmp), false, "Failed to decode amount");
|
||||
|
@ -476,196 +476,196 @@ bool gen_multisig_tx_validation_base::generate_with(std::vector<test_event_entry
|
|||
|
||||
bool gen_multisig_tx_valid_22_1_2::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 2, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_22_1_2_many_inputs::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 4, mixin, amount_paid, true, 2, 2, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_22_2_1::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 2, 2, {1}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_33_1_23::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 3, 3, 1, {2, 3}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_33_3_21::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 3, 3, 3, {2, 1}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_23_1_2::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 3, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_23_1_3::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 3, 1, {3}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_23_2_1::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 3, 2, {1}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_23_2_3::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 3, 2, {3}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_45_1_234::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 4, 5, 1, {2, 3, 4}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_45_4_135_many_inputs::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 4, mixin, amount_paid, true, 4, 5, 4, {1, 3, 5}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_89_3_1245789::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 8, 9, 3, {1, 2, 4, 5, 7, 8, 9}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_24_1_2::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 4, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_24_1_2_many_inputs::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 4, mixin, amount_paid, true, 2, 4, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_25_1_2::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 2, 5, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_25_1_2_many_inputs::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 4, mixin, amount_paid, true, 2, 5, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_48_1_234::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, true, 4, 8, 1, {2, 3, 4}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_valid_48_1_234_many_inputs::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 4, mixin, amount_paid, true, 4, 8, 1, {2, 3, 4}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_22_1__no_threshold::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 2, 2, 1, {}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_33_1__no_threshold::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 3, 3, 1, {}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_33_1_2_no_threshold::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 3, 3, 1, {2}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_33_1_3_no_threshold::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 3, 3, 1, {3}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_23_1__no_threshold::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 2, 3, 1, {}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_45_5_23_no_threshold::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 4, 5, 5, {2, 3}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_24_1_no_signers::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 2, 4, 1, {}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_25_1_no_signers::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 2, 5, 1, {}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_48_1_no_signers::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 4, 8, 1, {}, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gen_multisig_tx_invalid_48_1_23_no_threshold::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
const size_t mixin = 4;
|
||||
const size_t mixin = 10;
|
||||
const uint64_t amount_paid = 10000;
|
||||
return generate_with(events, 2, mixin, amount_paid, false, 4, 8, 1, {2, 3}, NULL, NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue