Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename fortcanningspicegarden to fortcanningcrunch #1267

Merged
merged 2 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +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.FortCanningCrunchHeight = 1936000; // June 2, 2022.
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -360,7 +360,7 @@ class CTestNetParams : public CChainParams {
consensus.FortCanningParkHeight = 828800;
consensus.FortCanningHillHeight = 828900;
consensus.FortCanningRoadHeight = 893700;
consensus.FortCanningSpiceGardenHeight = 1011600;
consensus.FortCanningCrunchHeight = 1011600;
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -551,7 +551,7 @@ class CDevNetParams : public CChainParams {
consensus.FortCanningParkHeight = std::numeric_limits<int>::max();
consensus.FortCanningHillHeight = std::numeric_limits<int>::max();
consensus.FortCanningRoadHeight = std::numeric_limits<int>::max();
consensus.FortCanningSpiceGardenHeight = std::numeric_limits<int>::max();
consensus.FortCanningCrunchHeight = std::numeric_limits<int>::max();
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -734,7 +734,7 @@ class CRegTestParams : public CChainParams {
consensus.FortCanningParkHeight = 10000000;
consensus.FortCanningHillHeight = 10000000;
consensus.FortCanningRoadHeight = 10000000;
consensus.FortCanningSpiceGardenHeight = 10000000;
consensus.FortCanningCrunchHeight = 10000000;
consensus.GreatWorldHeight = 10000000;

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -956,7 +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("Fort Canning Crunch", "-fortcanningcrunchheight", consensus.FortCanningCrunchHeight);
UpdateHeightValidation("Great World", "-greatworldheight", consensus.GreatWorldHeight);

if (gArgs.GetBoolArg("-simulatemainnet", false)) {
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct Params {
int FortCanningParkHeight;
int FortCanningHillHeight;
int FortCanningRoadHeight;
int FortCanningSpiceGardenHeight;
int FortCanningCrunchHeight;
int GreatWorldHeight;

/** Foundation share after AMK, normalized to COIN = 100% */
Expand Down
4 changes: 2 additions & 2 deletions src/consensus/tx_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ bool IsAnchorRewardTxPlus(CTransaction const & tx, std::vector<unsigned char> &
return result;
}

bool IsTokenSplitTx(CTransaction const & tx, std::vector<unsigned char> & metadata, bool fortCanningGreen)
bool IsTokenSplitTx(CTransaction const & tx, std::vector<unsigned char> & metadata, bool fortCanningCrunch)
{
if (!fortCanningGreen) {
if (!fortCanningCrunch) {
return false;
}
if (!tx.IsCoinBase() || tx.vout.size() != 1 || tx.vout[0].nValue != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/tx_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ bool ParseScriptByMarker(CScript const & script,
bool& hasAdditionalOpcodes);
bool IsAnchorRewardTx(CTransaction const & tx, std::vector<unsigned char> & metadata, bool fortCanning = false);
bool IsAnchorRewardTxPlus(CTransaction const & tx, std::vector<unsigned char> & metadata, bool fortCanning = false);
bool IsTokenSplitTx(CTransaction const & tx, std::vector<unsigned char> & metadata, bool fortCanningGreen = true);
bool IsTokenSplitTx(CTransaction const & tx, std::vector<unsigned char> & metadata, bool fortCanningCrunch = true);

#endif // DEFI_CONSENSUS_TX_CHECK_H
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 Spice Garden fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningcrunchheight", "Fort Canning Crunch 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);
Expand Down
16 changes: 8 additions & 8 deletions src/masternodes/govvariables/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
case TokenKeys::LoanCollateralFactor:
case TokenKeys::LoanMintingEnabled:
case TokenKeys::LoanMintingInterest: {
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
return Res::Err("Cannot be set before FortCanningCrunch");
}
if (!VerifyToken(view, attrV0->typeId)) {
return Res::Err("No such token (%d)", attrV0->typeId);
Expand All @@ -758,8 +758,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;
}
case TokenKeys::FixedIntervalPriceId:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
return Res::Err("Cannot be set before FortCanningCrunch");
}
if (!VerifyToken(view, attrV0->typeId)) {
return Res::Err("No such token (%d)", attrV0->typeId);
Expand All @@ -783,8 +783,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;

case AttributeTypes::Oracles:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
return Res::Err("Cannot be set before FortCanningCrunch");
}
if (attrV0->typeId == OracleIDs::Splits) {
const auto splitMap = boost::get<OracleSplits>(&attribute.second);
Expand Down Expand Up @@ -845,8 +845,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;

case AttributeTypes::Locks:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
return Res::Err("Cannot be set before FortCanningCrunch");
}
if (attrV0->typeId != ParamIDs::TokenID) {
return Res::Err("Unrecognised locks id");
Expand Down
14 changes: 7 additions & 7 deletions src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ class CCustomMetadataParseVisitor : public boost::static_visitor<Res>
return Res::Ok();
}

Res isPostFortCanningSpiceGardenFork() const {
if(static_cast<int>(height) < consensus.FortCanningSpiceGardenHeight) {
return Res::Err("called before FortCanningSpiceGarden height");
Res isPostFortCanningCrunchFork() const {
if(static_cast<int>(height) < consensus.FortCanningCrunchHeight) {
return Res::Err("called before FortCanningCrunch height");
}
return Res::Ok();
}
Expand Down Expand Up @@ -539,8 +539,8 @@ class CCustomMetadataParseVisitor : public boost::static_visitor<Res>
auto res = isPostFortCanningFork();
if (!res)
return res;
res = isPostFortCanningSpiceGardenFork();
return res ? Res::Err("called after FortCanningSpiceGarden height") : serialize(obj);
res = isPostFortCanningCrunchFork();
return res ? Res::Err("called after FortCanningCrunch height") : serialize(obj);
}

Res operator()(CLoanSchemeMessage& obj) const {
Expand Down Expand Up @@ -2307,7 +2307,7 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor
if (!HasFoundationAuth())
return Res::Err("tx not from foundation member!");

if (height >= static_cast<uint32_t>(consensus.FortCanningSpiceGardenHeight))
if (height >= static_cast<uint32_t>(consensus.FortCanningCrunchHeight))
{
const auto& tokenId = obj.idToken.v;

Expand Down Expand Up @@ -2379,7 +2379,7 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor
if (!HasFoundationAuth())
return Res::Err("tx not from foundation member!");

if (height >= static_cast<uint32_t>(consensus.FortCanningSpiceGardenHeight))
if (height >= static_cast<uint32_t>(consensus.FortCanningCrunchHeight))
{
CTokenImplementation token;
token.symbol = trim_ws(obj.symbol).substr(0, CToken::MAX_TOKEN_SYMBOL_LENGTH);
Expand Down
2 changes: 1 addition & 1 deletion src/masternodes/tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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().FortCanningSpiceGardenHeight && symbol.find('/') != std::string::npos) {
if (creationHeight >= Params().GetConsensus().FortCanningCrunchHeight && symbol.find('/') != std::string::npos) {
return Res::Err("token symbol should not contain '/'");
}
return Res::Ok();
Expand Down
2 changes: 1 addition & 1 deletion src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ std::unique_ptr<CBlockTemplate> 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().FortCanningSpiceGardenHeight) {
if (nHeight >= chainparams.GetConsensus().FortCanningCrunchHeight) {
const auto attributes = mnview.GetAttributes();
if (attributes) {
CDataStructureV0 splitKey{AttributeTypes::Oracles, OracleIDs::Splits, static_cast<uint32_t>(nHeight)};
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +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, "fortcanningcrunch", consensusParams.FortCanningCrunchHeight);
BuriedForkDescPushBack(softforks, "greatworld", consensusParams.GreatWorldHeight);
BIP9SoftForkDescPushBack(softforks, "testdummy", consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);
obj.pushKV("softforks", softforks);
Expand Down
8 changes: 4 additions & 4 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
int64_t nTimeStart = GetTimeMicros();

// Interrupt on hash or height requested. Invalidate the block.
if (StopOrInterruptConnect(pindex, state))
if (StopOrInterruptConnect(pindex, state))
return false;

// Reset phanton TX to block TX count
Expand Down Expand Up @@ -3648,7 +3648,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().FortCanningSpiceGardenHeight + 1) {
if (pindex->nHeight != chainparams.GetConsensus().FortCanningCrunchHeight + 1) {
return;
}

Expand Down Expand Up @@ -4068,7 +4068,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().FortCanningSpiceGardenHeight) {
if (pindex->nHeight < chainparams.GetConsensus().FortCanningCrunchHeight) {
return;
}
const auto attributes = cache.GetAttributes();
Expand Down Expand Up @@ -5536,7 +5536,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.FortCanningSpiceGardenHeight))
!IsTokenSplitTx(*block.vtx[i], dummy, height >= consensusParams.FortCanningCrunchHeight))
return state.Invalid(ValidationInvalidReason::CONSENSUS, false, REJECT_INVALID, "bad-cb-multiple", "more than one coinbase");
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_loan_setcollateraltoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
self.extra_args = [
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=50', '-fortcanningheight=50', '-fortcanninghillheight=50', '-fortcanningspicegardenheight=150', '-txindex=1']]
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=50', '-fortcanningheight=50', '-fortcanninghillheight=50', '-fortcanningcrunchheight=150', '-txindex=1']]

def run_test(self):
assert_equal(len(self.nodes[0].listtokens()), 1) # only one token == DFI
Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_loan_setloantoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
self.extra_args = [
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=50', '-fortcanningheight=50', '-fortcanninghillheight=50', '-fortcanningspicegardenheight=110', '-txindex=1']]
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=50', '-fortcanningheight=50', '-fortcanninghillheight=50', '-fortcanningcrunchheight=110', '-txindex=1']]

def run_test(self):
assert_equal(len(self.nodes[0].listtokens()), 1) # only one token == DFI
Expand Down
6 changes: 3 additions & 3 deletions test/functional/feature_loan_vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '-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']
['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-fortcanningcrunchheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'],
['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-fortcanningcrunchheight=1700', '-jellyfish_regtest=1', '-simulatemainnet']
]
self.vaults = []
self.owner_addresses = []
Expand Down Expand Up @@ -750,7 +750,7 @@ 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 FortCanningSpiceGarden height', self.nodes[0].updateloantoken, "DUSD", {
assert_raises_rpc_error(-32600, 'called after FortCanningCrunch height', self.nodes[0].updateloantoken, "DUSD", {
'symbol': "DUSD",
'name': "DUSD stable token",
'fixedIntervalPriceId': "DUSD/USD",
Expand Down
Loading