diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 892860a511..d124f76b2d 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -138,6 +138,7 @@ class CMainParams : public CChainParams { consensus.FortCanningSpringHeight = 2033000; // July 6, 2022. consensus.FortCanningGreatWorldHeight = 2212000; // Sep 7th, 2022. consensus.FortCanningEpilogueHeight = 2257500; // Sep 22nd, 2022. + consensus.GrandCentralHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks @@ -377,6 +378,7 @@ class CTestNetParams : public CChainParams { consensus.FortCanningSpringHeight = 1086000; consensus.FortCanningGreatWorldHeight = 1223000; consensus.FortCanningEpilogueHeight = 1244000; + consensus.GrandCentralHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks @@ -571,6 +573,7 @@ class CDevNetParams : public CChainParams { consensus.FortCanningSpringHeight = std::numeric_limits::max(); consensus.FortCanningGreatWorldHeight = std::numeric_limits::max(); consensus.FortCanningEpilogueHeight = std::numeric_limits::max(); + consensus.GrandCentralHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks @@ -757,6 +760,7 @@ class CRegTestParams : public CChainParams { consensus.FortCanningSpringHeight = 10000000; consensus.FortCanningGreatWorldHeight = 10000000; consensus.FortCanningEpilogueHeight = 10000000; + consensus.GrandCentralHeight = 10000000; consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks @@ -982,6 +986,7 @@ void SetupCommonArgActivationParams(Consensus::Params &consensus) { UpdateHeightValidation("Fort Canning Great World", "-fortcanninggreatworldheight", consensus.FortCanningGreatWorldHeight); UpdateHeightValidation("Fort Canning Great World", "-greatworldheight", consensus.FortCanningGreatWorldHeight); UpdateHeightValidation("Fort Canning Epilogue", "-fortcanningepilogueheight", consensus.FortCanningEpilogueHeight); + UpdateHeightValidation("Grand Central", "-grandcentralheight", consensus.GrandCentralHeight); if (gArgs.GetBoolArg("-simulatemainnet", false)) { consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks diff --git a/src/consensus/params.h b/src/consensus/params.h index 5586e3edc8..6dca524850 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -99,6 +99,7 @@ struct Params { int FortCanningSpringHeight; int FortCanningGreatWorldHeight; int FortCanningEpilogueHeight; + int GrandCentralHeight; /** Foundation share after AMK, normalized to COIN = 100% */ CAmount foundationShareDFIP1; diff --git a/src/init.cpp b/src/init.cpp index c8be1d444a..ecaf89184b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -504,6 +504,7 @@ void SetupServerArgs() gArgs.AddArg("-fortcanninggreatworldheight", "Fort Canning Great World fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-greatworldheight", "Alias for Fort Canning Great World fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanningepilogueheight", "Alias for Fort Canning Epilogue fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); + gArgs.AddArg("-grandcentralheight", "Grand Central fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-jellyfish_regtest", "Configure the regtest network for jellyfish testing", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); gArgs.AddArg("-regtest-skip-loan-collateral-validation", "Skip loan collateral check for jellyfish testing", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); gArgs.AddArg("-simulatemainnet", "Configure the regtest network to mainnet target timespan and spacing ", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); diff --git a/src/masternodes/govvariables/attributes.cpp b/src/masternodes/govvariables/attributes.cpp index 9b1557358a..eab6deb4a2 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -82,6 +82,7 @@ const std::map& ATTRIBUTES::allowedParamIDs() { // Note: DFIP2206F is currently in beta testing // for testnet. May not be enabled on mainnet until testing is complete. {"dfip2206f", ParamIDs::DFIP2206F}, + {"feature", ParamIDs::Feature}, }; return params; } @@ -103,6 +104,7 @@ const std::map& ATTRIBUTES::displayParamsIDs() { {ParamIDs::DFIP2206F, "dfip2206f"}, {ParamIDs::TokenID, "token"}, {ParamIDs::Economy, "economy"}, + {ParamIDs::Feature, "feature"}, }; return params; } @@ -158,6 +160,11 @@ const std::map>& ATTRIBUTES::allowedKeys {"dusd_interest_burn", DFIPKeys::DUSDInterestBurn}, {"dusd_loan_burn", DFIPKeys::DUSDLoanBurn}, {"start_block", DFIPKeys::StartBlock}, + {"gov-unset", DFIPKeys::GovUnset}, + {"gov-foundation", DFIPKeys::GovFoundation}, + {"mn-setrewardaddress", DFIPKeys::MNSetRewardAddress}, + {"mn-setoperatoraddress", DFIPKeys::MNSetOperatorAddress}, + {"mn-setowneraddress", DFIPKeys::MNSetOwnerAddress}, } }, }; @@ -204,6 +211,11 @@ const std::map>& ATTRIBUTES::displayKeys {DFIPKeys::DUSDInterestBurn, "dusd_interest_burn"}, {DFIPKeys::DUSDLoanBurn, "dusd_loan_burn"}, {DFIPKeys::StartBlock, "start_block"}, + {DFIPKeys::GovUnset, "gov-unset"}, + {DFIPKeys::GovFoundation, "gov-foundation"}, + {DFIPKeys::MNSetRewardAddress, "mn-setrewardaddress"}, + {DFIPKeys::MNSetOperatorAddress, "mn-setoperatoraddress"}, + {DFIPKeys::MNSetOwnerAddress, "mn-setowneraddress"}, } }, { @@ -378,6 +390,11 @@ const std::maptypeId == ParamIDs::DFIP2206F || attrV0->key == DFIPKeys::StartBlock || attrV0->typeId == ParamIDs::DFIP2206A) { + if (attrV0->typeId == ParamIDs::Feature) { + if (view.GetLastHeight() < Params().GetConsensus().GrandCentralHeight) { + return Res::Err("Cannot be set before GrandCentralHeight"); + } + } else if (attrV0->typeId == ParamIDs::DFIP2206F || attrV0->key == DFIPKeys::StartBlock || attrV0->typeId == ParamIDs::DFIP2206A) { if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpringHeight) { return Res::Err("Cannot be set before FortCanningSpringHeight"); } diff --git a/src/masternodes/govvariables/attributes.h b/src/masternodes/govvariables/attributes.h index 2ac5abbc75..03e7fc899a 100644 --- a/src/masternodes/govvariables/attributes.h +++ b/src/masternodes/govvariables/attributes.h @@ -30,6 +30,7 @@ enum ParamIDs : uint8_t { Economy = 'e', DFIP2206A = 'f', DFIP2206F = 'g', + Feature = 'h', }; enum OracleIDs : uint8_t { @@ -59,6 +60,11 @@ enum DFIPKeys : uint8_t { DUSDInterestBurn = 'g', DUSDLoanBurn = 'h', StartBlock = 'i', + GovUnset = 'j', + GovFoundation = 'k', + MNSetRewardAddress = 'l', + MNSetOperatorAddress = 'm', + MNSetOwnerAddress = 'n', }; enum TokenKeys : uint8_t { diff --git a/src/masternodes/mn_checks.cpp b/src/masternodes/mn_checks.cpp index 4cab628ea0..624fa8321d 100644 --- a/src/masternodes/mn_checks.cpp +++ b/src/masternodes/mn_checks.cpp @@ -263,6 +263,13 @@ class CCustomMetadataParseVisitor return Res::Ok(); } + Res isPostGrandCentralFork() const { + if(static_cast(height) < consensus.GrandCentralHeight) { + return Res::Err("called before GrandCentral height"); + } + return Res::Ok(); + } + template Res serialize(T& obj) const { CDataStream ss(metadata, SER_NETWORK, PROTOCOL_VERSION); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 4712f9b554..6cb2deafb1 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1336,6 +1336,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) BuriedForkDescPushBack(softforks, "fortcanningspring", consensusParams.FortCanningSpringHeight); BuriedForkDescPushBack(softforks, "fortcanninggreatworld", consensusParams.FortCanningGreatWorldHeight); BuriedForkDescPushBack(softforks, "fortcanningepilogue", consensusParams.FortCanningEpilogueHeight); + BuriedForkDescPushBack(softforks, "grandcentral", consensusParams.GrandCentralHeight); 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 e61dc65c98..598d4b45f5 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -140,6 +140,7 @@ def _test_getblockchaininfo(self): 'fortcanningspring': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanninggreatworld': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanningepilogue': {'type': 'buried', 'active': False, 'height': 10000000}, + 'grandcentral': {'type': 'buried', 'active': False, 'height': 10000000}, 'testdummy': { 'type': 'bip9', 'bip9': {