From 3c19bb969d1badf5cbb7dc6874d6e3b4d0d61868 Mon Sep 17 00:00:00 2001 From: zano build machine Date: Thu, 2 Nov 2023 00:33:38 +0300 Subject: [PATCH 1/6] === build number: 153 -> 154 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index ba99b00a..3f3082ea 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -8,6 +8,6 @@ #define PROJECT_REVISION "2" #define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION -#define PROJECT_VERSION_BUILD_NO 153 +#define PROJECT_VERSION_BUILD_NO 154 #define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO) #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]" From c0ab3dc48a21c6e8a26bfce3c1ff595db1c7b8aa Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Mon, 6 Nov 2023 16:36:25 +0100 Subject: [PATCH 2/6] staking improvement in GUI version --- src/wallet/wallets_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp index 8b3bd2aa..16dfe0a3 100644 --- a/src/wallet/wallets_manager.cpp +++ b/src/wallet/wallets_manager.cpp @@ -1935,7 +1935,7 @@ void wallets_manager::wallet_vs_options::worker_func() { LOG_PRINT_GREEN("[WALLET_HANDLER] Wallet handler thread started, addr: " << w->get()->get_account().get_public_address_str(), LOG_LEVEL_0); epee::math_helper::once_a_time_seconds scan_pool_interval; - epee::math_helper::once_a_time_seconds pos_minin_interval; + epee::math_helper::once_a_time_seconds<2> pos_minin_interval; view::wallet_status_info wsi = AUTO_VAL_INIT(wsi); while (!major_stop) { From a151cab066fef33256aa6960f9da941c9f389f18 Mon Sep 17 00:00:00 2001 From: zano build machine Date: Mon, 6 Nov 2023 18:39:54 +0300 Subject: [PATCH 3/6] === build number: 154 -> 155 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index 3f3082ea..c54bd284 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -8,6 +8,6 @@ #define PROJECT_REVISION "2" #define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION -#define PROJECT_VERSION_BUILD_NO 154 +#define PROJECT_VERSION_BUILD_NO 155 #define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO) #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]" From 1f0faf2c8e95f19a446480b7a60217f56764cc90 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 9 Nov 2023 18:47:13 +0100 Subject: [PATCH 4/6] coretests: pos_mining_with_decoys improved to reveal a bug with staking using auditable wallets --- tests/core_tests/pos_basic_tests.cpp | 38 ++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tests/core_tests/pos_basic_tests.cpp b/tests/core_tests/pos_basic_tests.cpp index 6bc00a5d..3ea45e20 100644 --- a/tests/core_tests/pos_basic_tests.cpp +++ b/tests/core_tests/pos_basic_tests.cpp @@ -152,10 +152,11 @@ bool pos_mining_with_decoys::generate(std::vector& events) con { uint64_t ts = test_core_time::get_time(); m_accounts.resize(TOTAL_ACCS_COUNT); - currency::account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate(); miner_acc.set_createtime(ts); - currency::account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate(); alice_acc.set_createtime(ts); - currency::account_base& bob_acc = m_accounts[BOB_ACC_IDX]; bob_acc.generate(); bob_acc.set_createtime(ts); - currency::account_base& carol_acc = m_accounts[CAROL_ACC_IDX]; carol_acc.generate(); carol_acc.set_createtime(ts); + currency::account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate(); miner_acc.set_createtime(ts); + currency::account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate(); alice_acc.set_createtime(ts); + currency::account_base& bob_acc = m_accounts[BOB_ACC_IDX]; bob_acc.generate(); bob_acc.set_createtime(ts); + currency::account_base& carol_acc = m_accounts[CAROL_ACC_IDX]; carol_acc.generate(); carol_acc.set_createtime(ts); + currency::account_base& dan_acc = m_accounts[DAN_ACC_IDX]; dan_acc.generate(true); dan_acc.set_createtime(ts); // Dan has an auditable wallet MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, ts); DO_CALLBACK(events, "configure_core"); // default configure_core callback will initialize core runtime config with m_hardforks @@ -167,7 +168,8 @@ bool pos_mining_with_decoys::generate(std::vector& events) con CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed"); std::vector destinations; destinations.emplace_back(47 * TESTS_DEFAULT_FEE, alice_acc.get_public_address()); - destinations.emplace_back(47 * TESTS_DEFAULT_FEE, miner_acc.get_public_address()); // as a decoy for Alice + destinations.emplace_back(47 * TESTS_DEFAULT_FEE, miner_acc.get_public_address()); // as a decoy for Alice and Dan + destinations.emplace_back(47 * TESTS_DEFAULT_FEE, dan_acc.get_public_address()); destinations.emplace_back(5 * TESTS_DEFAULT_FEE, bob_acc.get_public_address()); destinations.emplace_back(COIN, carol_acc.get_public_address()); @@ -204,6 +206,10 @@ bool pos_mining_with_decoys::c1(currency::core& c, size_t ev_index, const std::v carol_wlt->refresh(); CHECK_AND_ASSERT_MES(check_balance_via_wallet(*carol_wlt, "Carol", COIN, INVALID_BALANCE_VAL, COIN), false, ""); + std::shared_ptr dan_wlt = init_playtime_test_wallet(events, c, m_accounts[DAN_ACC_IDX]); + dan_wlt->refresh(); + CHECK_AND_ASSERT_MES(check_balance_via_wallet(*dan_wlt, "Dan", 47 * TESTS_DEFAULT_FEE, INVALID_BALANCE_VAL, 47 * TESTS_DEFAULT_FEE), false, ""); + // 1. Alice should be able to mine a PoS block with 1 decoys (ring size == 2) size_t top_block_height = c.get_top_block_height(); @@ -225,6 +231,7 @@ bool pos_mining_with_decoys::c1(currency::core& c, size_t ev_index, const std::v // 2. Bob should only be able to mine a PoS block with zero decoys (ring size == 1) top_block_height = c.get_top_block_height(); + bob_wlt->refresh(); r = bob_wlt->try_mint_pos(m_accounts[BOB_ACC_IDX].get_public_address()); CHECK_AND_ASSERT_MES(r, false, "try_mint_pos failed"); @@ -242,6 +249,7 @@ bool pos_mining_with_decoys::c1(currency::core& c, size_t ev_index, const std::v // 3. Carol should only be able to mine a PoS block with CURRENCY_DEFAULT_DECOY_SET_SIZE decoys (ring size == CURRENCY_DEFAULT_DECOY_SET_SIZE + 1) top_block_height = c.get_top_block_height(); + carol_wlt->refresh(); r = carol_wlt->try_mint_pos(m_accounts[CAROL_ACC_IDX].get_public_address()); CHECK_AND_ASSERT_MES(r, false, "try_mint_pos failed"); @@ -255,5 +263,25 @@ bool pos_mining_with_decoys::c1(currency::core& c, size_t ev_index, const std::v CHECK_AND_ASSERT_MES(intk.key_offsets.size() == CURRENCY_DEFAULT_DECOY_SET_SIZE + 1, false, "unexpected ring size: " << intk.key_offsets.size()); } + + // 4. Dan has an auditable wallet that couldn't use mixins, but still he should be able to successfully mine a PoS block (ring size = 1, zero decoys) + top_block_height = c.get_top_block_height(); + + CHECK_AND_ASSERT_MES(dan_wlt->is_auditable(), false, "Dan's wallet is not auditable, which is unexpected"); + + dan_wlt->refresh(); + r = dan_wlt->try_mint_pos(m_accounts[DAN_ACC_IDX].get_public_address()); + CHECK_AND_ASSERT_MES(r, false, "try_mint_pos failed"); + + { + block b{}; + CHECK_AND_ASSERT_MES(c.get_blockchain_storage().get_top_block(b), false, ""); + CHECK_AND_ASSERT_MES(get_block_height(b) == top_block_height + 1, false, "unexpected top block height"); + + txin_to_key& intk = boost::get(b.miner_tx.vin[1]); + CHECK_AND_ASSERT_MES(intk.amount == 47 * TESTS_DEFAULT_FEE, false, "incorrect amount: " << intk.amount); + CHECK_AND_ASSERT_MES(intk.key_offsets.size() == 1, false, "unexpected ring size: " << intk.key_offsets.size()); + } + return true; } From ee89a6ce128692fc99e509a98748a325ba80c86c Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 9 Nov 2023 19:25:06 +0100 Subject: [PATCH 5/6] wallet2: auditable wallets won't be requesting decoys for PoS anymore as they couldn't be used --- src/wallet/wallet2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a4edf54c..377d667d 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3512,7 +3512,7 @@ bool wallet2::prepare_and_sign_pos_block(const currency::pos_entry& pe, currency COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response decoys_resp = AUTO_VAL_INIT(decoys_resp); std::vector ring; uint64_t secret_index = 0; // index of the real stake output - if (m_required_decoys_count > 0) + if (m_required_decoys_count > 0 && !is_auditable()) { COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request decoys_req = AUTO_VAL_INIT(decoys_req); decoys_req.use_forced_mix_outs = false; From f9cabb0bd2b0e7db294859300ebb3ea10d16b294 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 9 Nov 2023 19:42:06 +0100 Subject: [PATCH 6/6] === build number: 155 -> 156 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index c54bd284..9dfd81f9 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -8,6 +8,6 @@ #define PROJECT_REVISION "2" #define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION -#define PROJECT_VERSION_BUILD_NO 155 +#define PROJECT_VERSION_BUILD_NO 156 #define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO) #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"