interim checkin - working RCT Carrot TX

This commit is contained in:
Some Random Crypto Guy
2025-06-27 16:05:08 +01:00
parent 14a6c6b8ef
commit 5306d4b94a
18 changed files with 279 additions and 131 deletions

View File

@@ -45,8 +45,8 @@ set(core_tests_sources
rct.cpp
bulletproofs.cpp
bulletproof_plus.cpp
rct2.cpp
wallet_tools.cpp)
rct2.cpp)
# wallet_tools.cpp)
set(core_tests_headers
block_reward.h
@@ -67,8 +67,8 @@ set(core_tests_headers
rct.h
bulletproofs.h
bulletproof_plus.h
rct2.h
wallet_tools.h)
rct2.h)
# wallet_tools.h)
monero_add_minimal_executable(core_tests
${core_tests_sources}

View File

@@ -13,7 +13,7 @@ using namespace cryptonote;
void wallet_accessor_test::set_account(tools::wallet2 * wallet, cryptonote::account_base& account)
{
wallet->clear();
// wallet->m_account = account;
wallet->m_account = reinterpret_cast<carrot::carrot_and_legacy_account&>(account);
wallet->m_key_device_type = account.get_device().get_type();
wallet->m_account_public_address = account.get_keys().m_account_address;

View File

@@ -39,7 +39,7 @@ set(unit_tests_sources
bulletproofs_plus.cpp
canonical_amounts.cpp
carrot_core.cpp
carrot_impl.cpp
# carrot_impl.cpp
carrot_legacy.cpp
carrot_mock_helpers.cpp
carrot_sparc.cpp
@@ -95,7 +95,7 @@ set(unit_tests_sources
test_peerlist.cpp
test_protocol_pack.cpp
threadpool.cpp
tx_construction_helpers.cpp
# tx_construction_helpers.cpp
tx_proof.cpp
hardfork.cpp
unbound.cpp
@@ -106,9 +106,9 @@ set(unit_tests_sources
output_selection.cpp
vercmp.cpp
ringdb.cpp
wallet_scanning.cpp
# wallet_scanning.cpp
wallet_storage.cpp
wallet_tx_builder.cpp
# wallet_tx_builder.cpp
wipeable_string.cpp
is_hdd.cpp
aligned.cpp
@@ -168,3 +168,6 @@ add_test(
monero_add_minimal_executable(test_notifier test_notifier.cpp)
target_link_libraries(test_notifier ${EXTRA_LIBRARIES})
set_property(TARGET test_notifier PROPERTY FOLDER "tests")
# Salvium tests
add_subdirectory(salvium)

View File

@@ -56,9 +56,8 @@ namespace test
source_amount += input.value().amount;
auto const& key = boost::get<cryptonote::txout_to_tagged_key>(input.value().target);
actual_sources.push_back(
{{}, 0, key_field.pub_key, {}, std::size_t(input.index()), input.value().amount, rct, false, false, rct::identity()}
);
cryptonote::tx_source_entry foo{{}, 0, key_field.pub_key, {}, std::size_t(input.index()), input.value().amount, rct, false, false, rct::identity(), {}, "SAL1"};
actual_sources.push_back(foo);
for (unsigned ring = 0; ring < 10; ++ring)
actual_sources.back().push_output(input.index(), key.key, input.value().amount);

View File

@@ -123,6 +123,9 @@ TEST(wallet_scanning, view_scan_long_payment_id)
const crypto::hash payment_id = crypto::rand<crypto::hash>();
// Create a keystore with a largely empty subaddress map
tools::keystore keystore({{bob_main_spend_pubkey, {}}}); // use a fake subaddress map with just the provided address in it
for (uint8_t hf_version = 1; hf_version < HF_VERSION_CARROT; ++hf_version)
{
MDEBUG("view_scan_as_sender_mainaddr: hf_version=" << static_cast<int>(hf_version));
@@ -161,10 +164,9 @@ TEST(wallet_scanning, view_scan_long_payment_id)
std::vector<std::optional<tools::wallet::enote_view_incoming_scan_info_t>> enote_scan_infos(tx.vout.size());
tools::keystore keystore;
tools::wallet::view_incoming_scan_transaction(tx,
bob.get_keys(),
// {{bob_main_spend_pubkey, {}}}, use a fake subaddress map with just the provided address in it
keystore,
epee::to_mut_span(enote_scan_infos));
bob.get_keys(),
keystore,
epee::to_mut_span(enote_scan_infos));
bool matched = false;
for (const auto &enote_scan_info : enote_scan_infos)
@@ -200,6 +202,9 @@ TEST(wallet_scanning, view_scan_short_payment_id)
crypto::hash payment_id = crypto::null_hash;
memcpy(&payment_id, &pid_8, sizeof(pid_8));
// Create a keystore with a largely empty subaddress map
tools::keystore keystore({{bob_main_spend_pubkey, {}}}); // use a fake subaddress map with just the provided address in it
ASSERT_FALSE(tools::wallet::is_long_payment_id(payment_id));
ASSERT_NE(crypto::null_hash, payment_id);
@@ -240,10 +245,16 @@ TEST(wallet_scanning, view_scan_short_payment_id)
std::vector<std::optional<tools::wallet::enote_view_incoming_scan_info_t>> enote_scan_infos(tx.vout.size());
tools::keystore keystore;
tools::wallet::view_incoming_scan_transaction(tx,
<<<<<<< Updated upstream
bob.get_keys(),
// {{bob_main_spend_pubkey, {}}}, // use a fake subaddress map with just the provided address in it
keystore,
epee::to_mut_span(enote_scan_infos));
=======
bob.get_keys(),
keystore,
epee::to_mut_span(enote_scan_infos));
>>>>>>> Stashed changes
bool matched = false;
for (const auto &enote_scan_info : enote_scan_infos)