From 0b63d4f4bd5099ef6b24689debf2fd6568d75862 Mon Sep 17 00:00:00 2001 From: Diego del Corral Tercero <55594560+hidiego@users.noreply.github.com> Date: Wed, 29 Dec 2021 14:04:03 +0100 Subject: [PATCH 1/6] Adds FortCanningHillHeight (#1005) * Adds FortCanningHillHeight Co-authored-by: Jouzo --- src/chainparams.cpp | 9 +++++++-- src/consensus/params.h | 1 + src/init.cpp | 1 + src/rpc/blockchain.cpp | 1 + test/functional/rpc_blockchain.py | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 0a7dd6f801e..c416f00f1a6 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -128,6 +128,7 @@ class CMainParams : public CChainParams { consensus.EunosPayaHeight = 1072000; // Aug 05, 2021. consensus.FortCanningHeight = 1367000; // Nov 15, 2021. consensus.FortCanningMuseumHeight = 1430640; + consensus.FortCanningHillHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks @@ -348,6 +349,7 @@ class CTestNetParams : public CChainParams { consensus.EunosPayaHeight = 463300; consensus.FortCanningHeight = 686200; consensus.FortCanningMuseumHeight = 724000; + consensus.FortCanningHillHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks @@ -530,6 +532,7 @@ class CDevNetParams : public CChainParams { consensus.EunosPayaHeight = 300; consensus.FortCanningHeight = std::numeric_limits::max(); consensus.FortCanningMuseumHeight = std::numeric_limits::max(); + consensus.FortCanningHillHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks @@ -704,6 +707,7 @@ class CRegTestParams : public CChainParams { consensus.EunosPayaHeight = 10000000; consensus.FortCanningHeight = 10000000; consensus.FortCanningMuseumHeight = 10000000; + consensus.FortCanningHillHeight = 10000000; consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks @@ -915,8 +919,9 @@ void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args) consensus.EunosKampungHeight = static_cast(eunosHeight.get()); } UpdateHeightValidation("Eunos Paya", "-eunospayaheight", consensus.EunosPayaHeight); - UpdateHeightValidation("Fork canning", "-fortcanningheight", consensus.FortCanningHeight); - UpdateHeightValidation("Fork canning museum", "-fortcanningmuseumheight", consensus.FortCanningMuseumHeight); + UpdateHeightValidation("Fort canning", "-fortcanningheight", consensus.FortCanningHeight); + UpdateHeightValidation("Fort canning museum", "-fortcanningmuseumheight", consensus.FortCanningMuseumHeight); + UpdateHeightValidation("Fort canning hill", "-fortcanninghillheight", consensus.FortCanningHillHeight); if (!args.IsArgSet("-vbparams")) return; diff --git a/src/consensus/params.h b/src/consensus/params.h index 28caa9fe432..f2da593335d 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -91,6 +91,7 @@ struct Params { int EunosPayaHeight; int FortCanningHeight; int FortCanningMuseumHeight; + int FortCanningHillHeight; /** Foundation share after AMK, normalized to COIN = 100% */ CAmount foundationShareDFIP1; diff --git a/src/init.cpp b/src/init.cpp index 3660aedad7f..5e404ceebc3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -473,6 +473,7 @@ void SetupServerArgs() gArgs.AddArg("-eunospayaheight", "EunosPaya fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanningheight", "Fort Canning fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanningmuseumheight", "Fort Canning Museum fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); + gArgs.AddArg("-fortcanninghillheight", "Fort Canning Hill fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-jellyfish_regtest", "Configure the regtest network for jellyfish testing", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); #ifdef USE_UPNP #if USE_UPNP diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index ca929e0c66b..1c17234ce6d 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1362,6 +1362,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) BuriedForkDescPushBack(softforks, "eunospaya", consensusParams.EunosPayaHeight); BuriedForkDescPushBack(softforks, "fortcanning", consensusParams.FortCanningHeight); BuriedForkDescPushBack(softforks, "fortcanningmuseum", consensusParams.FortCanningMuseumHeight); + BuriedForkDescPushBack(softforks, "fortcanninghill", consensusParams.FortCanningHillHeight); BIP9SoftForkDescPushBack(softforks, "testdummy", consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); obj.pushKV("softforks", softforks); diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index e0860f316aa..7932038eef7 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -133,6 +133,7 @@ def _test_getblockchaininfo(self): 'eunospaya': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanning': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanningmuseum': {'type': 'buried', 'active': False, 'height': 10000000}, + 'fortcanninghill': {'type': 'buried', 'active': False, 'height': 10000000}, 'testdummy': { 'type': 'bip9', 'bip9': { From 6a0f65958fbad80eb3208140e448a471ef6e322f Mon Sep 17 00:00:00 2001 From: Peter John Bushnell Date: Sun, 2 Jan 2022 18:08:11 +0000 Subject: [PATCH 2/6] Disable ICX - Version 2.4.0 (#1010) * Disable ICX * Set Fort Canning Park height Signed-off-by: Anthony Fieroni Co-authored-by: Anthony Fieroni --- configure.ac | 4 ++-- src/chainparams.cpp | 5 +++++ src/consensus/params.h | 1 + src/init.cpp | 1 + src/masternodes/mn_checks.cpp | 35 +++++++++++++++++++++++++++++++ src/rpc/blockchain.cpp | 1 + test/functional/rpc_blockchain.py | 1 + 7 files changed, 46 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c8816ae27a3..7f38a055d41 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 2) -define(_CLIENT_VERSION_MINOR, 3) -define(_CLIENT_VERSION_REVISION, 2) +define(_CLIENT_VERSION_MINOR, 4) +define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_RC, 0) define(_CLIENT_VERSION_IS_RELEASE, true) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index c416f00f1a6..6f7768d8116 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -128,6 +128,7 @@ class CMainParams : public CChainParams { consensus.EunosPayaHeight = 1072000; // Aug 05, 2021. consensus.FortCanningHeight = 1367000; // Nov 15, 2021. consensus.FortCanningMuseumHeight = 1430640; + consensus.FortCanningParkHeight = 1503143; consensus.FortCanningHillHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -349,6 +350,7 @@ class CTestNetParams : public CChainParams { consensus.EunosPayaHeight = 463300; consensus.FortCanningHeight = 686200; consensus.FortCanningMuseumHeight = 724000; + consensus.FortCanningParkHeight = std::numeric_limits::max(); consensus.FortCanningHillHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -532,6 +534,7 @@ class CDevNetParams : public CChainParams { consensus.EunosPayaHeight = 300; consensus.FortCanningHeight = std::numeric_limits::max(); consensus.FortCanningMuseumHeight = std::numeric_limits::max(); + consensus.FortCanningParkHeight = std::numeric_limits::max(); consensus.FortCanningHillHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -707,6 +710,7 @@ class CRegTestParams : public CChainParams { consensus.EunosPayaHeight = 10000000; consensus.FortCanningHeight = 10000000; consensus.FortCanningMuseumHeight = 10000000; + consensus.FortCanningParkHeight = 10000000; consensus.FortCanningHillHeight = 10000000; consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -921,6 +925,7 @@ void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args) UpdateHeightValidation("Eunos Paya", "-eunospayaheight", consensus.EunosPayaHeight); UpdateHeightValidation("Fort canning", "-fortcanningheight", consensus.FortCanningHeight); UpdateHeightValidation("Fort canning museum", "-fortcanningmuseumheight", consensus.FortCanningMuseumHeight); + UpdateHeightValidation("Fort canning park", "-fortcanningparkheight", consensus.FortCanningParkHeight); UpdateHeightValidation("Fort canning hill", "-fortcanninghillheight", consensus.FortCanningHillHeight); if (!args.IsArgSet("-vbparams")) return; diff --git a/src/consensus/params.h b/src/consensus/params.h index f2da593335d..5dfd6cffa6d 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -91,6 +91,7 @@ struct Params { int EunosPayaHeight; int FortCanningHeight; int FortCanningMuseumHeight; + int FortCanningParkHeight; int FortCanningHillHeight; /** Foundation share after AMK, normalized to COIN = 100% */ diff --git a/src/init.cpp b/src/init.cpp index 5e404ceebc3..91d8e5d3de3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -473,6 +473,7 @@ void SetupServerArgs() gArgs.AddArg("-eunospayaheight", "EunosPaya fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanningheight", "Fort Canning fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanningmuseumheight", "Fort Canning Museum fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); + gArgs.AddArg("-fortcanningparkheight", "Fort Canning Park fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanninghillheight", "Fort Canning Hill fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-jellyfish_regtest", "Configure the regtest network for jellyfish testing", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); #ifdef USE_UPNP diff --git a/src/masternodes/mn_checks.cpp b/src/masternodes/mn_checks.cpp index 8ae93607490..e67578a7506 100644 --- a/src/masternodes/mn_checks.cpp +++ b/src/masternodes/mn_checks.cpp @@ -3146,17 +3146,52 @@ void PopulateVaultHistoryData(CHistoryWriters* writers, CAccountsHistoryWriter& } } + +bool IsDisabledTx(uint32_t height, CustomTxType type, const Consensus::Params& consensus) { + if (height < consensus.FortCanningParkHeight) + return false; + + // ICXCreateOrder = '1', + // ICXMakeOffer = '2', + // ICXSubmitDFCHTLC = '3', + // ICXSubmitEXTHTLC = '4', + // ICXClaimDFCHTLC = '5', + // ICXCloseOrder = '6', + // ICXCloseOffer = '7', + + // Leaving close orders, as withdrawal of existing should be ok? + switch (type) { + case CustomTxType::ICXCreateOrder: + case CustomTxType::ICXMakeOffer: + case CustomTxType::ICXSubmitDFCHTLC: + case CustomTxType::ICXSubmitEXTHTLC: + case CustomTxType::ICXClaimDFCHTLC: + return true; + default: + return false; + } +} + + Res ApplyCustomTx(CCustomCSView& mnview, const CCoinsViewCache& coins, const CTransaction& tx, const Consensus::Params& consensus, uint32_t height, uint64_t time, uint32_t txn, CHistoryWriters* writers) { auto res = Res::Ok(); if (tx.IsCoinBase() && height > 0) { // genesis contains custom coinbase txs return res; } std::vector metadata; + + const auto metadataValidation = height >= consensus.FortCanningHeight; + auto txType = GuessCustomTxType(tx, metadata, metadataValidation); if (txType == CustomTxType::None) { return res; } + + if (IsDisabledTx(height, txType, consensus)) { + return Res::ErrCode(CustomTxErrCodes::Fatal, "Disabled custom transaction"); + } + if (metadataValidation && txType == CustomTxType::Reject) { return Res::ErrCode(CustomTxErrCodes::Fatal, "Invalid custom transaction"); } diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 1c17234ce6d..60a9d3814a7 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1362,6 +1362,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) BuriedForkDescPushBack(softforks, "eunospaya", consensusParams.EunosPayaHeight); BuriedForkDescPushBack(softforks, "fortcanning", consensusParams.FortCanningHeight); BuriedForkDescPushBack(softforks, "fortcanningmuseum", consensusParams.FortCanningMuseumHeight); + BuriedForkDescPushBack(softforks, "fortcanningpark", consensusParams.FortCanningParkHeight); BuriedForkDescPushBack(softforks, "fortcanninghill", consensusParams.FortCanningHillHeight); BIP9SoftForkDescPushBack(softforks, "testdummy", consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); obj.pushKV("softforks", softforks); diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index 7932038eef7..440f3bcddcb 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -133,6 +133,7 @@ def _test_getblockchaininfo(self): 'eunospaya': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanning': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanningmuseum': {'type': 'buried', 'active': False, 'height': 10000000}, + 'fortcanningpark': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanninghill': {'type': 'buried', 'active': False, 'height': 10000000}, 'testdummy': { 'type': 'bip9', From 7f8b5658d1a3c2c021e1151d7e062a1d46fcf3b5 Mon Sep 17 00:00:00 2001 From: Peter John Bushnell Date: Mon, 3 Jan 2022 10:47:05 +0000 Subject: [PATCH 3/6] Add checkpoint (#1013) --- src/chainparams.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 6f7768d8116..38cd7844f59 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -309,6 +309,7 @@ class CMainParams : public CChainParams { {850000, uint256S("2d7d58ae18a74f73b9836a8fffd3f65ce409536e654a6c644ce735215238a004")}, {875000, uint256S("44d3b3ba8e920cef86b7ec096ab0a2e608d9fedc14a59611a76a5e40aa53145e")}, {895741, uint256S("61bc1d73c720990dde43a3fec1f703a222ec5c265e6d491efd60eeec1bdb6dc3")}, + {1505965,uint256S("f7474c805de4f05673df2103bd5d8b8dea09b0d22f808ee957a9ceefc0720609")}, } }; From 7d69df35e3ab21a66b30477b3bc9dd0e5c597e09 Mon Sep 17 00:00:00 2001 From: Peter John Bushnell Date: Mon, 3 Jan 2022 15:26:50 +0000 Subject: [PATCH 4/6] Bump protocol version (#1014) * Bump protocol version Co-authored-by: Prasanna Loganathar --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index de61d7e4a08..47c75dcd3d3 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70022; +static const int PROTOCOL_VERSION = 70023; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; From f1ac2be37baff2c51670e50049a09a079ee8b0db Mon Sep 17 00:00:00 2001 From: Anthony Fieroni Date: Mon, 3 Jan 2022 17:46:27 +0000 Subject: [PATCH 5/6] Reject block that contains custom tx produced by incorrect masternode (#1018) Signed-off-by: Anthony Fieroni --- src/validation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index c55a54d7e6e..6e2d380df6d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3938,7 +3938,10 @@ bool CChainState::ActivateBestChainStep(CValidationState& state, const CChainPar if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr(), connectTrace, disconnectpool)) { if (state.IsInvalid()) { fContinue = false; - if (state.GetRejectReason() == "high-hash") { + if (state.GetRejectReason() == "high-hash" + || (pindexConnect == pindexMostWork + && pindexConnect->nHeight >= chainparams.GetConsensus().FortCanningParkHeight + && state.GetRejectCode() == REJECT_CUSTOMTX)) { UpdateMempoolForReorg(disconnectpool, false); return false; } From 7630137b3ea10269f564f13297f21b997735f38e Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Tue, 4 Jan 2022 03:28:43 +0530 Subject: [PATCH 6/6] Version 2.5.0 (#1017) * Protocol upgrade for v2.5.0 * Revert min proto change --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7f38a055d41..c3a6314e75c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 2) -define(_CLIENT_VERSION_MINOR, 4) +define(_CLIENT_VERSION_MINOR, 5) define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_RC, 0)