From dd85d5dea665dd456c8b6d7d3c50dbecb35d507e Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Thu, 16 May 2024 21:15:25 +0200 Subject: [PATCH 01/19] Add S8 pubkeys (placeholder) and HF estimate --- src/komodo_hardfork.cpp | 72 +++++++++++++++++++++++++++++++++++++++++ src/komodo_hardfork.h | 9 ++++-- 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index 14d4818ec96..75bc3bc4df5 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -1,3 +1,5 @@ +#include +#include #include "komodo_hardfork.h" const uint32_t nStakedDecemberHardforkTimestamp = 1576840000; //December 2019 hardfork 12/20/2019 @ 11:06am (UTC) @@ -15,6 +17,9 @@ const int32_t nS6HardforkHeight = 2963330; // dPoW Season 6, Fri Jun 24 2022 const uint32_t nS7Timestamp = 1688132253; // dPoW Season 7, Fri Jun 30 2023 13:37:33 GMT+0000 const int32_t nS7HardforkHeight = 3484958; // dPoW Season 7, Fri Jun 30 2023 +const uint32_t nS8Timestamp = 1726321053; // dPoW Season 8, Sat Sep 14 2024 13:37:33 GMT+0000 +const int32_t nS8HardforkHeight = 4100333; // dPoW Season 8, Sat Sep 14 2024 + // Era array of pubkeys. Add extra seasons to bottom as requried, after adding appropriate info above. const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = { @@ -550,5 +555,72 @@ const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = {"dragonhound_EU", "0286d7af8583e18127bd1f45730916b4f48ae3e0c90181b2745174b91b76c6e28b"}, {"dragonhound_NA", "0306476ea5fb67aec667172a9bb30646dbff195b84c30ac958175af9b475987802"}, {"dragonhound_DEV", "02f9a7b49282885cd03969f1f5478287497bc8edfceee9eac676053c107c5fcdaf"} + }, + { + // Season 8 (placeholder) + {"nodename_0", "0000000000000000000000000000000000000000000000000000000000000000"}, // 0 + {"nodename_1", "0000000000000000000000000000000000000000000000000000000000000001"}, + {"nodename_2", "0000000000000000000000000000000000000000000000000000000000000002"}, + {"nodename_3", "0000000000000000000000000000000000000000000000000000000000000003"}, + {"nodename_4", "0000000000000000000000000000000000000000000000000000000000000004"}, + {"nodename_5", "0000000000000000000000000000000000000000000000000000000000000005"}, + {"nodename_6", "0000000000000000000000000000000000000000000000000000000000000006"}, + {"nodename_7", "0000000000000000000000000000000000000000000000000000000000000007"}, + {"nodename_8", "0000000000000000000000000000000000000000000000000000000000000008"}, + {"nodename_9", "0000000000000000000000000000000000000000000000000000000000000009"}, + {"nodename_10", "0000000000000000000000000000000000000000000000000000000000000010"}, // 10 + {"nodename_11", "0000000000000000000000000000000000000000000000000000000000000011"}, + {"nodename_12", "0000000000000000000000000000000000000000000000000000000000000012"}, + {"nodename_13", "0000000000000000000000000000000000000000000000000000000000000013"}, + {"nodename_14", "0000000000000000000000000000000000000000000000000000000000000014"}, + {"nodename_15", "0000000000000000000000000000000000000000000000000000000000000015"}, + {"nodename_16", "0000000000000000000000000000000000000000000000000000000000000016"}, + {"nodename_17", "0000000000000000000000000000000000000000000000000000000000000017"}, + {"nodename_18", "0000000000000000000000000000000000000000000000000000000000000018"}, + {"nodename_19", "0000000000000000000000000000000000000000000000000000000000000019"}, + {"nodename_20", "0000000000000000000000000000000000000000000000000000000000000020"}, // 20 + {"nodename_21", "0000000000000000000000000000000000000000000000000000000000000021"}, + {"nodename_22", "0000000000000000000000000000000000000000000000000000000000000022"}, + {"nodename_23", "0000000000000000000000000000000000000000000000000000000000000023"}, + {"nodename_24", "0000000000000000000000000000000000000000000000000000000000000024"}, + {"nodename_25", "0000000000000000000000000000000000000000000000000000000000000025"}, + {"nodename_26", "0000000000000000000000000000000000000000000000000000000000000026"}, + {"nodename_27", "0000000000000000000000000000000000000000000000000000000000000027"}, + {"nodename_28", "0000000000000000000000000000000000000000000000000000000000000028"}, + {"nodename_29", "0000000000000000000000000000000000000000000000000000000000000029"}, + {"nodename_30", "0000000000000000000000000000000000000000000000000000000000000030"}, // 30 + {"nodename_31", "0000000000000000000000000000000000000000000000000000000000000031"}, + {"nodename_32", "0000000000000000000000000000000000000000000000000000000000000032"}, + {"nodename_33", "0000000000000000000000000000000000000000000000000000000000000033"}, + {"nodename_34", "0000000000000000000000000000000000000000000000000000000000000034"}, + {"nodename_35", "0000000000000000000000000000000000000000000000000000000000000035"}, + {"nodename_36", "0000000000000000000000000000000000000000000000000000000000000036"}, + {"nodename_37", "0000000000000000000000000000000000000000000000000000000000000037"}, + {"nodename_38", "0000000000000000000000000000000000000000000000000000000000000038"}, + {"nodename_39", "0000000000000000000000000000000000000000000000000000000000000039"}, + {"nodename_40", "0000000000000000000000000000000000000000000000000000000000000040"}, // 40 + {"nodename_41", "0000000000000000000000000000000000000000000000000000000000000041"}, + {"nodename_42", "0000000000000000000000000000000000000000000000000000000000000042"}, + {"nodename_43", "0000000000000000000000000000000000000000000000000000000000000043"}, + {"nodename_44", "0000000000000000000000000000000000000000000000000000000000000044"}, + {"nodename_45", "0000000000000000000000000000000000000000000000000000000000000045"}, + {"nodename_46", "0000000000000000000000000000000000000000000000000000000000000046"}, + {"nodename_47", "0000000000000000000000000000000000000000000000000000000000000047"}, + {"nodename_48", "0000000000000000000000000000000000000000000000000000000000000048"}, + {"nodename_49", "0000000000000000000000000000000000000000000000000000000000000049"}, + {"nodename_50", "0000000000000000000000000000000000000000000000000000000000000050"}, // 50 + {"nodename_51", "0000000000000000000000000000000000000000000000000000000000000051"}, + {"nodename_52", "0000000000000000000000000000000000000000000000000000000000000052"}, + {"nodename_53", "0000000000000000000000000000000000000000000000000000000000000053"}, + {"nodename_54", "0000000000000000000000000000000000000000000000000000000000000054"}, + {"nodename_55", "0000000000000000000000000000000000000000000000000000000000000055"}, + {"nodename_56", "0000000000000000000000000000000000000000000000000000000000000056"}, + {"nodename_57", "0000000000000000000000000000000000000000000000000000000000000057"}, + {"nodename_58", "0000000000000000000000000000000000000000000000000000000000000058"}, + {"nodename_59", "0000000000000000000000000000000000000000000000000000000000000059"}, + {"nodename_60", "0000000000000000000000000000000000000000000000000000000000000060"}, // 60 + {"nodename_61", "0000000000000000000000000000000000000000000000000000000000000061"}, + {"nodename_62", "0000000000000000000000000000000000000000000000000000000000000062"}, + {"nodename_63", "0000000000000000000000000000000000000000000000000000000000000063"} } }; diff --git a/src/komodo_hardfork.h b/src/komodo_hardfork.h index 6692c81b121..02c70896d0b 100644 --- a/src/komodo_hardfork.h +++ b/src/komodo_hardfork.h @@ -1,7 +1,7 @@ #pragma once #include -#define NUM_KMD_SEASONS 8 +#define NUM_KMD_SEASONS 9 #define NUM_KMD_NOTARIES 64 extern const uint32_t nStakedDecemberHardforkTimestamp; //December 2019 hardfork @@ -19,8 +19,11 @@ extern const int32_t nS6HardforkHeight; // dPoW Season 6, Fri Jun 24 2022 extern const uint32_t nS7Timestamp; // dPoW Season 7, Fri Jun 30 2023 13:37:33 GMT+0000 extern const int32_t nS7HardforkHeight; // dPoW Season 7, Fri Jun 30 2023 -static const uint32_t KMD_SEASON_TIMESTAMPS[NUM_KMD_SEASONS] = {1525132800, 1563148800, nStakedDecemberHardforkTimestamp, nS4Timestamp, nS5Timestamp, nS6Timestamp, nS7Timestamp, 1951328000}; -static const int32_t KMD_SEASON_HEIGHTS[NUM_KMD_SEASONS] = {814000, 1444000, nDecemberHardforkHeight, nS4HardforkHeight, nS5HardforkHeight, nS6HardforkHeight, nS7HardforkHeight, 8113400}; +extern const uint32_t nS8Timestamp; // dPoW Season 8, Sat Sep 14 2024 13:37:33 GMT+0000 +extern const int32_t nS8HardforkHeight; // dPoW Season 8, Sat Sep 14 2024 + +static const uint32_t KMD_SEASON_TIMESTAMPS[NUM_KMD_SEASONS] = {1525132800, 1563148800, nStakedDecemberHardforkTimestamp, nS4Timestamp, nS5Timestamp, nS6Timestamp, nS7Timestamp, nS8Timestamp, 1951328000}; +static const int32_t KMD_SEASON_HEIGHTS[NUM_KMD_SEASONS] = {814000, 1444000, nDecemberHardforkHeight, nS4HardforkHeight, nS5HardforkHeight, nS6HardforkHeight, nS7HardforkHeight, nS8HardforkHeight, 8113400}; extern char NOTARYADDRS[64][64]; extern char NOTARY_ADDRESSES[NUM_KMD_SEASONS][64][64]; From 750be5727dde85e63ae8cee4b6c7c98d4a626f80 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Thu, 16 May 2024 21:39:17 +0200 Subject: [PATCH 02/19] add NotaryChecker class and its instance Pre-check the public keys array, season heights, and timestamps before launching the daemon. This check prevents the daemon from launching if some information in the important arrays is incorrectly filled. --- src/komodo_hardfork.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index 75bc3bc4df5..35f4df59943 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -624,3 +624,44 @@ const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = {"nodename_63", "0000000000000000000000000000000000000000000000000000000000000063"} } }; + +class NotaryChecker { +public: + NotaryChecker() { + checkSeasons(); + checkNotaries(); + } + +private: + void checkSeasons() const { + for (size_t i = 0; i < NUM_KMD_SEASONS; ++i) { + assert(KMD_SEASON_TIMESTAMPS[i] != 0 && "KMD_SEASON_TIMESTAMPS is invalid"); + assert(KMD_SEASON_HEIGHTS[i] != 0 && "KMD_SEASON_HEIGHTS is invalid"); + } + } + + void checkNotaries() const { + for (int season = 0; season < NUM_KMD_SEASONS; ++season) { + for (int notary = 0; notary < NUM_KMD_NOTARIES; ++notary) { + const char* name = notaries_elected[season][notary][0]; + const char* pubkey = notaries_elected[season][notary][1]; + assert(name != nullptr && "Notary name is null"); + assert(pubkey != nullptr && "Notary pubkey is null"); + assert(isValidPubkey(pubkey) && "Notary pubkey is invalid"); + } + } + } + + bool isValidPubkey(const char* str) const { + if (strlen(str) != 66) return false; + if (str[0] != '0' || (str[1] != '2' && str[1] != '3')) return false; + for (int i = 2; i < 66; ++i) { + if (!((str[i] >= '0' && str[i] <= '9') || (str[i] >= 'a' && str[i] <= 'f') || (str[i] >= 'A' && str[i] <= 'F'))) { + return false; + } + } + return true; + } +}; + +NotaryChecker notaryChecker; \ No newline at end of file From 372a5ec2eda57fa9c4d118c343dc91715101278e Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Thu, 16 May 2024 21:46:32 +0200 Subject: [PATCH 03/19] bump version [0.8.3] --- configure.ac | 2 +- src/clientversion.h | 2 +- src/rpc/misc.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index eaa9df7273b..183c68a279a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 8) -define(_CLIENT_VERSION_REVISION, 2) +define(_CLIENT_VERSION_REVISION, 3) define(_CLIENT_VERSION_BUILD, 0) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) diff --git a/src/clientversion.h b/src/clientversion.h index 952b67c4ab9..4c162520572 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -32,7 +32,7 @@ //! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 8 -#define CLIENT_VERSION_REVISION 2 +#define CLIENT_VERSION_REVISION 3 #define CLIENT_VERSION_BUILD 0 //! Set to true for release, false for prerelease or test build diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index ff1deca9bb9..1065862d76c 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -81,7 +81,7 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress); uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount); int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);*/ -#define KOMODO_VERSION "0.8.2" +#define KOMODO_VERSION "0.8.3" extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; extern uint32_t ASSETCHAINS_MAGIC,ASSETCHAINS_ALGO; From b932faa89de68578f968bfdce718b0cd5a4636da Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Thu, 16 May 2024 21:49:51 +0200 Subject: [PATCH 04/19] bump (min) protocol version --- src/version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/version.h b/src/version.h index ba4212ce0dc..7262c462d41 100644 --- a/src/version.h +++ b/src/version.h @@ -24,7 +24,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 170012; +static const int PROTOCOL_VERSION = 170013; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -33,8 +33,8 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 31800; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 170011; -static const int STAKEDMIN_PEER_PROTO_VERSION = 170011; +static const int MIN_PEER_PROTO_VERSION = 170012; +static const int STAKEDMIN_PEER_PROTO_VERSION = 170012; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this From 69c2577f979e1d166655be89b891f89206493a9f Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Thu, 16 May 2024 21:58:34 +0200 Subject: [PATCH 05/19] update DEPRECATION_HEIGHT to 4820333 (S9 approximated time + extra) --- src/deprecation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deprecation.h b/src/deprecation.h index 25a0a6afdbc..29fb93eba1e 100644 --- a/src/deprecation.h +++ b/src/deprecation.h @@ -24,7 +24,7 @@ // * Shut down WEEKS_UNTIL_DEPRECATION weeks' worth of blocks after the estimated release block height. // * A warning is shown during the DEPRECATION_WARN_LIMIT worth of blocks prior to shut down. static const int WEEKS_UNTIL_DEPRECATION = 52; -static const int DEPRECATION_HEIGHT = 4320000; //TODO: use [last_season_array_item - 1] + 650.000 for automagic update +static const int DEPRECATION_HEIGHT = 4820333; //TODO: use [last_season_array_item - 1] + 650.000 for automagic update static const int APPROX_RELEASE_HEIGHT = DEPRECATION_HEIGHT - (WEEKS_UNTIL_DEPRECATION * 7 * 24 * 60); // Number of blocks before deprecation to warn users From 82eece456a3dd5712134be7f299437754a711c79 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 17 May 2024 22:56:07 +0200 Subject: [PATCH 06/19] KIP-0002: block subsidy reduction implementation https://github.com/KomodoPlatform/kips/blob/main/kips/kip-0002.mediawiki --- src/main.cpp | 47 +++++++++-------------------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c0131cd55fe..e93f65528c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2419,45 +2419,16 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW) CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { - int32_t numhalvings,i; uint64_t numerator; CAmount nSubsidy = 3 * COIN; - if ( chainName.isKMD() ) - { - if ( nHeight == 1 ) - return(100000000 * COIN); // ICO allocation - else if ( nHeight < KOMODO_ENDOFERA ) - return(3 * COIN); - else if ( nHeight < 2*KOMODO_ENDOFERA ) - return(2 * COIN); - else return(COIN); - } - else - { - return(komodo_ac_block_subsidy(nHeight)); + if (chainName.isKMD()) { + if (nHeight == 1) + return 100000000 * COIN; // ICO allocation + else if (nHeight < nS8HardforkHeight) + return 3 * COIN; + else + return COIN; // KIP-0002, https://github.com/KomodoPlatform/kips/blob/main/kips/kip-0002.mediawiki + } else { + return komodo_ac_block_subsidy(nHeight); } - /* - // Mining slow start - // The subsidy is ramped up linearly, skipping the middle payout of - // MAX_SUBSIDY/2 to keep the monetary curve consistent with no slow start. - if (nHeight < consensusParams.nSubsidySlowStartInterval / 2) { - nSubsidy /= consensusParams.nSubsidySlowStartInterval; - nSubsidy *= nHeight; - return nSubsidy; - } else if (nHeight < consensusParams.nSubsidySlowStartInterval) { - nSubsidy /= consensusParams.nSubsidySlowStartInterval; - nSubsidy *= (nHeight+1); - return nSubsidy; - } - - assert(nHeight > consensusParams.SubsidySlowStartShift()); - int halvings = (nHeight - consensusParams.SubsidySlowStartShift()) / consensusParams.nSubsidyHalvingInterval;*/ - // Force block reward to zero when right shift is undefined. - //int halvings = nHeight / consensusParams.nSubsidyHalvingInterval; - //if (halvings >= 64) - // return 0; - - // Subsidy is cut in half every 840,000 blocks which will occur approximately every 4 years. - //nSubsidy >>= halvings; - //return nSubsidy; } bool IsInitialBlockDownload() From f5a8ea237188de7d9aa651183f516560b676eb73 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Mon, 20 May 2024 20:29:00 +0200 Subject: [PATCH 07/19] KIP0003: add fee burning in blocktemplate (coinbase) --- src/komodo_hardfork.cpp | 2 ++ src/komodo_hardfork.h | 2 ++ src/miner.cpp | 14 +++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index 35f4df59943..91c6f761aa0 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -20,6 +20,8 @@ const int32_t nS7HardforkHeight = 3484958; // dPoW Season 7, Fri Jun 30 2023 const uint32_t nS8Timestamp = 1726321053; // dPoW Season 8, Sat Sep 14 2024 13:37:33 GMT+0000 const int32_t nS8HardforkHeight = 4100333; // dPoW Season 8, Sat Sep 14 2024 +const int32_t nKIP0003Activation = nS8HardforkHeight; + // Era array of pubkeys. Add extra seasons to bottom as requried, after adding appropriate info above. const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = { diff --git a/src/komodo_hardfork.h b/src/komodo_hardfork.h index 02c70896d0b..cb6286ba846 100644 --- a/src/komodo_hardfork.h +++ b/src/komodo_hardfork.h @@ -22,6 +22,8 @@ extern const int32_t nS7HardforkHeight; // dPoW Season 7, Fri Jun 30 2023 extern const uint32_t nS8Timestamp; // dPoW Season 8, Sat Sep 14 2024 13:37:33 GMT+0000 extern const int32_t nS8HardforkHeight; // dPoW Season 8, Sat Sep 14 2024 +extern const int32_t nKIP0003Activation; // https://github.com/KomodoPlatform/kips/blob/main/kips/kip-0003.mediawiki + static const uint32_t KMD_SEASON_TIMESTAMPS[NUM_KMD_SEASONS] = {1525132800, 1563148800, nStakedDecemberHardforkTimestamp, nS4Timestamp, nS5Timestamp, nS6Timestamp, nS7Timestamp, nS8Timestamp, 1951328000}; static const int32_t KMD_SEASON_HEIGHTS[NUM_KMD_SEASONS] = {814000, 1444000, nDecemberHardforkHeight, nS4HardforkHeight, nS5HardforkHeight, nS6HardforkHeight, nS7HardforkHeight, nS8HardforkHeight, 8113400}; diff --git a/src/miner.cpp b/src/miner.cpp index 09b931eca03..794078a85ec 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -693,8 +693,20 @@ CBlockTemplate* CreateNewBlock(const CPubKey _pk, const CScript& _scriptPubKeyIn txNew.vin[0].scriptSig = (CScript() << nHeight << CScriptNum(1)) + COINBASE_FLAGS; txNew.vout.resize(1); txNew.vout[0].scriptPubKey = scriptPubKeyIn; - txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees; + txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams); txNew.nExpiryHeight = 0; + + // KIP0003 - fee burning + if (chainName.isKMD() && nHeight >= nKIP0003Activation) + { + CTxOut burnOpRet(nFees, CScript() << OP_RETURN); + txNew.vout.push_back(burnOpRet); + } + else + { + txNew.vout[0].nValue += nFees; + } + if ( ASSETCHAINS_ADAPTIVEPOW <= 0 ) txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetTime()); else txNew.nLockTime = std::max((int64_t)(pindexPrev->nTime+1), GetTime()); From 03717c99150c6195a4423ef861912b9191aef4e6 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Mon, 20 May 2024 22:24:20 +0200 Subject: [PATCH 08/19] KIP0003: fix deal with extra 5k sat in coinbase --- src/miner.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 794078a85ec..3814a87dbec 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -696,11 +696,19 @@ CBlockTemplate* CreateNewBlock(const CPubKey _pk, const CScript& _scriptPubKeyIn txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams); txNew.nExpiryHeight = 0; - // KIP0003 - fee burning - if (chainName.isKMD() && nHeight >= nKIP0003Activation) + if (chainName.isKMD()) { - CTxOut burnOpRet(nFees, CScript() << OP_RETURN); - txNew.vout.push_back(burnOpRet); + bool fAdd5kSat = IS_KOMODO_NOTARY && My_notaryid >= 0; + if (nHeight < nKIP0003Activation) + { + txNew.vout[0].nValue += nFees + (fAdd5kSat ? 5000 : 0); + } + else + { + // KIP0003 - fee burning + CTxOut burnOpRet(nFees + (fAdd5kSat ? 5000 : 0), CScript() << OP_RETURN); + txNew.vout.push_back(burnOpRet); + } } else { @@ -711,8 +719,6 @@ CBlockTemplate* CreateNewBlock(const CPubKey _pk, const CScript& _scriptPubKeyIn txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetTime()); else txNew.nLockTime = std::max((int64_t)(pindexPrev->nTime+1), GetTime()); - if ( chainName.isKMD() && IS_KOMODO_NOTARY && My_notaryid >= 0 ) - txNew.vout[0].nValue += 5000; pblock->vtx[0] = txNew; uint64_t commission; From b95262bceb68ce3cd4c2e1775ced4372104ca345 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Mon, 20 May 2024 23:30:54 +0200 Subject: [PATCH 09/19] check deposit: remove the non-reachable condition. In the real KMD chain (not in the first blocks), block.nBits will always be greater than KOMODO_MINDIFF_NBITS. Therefore, the control will never enter this conditional statement. Also "fee stealing" is impossible, since we have notary proof tx (last tx in notary mined block). --- src/komodo_gateway.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/komodo_gateway.cpp b/src/komodo_gateway.cpp index 6f374393085..0401ba39134 100644 --- a/src/komodo_gateway.cpp +++ b/src/komodo_gateway.cpp @@ -186,12 +186,6 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) return(-1); } } - else if ( block.nBits == KOMODO_MINDIFF_NBITS && total > 0 ) // to deal with fee stealing - { - fprintf(stderr,"notary mined ht.%d with extra %.8f\n",height,dstr(total)); - if ( height > KOMODO_NOTARIES_HEIGHT1 ) - return(-1); - } if ( strangeout != 0 || notmatched != 0 ) { if ( 0 && strcmp(NOTARY_PUBKEY.c_str(),"03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828") == 0 ) From 0475d132639931978f05041ab46adedaccbf1bd1 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Mon, 20 May 2024 23:37:35 +0200 Subject: [PATCH 10/19] check deposit: allow additional vouts in coinbase For some reason, we were not allowed to have additional vouts in the coinbase transaction if their total was greater than 0.1 KMD. Therefore, a coinbase transaction with 2.8 KMD in vout[0] and 0.2 KMD in vout[1] was forbidden. Since this release, we are allowing such transactions. We are not using height activation here to keep the code simple; instead, we have just removed the restriction itself. --- src/komodo_gateway.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.cpp b/src/komodo_gateway.cpp index 0401ba39134..d374a60c6e7 100644 --- a/src/komodo_gateway.cpp +++ b/src/komodo_gateway.cpp @@ -177,7 +177,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) } if ( chainName.isKMD() ) { - if ( overflow != 0 || total > COIN/10 ) + if ( overflow != 0 ) { if ( height >= activation ) { From 65bfb2f6099adde0e269bc6f45b193a29f72524e Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Tue, 21 May 2024 23:14:20 +0200 Subject: [PATCH 11/19] add KIP0003 consensus rule for NN (now with logging only) --- src/komodo_bitcoind.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.cpp b/src/komodo_bitcoind.cpp index 51b60755c05..c6a533f2123 100644 --- a/src/komodo_bitcoind.cpp +++ b/src/komodo_bitcoind.cpp @@ -2032,7 +2032,40 @@ int32_t komodo_checkPOW(int64_t stakeTxValue, int32_t slowflag,CBlock *pblock,in } } -//fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed); + /* + KIP0003 partial (for S8) consensus rule implementation. If it's an easy-mined + block (i.e., produced by a notary), the coinbase should have at only two + vouts. The first vout should be equal to the block reward (BR), and the second + should reflect a burned fee. Even if the fee in the block is zero, a 0-value + OP_RETURN second vout should exist to indicate that the block producer supports + KIP0003. We will not calculate fees for each transaction here for simplicity. + We will just check that the coinbase's first vout amount pays exactly the block + reward or less. This will mean that fees are burned anyway. Before the beginning + of S9, this rule should be removed, and a common rule (for both easy-mined and + regular blocks) for KIP0003 with nFees burned amount check should be placed in + ConnectBlock. + */ + + if (chainName.isKMD() && height > nKIP0003Activation && possible != 0 && failed != 0 && notaryid != -1) + { + // it's a P2PK block with hash > bnTarget and mined by notary with index notaryid + const CBlock &blk = *pblock; + const CAmount blockReward = GetBlockSubsidy(height, Params().GetConsensus()); + + bool fKIP0003Checked = blk.vtx.size() > 1 && + blk.vtx[0].vout.size() == 2 && + blk.vtx[0].vout[0].nValue <= blockReward && + blk.vtx[0].vout[1].scriptPubKey.IsOpReturn(); + + LogPrintf("KIP0003 check for NN: ht.%d, hash.%s - %s\n", + height, blk.GetHash().ToString(), + fKIP0003Checked ? "PASSED!" : "FAILED!"); + + // Uncomment the following line if you need to return -1 on failure + // if (!fKIP0003Checked) return -1; + } + + //fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed); if ( failed != 0 && possible == 0 && notaryid < 0 ) return(-1); else return(0); From 4783c0b06e053cd203263472ef4dfc8a812243c4 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 8 Aug 2024 17:45:25 +0800 Subject: [PATCH 12/19] add season 8 pubkeys --- src/komodo_hardfork.cpp | 64 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index 14d4818ec96..11d3baa7893 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -550,5 +550,69 @@ const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = {"dragonhound_EU", "0286d7af8583e18127bd1f45730916b4f48ae3e0c90181b2745174b91b76c6e28b"}, {"dragonhound_NA", "0306476ea5fb67aec667172a9bb30646dbff195b84c30ac958175af9b475987802"}, {"dragonhound_DEV", "02f9a7b49282885cd03969f1f5478287497bc8edfceee9eac676053c107c5fcdaf"} + }, + { + {"alright_DEV", "028548847b3bbccff37c9b47bc4154183304902773d514b792ec2adc91e600e3b9"}, // 0 + {"alien_AR", "03a40091ce1e7aa9863d9ad0c27f67b7d18bb47612438570ce344cd1782937c575"}, + {"alien_EU", "03bb749e337b9074465fa28e757b5aa92cb1f0fea1a39589bca91a602834d443cd"}, + {"alien_NA", "03bea1ac333b95c8669ec091907ea8713cae26f74b9e886e13593400e21c4d30a8"}, + {"alien_SH", "03911a60395801082194b6834244fa78a3c30ff3e888667498e157b4aa80b0a65f"}, + {"alienx_EU", "026afe5b112d1b39e0edafd5e051e261a676104460581f3673f26ceff7f1e6c56c"}, + {"alienx_NA", "02f0b3ef87629509441b1ae95f28108f258a81910e483b90e0496205e24e7069b8"}, + {"artist_SH", "023f9632eb3dc7fd1cfd700bb58de2da51bfa5898838586f49afdd145bddac16b6"}, + {"batman_EU", "0358441eca9d8d24cd756fb3308fd7c9d60fe2b5af702ce5c9c1429cbea7a4c284"}, + {"blackice_AR", "02bbc5518d27918d77c46b4e3ad0b9df936df520646527ab4c2f206544a2b03967"}, + {"blackice_EU", "02340bf4749a392865b0ddaf37e652195e740c7538aeac87f7a51b8bf2dcdc24ac"}, // 10 + {"blackice_NA", "035baa12331ad6c284d5f1b76527c1d6c5eb15a74b9ba369e5d46aefcc9c120938"}, + {"blackice_SH", "02c275d12560b2c8238b8a10a8fc8da891784eb7b2ff5d3310ebcb666e47579571"}, + {"blackice2_AR", "03d224790d17b881db560759cc9cc73fe5c865136a88af471ea156b7eb6d88ce32"}, + {"ca333_EU", "030a18ffa85e2928ed37b2e30dbeb9bfb30b21fb15c5c4bcbd61d26b945e398e2b"}, + {"chmex_AR", "036c856ea778ea105b93c0be187004d4e51161eda32888aa307b8f72d490884005"}, + {"chmex_EU", "025b7209ba37df8d9695a23ea706ea2594863ab09055ca6bf485855937f3321d1d"}, + {"chmex_NA", "030c2528c29d5328243c910277e3d74aa77c9b4e145308007d2b11550731591dbe"}, + {"chmex_SH", "02698305eb3c27a2c724efd2152f9250739355116f201656c34b83aac2d3aebd19"}, + {"chmexvet_SH", "02d27ed1cddfbaff9e47865e7df0165457e8f075f70bbea8c0498598ccf494555d"}, + {"cipi_AR", "033ae024cdb748e083406a2e20037017a1292079ad6a8161ae5b43f398724fea74"}, // 20 + {"cipi_EU", "03d6e1f3a693b5d69049791005d7cb64c259a1ad85833f5a9c545d4fee29905009"}, + {"cipi_NA", "036cc1d7476e4260601927be0fc8b748ae68d8fec8f5c498f71569a01bd92046c5"}, // 10 + {"dimxy_AR", "02689d0b77b1e8e8c93a102d8b689fd08179164d70e2dd585543c3896a0916e6a1"}, + {"dragonhound_AR", "030a72f1a15f67624aea55743c5b777bdd55362596add77b544ee2e582bdebf0c7"}, + {"dragonhound_EU", "0286d7af8583e18127bd1f45730916b4f48ae3e0c90181b2745174b91b76c6e28b"}, + {"dragonhound_NA", "0306476ea5fb67aec667172a9bb30646dbff195b84c30ac958175af9b475987802"}, + {"dragonhound_SH", "02fe8e5a64979bc8e55b24e121182d2f1948e00a050c77407edbfc9cc8c012d679"}, + {"fediakash_AR", "027dfe5403f8870fb0e1b94a2b4204373b31ea73179ba500a88dd56d22855cd03b"}, // 30 + {"fediakash_NA", "024b31751c90dd9bd31e9a419be54d6f6cb7f4a85ea475359852ab645124010290"}, + {"francois_SH", "02fdbb8fdfa4b859e1a21c30824f8c04e15c8886b1e1cab5d9d0bd89c353eb9710"}, + {"gcharang_AR", "030de3d833ba049da08231ca6b622c77c7f96b26269963291d9604706bb94031a5"}, + {"gcharang_SH", "02cb445948bf0d89f8d61102e12a5ee6e98be61ac7c2cb9ba435219ea9db967117"}, + {"gcharang2_SH", "02567b688c180212df97b65273e70512f5f1f5edd20eb5fb85c7efa2a510e363d7"}, + {"kmdude_SH", "02116774b25226d0b99f70a24f55c5ce17a7af6d3522071369c233157ecb27b82a"}, + {"marmarachain_AR", "0335ab9e59d602df5580b964b6451d02cd9cc243ddf01b065db84375488df9f53c"}, + {"marmarachain_EU", "0234e40800500370d43979586ee2cec2e777a0368d10c682e78bca30fd1630c18d"}, + {"mcrypt_NA", "03ccaa74304165e0d66968c3f714942a130d67f02db1c2f910a75dfc15c0d3d58f"}, + {"naezith_EU", "038f61a0418deafdb9fa8809a5df0956943f423364022cab578c3fcb158f3dfc55"}, // 40 + {"naezith_NA", "033d9e2e3e51627b4cf9fec2ddbaadfd76a50965d423a2741e5b0db6ab13a057af"}, + {"onuz-ozkan_EU", "03c159a0733fb3d15d0b6e7eb67568343c10891eb6f1e8ab0ae6fbe9e33af17bc0"}, + {"onuz-ozkan_NA", "02be4ac61cf534b0fb98568ec539ee9e34c5104088f94f21cee2945d37d88373da"}, + {"pbca26_NA", "024034ed324e69316d6f6d554168b56828e40334f99d7adfe4ef9248c49d433e12"}, + {"ptyx_SH", "02ac5e2bc7bd5372395eab76c56951f699af617cd4e1fa2926eb7318e9caecd531"}, + {"shamardy_SH", "026d378de09ba51d8f56be52bc8d02f5e20bae843406e23686047b76c72412a7b3"}, + {"smdmitry_AR", "022a2a45979a6631a25e4c96469423de720a2f4c849548957c35a35c91041ee7ac"}, + {"smdmitry2_AR", "026e33b213be94fa7c05c781cb1d2fb381e4c4ef6aad40d6a67f0a8ad573d92efe"}, + {"smdmitry_EU", "02eb3aad81778f8d6f7e5295c44ca224e5c812f5e43fc1e9ce4ebafc23324183c9"}, + {"smdmitry_NA", "020580cbdfc051bdac9e5d05fe9a6b6a15885fbd3989c6662001f2399c6e0d7e4c"}, // 50 + {"smdmitry_SH", "02d01cd6b87cbf5a9795c06968f0d169168c1be0d82cfeb79958b11ae2c30316c1"}, + {"strob_SH", "025ceac4256cef83ca4b110f837a71d70a5a977ecfdf807335e00bc78b560d451a"}, + {"gcharang_DEV", "033b82b5791c65477dd11095cf33332013df6d2bcb7aa06a6dae5f7b22b6959b0b"}, + {"dimxy_DEV", "039a01cd626d5efbe7fd05a59d8e5fced53bacac589192278f9b00ad31654b6956"}, + {"ca333_DEV", "03cf925a2d7d697448c3ac6fff9aff349b80d773b4ce7de22c9ef7e2c8c002bec6"}, + {"qa_DEV", "036f42e1888378068c3a17a53665b0a9db21465571d63ca02eb8d5681afa709074"}, + {"core_DEV", "035509136135ba8e3f5d4733f7a9c160c2e1fefd8dc4658c3d95a5407e8da14749"}, + {"security_DEV", "022450f4f32435372b43dc2b9d5b690114fbe5e5dcbe0c02ab8164698f1a9eda6e"}, + {"tonyl_AR", "0277bbdf6403d1ebaac5a715a9120118e74be0d3bed71a2c8cf5542fb6ca7d2dd7"}, + {"van_EU", "03af7f8c82f20671ca1978116353839d3e501523e379bfb52b1e05d7816bb5812f"}, // 60 + {"who-biz_AR", "03057d4c00c4e18f72faa4234aada9ad17ecd4bd9455c548edef16b94befa1a087"}, + {"who-biz_NA", "03170d900f6d6a13002255b708f7bd27e55b5c05d1ddbaf8c25a1fc287d9f804ed"}, + {"dragonhound_DEV", "02f9a7b49282885cd03969f1f5478287497bc8edfceee9eac676053c107c5fcdaf"} } }; From d96668c224a2554a99ec85a7bfadd43989823a5e Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 8 Aug 2024 17:47:21 +0800 Subject: [PATCH 13/19] rm misplaced comment --- src/komodo_hardfork.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index 11d3baa7893..daef7900854 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -574,7 +574,7 @@ const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = {"chmexvet_SH", "02d27ed1cddfbaff9e47865e7df0165457e8f075f70bbea8c0498598ccf494555d"}, {"cipi_AR", "033ae024cdb748e083406a2e20037017a1292079ad6a8161ae5b43f398724fea74"}, // 20 {"cipi_EU", "03d6e1f3a693b5d69049791005d7cb64c259a1ad85833f5a9c545d4fee29905009"}, - {"cipi_NA", "036cc1d7476e4260601927be0fc8b748ae68d8fec8f5c498f71569a01bd92046c5"}, // 10 + {"cipi_NA", "036cc1d7476e4260601927be0fc8b748ae68d8fec8f5c498f71569a01bd92046c5"}, {"dimxy_AR", "02689d0b77b1e8e8c93a102d8b689fd08179164d70e2dd585543c3896a0916e6a1"}, {"dragonhound_AR", "030a72f1a15f67624aea55743c5b777bdd55362596add77b544ee2e582bdebf0c7"}, {"dragonhound_EU", "0286d7af8583e18127bd1f45730916b4f48ae3e0c90181b2745174b91b76c6e28b"}, From acca0f9b4f4e3844b009c71f70239d2c55f94a6c Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 8 Aug 2024 17:49:19 +0800 Subject: [PATCH 14/19] fix index comments --- src/komodo_hardfork.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index daef7900854..a8747f98b0f 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -575,6 +575,8 @@ const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = {"cipi_AR", "033ae024cdb748e083406a2e20037017a1292079ad6a8161ae5b43f398724fea74"}, // 20 {"cipi_EU", "03d6e1f3a693b5d69049791005d7cb64c259a1ad85833f5a9c545d4fee29905009"}, {"cipi_NA", "036cc1d7476e4260601927be0fc8b748ae68d8fec8f5c498f71569a01bd92046c5"}, + {"cipi2_NA", "0306531923dbd4517d15e932668b64cbf95cc6c4293e46c8b5825c6543e0f06b15"}, + {"colmapol_EU", "020c63078b5f5d27183de6f2bbae9bfe3fc57e017faf89b7d566bb947a92a2e40d"}, {"dimxy_AR", "02689d0b77b1e8e8c93a102d8b689fd08179164d70e2dd585543c3896a0916e6a1"}, {"dragonhound_AR", "030a72f1a15f67624aea55743c5b777bdd55362596add77b544ee2e582bdebf0c7"}, {"dragonhound_EU", "0286d7af8583e18127bd1f45730916b4f48ae3e0c90181b2745174b91b76c6e28b"}, From 283d6b40da10bf12a7e0de3ba4a69f948c44bbf7 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 8 Aug 2024 20:29:30 +0800 Subject: [PATCH 15/19] fix Onur name --- src/komodo_hardfork.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index a8747f98b0f..d6f1e0a451d 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -594,8 +594,8 @@ const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = {"mcrypt_NA", "03ccaa74304165e0d66968c3f714942a130d67f02db1c2f910a75dfc15c0d3d58f"}, {"naezith_EU", "038f61a0418deafdb9fa8809a5df0956943f423364022cab578c3fcb158f3dfc55"}, // 40 {"naezith_NA", "033d9e2e3e51627b4cf9fec2ddbaadfd76a50965d423a2741e5b0db6ab13a057af"}, - {"onuz-ozkan_EU", "03c159a0733fb3d15d0b6e7eb67568343c10891eb6f1e8ab0ae6fbe9e33af17bc0"}, - {"onuz-ozkan_NA", "02be4ac61cf534b0fb98568ec539ee9e34c5104088f94f21cee2945d37d88373da"}, + {"onur-ozkan_EU", "03c159a0733fb3d15d0b6e7eb67568343c10891eb6f1e8ab0ae6fbe9e33af17bc0"}, + {"onur-ozkan_NA", "02be4ac61cf534b0fb98568ec539ee9e34c5104088f94f21cee2945d37d88373da"}, {"pbca26_NA", "024034ed324e69316d6f6d554168b56828e40334f99d7adfe4ef9248c49d433e12"}, {"ptyx_SH", "02ac5e2bc7bd5372395eab76c56951f699af617cd4e1fa2926eb7318e9caecd531"}, {"shamardy_SH", "026d378de09ba51d8f56be52bc8d02f5e20bae843406e23686047b76c72412a7b3"}, From 9fbab363f56eba11db026c2a26681dbe422f8dab Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 8 Aug 2024 22:55:15 +0800 Subject: [PATCH 16/19] add season 8 hardfork constants --- src/komodo_hardfork.cpp | 3 +++ src/komodo_hardfork.h | 29 ++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index d6f1e0a451d..632a42ae289 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -15,6 +15,9 @@ const int32_t nS6HardforkHeight = 2963330; // dPoW Season 6, Fri Jun 24 2022 const uint32_t nS7Timestamp = 1688132253; // dPoW Season 7, Fri Jun 30 2023 13:37:33 GMT+0000 const int32_t nS7HardforkHeight = 3484958; // dPoW Season 7, Fri Jun 30 2023 +const uint32_t nS8Timestamp = 1728049053; // dPoW Season 8, Fri Oct 4 2024 13:37:33 GMT+0000 +const int32_t nS8HardforkHeight = 4125988; // dPoW Season 8, Fri Oct 4 2024 (est. via https://github.com/KomodoPlatform/NotaryNodes/blob/master/utils/estimate_hf_block.py) + // Era array of pubkeys. Add extra seasons to bottom as requried, after adding appropriate info above. const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = { diff --git a/src/komodo_hardfork.h b/src/komodo_hardfork.h index 6692c81b121..898ce160367 100644 --- a/src/komodo_hardfork.h +++ b/src/komodo_hardfork.h @@ -1,7 +1,7 @@ #pragma once #include -#define NUM_KMD_SEASONS 8 +#define NUM_KMD_SEASONS 9 #define NUM_KMD_NOTARIES 64 extern const uint32_t nStakedDecemberHardforkTimestamp; //December 2019 hardfork @@ -19,8 +19,31 @@ extern const int32_t nS6HardforkHeight; // dPoW Season 6, Fri Jun 24 2022 extern const uint32_t nS7Timestamp; // dPoW Season 7, Fri Jun 30 2023 13:37:33 GMT+0000 extern const int32_t nS7HardforkHeight; // dPoW Season 7, Fri Jun 30 2023 -static const uint32_t KMD_SEASON_TIMESTAMPS[NUM_KMD_SEASONS] = {1525132800, 1563148800, nStakedDecemberHardforkTimestamp, nS4Timestamp, nS5Timestamp, nS6Timestamp, nS7Timestamp, 1951328000}; -static const int32_t KMD_SEASON_HEIGHTS[NUM_KMD_SEASONS] = {814000, 1444000, nDecemberHardforkHeight, nS4HardforkHeight, nS5HardforkHeight, nS6HardforkHeight, nS7HardforkHeight, 8113400}; +extern const uint32_t nS8Timestamp; // dPoW Season 8, Fri Oct 4 2024 13:37:33 GMT+0000 +extern const int32_t nS8HardforkHeight; // dPoW Season 8, Fri Oct 4 2024 + +static const uint32_t KMD_SEASON_TIMESTAMPS[NUM_KMD_SEASONS] = { + 1525132800, + 1563148800, + nStakedDecemberHardforkTimestamp, + nS4Timestamp, + nS5Timestamp, + nS6Timestamp, + nS7Timestamp, + nS8Timestamp, + 1951328000 +}; +static const int32_t KMD_SEASON_HEIGHTS[NUM_KMD_SEASONS] = { + 814000, + 1444000, + nDecemberHardforkHeight, + nS4HardforkHeight, + nS5HardforkHeight, + nS6HardforkHeight, + nS7HardforkHeight, + nS8HardforkHeight, + 8113400 +}; extern char NOTARYADDRS[64][64]; extern char NOTARY_ADDRESSES[NUM_KMD_SEASONS][64][64]; From 9363d9efa62c43e4520198227bc0efede41b1531 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 9 Aug 2024 20:16:39 +0200 Subject: [PATCH 17/19] mac build: fix boost 1.72 build error with clang 16 error: integer value -1 is outside the valid range of values [0, 3] for this enumeration type - https://trac.macports.org/ticket/69103 - https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a --- depends/packages/boost.mk | 5 +- .../patches/boost/range_enums_clang_16.patch | 75 +++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 depends/patches/boost/range_enums_clang_16.patch diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index e671ea0e734..56004d21722 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -4,7 +4,7 @@ $(package)_version=1_72_0 $(package)_download_path=https://github.com/KomodoPlatform/boost/releases/download/boost-1.72.0-kmd $(package)_sha256_hash=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722 $(package)_file_name=$(package)_$($(package)_version).tar.bz2 -$(package)_patches=fix-Solaris.patch ignore_wnonnull_gcc_11.patch +$(package)_patches=fix-Solaris.patch ignore_wnonnull_gcc_11.patch range_enums_clang_16.patch define $(package)_set_vars $(package)_config_opts_release=variant=release @@ -30,7 +30,8 @@ endef define $(package)_preprocess_cmds echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam&& \ patch -p1 < $($(package)_patch_dir)/fix-Solaris.patch &&\ - patch -p2 < $($(package)_patch_dir)/ignore_wnonnull_gcc_11.patch + patch -p2 < $($(package)_patch_dir)/ignore_wnonnull_gcc_11.patch &&\ + patch -p2 < $($(package)_patch_dir)/range_enums_clang_16.patch endef define $(package)_config_cmds diff --git a/depends/patches/boost/range_enums_clang_16.patch b/depends/patches/boost/range_enums_clang_16.patch new file mode 100644 index 00000000000..3e049e261c0 --- /dev/null +++ b/depends/patches/boost/range_enums_clang_16.patch @@ -0,0 +1,75 @@ +diff --git a/include/boost/numeric/conversion/detail/int_float_mixture.hpp b/include/boost/numeric/conversion/detail/int_float_mixture.hpp +index 464e527..7690d07 100644 +--- a/include/boost/numeric/conversion/detail/int_float_mixture.hpp ++++ b/include/boost/numeric/conversion/detail/int_float_mixture.hpp +@@ -16,15 +16,15 @@ + #include "boost/numeric/conversion/int_float_mixture_enum.hpp" + #include "boost/numeric/conversion/detail/meta.hpp" + +-#include "boost/mpl/integral_c.hpp" ++#include "boost/type_traits/integral_constant.hpp" + + namespace boost { namespace numeric { namespace convdetail + { + // Integral Constants for 'IntFloatMixture' +- typedef mpl::integral_c int2int_c ; +- typedef mpl::integral_c int2float_c ; +- typedef mpl::integral_c float2int_c ; +- typedef mpl::integral_c float2float_c ; ++ typedef boost::integral_constant int2int_c ; ++ typedef boost::integral_constant int2float_c ; ++ typedef boost::integral_constant float2int_c ; ++ typedef boost::integral_constant float2float_c ; + + // Metafunction: + // +diff --git a/include/boost/numeric/conversion/detail/sign_mixture.hpp b/include/boost/numeric/conversion/detail/sign_mixture.hpp +index c7f9e42..fde1584 100644 +--- a/include/boost/numeric/conversion/detail/sign_mixture.hpp ++++ b/include/boost/numeric/conversion/detail/sign_mixture.hpp +@@ -16,15 +16,15 @@ + #include "boost/numeric/conversion/sign_mixture_enum.hpp" + #include "boost/numeric/conversion/detail/meta.hpp" + +-#include "boost/mpl/integral_c.hpp" ++#include "boost/type_traits/integral_constant.hpp" + + namespace boost { namespace numeric { namespace convdetail + { + // Integral Constants for 'SignMixture' +- typedef mpl::integral_c unsig2unsig_c ; +- typedef mpl::integral_c sig2sig_c ; +- typedef mpl::integral_c sig2unsig_c ; +- typedef mpl::integral_c unsig2sig_c ; ++ typedef boost::integral_constant unsig2unsig_c ; ++ typedef boost::integral_constant sig2sig_c ; ++ typedef boost::integral_constant sig2unsig_c ; ++ typedef boost::integral_constant unsig2sig_c ; + + // Metafunction: + // +diff --git a/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp b/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +index 36dbc49..a39d29f 100644 +--- a/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp ++++ b/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +@@ -15,15 +15,15 @@ + #include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp" + #include "boost/numeric/conversion/detail/meta.hpp" + +-#include "boost/mpl/integral_c.hpp" ++#include "boost/type_traits/integral_constant.hpp" + + namespace boost { namespace numeric { namespace convdetail + { + // Integral Constants for 'UdtMixture' +- typedef mpl::integral_c builtin2builtin_c ; +- typedef mpl::integral_c builtin2udt_c ; +- typedef mpl::integral_c udt2builtin_c ; +- typedef mpl::integral_c udt2udt_c ; ++ typedef boost::integral_constant builtin2builtin_c ; ++ typedef boost::integral_constant builtin2udt_c ; ++ typedef boost::integral_constant udt2builtin_c ; ++ typedef boost::integral_constant udt2udt_c ; + + // Metafunction: + // From 5f572b9606fa33fc37f4ded43845b647cf87a816 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Fri, 9 Aug 2024 20:39:41 +0200 Subject: [PATCH 18/19] mac build: macos-latest-large runner image instead of macos-latest (arm64) try launch build on x86_64-apple-darwin host instead of arm-apple-darwin - https://github.com/actions/runner-images/issues/9741 - https://github.com/actions/runner-images?tab=readme-ov-file#available-images --- .github/workflows/komodo_mac_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/komodo_mac_ci.yml b/.github/workflows/komodo_mac_ci.yml index f5482660f7b..61e4ce99e1e 100644 --- a/.github/workflows/komodo_mac_ci.yml +++ b/.github/workflows/komodo_mac_ci.yml @@ -10,7 +10,7 @@ jobs: macos-build: name: MacOS Build - runs-on: macos-latest + runs-on: macos-latest-large steps: - uses: actions/checkout@v4 From 040daa5321dbc7fe3c7e8d473d57e38e0470cbca Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Mon, 12 Aug 2024 20:11:10 +0200 Subject: [PATCH 19/19] add S8 label in notaries_elected --- src/komodo_hardfork.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_hardfork.cpp b/src/komodo_hardfork.cpp index adf55784d2c..ad53af9fd60 100644 --- a/src/komodo_hardfork.cpp +++ b/src/komodo_hardfork.cpp @@ -559,6 +559,7 @@ const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = {"dragonhound_DEV", "02f9a7b49282885cd03969f1f5478287497bc8edfceee9eac676053c107c5fcdaf"} }, { + // Season 8 {"alright_DEV", "028548847b3bbccff37c9b47bc4154183304902773d514b792ec2adc91e600e3b9"}, // 0 {"alien_AR", "03a40091ce1e7aa9863d9ad0c27f67b7d18bb47612438570ce344cd1782937c575"}, {"alien_EU", "03bb749e337b9074465fa28e757b5aa92cb1f0fea1a39589bca91a602834d443cd"},