diff --git a/CMakeLists.txt b/CMakeLists.txt
index eea4345c..16b7a7b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,11 @@ if(TESTNET)
add_definitions(-DTESTNET)
endif()
+if(CAKEWALLET)
+ message("NOTICE: Building libraries for CAKEWALLET")
+ add_definitions(-DCAKEWALLET)
+endif()
+
set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically
find_package(OpenSSL REQUIRED)
@@ -189,6 +194,11 @@ else()
endif()
+# If BOOST_ROOT is set, ignore system-wide Boost
+if(DEFINED ENV{BOOST_ROOT})
+ set(Boost_NO_SYSTEM_PATHS ON)
+endif()
+
if(MSVC)
set(Boost_USE_STATIC_LIBS ON)
endif()
diff --git a/README.md b/README.md
index 4d5ca173..cc7cdd6f 100644
--- a/README.md
+++ b/README.md
@@ -13,14 +13,14 @@ Be sure to clone the repository properly:\
### Dependencies
| component / version | minimum
(not recommended but may work) | recommended | most recent of what we have ever tested |
|--|--|--|--|
-| gcc (Linux) | 7.5.0 | 7.5.0 | 8.3.0 |
+| gcc (Linux) | 5.4.0 | 9.4.0 | 12.3.0 |
| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 |
-| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2017 (15.9.30) | 2022 (17.6.1) |
+| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2017 (15.9.30) | 2022 (17.7.5) |
| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 14.3 |
-| [CMake](https://cmake.org/download/) | 3.1.6 | 3.15.5 | 3.26.3 |
+| [CMake](https://cmake.org/download/) | 3.15.5 | 3.22.1 | 3.26.3 |
| [Boost](https://www.boost.org/users/download/) | 1.70 | 1.70 | 1.76 |
-| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | - | 1.1.1n | 1.1.1n |
-| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 5.8.0 | 5.12.12 | 5.15.2 |
+| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | 1.1.1n | 1.1.1w | 1.1.1w |
+| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 5.8.0 | 5.11.2 | 5.15.2 |
Note:\
[*server version*] denotes steps required for building command-line tools (daemon, simplewallet, etc.).\
@@ -30,25 +30,28 @@ Note:\
### Linux
-Recommended OS version: Ubuntu 18.04 LTS.
+Recommended OS versions: Ubuntu 20.04, 22.04 LTS.
1. Prerequisites
[*server version*]
- sudo apt-get install -y build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev
+ sudo apt-get install -y build-essential g++ curl autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev
[*GUI version*]
sudo apt-get install -y build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev mesa-common-dev libglu1-mesa-dev
-2. Download and build Boost
+2. Download and build Boost\
+ (Assuming you have cloned Zano into the 'zano' folder. If you used a different location for Zano, edit line 4 accordingly.)
curl -OL https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2
echo "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 boost_1_70_0.tar.bz2" | shasum -c && tar -xjf boost_1_70_0.tar.bz2
- cd boost_1_70_0
+ rm boost_1_70_0.tar.bz2 && cd boost_1_70_0
+ patch -p0 < ../zano/utils/boost_1.70_gcc_8.patch || cd ..
./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log
./b2
+ Make sure that you see "The Boost C++ Libraries were successfully built!" message at the end.
3. Install Qt\
(*GUI version only, skip this step if you're building server version*)
@@ -63,15 +66,13 @@ Recommended OS version: Ubuntu 18.04 LTS.
4. Install OpenSSL
- We recommend installing OpenSSL v1.1.1n locally unless you would like to use the same version system-wide. Adjust the local path `/home/user/openssl` in the commands below according to your needs.
+ We recommend installing OpenSSL v1.1.1w locally unless you would like to use the same version system-wide. Adjust the local path `/home/user/openssl` in the commands below according to your needs.
- curl -OL https://www.openssl.org/source/openssl-1.1.1n.tar.gz
- echo "40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a openssl-1.1.1n.tar.gz" | shasum -c && tar xaf openssl-1.1.1n.tar.gz
- cd openssl-1.1.1n/
+ curl -OL https://www.openssl.org/source/openssl-1.1.1w.tar.gz
+ echo "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 openssl-1.1.1w.tar.gz" | shasum -c && tar xaf openssl-1.1.1w.tar.gz
+ cd openssl-1.1.1w/
./config --prefix=/home/user/openssl --openssldir=/home/user/openssl shared zlib
- make
- make test
- make install
+ make && make test && make install
5. Set environment variables properly\
@@ -89,7 +90,7 @@ For instance, by adding the following lines to `~/.bashrc`
export OPENSSL_ROOT_DIR=/home/user/openssl
export QT_PREFIX_PATH=/home/user/Qt5.11.2/5.11.2/gcc_64
-
+ Make sure you've restarted your terminal session (by reopening the terminal window or reconnecting the server) to apply these changes.
6. Build the binaries
1. Build daemon and simplewallet:
diff --git a/src/currency_core/currency_format_utils.h b/src/currency_core/currency_format_utils.h
index aa9e800e..5a2ca910 100644
--- a/src/currency_core/currency_format_utils.h
+++ b/src/currency_core/currency_format_utils.h
@@ -359,6 +359,8 @@ namespace currency
bool derive_public_key_from_target_address(const account_public_address& destination_addr, const crypto::secret_key& tx_sec_key, size_t index, crypto::public_key& out_eph_public_key, crypto::key_derivation& derivation);
bool derive_public_key_from_target_address(const account_public_address& destination_addr, const crypto::secret_key& tx_sec_key, size_t index, crypto::public_key& out_eph_public_key);
bool derive_key_pair_from_key_pair(const crypto::public_key& src_pub_key, const crypto::secret_key& src_sec_key, crypto::secret_key& derived_sec_key, crypto::public_key& derived_pub_key, const char(&hs_domain)[32], uint64_t index = 0);
+ uint16_t get_derivation_hint(const crypto::key_derivation& derivation);
+ tx_derivation_hint make_tx_derivation_hint_from_uint16(uint16_t hint);
std::string short_hash_str(const crypto::hash& h);
bool is_mixattr_applicable_for_fake_outs_counter(uint8_t mix_attr, uint64_t fake_attr_count);
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index a2283c54..20c36019 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -5427,7 +5427,7 @@ bool wallet2::build_ionic_swap_template(const wallet_public::ionic_swap_proposal
return true;
}
//----------------------------------------------------------------------------------------------------
-bool wallet2::get_ionic_swap_proposal_info(const std::string&raw_proposal, wallet_public::ionic_swap_proposal_info& proposal_info)
+bool wallet2::get_ionic_swap_proposal_info(const std::string&raw_proposal, wallet_public::ionic_swap_proposal_info& proposal_info) const
{
wallet_public::ionic_swap_proposal proposal = AUTO_VAL_INIT(proposal);
bool r = t_unserializable_object_from_blob(proposal, raw_proposal);
@@ -5435,13 +5435,13 @@ bool wallet2::get_ionic_swap_proposal_info(const std::string&raw_proposal, walle
return get_ionic_swap_proposal_info(proposal, proposal_info);
}
//----------------------------------------------------------------------------------------------------
-bool wallet2::get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info)
+bool wallet2::get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info) const
{
wallet_public::ionic_swap_proposal_context ionic_context = AUTO_VAL_INIT(ionic_context);
return get_ionic_swap_proposal_info(proposal, proposal_info, ionic_context);
}
//----------------------------------------------------------------------------------------------------
-bool wallet2::get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info, wallet_public::ionic_swap_proposal_context& ionic_context)
+bool wallet2::get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info, wallet_public::ionic_swap_proposal_context& ionic_context) const
{
const transaction& tx = proposal.tx_template;
crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index b70ff375..cd32ca48 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -1026,9 +1026,9 @@ namespace tools
bool build_ionic_swap_template(const wallet_public::ionic_swap_proposal_info& proposal_detais, const currency::account_public_address& destination_addr,
wallet_public::ionic_swap_proposal& proposal,
std::vector& selected_transfers_for_template);
- bool get_ionic_swap_proposal_info(const std::string&raw_proposal, wallet_public::ionic_swap_proposal_info& proposal_info);
- bool get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info);
- bool get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info, wallet_public::ionic_swap_proposal_context& ionic_context);
+ bool get_ionic_swap_proposal_info(const std::string&raw_proposal, wallet_public::ionic_swap_proposal_info& proposal_info) const;
+ bool get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info) const;
+ bool get_ionic_swap_proposal_info(const wallet_public::ionic_swap_proposal& proposal, wallet_public::ionic_swap_proposal_info& proposal_info, wallet_public::ionic_swap_proposal_context& ionic_context) const;
bool accept_ionic_swap_proposal(const std::string& raw_proposal, currency::transaction& result_tx);
bool accept_ionic_swap_proposal(const wallet_public::ionic_swap_proposal& proposal, currency::transaction& result_tx);
diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp
index 2f0aac77..b16e24ee 100644
--- a/tests/core_tests/chaingen.cpp
+++ b/tests/core_tests/chaingen.cpp
@@ -1905,10 +1905,10 @@ bool find_block_chain(const std::vector& events, std::vector& sources)
return true;
}
+// creates destinations.size() + 1 outputs if the total sum of amounts is less than the original premine amount (the last one will have amount = old_premine - sum)
bool replace_coinbase_in_genesis_block(const std::vector& destinations, test_generator& generator, std::vector& events, currency::block& genesis_block)
{
bool r = false;
@@ -2340,13 +2345,19 @@ bool replace_coinbase_in_genesis_block(const std::vectortype() == typeid(crypto::public_key))
{
- boost::get(el) = tx_key.pub;
- break;
+ boost::get(*it) = tx_key.pub; // rewtire it
}
+ else if (it->type() == typeid(tx_derivation_hint))
+ {
+ it = genesis_block.miner_tx.extra.erase(it);
+ continue; // remove it
+ }
+
+ ++it;
}
uint64_t total_amount = 0;
@@ -2357,10 +2368,13 @@ bool replace_coinbase_in_genesis_block(const std::vector& event
bool use_ref_by_id = false);
uint64_t get_balance(const currency::account_keys& addr, const std::vector& blockchain, const map_hash2tx_t& mtx, bool dbg_log = false);
uint64_t get_balance(const currency::account_base& addr, const std::vector& blockchain, const map_hash2tx_t& mtx, bool dbg_log = false);
-void balance_via_wallet(const tools::wallet2& w, uint64_t* p_total, uint64_t* p_unlocked = 0, uint64_t* p_awaiting_in = 0, uint64_t* p_awaiting_out = 0, uint64_t* p_mined = 0);
+void balance_via_wallet(const tools::wallet2& w, const crypto::public_key& asset_id, uint64_t* p_total, uint64_t* p_unlocked = 0, uint64_t* p_awaiting_in = 0, uint64_t* p_awaiting_out = 0, uint64_t* p_mined = 0);
#define INVALID_BALANCE_VAL std::numeric_limits::max()
bool check_balance_via_wallet(const tools::wallet2& w, const char* account_name,
uint64_t expected_total,
uint64_t expected_mined = INVALID_BALANCE_VAL,
uint64_t expected_unlocked = INVALID_BALANCE_VAL,
uint64_t expected_awaiting_in = INVALID_BALANCE_VAL,
- uint64_t expected_awaiting_out = INVALID_BALANCE_VAL);
+ uint64_t expected_awaiting_out = INVALID_BALANCE_VAL,
+ const crypto::public_key& asset_id = currency::native_coin_asset_id);
bool calculate_amounts_many_outs_have_and_no_outs_have(const uint64_t first_blocks_reward, uint64_t& amount_many_outs_have, uint64_t& amount_no_outs_have);
bool find_global_index_for_output(const std::vector& events, const crypto::hash& head_block_hash, const currency::transaction& reference_tx, const size_t reference_tx_out_index, uint64_t& global_index);
@@ -1112,9 +1113,10 @@ void append_vector_by_another_vector(U& dst, const V& src)
PRINT_EVENT_N_TEXT(VEC_EVENTS, "MAKE_NEXT_POS_BLOCK_TX1(" << #BLK_NAME << ")"); \
currency::block BLK_NAME = AUTO_VAL_INIT(BLK_NAME); \
{ \
- std::listtx_list; \
+ std::list tx_list; \
tx_list.push_back(TX_1); \
- generator.construct_block(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, tx_list, MINERS_ACC_LIST); \
+ if (!generator.construct_block(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, tx_list, MINERS_ACC_LIST)) \
+ return false; \
} \
VEC_EVENTS.push_back(BLK_NAME)
diff --git a/tests/core_tests/ionic_swap_tests.cpp b/tests/core_tests/ionic_swap_tests.cpp
index 690730ce..0ec0602d 100644
--- a/tests/core_tests/ionic_swap_tests.cpp
+++ b/tests/core_tests/ionic_swap_tests.cpp
@@ -10,6 +10,64 @@
#include "random_helper.h"
#include "tx_builder.h"
+using namespace currency;
+
+// Helpers
+
+bool check_ionic_swap_tx_outs(const std::vector& accounts, const currency::transaction& tx, std::shared_ptr w, const tools::wallet_public::ionic_swap_proposal& proposal)
+{
+ tools::mode_separate_context msc = AUTO_VAL_INIT(msc);
+ msc.tx_for_mode_separate = proposal.tx_template;
+
+ tools::wallet_public::ionic_swap_proposal_context ionic_context = AUTO_VAL_INIT(ionic_context);
+ bool r = w->get_ionic_swap_proposal_info(proposal, msc.proposal_info, ionic_context);
+ CHECK_AND_ASSERT_MES(r, false, "get_ionic_swap_proposal_info failed");
+
+ // decode all outputs amounts and asset_ids
+ std::vector> outs_amounts_and_asset_ids;
+ outs_amounts_and_asset_ids.resize(tx.vout.size());
+
+ //ionic_context.one_time_skey
+ const crypto::public_key& tx_pub_key = get_tx_pub_key_from_extra(tx);
+
+ for(size_t i = 0; i < tx.vout.size(); ++i)
+ {
+ VARIANT_SWITCH_BEGIN(tx.vout[i])
+ VARIANT_CASE_CONST(currency::tx_out_zarcanum, oz)
+ for(size_t k = 0; k < accounts.size(); ++k)
+ {
+ crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);
+ bool r = crypto::generate_key_derivation(tx_pub_key, accounts[k].get_keys().view_secret_key, derivation);
+ CHECK_AND_ASSERT_MES(r, false, "generate_key_derivation failed");
+ uint64_t decoded_amount = 0;
+ crypto::public_key decoded_asset_id{};
+ crypto::scalar_t amount_blinding_mask{};
+ crypto::scalar_t asset_id_blinding_mask{};
+ if (decode_output_amount_and_asset_id(oz, derivation, i, decoded_amount, decoded_asset_id, amount_blinding_mask, asset_id_blinding_mask))
+ {
+ outs_amounts_and_asset_ids[i] = std::make_pair(decoded_amount, decoded_asset_id);
+ break;
+ }
+ }
+ VARIANT_SWITCH_END()
+ }
+
+ static_assert(CURRENCY_TX_MIN_ALLOWED_OUTS >= 2);
+ const size_t expected_number_of_zero_amount_outputs = CURRENCY_TX_MIN_ALLOWED_OUTS - 2;
+ size_t zero_amount_outputs = 0;
+ for(auto& oaai : outs_amounts_and_asset_ids)
+ {
+ CHECK_AND_ASSERT_MES(oaai.second != null_pkey, false, "Not all outputs were decoded");
+ if (oaai.first == 0)
+ ++zero_amount_outputs;
+ }
+
+ CHECK_AND_ASSERT_MES(zero_amount_outputs <= expected_number_of_zero_amount_outputs, false, "zero_amount_outputs: " << zero_amount_outputs << ", expected_number_of_zero_amount_outputs: " << expected_number_of_zero_amount_outputs);
+
+ return true;
+}
+
+//----------------------------------------------------------------------------------------------------
ionic_swap_basic_test::ionic_swap_basic_test()
{
diff --git a/utils/boost_1.70_gcc_8.patch b/utils/boost_1.70_gcc_8.patch
new file mode 100644
index 00000000..812eed14
--- /dev/null
+++ b/utils/boost_1.70_gcc_8.patch
@@ -0,0 +1,15 @@
+# This patch fixes compilation issue in Boost 1.70-1.71 while it is being compiled by GCC ver >= 8.3
+# -- sowle
+# see also: https://github.com/boostorg/thread/pull/297
+#
+--- boost/thread/pthread/thread_data.hpp.orig 2023-10-10 20:22:30.860192033 +0000
++++ boost/thread/pthread/thread_data.hpp 2023-10-10 18:19:22.460764089 +0000
+@@ -57,7 +57,7 @@
+ #else
+ std::size_t page_size = ::sysconf( _SC_PAGESIZE);
+ #endif
+-#if PTHREAD_STACK_MIN > 0
++#ifdef PTHREAD_STACK_MIN
+ if (size