diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2026-07-23 09:51:20 +0200 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2026-08-03 14:53:50 +0200 |
| commit | c765eca1fbbfde6165d5ed5e56276878b3496c77 (patch) | |
| tree | 5b9ef6e90361595b70fb6076d92bc41b7c6b7abc /patches/monero/0005-UR-functions.patch | |
| parent | 5952bef2ec01b0b7e57c11613cbdc081dcd727c5 (diff) | |
use FCMP branch, bump simplybs, rebase patchescyjan-fcmp-v2
Diffstat (limited to 'patches/monero/0005-UR-functions.patch')
| -rw-r--r-- | patches/monero/0005-UR-functions.patch | 144 |
1 files changed, 66 insertions, 78 deletions
diff --git a/patches/monero/0005-UR-functions.patch b/patches/monero/0005-UR-functions.patch index 116d050..d86fec2 100644 --- a/patches/monero/0005-UR-functions.patch +++ b/patches/monero/0005-UR-functions.patch @@ -1,7 +1,7 @@ -From ccd02185be7d4a928776ff38111eb3ce9face61f Mon Sep 17 00:00:00 2001 +From 5ffd332c6a2943891d99895ca7ec70d96f23b445 Mon Sep 17 00:00:00 2001 From: tobtoht <tob@featherwallet.org> Date: Tue, 12 Mar 2024 10:09:50 +0100 -Subject: [PATCH 05/20] UR functions +Subject: [PATCH 05/22] UR functions This commit adds UR functions for UR tasks, I believe that the right place to get @@ -20,7 +20,7 @@ Things broken in the commit of this patch) it is not a dealbreaker. --- .gitmodules | 4 + - CMakeLists.txt | 4 +- + CMakeLists.txt | 2 + external/CMakeLists.txt | 1 + external/bc-ur | 1 + src/device/device_ledger.cpp | 5 +- @@ -32,55 +32,54 @@ Things broken in the commit src/wallet/api/wallet.cpp | 307 ++++++++++++++++++++++++ src/wallet/api/wallet.h | 8 + src/wallet/api/wallet2_api.h | 22 +- - src/wallet/wallet2.cpp | 141 +++++++---- + src/wallet/wallet2.cpp | 137 +++++++---- src/wallet/wallet2.h | 3 + - 15 files changed, 518 insertions(+), 56 deletions(-) + 15 files changed, 516 insertions(+), 52 deletions(-) create mode 160000 external/bc-ur diff --git a/.gitmodules b/.gitmodules -index ffb73fe9a..72af74d55 100644 +index 9dcb71804..57fdfbfc8 100644 --- a/.gitmodules +++ b/.gitmodules -@@ -15,3 +15,7 @@ - path = external/supercop - url = https://github.com/monero-project/supercop - branch = monero +@@ -19,3 +19,7 @@ + path = external/mx25519 + url = https://github.com/jeffro256/mx25519 + branch = unclamped +[submodule "external/bc-ur"] + path = external/bc-ur + url = https://github.com/MrCyjaneK/bc-ur + branch = misc diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9b922046e..268339201 100644 +index b829efaf0..4ba3b7557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -96,7 +96,8 @@ enable_language(C ASM) - set(CMAKE_C_STANDARD 11) +@@ -122,6 +122,7 @@ set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) --set(CMAKE_CXX_STANDARD 14) -+set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 17) +add_definitions(-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) # boost: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'? set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -@@ -364,6 +365,7 @@ if(NOT MANUAL_SUBMODULES) +@@ -385,6 +386,7 @@ if(NOT MANUAL_SUBMODULES) endfunction () message(STATUS "Checking submodules") +# check_submodule(external/bc-ur) - check_submodule(external/miniupnp) check_submodule(external/rapidjson) - check_submodule(external/trezor-common) + check_submodule(external/randomx) + check_submodule(external/supercop) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index 538e4d215..074e23f16 100644 +index 08e910a0a..900684b6d 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt -@@ -70,4 +70,5 @@ endif() +@@ -31,5 +31,6 @@ add_subdirectory(db_drivers) add_subdirectory(easylogging++) add_subdirectory(qrcodegen) +add_subdirectory(bc-ur) add_subdirectory(randomx EXCLUDE_FROM_ALL) + add_subdirectory(mx25519) diff --git a/external/bc-ur b/external/bc-ur new file mode 160000 index 000000000..d82e7c753 @@ -89,10 +88,10 @@ index 000000000..d82e7c753 @@ -0,0 +1 @@ +Subproject commit d82e7c753e710b8000706dc3383b498438795208 diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp -index 6dde4a564..7e4be6347 100644 +index f8631e42d..aa6e037a1 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp -@@ -313,12 +313,13 @@ namespace hw { +@@ -314,12 +314,13 @@ namespace hw { /* ======================================================================= */ /* LOCKER */ @@ -103,25 +102,25 @@ index 6dde4a564..7e4be6347 100644 + #pragma message ("Warning AUTO_LOCK_CMD is intentionally left broken. This is yet to be fixed.") #define AUTO_LOCK_CMD() \ /* lock both mutexes without deadlock*/ \ -- boost::lock(device_locker, command_locker); \ -+ /* boost::lock(device_locker, command_locker); */ \ +- std::lock(device_locker, command_locker); \ ++ /* std::lock(device_locker, command_locker); */ \ /* make sure both already-locked mutexes are unlocked at the end of scope */ \ - boost::lock_guard<boost::recursive_mutex> lock1(device_locker, boost::adopt_lock); \ - boost::lock_guard<boost::mutex> lock2(command_locker, boost::adopt_lock) + std::lock_guard<std::recursive_mutex> lock1(device_locker, std::adopt_lock); \ + std::lock_guard<std::mutex> lock2(command_locker, std::adopt_lock) diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt -index 6095f99d5..b163212b7 100644 +index 054a5e876..db7c3c06b 100644 --- a/src/wallet/CMakeLists.txt +++ b/src/wallet/CMakeLists.txt -@@ -50,6 +50,7 @@ monero_add_library(wallet +@@ -52,6 +52,7 @@ monero_add_library(wallet target_link_libraries(wallet PUBLIC rpc_base + bc-ur multisig + carrot_impl common - cryptonote_core diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp -index 70a702796..9c3c26ee5 100644 +index 1618b915d..919e210f0 100644 --- a/src/wallet/api/pending_transaction.cpp +++ b/src/wallet/api/pending_transaction.cpp @@ -42,6 +42,8 @@ @@ -172,7 +171,7 @@ index 70a702796..9c3c26ee5 100644 { uint64_t result = 0; diff --git a/src/wallet/api/pending_transaction.h b/src/wallet/api/pending_transaction.h -index 0a9779c07..403bfe281 100644 +index 9d8d754c0..8a70d774d 100644 --- a/src/wallet/api/pending_transaction.h +++ b/src/wallet/api/pending_transaction.h @@ -46,6 +46,7 @@ public: @@ -184,7 +183,7 @@ index 0a9779c07..403bfe281 100644 uint64_t dust() const override; uint64_t fee() const override; diff --git a/src/wallet/api/unsigned_transaction.cpp b/src/wallet/api/unsigned_transaction.cpp -index 6165a2240..fd03e959d 100644 +index c549539e5..062df7f41 100644 --- a/src/wallet/api/unsigned_transaction.cpp +++ b/src/wallet/api/unsigned_transaction.cpp @@ -40,6 +40,8 @@ @@ -244,7 +243,7 @@ index 6165a2240..fd03e959d 100644 bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_num_txes, const std::function<const tools::wallet2::tx_construction_data&(size_t)> &get_tx, const std::string &extra_message) { diff --git a/src/wallet/api/unsigned_transaction.h b/src/wallet/api/unsigned_transaction.h -index 30065a7fa..a94b23f75 100644 +index b07d43fb1..76165a230 100644 --- a/src/wallet/api/unsigned_transaction.h +++ b/src/wallet/api/unsigned_transaction.h @@ -53,6 +53,7 @@ public: @@ -256,18 +255,18 @@ index 30065a7fa..a94b23f75 100644 uint64_t minMixinCount() const override; diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 6301bd1ef..d179e502b 100644 +index 27d8716c3..52bc7647a 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp -@@ -47,6 +47,7 @@ +@@ -51,6 +51,7 @@ + #endif - #include <boost/locale.hpp> #include <boost/filesystem.hpp> +#include "bc-ur/src/bc-ur.hpp" using namespace std; using namespace cryptonote; -@@ -1066,6 +1067,24 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const +@@ -1012,6 +1013,24 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const return m_wallet->unlocked_balance(accountIndex, false); } @@ -291,8 +290,8 @@ index 6301bd1ef..d179e502b 100644 + uint64_t WalletImpl::blockChainHeight() const { - if(m_wallet->light_wallet()) { -@@ -1208,6 +1227,61 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file + return m_wallet->get_blockchain_current_height(); +@@ -1145,6 +1164,61 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file return transaction; } @@ -354,7 +353,7 @@ index 6301bd1ef..d179e502b 100644 bool WalletImpl::submitTransaction(const string &fileName) { clearStatus(); if (checkBackgroundSync("cannot submit tx")) -@@ -1228,6 +1302,61 @@ bool WalletImpl::submitTransaction(const string &fileName) { +@@ -1165,6 +1239,61 @@ bool WalletImpl::submitTransaction(const string &fileName) { return true; } @@ -416,7 +415,7 @@ index 6301bd1ef..d179e502b 100644 bool WalletImpl::exportKeyImages(const string &filename, bool all) { if (m_wallet->watch_only()) -@@ -1255,6 +1384,39 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) +@@ -1192,6 +1321,39 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) return true; } @@ -456,7 +455,7 @@ index 6301bd1ef..d179e502b 100644 bool WalletImpl::importKeyImages(const string &filename) { if (checkBackgroundSync("cannot import key images")) -@@ -1280,6 +1442,62 @@ bool WalletImpl::importKeyImages(const string &filename) +@@ -1217,6 +1379,62 @@ bool WalletImpl::importKeyImages(const string &filename) return true; } @@ -519,7 +518,7 @@ index 6301bd1ef..d179e502b 100644 bool WalletImpl::exportOutputs(const string &filename, bool all) { if (checkBackgroundSync("cannot export outputs")) -@@ -1312,6 +1530,40 @@ bool WalletImpl::exportOutputs(const string &filename, bool all) +@@ -1249,6 +1467,40 @@ bool WalletImpl::exportOutputs(const string &filename, bool all) return true; } @@ -560,7 +559,7 @@ index 6301bd1ef..d179e502b 100644 bool WalletImpl::importOutputs(const string &filename) { if (checkBackgroundSync("cannot import outputs")) -@@ -1346,6 +1598,61 @@ bool WalletImpl::importOutputs(const string &filename) +@@ -1283,6 +1535,61 @@ bool WalletImpl::importOutputs(const string &filename) return true; } @@ -623,10 +622,10 @@ index 6301bd1ef..d179e502b 100644 { if (checkBackgroundSync("cannot scan transactions")) diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index ac7ce2f6a..edf8bb8ce 100644 +index 365025c6e..a50983a69 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h -@@ -112,6 +112,7 @@ public: +@@ -113,6 +113,7 @@ public: bool setProxy(const std::string &address) override; uint64_t balance(uint32_t accountIndex = 0) const override; uint64_t unlockedBalance(uint32_t accountIndex = 0) const override; @@ -634,7 +633,7 @@ index ac7ce2f6a..edf8bb8ce 100644 uint64_t blockChainHeight() const override; uint64_t approximateBlockChainHeight() const override; uint64_t estimateBlockChainHeight() const override; -@@ -164,11 +165,18 @@ public: +@@ -166,11 +167,18 @@ public: std::set<uint32_t> subaddr_indices = {}) override; virtual PendingTransaction * createSweepUnmixableTransaction() override; bool submitTransaction(const std::string &fileName) override; @@ -654,10 +653,10 @@ index ac7ce2f6a..edf8bb8ce 100644 bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional<std::string> &background_cache_password = optional<std::string>()) override; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index e349df176..764adbfbf 100644 +index 534679820..a5164260f 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h -@@ -91,6 +91,7 @@ struct PendingTransaction +@@ -83,6 +83,7 @@ struct PendingTransaction virtual std::string errorString() const = 0; // commit transaction or save to file if filename is provided. virtual bool commit(const std::string &filename = "", bool overwrite = false) = 0; @@ -665,7 +664,7 @@ index e349df176..764adbfbf 100644 virtual uint64_t amount() const = 0; virtual uint64_t dust() const = 0; virtual uint64_t fee() const = 0; -@@ -160,7 +161,8 @@ struct UnsignedTransaction +@@ -152,7 +153,8 @@ struct UnsignedTransaction * @param signedFileName * return - true on success */ @@ -675,7 +674,7 @@ index e349df176..764adbfbf 100644 }; /** -@@ -626,6 +628,7 @@ struct Wallet +@@ -619,6 +621,7 @@ struct Wallet result += unlockedBalance(i); return result; } @@ -683,7 +682,7 @@ index e349df176..764adbfbf 100644 /** * @brief watchOnly - checks if wallet is watch only -@@ -884,13 +887,15 @@ struct Wallet +@@ -886,13 +889,15 @@ struct Wallet * after object returned */ virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0; @@ -702,7 +701,7 @@ index e349df176..764adbfbf 100644 /*! * \brief disposeTransaction - destroys transaction object -@@ -906,6 +911,8 @@ struct Wallet +@@ -908,6 +913,8 @@ struct Wallet virtual uint64_t estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations, PendingTransaction::Priority priority) const = 0; @@ -711,7 +710,7 @@ index e349df176..764adbfbf 100644 /*! * \brief exportKeyImages - exports key images to file * \param filename -@@ -913,20 +920,22 @@ struct Wallet +@@ -915,20 +922,22 @@ struct Wallet * \return - true on success */ virtual bool exportKeyImages(const std::string &filename, bool all = false) = 0; @@ -736,7 +735,7 @@ index e349df176..764adbfbf 100644 /*! * \brief importOutputs - imports outputs from file -@@ -934,6 +943,7 @@ struct Wallet +@@ -936,6 +945,7 @@ struct Wallet * \return - true on success */ virtual bool importOutputs(const std::string &filename) = 0; @@ -745,10 +744,10 @@ index e349df176..764adbfbf 100644 /*! * \brief scanTransactions - scan a list of transaction ids, this operation may reveal the txids to the remote node and affect your privacy diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index ac2a1fec3..a8db99c3f 100644 +index ff8950fd4..79cab37a4 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp -@@ -953,6 +953,16 @@ uint32_t get_subaddress_clamped_sum(uint32_t idx, uint32_t extra) +@@ -974,6 +974,16 @@ uint32_t get_subaddress_clamped_sum(uint32_t idx, uint32_t extra) return idx + extra; } @@ -765,7 +764,7 @@ index ac2a1fec3..a8db99c3f 100644 static void setup_shim(hw::wallet_shim * shim, tools::wallet2 * wallet) { shim->get_tx_pub_key_from_received_outs = std::bind(&tools::wallet2::get_tx_pub_key_from_received_outs, wallet, std::placeholders::_1); -@@ -7065,6 +7075,25 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t * +@@ -7326,6 +7336,25 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t * return amount; } //---------------------------------------------------------------------------------------------------- @@ -791,18 +790,7 @@ index ac2a1fec3..a8db99c3f 100644 std::map<uint32_t, uint64_t> wallet2::balance_per_subaddress(uint32_t index_major, bool strict) const { std::map<uint32_t, uint64_t> amount_per_subaddr; -@@ -7916,9 +7945,7 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pendin - crypto::key_derivation derivation; - std::vector<crypto::key_derivation> additional_derivations; - -- // compute public keys from out secret keys -- crypto::public_key tx_pub_key; -- crypto::secret_key_to_public_key(txs[n].tx_key, tx_pub_key); -+ crypto::public_key tx_pub_key = get_tx_pub_key_from_extra(tx); - std::vector<crypto::public_key> additional_tx_pub_keys; - for (const crypto::secret_key &skey: txs[n].additional_tx_keys) - { -@@ -11261,7 +11288,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp +@@ -10864,7 +10893,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2( MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below fractional threshold " << print_money(fractional_threshold)); continue; } @@ -811,7 +799,7 @@ index ac2a1fec3..a8db99c3f 100644 { if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below) { -@@ -11311,9 +11338,15 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp +@@ -10914,9 +10943,15 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2( LOG_PRINT_L2("Starting with " << num_nondust_outputs << " non-dust outputs and " << num_dust_outputs << " dust outputs"); @@ -829,8 +817,8 @@ index ac2a1fec3..a8db99c3f 100644 // if empty, put dummy entry so that the front can be referenced later in the loop if (unused_dust_indices_per_subaddr.empty()) unused_dust_indices_per_subaddr.push_back({}); -@@ -13949,33 +13982,40 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle - +@@ -13501,33 +13536,40 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle + //---------------------------------------------------------------------------------------------------- bool wallet2::export_key_images(const std::string &filename, bool all) const { - PERF_TIMER(export_key_images); @@ -893,7 +881,7 @@ index ac2a1fec3..a8db99c3f 100644 //---------------------------------------------------------------------------------------------------- std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>>> wallet2::export_key_images(bool all) const { -@@ -14030,53 +14070,60 @@ std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>> +@@ -13582,53 +13624,60 @@ std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>> return std::make_pair(offset, ski); } @@ -973,10 +961,10 @@ index ac2a1fec3..a8db99c3f 100644 ski.push_back(std::make_pair(key_image, signature)); } diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index 92f735f96..18e60d89a 100644 +index e78abda83..aa70d5662 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h -@@ -1164,6 +1164,7 @@ private: +@@ -667,6 +667,7 @@ private: // locked & unlocked balance of given or current subaddress account uint64_t balance(uint32_t subaddr_index_major, bool strict) const; uint64_t unlocked_balance(uint32_t subaddr_index_major, bool strict, uint64_t *blocks_to_unlock = NULL, uint64_t *time_to_unlock = NULL); @@ -984,7 +972,7 @@ index 92f735f96..18e60d89a 100644 // locked & unlocked balance per subaddress of given or current subaddress account std::map<uint32_t, uint64_t> balance_per_subaddress(uint32_t subaddr_index_major, bool strict) const; std::map<uint32_t, std::pair<uint64_t, std::pair<uint64_t, uint64_t>>> unlocked_balance_per_subaddress(uint32_t subaddr_index_major, bool strict); -@@ -1639,9 +1640,11 @@ private: +@@ -1196,9 +1197,11 @@ private: std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> export_blockchain() const; void import_blockchain(const std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> &bc); bool export_key_images(const std::string &filename, bool all = false) const; @@ -997,5 +985,5 @@ index 92f735f96..18e60d89a 100644 bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false); crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const; -- -2.50.1 (Apple Git-155) +2.54.0 (Apple Git-157) |
