From c8f94752303852c8f62b65d477fc52c71e435608 Mon Sep 17 00:00:00 2001 From: Tay8NWWFKpz9JT4NXU0w Date: Thu, 22 Aug 2024 16:18:08 +0000 Subject: [PATCH] Haven 4.1 hard fork bugfixing and finalization (#74) * initial implementation of burn in the CLI * additional CLI burn related changes * bugfix - burn tx should not be possible before Haven 4.1 * fix warning message typo * finalize hardfork time * limit txn fee * add enable-burn-experimental to set values in CLI * fix display issues with xasset converions * rewording of CLI help message --------- Co-authored-by: Tay8NWWFKpz9JT4NXU0w --- src/cryptonote_config.h | 4 +++- src/hardforks/hardforks.cpp | 4 ++-- src/ringct/rctSigs.cpp | 1 + src/simplewallet/simplewallet.cpp | 9 +++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 30bc047b9..a7c51448c 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -261,6 +261,8 @@ #define HF_VERSION_BURN 24 #define HF_VERSION_CONVERSION_FEES_NOT_BURNT_FINAL 24 #define HF_VERSION_OFFSHORE_FEES_V3 24 +#define HF_VERSION_MAX_CONV_TRANSACTION_FEE 24 +#define MAX_CONV_TRANSACTION_FEE ((uint64_t)10000000000000ull) #define STAGENET_VERSION 0x0e @@ -272,7 +274,7 @@ #define BURNT_CONVERSION_FEES_MINT_HEIGHT ((uint64_t)1656720) #define BURNT_CONVERSION_FEES_MINT_AMOUNT_FINAL ((uint64_t)511812000000000000ull) -#define BURNT_CONVERSION_FEES_MINT_HEIGHT_FINAL ((uint64_t)1692002) +#define BURNT_CONVERSION_FEES_MINT_HEIGHT_FINAL ((uint64_t)1692780) #define PER_KB_FEE_QUANTIZATION_DECIMALS 8 #define CRYPTONOTE_SCALING_2021_FEE_ROUNDING_PLACES 2 diff --git a/src/hardforks/hardforks.cpp b/src/hardforks/hardforks.cpp index ba6892e0b..deca2ef5d 100644 --- a/src/hardforks/hardforks.cpp +++ b/src/hardforks/hardforks.cpp @@ -49,8 +49,8 @@ const hardfork_t mainnet_hard_forks[] = { { 20, 1272875, 0, 1671618321 }, // Fork time is on or around 9th January 2023 at 10:00 GMT. Fork time finalised on 2022-12-21. { 21, 1439500, 0, 1690797000 }, // Fork time is on or around 29th August 2023 at 10:00 GMT. Fork time finalised on 2023-07-31. { 22, 1439544, 0, 1693999500 }, // Fork time is on or around 29th August 2023 at 12:05 GMT. Fork time finalised on 2023-09-06. - { 23, 1656000, 0, 1719672007 }, // Fork time is on or around 8th July 2024 at 09:00 GMT. Fork time finalised on 2024-06-29. - { 24, 1691182, 0, 1724716500 } // Fork time is on or around 26th August 2024 at 23:55 GMT. + { 23, 1656000, 0, 1719672007 }, // Fork time is on or around 8th July 2024 at 09:00 GMT. Fork time finalised on 2024-06-29. + { 24, 1692720, 0, 1724274501 } // Fork time is on or around 28th August 2024 at 11:00 GMT. Fork time finalised on 2024-09-21. }; const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]); const uint64_t mainnet_hard_fork_version_1_till = 1009826; diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index 163900a5c..ff36172f5 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -1699,6 +1699,7 @@ namespace rct { if (tx_type == tt::OFFSHORE || tx_type == tt::ONSHORE) CHECK_AND_ASSERT_MES(amount_collateral, false, "0 collateral requirement something went wrong! rejecting tx.."); } + CHECK_AND_ASSERT_MES(version < HF_VERSION_MAX_CONV_TRANSACTION_FEE || rv.txnFee < MAX_CONV_TRANSACTION_FEE, false, "Transaction fee too high! rejecting tx.."); } if (strSource == strDest) { diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index a69ca74cd..4729b2fc9 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -3562,7 +3562,7 @@ simple_wallet::simple_wallet() "enable-multisig-experimental <1|0>\n " " Set this to allow multisig commands. Multisig may currently be exploitable if parties do not trust each other.\n " "enable-burn-experimental <1|0>\n " - " Set this to allow burning of funds. This feature can result in complete funds loss. Do not use.\n " + " Set this to allow burning of funds. This feature can result in complete loss of funds. Do not use.\n " "inactivity-lock-timeout \n " " How many seconds to wait before locking the wallet (0 to disable).")); m_cmd_binder.set_handler("encrypted_seed", @@ -3979,6 +3979,7 @@ bool simple_wallet::set_variable(const std::vector &args) success_msg_writer() << "credits-target = " << m_wallet->credits_target(); success_msg_writer() << "load-deprecated-formats = " << m_wallet->load_deprecated_formats(); success_msg_writer() << "enable-multisig-experimental = " << m_wallet->is_multisig_enabled(); + success_msg_writer() << "enable-burn-experimental = " << m_wallet->is_burn_enabled(); return true; } else @@ -7183,7 +7184,7 @@ bool simple_wallet::transfer_main( if (total_suppy_burnt > 0) { message_writer(console_color_red, false) << boost::format(tr("WARNING WARNING WARNING !!!.\n")); message_writer(console_color_red, false) << boost::format(tr("PERMANENTLY DESTROYING %s %s , MAKE SURE THIS IS INTENTIONAL !!!.\n")) % print_money(total_suppy_burnt) % source_asset; - message_writer(console_color_red, false) << boost::format(tr("ABORT IMMEDIATELLY UNLESS ABSOLUTELY CERTAIN !!!.\n")); + message_writer(console_color_red, false) << boost::format(tr("ABORT IMMEDIATELY UNLESS ABSOLUTELY CERTAIN !!!.\n")); prompt << boost::format(tr("!!!! PERMANENTLY DESTROYING %s %s , MAKE SURE THIS IS INTENTIONAL !!!.\n")) % print_money(total_suppy_burnt) % source_asset; } } else { @@ -7205,11 +7206,11 @@ bool simple_wallet::transfer_main( break; case tt::XUSD_TO_XASSET: conversion_fee_in_C = (total_sent * 3) / 200; - prompt << boost::format(tr("Converting %s XUSD (of which %s XUSD is slippage which is %s) to %s %s.\n")) % print_pct(total_slippage_pct, 2) % print_money(total_sent) % print_money(total_slippage) % print_money(total_received) % dest_asset; + prompt << boost::format(tr("Converting %s XUSD (of which %s XUSD is slippage which is %s) to %s %s.\n")) % print_money(total_sent) % print_money(total_slippage) % print_pct(total_slippage_pct, 2) % print_money(total_received) % dest_asset; break; case tt::XASSET_TO_XUSD: conversion_fee_in_C = (total_sent * 3) / 200; - prompt << boost::format(tr("Converting %s %s (of which %s %s is slippage which is %s) to %s XUSD.\n")) % print_pct(total_slippage_pct, 2) % print_money(total_sent) % source_asset % print_money(total_slippage) % source_asset % print_money(total_received); + prompt << boost::format(tr("Converting %s %s (of which %s %s is slippage which is %s) to %s XUSD.\n")) % print_money(total_sent) % source_asset % print_money(total_slippage) % source_asset % print_pct(total_slippage_pct, 2) % print_money(total_received); break; default: break;