Skip to content

Commit

Permalink
Haven 4.1 hard fork bugfixing and finalization (#74)
Browse files Browse the repository at this point in the history
* 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 <user.email>
  • Loading branch information
Tay8NWWFKpz9JT4NXU0w authored Aug 22, 2024
1 parent 3fd2729 commit c8f9475
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/cryptonote_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/hardforks/hardforks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/ringct/rctSigs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 5 additions & 4 deletions src/simplewallet/simplewallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <unsigned int>\n "
" How many seconds to wait before locking the wallet (0 to disable)."));
m_cmd_binder.set_handler("encrypted_seed",
Expand Down Expand Up @@ -3979,6 +3979,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &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
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit c8f9475

Please sign in to comment.