From ed62452853f7336900fee516d12442584e2ec288 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Wed, 10 Apr 2024 19:10:32 +0200 Subject: [PATCH] hardfork 5 --- src/currency_core/blockchain_storage.cpp | 4 ++++ src/currency_core/currency_config.h | 7 +++++-- src/currency_core/currency_format_utils.cpp | 6 ++++++ src/currency_core/currency_format_utils.h | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index eb6d0fb3..c12e5ca9 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -4038,6 +4038,10 @@ bool blockchain_storage::validate_asset_operation_against_current_blochain_state CHECK_AND_ASSERT_MES(!avc.asset_op_history, false, "asset with id " << avc.asset_id << " has already been registered"); avc.amount_to_validate = ado.descriptor.current_supply; CHECK_AND_ASSERT_MES(validate_asset_operation_amount_commitment(avc), false, "validate_asset_operation_amount_commitment failed!"); + if(this->is_hardfork_active(ZANO_HARDFORK_05)) + { + CHECK_AND_ASSERT_MES(validate_ado_initial(ado.descriptor), false, "validate_ado_initial failed!"); + } } else { diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index ddd37b57..2afc400a 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -264,12 +264,14 @@ #define ZANO_HARDFORK_02_AFTER_HEIGHT 999999 // 2021-04-05 09:11:45 #define ZANO_HARDFORK_03_AFTER_HEIGHT 1082577 // 2021-06-01 23:28:10 #define ZANO_HARDFORK_04_AFTER_HEIGHT 2555000 // 2024-03-21 11:49:55 +#define ZANO_HARDFORK_05_AFTER_HEIGHT 999999999999999999 #else /////// Zarcanum Testnet ////////////////////////////// #define ZANO_HARDFORK_01_AFTER_HEIGHT 0 #define ZANO_HARDFORK_02_AFTER_HEIGHT 0 #define ZANO_HARDFORK_03_AFTER_HEIGHT 0 -#define ZANO_HARDFORK_04_AFTER_HEIGHT 2440 +#define ZANO_HARDFORK_04_AFTER_HEIGHT 200 +#define ZANO_HARDFORK_05_AFTER_HEIGHT 200 #endif @@ -278,7 +280,8 @@ #define ZANO_HARDFORK_02 2 #define ZANO_HARDFORK_03 3 #define ZANO_HARDFORK_04_ZARCANUM 4 -#define ZANO_HARDFORKS_TOTAL 5 +#define ZANO_HARDFORK_05 5 +#define ZANO_HARDFORKS_TOTAL 6 diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index 32b43656..410d6a91 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -1152,6 +1152,12 @@ namespace currency return true; } //--------------------------------------------------------------- + bool validate_ado_initial(const asset_descriptor_base& new_ado) + { + if (new_ado.current_supply > new_ado.total_max_supply) return false; + return true; + } + //--------------------------------------------------------------- /* crypto::hash get_signature_hash_for_asset_operation(const asset_descriptor_operation& ado) { diff --git a/src/currency_core/currency_format_utils.h b/src/currency_core/currency_format_utils.h index 8f858303..70751c8d 100644 --- a/src/currency_core/currency_format_utils.h +++ b/src/currency_core/currency_format_utils.h @@ -276,6 +276,7 @@ namespace currency bool check_tx_bare_balance(const transaction& tx, uint64_t additional_inputs_amount_and_fees_for_mining_tx = 0); bool check_tx_balance(const transaction& tx, const crypto::hash& tx_id, uint64_t additional_inputs_amount_and_fees_for_mining_tx = 0); bool validate_asset_operation_amount_commitment(asset_op_verification_context& context); + const char* get_asset_operation_type_string(size_t asset_operation_type, bool short_name = false); //--------------------------------------------------------------- bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, @@ -463,7 +464,7 @@ namespace currency std::string generate_origin_for_htlc(const txout_htlc& htlc, const account_keys& acc_keys); bool validate_ado_update_allowed(const asset_descriptor_base& a, const asset_descriptor_base& b); - + bool validate_ado_initial(const asset_descriptor_base& a); void normalize_asset_operation_for_hashing(asset_descriptor_operation& op); crypto::hash get_signature_hash_for_asset_operation(const asset_descriptor_operation& ado);