@ -42,7 +42,7 @@ using namespace cryptonote;
// Tests
// Tests
bool gen_bp_tx_validation_base : : generate_with ( std : : vector < test_event_entry > & events ,
bool gen_bp_tx_validation_base : : generate_with ( std : : vector < test_event_entry > & events ,
size_t mixin , size_t n_txes , const uint64_t * amounts_paid , bool valid , const rct : : RCTConfig * rct_config ,
size_t mixin , size_t n_txes , const uint64_t * amounts_paid , bool valid , const rct : : RCTConfig * rct_config , uint8_t hf_version ,
const std : : function < bool ( std : : vector < tx_source_entry > & sources , std : : vector < tx_destination_entry > & destinations , size_t tx_idx ) > & pre_tx ,
const std : : function < bool ( std : : vector < tx_source_entry > & sources , std : : vector < tx_destination_entry > & destinations , size_t tx_idx ) > & pre_tx ,
const std : : function < bool ( transaction & tx , size_t tx_idx ) > & post_tx ) const
const std : : function < bool ( transaction & tx , size_t tx_idx ) > & post_tx ) const
{
{
@ -157,7 +157,7 @@ bool gen_bp_tx_validation_base::generate_with(std::vector<test_event_entry>& eve
crypto : : derivation_to_scalar ( derivation , o , amount_key ) ;
crypto : : derivation_to_scalar ( derivation , o , amount_key ) ;
rct : : key rct_tx_mask ;
rct : : key rct_tx_mask ;
const uint8_t type = rct_txes . back ( ) . rct_signatures . type ;
const uint8_t type = rct_txes . back ( ) . rct_signatures . type ;
if ( type = = rct : : RCTTypeSimple | | type = = rct : : RCTTypeBulletproof | | type = = rct : : RCTTypeBulletproof2 )
if ( type = = rct : : RCTTypeSimple | | type = = rct : : RCTTypeBulletproof | | type = = rct : : RCTTypeBulletproof2 | | type = = rct : : RCTTypeCLSAG )
rct : : decodeRctSimple ( rct_txes . back ( ) . rct_signatures , rct : : sk2rct ( amount_key ) , o , rct_tx_mask , hw : : get_device ( " default " ) ) ;
rct : : decodeRctSimple ( rct_txes . back ( ) . rct_signatures , rct : : sk2rct ( amount_key ) , o , rct_tx_mask , hw : : get_device ( " default " ) ) ;
else
else
rct : : decodeRct ( rct_txes . back ( ) . rct_signatures , rct : : sk2rct ( amount_key ) , o , rct_tx_mask , hw : : get_device ( " default " ) ) ;
rct : : decodeRct ( rct_txes . back ( ) . rct_signatures , rct : : sk2rct ( amount_key ) , o , rct_tx_mask , hw : : get_device ( " default " ) ) ;
@ -173,7 +173,7 @@ bool gen_bp_tx_validation_base::generate_with(std::vector<test_event_entry>& eve
CHECK_AND_ASSERT_MES ( generator . construct_block_manually ( blk_txes , blk_last , miner_account ,
CHECK_AND_ASSERT_MES ( generator . construct_block_manually ( blk_txes , blk_last , miner_account ,
test_generator : : bf_major_ver | test_generator : : bf_minor_ver | test_generator : : bf_timestamp | test_generator : : bf_tx_hashes | test_generator : : bf_hf_version | test_generator : : bf_max_outs ,
test_generator : : bf_major_ver | test_generator : : bf_minor_ver | test_generator : : bf_timestamp | test_generator : : bf_tx_hashes | test_generator : : bf_hf_version | test_generator : : bf_max_outs ,
10 , 10 , blk_last . timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN * 2 , // v2 has blocks twice as long
hf_version , hf_version , blk_last . timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN * 2 , // v2 has blocks twice as long
crypto : : hash ( ) , 0 , transaction ( ) , starting_rct_tx_hashes , 0 , 6 , 10 ) ,
crypto : : hash ( ) , 0 , transaction ( ) , starting_rct_tx_hashes , 0 , 6 , 10 ) ,
false , " Failed to generate block " ) ;
false , " Failed to generate block " ) ;
if ( ! valid )
if ( ! valid )
@ -205,13 +205,22 @@ bool gen_bp_tx_validation_base::check_bp(const cryptonote::transaction &tx, size
return true ;
return true ;
}
}
bool gen_bp_tx_valid_1 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_tx_valid_1 _before_12 : : generate ( std : : vector < test_event_entry > & events ) const
{
{
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 10000 , ( uint64_t ) - 1 } ;
const uint64_t amounts_paid [ ] = { 10000 , ( uint64_t ) - 1 } ;
const size_t bp_sizes [ ] = { 1 , ( size_t ) - 1 } ;
const size_t bp_sizes [ ] = { 1 , ( size_t ) - 1 } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofPaddedBulletproof , 0 } } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofPaddedBulletproof , 2 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , true , rct_config , NULL , [ & ] ( const cryptonote : : transaction & tx , size_t tx_idx ) { return check_bp ( tx , tx_idx , bp_sizes , " gen_bp_tx_valid_1 " ) ; } ) ;
return generate_with ( events , mixin , 1 , amounts_paid , true , rct_config , 11 , NULL , [ & ] ( const cryptonote : : transaction & tx , size_t tx_idx ) { return check_bp ( tx , tx_idx , bp_sizes , " gen_bp_tx_valid_1_before_12 " ) ; } ) ;
}
bool gen_bp_tx_invalid_1_from_12 : : generate ( std : : vector < test_event_entry > & events ) const
{
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 10000 , ( uint64_t ) - 1 } ;
const size_t bp_sizes [ ] = { 1 , ( size_t ) - 1 } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofPaddedBulletproof , 2 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , 12 , NULL , [ & ] ( const cryptonote : : transaction & tx , size_t tx_idx ) { return check_bp ( tx , tx_idx , bp_sizes , " gen_bp_tx_invalid_1_from_12 " ) ; } ) ;
}
}
bool gen_bp_tx_invalid_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
@ -219,7 +228,7 @@ bool gen_bp_tx_invalid_1_1::generate(std::vector<test_event_entry>& events) cons
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 5000 , 5000 , ( uint64_t ) - 1 } ;
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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , NULL ) ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , HF_VERSION_CLSAG , NULL , NULL ) ;
}
}
bool gen_bp_tx_valid_2 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_tx_valid_2 : : generate ( std : : vector < test_event_entry > & events ) const
@ -228,7 +237,7 @@ bool gen_bp_tx_valid_2::generate(std::vector<test_event_entry>& events) const
const uint64_t amounts_paid [ ] = { 5000 , 5000 , ( uint64_t ) - 1 } ;
const uint64_t amounts_paid [ ] = { 5000 , 5000 , ( uint64_t ) - 1 } ;
const size_t bp_sizes [ ] = { 2 , ( size_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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , true , rct_config , NULL , [ & ] ( const cryptonote : : transaction & tx , size_t tx_idx ) { return check_bp ( tx , tx_idx , bp_sizes , " gen_bp_tx_valid_2 " ) ; } ) ;
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 " ) ; } ) ;
}
}
bool gen_bp_tx_valid_3 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_tx_valid_3 : : generate ( std : : vector < test_event_entry > & events ) const
@ -237,7 +246,7 @@ bool gen_bp_tx_valid_3::generate(std::vector<test_event_entry>& events) const
const uint64_t amounts_paid [ ] = { 5000 , 5000 , 5000 , ( uint64_t ) - 1 } ;
const uint64_t amounts_paid [ ] = { 5000 , 5000 , 5000 , ( uint64_t ) - 1 } ;
const size_t bp_sizes [ ] = { 4 , ( size_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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , true , rct_config , NULL , [ & ] ( const cryptonote : : transaction & tx , size_t tx_idx ) { return check_bp ( tx , tx_idx , bp_sizes , " gen_bp_tx_valid_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 " ) ; } ) ;
}
}
bool gen_bp_tx_valid_16 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_tx_valid_16 : : generate ( std : : vector < test_event_entry > & events ) const
@ -246,7 +255,7 @@ bool gen_bp_tx_valid_16::generate(std::vector<test_event_entry>& events) const
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 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 size_t bp_sizes [ ] = { 16 , ( size_t ) - 1 } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofPaddedBulletproof , 0 } } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofPaddedBulletproof , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , true , rct_config , NULL , [ & ] ( const cryptonote : : transaction & tx , size_t tx_idx ) { return check_bp ( tx , tx_idx , bp_sizes , " gen_bp_tx_valid_16 " ) ; } ) ;
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 " ) ; } ) ;
}
}
bool gen_bp_tx_invalid_4_2_1 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_tx_invalid_4_2_1 : : generate ( std : : vector < test_event_entry > & events ) const
@ -254,7 +263,7 @@ bool gen_bp_tx_invalid_4_2_1::generate(std::vector<test_event_entry>& events) co
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , ( uint64_t ) - 1 } ;
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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , NULL ) ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , HF_VERSION_CLSAG , NULL , NULL ) ;
}
}
bool gen_bp_tx_invalid_16_16 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_tx_invalid_16_16 : : generate ( std : : vector < test_event_entry > & events ) const
@ -262,7 +271,7 @@ bool gen_bp_tx_invalid_16_16::generate(std::vector<test_event_entry>& events) co
const size_t mixin = 10 ;
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 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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , NULL ) ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , HF_VERSION_CLSAG , NULL , NULL ) ;
}
}
bool gen_bp_txs_valid_2_and_2 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_txs_valid_2_and_2 : : generate ( std : : vector < test_event_entry > & events ) const
@ -271,7 +280,7 @@ bool gen_bp_txs_valid_2_and_2::generate(std::vector<test_event_entry>& events) c
const uint64_t amounts_paid [ ] = { 1000 , 1000 , ( size_t ) - 1 , 1000 , 1000 , ( uint64_t ) - 1 } ;
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 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 , 0 } , { rct : : RangeProofPaddedBulletproof , 0 } } ;
return generate_with ( events , mixin , 2 , amounts_paid , true , rct_config , NULL , [ & ] ( const cryptonote : : transaction & tx , size_t tx_idx ) { return check_bp ( tx , tx_idx , bp_sizes , " gen_bp_txs_valid_2_and_2 " ) ; } ) ;
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 " ) ; } ) ;
}
}
bool gen_bp_txs_invalid_2_and_8_2_and_16_16_1 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_txs_invalid_2_and_8_2_and_16_16_1 : : generate ( std : : vector < test_event_entry > & events ) const
@ -279,7 +288,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 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 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 , 0 } , { rct : : RangeProofMultiOutputBulletproof , 0 } , { rct : : RangeProofMultiOutputBulletproof , 0 } } ;
return generate_with ( events , mixin , 3 , amounts_paid , false , rct_config , NULL , NULL ) ;
return generate_with ( events , mixin , 3 , amounts_paid , false , rct_config , HF_VERSION_CLSAG , NULL , NULL ) ;
}
}
bool gen_bp_txs_valid_2_and_3_and_2_and_4 : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_txs_valid_2_and_3_and_2_and_4 : : generate ( std : : vector < test_event_entry > & events ) const
@ -288,7 +297,7 @@ bool gen_bp_txs_valid_2_and_3_and_2_and_4::generate(std::vector<test_event_entry
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 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 , 0 } , { rct : : RangeProofPaddedBulletproof , 0 } , { rct : : RangeProofPaddedBulletproof , 0 } , { rct : : RangeProofPaddedBulletproof , 0 } } ;
const size_t bp_sizes [ ] = { 2 , ( size_t ) - 1 , 4 , ( size_t ) - 1 , 2 , ( size_t ) - 1 , 4 , ( size_t ) - 1 } ;
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 , 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 " ) ; } ) ;
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 " ) ; } ) ;
}
}
bool gen_bp_tx_invalid_not_enough_proofs : : generate ( std : : vector < test_event_entry > & events ) const
bool gen_bp_tx_invalid_not_enough_proofs : : generate ( std : : vector < test_event_entry > & events ) const
@ -297,8 +306,8 @@ bool gen_bp_tx_invalid_not_enough_proofs::generate(std::vector<test_event_entry>
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 5000 , 5000 , ( uint64_t ) - 1 } ;
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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , [ & ] ( cryptonote : : transaction & tx , size_t idx ) {
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 ) ;
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 ( ) ) ;
CHECK_TEST_CONDITION ( ! tx . rct_signatures . p . bulletproofs . empty ( ) ) ;
tx . rct_signatures . p . bulletproofs . pop_back ( ) ;
tx . rct_signatures . p . bulletproofs . pop_back ( ) ;
CHECK_TEST_CONDITION ( ! tx . rct_signatures . p . bulletproofs . empty ( ) ) ;
CHECK_TEST_CONDITION ( ! tx . rct_signatures . p . bulletproofs . empty ( ) ) ;
@ -312,8 +321,8 @@ bool gen_bp_tx_invalid_empty_proofs::generate(std::vector<test_event_entry>& eve
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 50000 , 50000 , ( uint64_t ) - 1 } ;
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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , [ & ] ( cryptonote : : transaction & tx , size_t idx ) {
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 ) ;
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 ( ) ;
tx . rct_signatures . p . bulletproofs . clear ( ) ;
return true ;
return true ;
} ) ;
} ) ;
@ -325,8 +334,8 @@ bool gen_bp_tx_invalid_too_many_proofs::generate(std::vector<test_event_entry>&
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 10000 , ( uint64_t ) - 1 } ;
const uint64_t amounts_paid [ ] = { 10000 , ( uint64_t ) - 1 } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofBulletproof , 0 } } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofBulletproof , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , [ & ] ( cryptonote : : transaction & tx , size_t idx ) {
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 ) ;
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 ( ) ) ;
CHECK_TEST_CONDITION ( ! tx . rct_signatures . p . bulletproofs . empty ( ) ) ;
tx . rct_signatures . p . bulletproofs . push_back ( tx . rct_signatures . p . bulletproofs . back ( ) ) ;
tx . rct_signatures . p . bulletproofs . push_back ( tx . rct_signatures . p . bulletproofs . back ( ) ) ;
return true ;
return true ;
@ -339,8 +348,8 @@ bool gen_bp_tx_invalid_wrong_amount::generate(std::vector<test_event_entry>& eve
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 10000 , ( uint64_t ) - 1 } ;
const uint64_t amounts_paid [ ] = { 10000 , ( uint64_t ) - 1 } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofBulletproof , 0 } } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofBulletproof , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , [ & ] ( cryptonote : : transaction & tx , size_t idx ) {
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 ) ;
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 ( ) ) ;
CHECK_TEST_CONDITION ( ! tx . rct_signatures . p . bulletproofs . empty ( ) ) ;
tx . rct_signatures . p . bulletproofs . back ( ) = rct : : bulletproof_PROVE ( 1000 , rct : : skGen ( ) ) ;
tx . rct_signatures . p . bulletproofs . back ( ) = rct : : bulletproof_PROVE ( 1000 , rct : : skGen ( ) ) ;
return true ;
return true ;
@ -353,7 +362,18 @@ bool gen_bp_tx_invalid_borromean_type::generate(std::vector<test_event_entry>& e
const size_t mixin = 10 ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 5000 , 5000 , ( uint64_t ) - 1 } ;
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 , 0 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , NULL , [ & ] ( cryptonote : : transaction & tx , size_t tx_idx ) {
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , 11 , NULL , [ & ] ( cryptonote : : transaction & tx , size_t tx_idx ) {
return true ;
} ) ;
}
bool gen_bp_tx_invalid_bulletproof2_type : : generate ( std : : vector < test_event_entry > & events ) const
{
DEFINE_TESTS_ERROR_CONTEXT ( " gen_bp_tx_invalid_bulletproof2_type " ) ;
const size_t mixin = 10 ;
const uint64_t amounts_paid [ ] = { 5000 , 5000 , ( uint64_t ) - 1 } ;
const rct : : RCTConfig rct_config [ ] = { { rct : : RangeProofPaddedBulletproof , 2 } } ;
return generate_with ( events , mixin , 1 , amounts_paid , false , rct_config , HF_VERSION_CLSAG + 1 , NULL , [ & ] ( cryptonote : : transaction & tx , size_t tx_idx ) {
return true ;
return true ;
} ) ;
} ) ;
}
}