From 3ec16c321dea20321e6b62592259dbbaa8d614a5 Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Mon, 23 May 2022 12:45:04 +0200 Subject: [PATCH 1/5] Add FortCanningSpiceGarden and move checks from GreatWorld --- src/chainparams.cpp | 5 +++++ src/consensus/params.h | 1 + src/init.cpp | 1 + src/masternodes/govvariables/attributes.cpp | 16 +++++++-------- src/masternodes/mn_checks.cpp | 19 ++++++++++++------ src/masternodes/tokens.cpp | 2 +- src/miner.cpp | 22 ++++++++++----------- src/rpc/blockchain.cpp | 1 + src/validation.cpp | 6 +++--- test/functional/feature_loan_vault.py | 10 +++++----- test/functional/feature_setgov.py | 18 ++++++++--------- test/functional/feature_token_lock.py | 2 +- test/functional/feature_token_split.py | 2 +- 13 files changed, 60 insertions(+), 45 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 60496c0d00..c0740ffdf1 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -130,6 +130,7 @@ class CMainParams : public CChainParams { consensus.FortCanningParkHeight = 1503143; consensus.FortCanningHillHeight = 1604999; // Feb 7, 2022. consensus.FortCanningRoadHeight = 1786000; // April 11, 2022. + consensus.FortCanningSpiceGardenHeight = 1936000; // June 2, 2022. consensus.GreatWorldHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -359,6 +360,7 @@ class CTestNetParams : public CChainParams { consensus.FortCanningParkHeight = 828800; consensus.FortCanningHillHeight = 828900; consensus.FortCanningRoadHeight = 893700; + consensus.FortCanningSpiceGardenHeight = std::numeric_limits::max(); consensus.GreatWorldHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -549,6 +551,7 @@ class CDevNetParams : public CChainParams { consensus.FortCanningParkHeight = std::numeric_limits::max(); consensus.FortCanningHillHeight = std::numeric_limits::max(); consensus.FortCanningRoadHeight = std::numeric_limits::max(); + consensus.FortCanningSpiceGardenHeight = std::numeric_limits::max(); consensus.GreatWorldHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -731,6 +734,7 @@ class CRegTestParams : public CChainParams { consensus.FortCanningParkHeight = 10000000; consensus.FortCanningHillHeight = 10000000; consensus.FortCanningRoadHeight = 10000000; + consensus.FortCanningSpiceGardenHeight = 10000000; consensus.GreatWorldHeight = 10000000; consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -952,6 +956,7 @@ void CRegTestParams::UpdateActivationParametersFromArgs() UpdateHeightValidation("Fort Canning Park", "-fortcanningparkheight", consensus.FortCanningParkHeight); UpdateHeightValidation("Fort Canning Hill", "-fortcanninghillheight", consensus.FortCanningHillHeight); UpdateHeightValidation("Fort Canning Road", "-fortcanningroadheight", consensus.FortCanningRoadHeight); + UpdateHeightValidation("Fort Canning Split", "-fortcanningspicegardenheight", consensus.FortCanningSpiceGardenHeight); UpdateHeightValidation("Great World", "-greatworldheight", consensus.GreatWorldHeight); if (gArgs.GetBoolArg("-simulatemainnet", false)) { diff --git a/src/consensus/params.h b/src/consensus/params.h index 7c919d1bec..03170fa36c 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -95,6 +95,7 @@ struct Params { int FortCanningParkHeight; int FortCanningHillHeight; int FortCanningRoadHeight; + int FortCanningSpiceGardenHeight; int GreatWorldHeight; /** Foundation share after AMK, normalized to COIN = 100% */ diff --git a/src/init.cpp b/src/init.cpp index 8a2d037067..a753b72837 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -477,6 +477,7 @@ void SetupServerArgs() gArgs.AddArg("-fortcanningparkheight", "Fort Canning Park fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanninghillheight", "Fort Canning Hill fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanningroadheight", "Fort Canning Road fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); + gArgs.AddArg("-fortcanningspicegardenheight", "Fort Canning Split fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-greatworldheight", "Great World 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("-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 01d2ee2dc8..3d6177b09f 100644 --- a/src/masternodes/govvariables/attributes.cpp +++ b/src/masternodes/govvariables/attributes.cpp @@ -731,8 +731,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const case TokenKeys::LoanCollateralFactor: case TokenKeys::LoanMintingEnabled: case TokenKeys::LoanMintingInterest: { - if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) { - return Res::Err("Cannot be set before GreatWorld"); + if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) { + return Res::Err("Cannot be set before FortCanningSpiceGarden"); } if (!VerifyToken(view, attrV0->typeId)) { return Res::Err("No such token (%d)", attrV0->typeId); @@ -745,8 +745,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const break; } case TokenKeys::FixedIntervalPriceId: - if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) { - return Res::Err("Cannot be set before GreatWorld"); + if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) { + return Res::Err("Cannot be set before FortCanningSpiceGarden"); } if (!VerifyToken(view, attrV0->typeId)) { return Res::Err("No such token (%d)", attrV0->typeId); @@ -770,8 +770,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const break; case AttributeTypes::Oracles: - if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) { - return Res::Err("Cannot be set before GreatWorld"); + if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) { + return Res::Err("Cannot be set before FortCanningSpiceGarden"); } if (attrV0->typeId == OracleIDs::Splits) { const auto splitMap = boost::get(&attribute.second); @@ -832,8 +832,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const break; case AttributeTypes::Locks: - if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) { - return Res::Err("Cannot be set before GreatWorld"); + if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) { + return Res::Err("Cannot be set before FortCanningSpiceGarden"); } if (attrV0->typeId != ParamIDs::TokenID) { return Res::Err("Unrecognised locks id"); diff --git a/src/masternodes/mn_checks.cpp b/src/masternodes/mn_checks.cpp index dc61433305..bfad48fd3d 100644 --- a/src/masternodes/mn_checks.cpp +++ b/src/masternodes/mn_checks.cpp @@ -249,6 +249,13 @@ class CCustomMetadataParseVisitor : public boost::static_visitor return Res::Ok(); } + Res isPostFortCanningSpiceGardenFork() const { + if(static_cast(height) < consensus.FortCanningSpiceGardenHeight) { + return Res::Err("called before FortCanningSpiceGarden height"); + } + return Res::Ok(); + } + Res isPostGreatWorldFork() const { if(static_cast(height) < consensus.GreatWorldHeight) { return Res::Err("called before GreatWorldHeight height"); @@ -522,24 +529,24 @@ class CCustomMetadataParseVisitor : public boost::static_visitor auto res = isPostFortCanningFork(); if (!res) return res; - res = isPostGreatWorldFork(); - return res ? Res::Err("called after GreatWorld height") : serialize(obj); + res = isPostFortCanningSpiceGardenFork(); + return res ? Res::Err("called after FortCanningSpiceGarden height") : serialize(obj); } Res operator()(CLoanSetLoanTokenMessage& obj) const { auto res = isPostFortCanningFork(); if (!res) return res; - res = isPostGreatWorldFork(); - return res ? Res::Err("called after GreatWorld height") : serialize(obj); + res = isPostFortCanningSpiceGardenFork(); + return res ? Res::Err("called after FortCanningSpiceGarden height") : serialize(obj); } Res operator()(CLoanUpdateLoanTokenMessage& obj) const { auto res = isPostFortCanningFork(); if (!res) return res; - res = isPostGreatWorldFork(); - return res ? Res::Err("called after GreatWorld height") : serialize(obj); + res = isPostFortCanningSpiceGardenFork(); + return res ? Res::Err("called after FortCanningSpiceGarden height") : serialize(obj); } Res operator()(CLoanSchemeMessage& obj) const { diff --git a/src/masternodes/tokens.cpp b/src/masternodes/tokens.cpp index 1c1625e12f..0f12fd0039 100644 --- a/src/masternodes/tokens.cpp +++ b/src/masternodes/tokens.cpp @@ -299,7 +299,7 @@ inline Res CTokenImplementation::IsValidSymbol() const if (symbol.find('#') != std::string::npos) { return Res::Err("token symbol should not contain '#'"); } - if (creationHeight >= Params().GetConsensus().GreatWorldHeight && symbol.find('/') != std::string::npos) { + if (creationHeight >= Params().GetConsensus().FortCanningSpiceGardenHeight && symbol.find('/') != std::string::npos) { return Res::Err("token symbol should not contain '/'"); } return Res::Ok(); diff --git a/src/miner.cpp b/src/miner.cpp index 296a7cc010..1b543c08ab 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -221,7 +221,7 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc addPackageTxs(nPackagesSelected, nDescendantsUpdated, nHeight, mnview); // TXs for the creationTx field in new tokens created via token split - if (nHeight >= chainparams.GetConsensus().GreatWorldHeight) { + if (nHeight >= chainparams.GetConsensus().FortCanningSpiceGardenHeight) { const auto attributes = mnview.GetAttributes(); if (attributes) { CDataStructureV0 splitKey{AttributeTypes::Oracles, OracleIDs::Splits, static_cast(nHeight)}; @@ -708,19 +708,19 @@ namespace pos { return Status::stakeReady; } - // This is an internal only method to ignore some mints, even though it's valid. - // This is done to workaround https://github.com/DeFiCh/ain/issues/693, so on specific bug condition, + // This is an internal only method to ignore some mints, even though it's valid. + // This is done to workaround https://github.com/DeFiCh/ain/issues/693, so on specific bug condition, // i.e, when subnode 1 stakes before subnode 0 on Eunos Paya+ (in particular to target pre-Eunos Paya masternodes that's carried over), it's ignored. - // in order to give time for subnode 0 to first succeed and create a record. - // + // in order to give time for subnode 0 to first succeed and create a record. + // // This is done to ensure that we can workaround the bug, without waiting for consensus change in next update. // This shouldn't have any effect on the mining, even though we ignore some successful hashes since the - // Coinages are retained and keep growing. Once subnode 0 mines, subnode 1 should stake again shortly with + // Coinages are retained and keep growing. Once subnode 0 mines, subnode 1 should stake again shortly with // higher coinage / TM. // - bool shouldIgnoreMint(uint8_t subNode, int64_t blockHeight, int64_t creationHeight, + bool shouldIgnoreMint(uint8_t subNode, int64_t blockHeight, int64_t creationHeight, const std::vector& subNodesBlockTime, const CChainParams& chainParams) { - + auto eunosPayaHeight = chainParams.GetConsensus().EunosPayaHeight; if (blockHeight < eunosPayaHeight || creationHeight >= eunosPayaHeight) { return false; @@ -807,7 +807,7 @@ namespace pos { // Plus one to avoid time-too-old error on exact median time. nLastCoinStakeSearchTime = tip->GetMedianTimePast() + 1; } - + lastBlockSeen = tip->GetBlockHash(); } @@ -828,7 +828,7 @@ namespace pos { if (pos::CheckKernelHash(stakeModifier, nBits, creationHeight, blockTime, blockHeight, masternodeID, chainparams.GetConsensus(), subNodesBlockTime, timelock, ctxState)) { - if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams)) + if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams)) break; LogPrint(BCLog::STAKING, "MakeStake: kernel found\n"); @@ -853,7 +853,7 @@ namespace pos { if (pos::CheckKernelHash(stakeModifier, nBits, creationHeight, blockTime, blockHeight, masternodeID, chainparams.GetConsensus(), subNodesBlockTime, timelock, ctxState)) { - if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams)) + if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams)) break; LogPrint(BCLog::STAKING, "MakeStake: kernel found\n"); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index ddc0b58b56..12af6b304e 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1336,6 +1336,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) BuriedForkDescPushBack(softforks, "fortcanningpark", consensusParams.FortCanningParkHeight); BuriedForkDescPushBack(softforks, "fortcanninghill", consensusParams.FortCanningHillHeight); BuriedForkDescPushBack(softforks, "fortcanningroad", consensusParams.FortCanningRoadHeight); + BuriedForkDescPushBack(softforks, "fortcanningspicegarden", consensusParams.FortCanningSpiceGardenHeight); BuriedForkDescPushBack(softforks, "greatworld", consensusParams.GreatWorldHeight); BIP9SoftForkDescPushBack(softforks, "testdummy", consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); obj.pushKV("softforks", softforks); diff --git a/src/validation.cpp b/src/validation.cpp index df8c71e439..e9e8d3a9bf 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3610,7 +3610,7 @@ void CChainState::ProcessTokenToGovVar(const CBlockIndex* pindex, CCustomCSView& // Migrate at +1 height so that GetLastHeight() in Gov var // Validate() has a height equal to the GW fork. - if (pindex->nHeight != chainparams.GetConsensus().GreatWorldHeight + 1) { + if (pindex->nHeight != chainparams.GetConsensus().FortCanningSpiceGardenHeight + 1) { return; } @@ -4030,7 +4030,7 @@ static Res VaultSplits(CCustomCSView& view, ATTRIBUTES& attributes, const DCT_ID } void CChainState::ProcessTokenSplits(const CBlock& block, const CBlockIndex* pindex, CCustomCSView& cache, const CreationTxs& creationTxs, const CChainParams& chainparams) { - if (pindex->nHeight < chainparams.GetConsensus().GreatWorldHeight) { + if (pindex->nHeight < chainparams.GetConsensus().FortCanningSpiceGardenHeight) { return; } const auto attributes = cache.GetAttributes(); @@ -5499,7 +5499,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P if (block.vtx[i]->IsCoinBase() && !IsAnchorRewardTx(*block.vtx[i], dummy, height >= consensusParams.FortCanningHeight) && !IsAnchorRewardTxPlus(*block.vtx[i], dummy, height >= consensusParams.FortCanningHeight) && - !IsTokenSplitTx(*block.vtx[i], dummy, height >= consensusParams.GreatWorldHeight)) + !IsTokenSplitTx(*block.vtx[i], dummy, height >= consensusParams.FortCanningSpiceGardenHeight)) return state.Invalid(ValidationInvalidReason::CONSENSUS, false, REJECT_INVALID, "bad-cb-multiple", "more than one coinbase"); } } diff --git a/test/functional/feature_loan_vault.py b/test/functional/feature_loan_vault.py index 67b49f3633..40c12f6345 100755 --- a/test/functional/feature_loan_vault.py +++ b/test/functional/feature_loan_vault.py @@ -18,8 +18,8 @@ def set_test_params(self): self.num_nodes = 2 self.setup_clean_chain = True self.extra_args = [ - ['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-greatworldheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'], - ['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-greatworldheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'] + ['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-fortcanningspicegardenheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'], + ['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-fortcanningspicegardenheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'] ] self.vaults = [] self.owner_addresses = [] @@ -750,19 +750,19 @@ def loan_and_collateral_token_to_govvar(self): self.move_to_gw_fork() # Try and call disabled RPC calls - assert_raises_rpc_error(-32600, 'called after GreatWorld height', self.nodes[0].setloantoken, { + assert_raises_rpc_error(-32600, 'called after FortCanningSpiceGarden height', self.nodes[0].setloantoken, { 'symbol': "DUSD", 'name': "DUSD stable token", 'fixedIntervalPriceId': "DUSD/USD", 'mintable': True, 'interest': 1}) - assert_raises_rpc_error(-32600, 'called after GreatWorld height', self.nodes[0].updateloantoken, "DUSD", { + assert_raises_rpc_error(-32600, 'called after FortCanningSpiceGarden height', self.nodes[0].updateloantoken, "DUSD", { 'symbol': "DUSD", 'name': "DUSD stable token", 'fixedIntervalPriceId': "DUSD/USD", 'mintable': True, 'interest': 1}) - assert_raises_rpc_error(-32600, 'called after GreatWorld height', self.nodes[0].setcollateraltoken, { + assert_raises_rpc_error(-32600, 'called after FortCanningSpiceGarden height', self.nodes[0].setcollateraltoken, { 'token': self.idDFI, 'factor': 1, 'fixedIntervalPriceId': "DFI/USD"}) diff --git a/test/functional/feature_setgov.py b/test/functional/feature_setgov.py index 821240b2e9..c0855a1c7c 100755 --- a/test/functional/feature_setgov.py +++ b/test/functional/feature_setgov.py @@ -21,8 +21,8 @@ def set_test_params(self): self.num_nodes = 2 self.setup_clean_chain = True self.extra_args = [ - ['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-greatworldheight=1200', '-subsidytest=1'], - ['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-greatworldheight=1200', '-subsidytest=1']] + ['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-fortcanningspicegardenheight=1200', '-subsidytest=1'], + ['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-fortcanningspicegardenheight=1200', '-subsidytest=1']] def run_test(self): @@ -591,13 +591,13 @@ def run_test(self): assert_equal(result['v0/token/5/dfip2203'], 'true') # Check errors - assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/locks/token/5':'true'}}) - assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/oracles/splits/4000': '1/50'}}) - assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/fixed_interval_price_id':'TSLA/USD'}}) - assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_enabled':'true'}}) - assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_factor':'1.00000000'}}) - assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_enabled':'true'}}) - assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_interest':'5.00000000'}}) + assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningSpiceGarden", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/locks/token/5':'true'}}) + assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningSpiceGarden", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/oracles/splits/4000': '1/50'}}) + assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningSpiceGarden", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/fixed_interval_price_id':'TSLA/USD'}}) + assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningSpiceGarden", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_enabled':'true'}}) + assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningSpiceGarden", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_factor':'1.00000000'}}) + assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningSpiceGarden", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_enabled':'true'}}) + assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningSpiceGarden", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_interest':'5.00000000'}}) # Move to GW fork self.nodes[0].generate(1200 - self.nodes[0].getblockcount()) diff --git a/test/functional/feature_token_lock.py b/test/functional/feature_token_lock.py index 6e6092416f..e89fe5edb0 100644 --- a/test/functional/feature_token_lock.py +++ b/test/functional/feature_token_lock.py @@ -15,7 +15,7 @@ class TokenLockTest(DefiTestFramework): def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True - self.extra_args = [['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-eunosheight=1', '-fortcanningheight=1', '-fortcanninghillheight=1', '-fortcanningroadheight=1', '-greatworldheight=200', '-subsidytest=1']] + self.extra_args = [['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-eunosheight=1', '-fortcanningheight=1', '-fortcanninghillheight=1', '-fortcanningroadheight=1', '-fortcanningspicegardenheight=200', '-subsidytest=1']] def run_test(self): self.nodes[0].generate(150) diff --git a/test/functional/feature_token_split.py b/test/functional/feature_token_split.py index 4fcb9e000b..a6f09e99a1 100644 --- a/test/functional/feature_token_split.py +++ b/test/functional/feature_token_split.py @@ -20,7 +20,7 @@ def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True self.extra_args = [ - ['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-eunosheight=1', '-fortcanningheight=1', '-fortcanningmuseumheight=1', '-fortcanninghillheight=1', '-fortcanningroadheight=1', '-greatworldheight=150', '-subsidytest=1']] + ['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-eunosheight=1', '-fortcanningheight=1', '-fortcanningmuseumheight=1', '-fortcanninghillheight=1', '-fortcanningroadheight=1', '-fortcanningspicegardenheight=150', '-subsidytest=1']] def run_test(self): self.setup_test_tokens() From 53d3d9ac71105f610c3ee1cd8503095e9384bdfc Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Mon, 23 May 2022 12:49:17 +0200 Subject: [PATCH 2/5] Set version and protocol version --- configure.ac | 4 ++-- src/version.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 0c6c7a7fd4..24b785b26e 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, 7) -define(_CLIENT_VERSION_REVISION, 1) +define(_CLIENT_VERSION_MINOR, 8) +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/version.h b/src/version.h index 4e8fdcc93c..3ab303d56c 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70028; +static const int PROTOCOL_VERSION = 70029; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; From eafb2de4b9164639a5ad868b47a744c5675cb4f0 Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Mon, 23 May 2022 13:10:05 +0200 Subject: [PATCH 3/5] Set testnet height --- src/chainparams.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index c0740ffdf1..88acaa74e0 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -360,7 +360,7 @@ class CTestNetParams : public CChainParams { consensus.FortCanningParkHeight = 828800; consensus.FortCanningHillHeight = 828900; consensus.FortCanningRoadHeight = 893700; - consensus.FortCanningSpiceGardenHeight = std::numeric_limits::max(); + consensus.FortCanningSpiceGardenHeight = 1011600; consensus.GreatWorldHeight = std::numeric_limits::max(); consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); From c91339ee143f01a8fea43dac23ff58715dcd4cbc Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Mon, 23 May 2022 13:30:23 +0200 Subject: [PATCH 4/5] Add spicegarden in rpc_blockchain test --- test/functional/rpc_blockchain.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index 1b316d0aeb..f97c296e62 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -136,6 +136,7 @@ def _test_getblockchaininfo(self): 'fortcanningpark': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanninghill': {'type': 'buried', 'active': False, 'height': 10000000}, 'fortcanningroad': {'type': 'buried', 'active': False, 'height': 10000000}, + 'fortcanningspicegarden': {'type': 'buried', 'active': False, 'height': 10000000}, 'greatworld': {'type': 'buried', 'active': False, 'height': 10000000}, 'testdummy': { 'type': 'bip9', From 956fe1cf5e1ffc2cacac77d1f999e4108e8dd475 Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Mon, 23 May 2022 13:38:30 +0200 Subject: [PATCH 5/5] Fix --- src/init.cpp | 2 +- src/miner.cpp | 29 ----------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index a753b72837..9bc359cb65 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -477,7 +477,7 @@ void SetupServerArgs() gArgs.AddArg("-fortcanningparkheight", "Fort Canning Park fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanninghillheight", "Fort Canning Hill fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fortcanningroadheight", "Fort Canning Road fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); - gArgs.AddArg("-fortcanningspicegardenheight", "Fort Canning Split fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); + gArgs.AddArg("-fortcanningspicegardenheight", "Fort Canning Spice Garden fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-greatworldheight", "Great World 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("-simulatemainnet", "Configure the regtest network to mainnet target timespan and spacing ", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); diff --git a/src/miner.cpp b/src/miner.cpp index 1b543c08ab..f867335f52 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -708,31 +708,6 @@ namespace pos { return Status::stakeReady; } - // This is an internal only method to ignore some mints, even though it's valid. - // This is done to workaround https://github.com/DeFiCh/ain/issues/693, so on specific bug condition, - // i.e, when subnode 1 stakes before subnode 0 on Eunos Paya+ (in particular to target pre-Eunos Paya masternodes that's carried over), it's ignored. - // in order to give time for subnode 0 to first succeed and create a record. - // - // This is done to ensure that we can workaround the bug, without waiting for consensus change in next update. - // This shouldn't have any effect on the mining, even though we ignore some successful hashes since the - // Coinages are retained and keep growing. Once subnode 0 mines, subnode 1 should stake again shortly with - // higher coinage / TM. - // - bool shouldIgnoreMint(uint8_t subNode, int64_t blockHeight, int64_t creationHeight, - const std::vector& subNodesBlockTime, const CChainParams& chainParams) { - - auto eunosPayaHeight = chainParams.GetConsensus().EunosPayaHeight; - if (blockHeight < eunosPayaHeight || creationHeight >= eunosPayaHeight) { - return false; - } - - if (subNode == 1 && subNodesBlockTime[0] == subNodesBlockTime[1]) { - LogPrint(BCLog::STAKING, "MakeStake: kernel ignored\n"); - return true; - } - return false; - } - Staker::Status Staker::stake(const CChainParams& chainparams, const ThreadStaker::Args& args) { bool found = false; @@ -828,8 +803,6 @@ namespace pos { if (pos::CheckKernelHash(stakeModifier, nBits, creationHeight, blockTime, blockHeight, masternodeID, chainparams.GetConsensus(), subNodesBlockTime, timelock, ctxState)) { - if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams)) - break; LogPrint(BCLog::STAKING, "MakeStake: kernel found\n"); found = true; @@ -853,8 +826,6 @@ namespace pos { if (pos::CheckKernelHash(stakeModifier, nBits, creationHeight, blockTime, blockHeight, masternodeID, chainparams.GetConsensus(), subNodesBlockTime, timelock, ctxState)) { - if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams)) - break; LogPrint(BCLog::STAKING, "MakeStake: kernel found\n"); found = true;