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

Numeric prefix to all network upgrades #2292

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class CBlockIndex
std::sort(pbegin, pend);

// Only after FC and when we have a full set of times.
if (nHeight >= Params().GetConsensus().FortCanningHeight && pend - pbegin == nMedianTimeSpan) {
if (nHeight >= Params().GetConsensus().DF11FortCanningHeight && pend - pbegin == nMedianTimeSpan) {
// Take the median of the top five.
return pbegin[8];
}
Expand Down
264 changes: 132 additions & 132 deletions src/chainparams.cpp

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,32 @@ struct Params {
* BIP 16 exception blocks. */
int SegwitHeight;
/** Block height at which tokens, liquidity pools and new block rewards becomes active */
int AMKHeight;
int DF1AMKHeight;
/** What exactly? Changes to mint DAT, new updatetokens? */
int BayfrontHeight;
int BayfrontMarinaHeight;
int BayfrontGardensHeight;
int DF2BayfrontHeight;
int DF3BayfrontMarinaHeight;
int DF4BayfrontGardensHeight;
/** Third major fork. */
int ClarkeQuayHeight;
int DF5ClarkeQuayHeight;
/** Fourth major fork **/
int DakotaHeight;
int DakotaCrescentHeight;
int DF6DakotaHeight;
int DF7DakotaCrescentHeight;
/** Fifth major fork **/
int EunosHeight;
int EunosKampungHeight;
int EunosPayaHeight;
int FortCanningHeight;
int FortCanningMuseumHeight;
int FortCanningParkHeight;
int FortCanningHillHeight;
int FortCanningRoadHeight;
int FortCanningCrunchHeight;
int FortCanningSpringHeight;
int FortCanningGreatWorldHeight;
int FortCanningEpilogueHeight;
int GrandCentralHeight;
int GrandCentralEpilogueHeight;
int NextNetworkUpgradeHeight;
int DF8EunosHeight;
int DF9EunosKampungHeight;
int DF10EunosPayaHeight;
int DF11FortCanningHeight;
int DF12FortCanningMuseumHeight;
int DF13FortCanningParkHeight;
int DF14FortCanningHillHeight;
int DF15FortCanningRoadHeight;
int DF16FortCanningCrunchHeight;
int DF17FortCanningSpringHeight;
int DF18FortCanningGreatWorldHeight;
int DF19FortCanningEpilogueHeight;
int DF20GrandCentralHeight;
int DF21GrandCentralEpilogueHeight;
int DF22NextHeight;

/** Foundation share after AMK, normalized to COIN = 100% */
CAmount foundationShareDFIP1;
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ bool Consensus::CheckTxInputs(const CTransaction& tx, CValidationState& state, c
std::vector<unsigned char> dummy;
const auto txType = GuessCustomTxType(tx, dummy);

if (NotAllowedToFail(txType, nSpendHeight) || (nSpendHeight >= chainparams.GetConsensus().GrandCentralHeight && txType == CustomTxType::UpdateMasternode)) {
if (NotAllowedToFail(txType, nSpendHeight) || (nSpendHeight >= chainparams.GetConsensus().DF20GrandCentralHeight && txType == CustomTxType::UpdateMasternode)) {
CCustomCSView discardCache(mnview, nullptr, nullptr, nullptr);
auto res = ApplyCustomTx(discardCache, inputs, tx, chainparams.GetConsensus(), nSpendHeight, 0, &canSpend);
if (!res.ok && (res.code & CustomTxErrCodes::Fatal)) {
Expand Down
8 changes: 4 additions & 4 deletions src/masternodes/anchors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,14 +759,14 @@ bool ValidateAnchor(const CAnchor &anchor) {
// Post-fork anchor, will be added to pending anchors to validate in chain context
if (GetAnchorEmbeddedData(teamData, anchorCreationHeight, prefix)) {
// Make sure anchor created after fork.
if (anchorCreationHeight >= static_cast<uint64_t>(Params().GetConsensus().DakotaHeight)) {
if (anchorCreationHeight >= static_cast<uint64_t>(Params().GetConsensus().DF6DakotaHeight)) {
return true;
} else {
LogPrint(BCLog::ANCHORING,
"%s: Post fork anchor created before fork height. Anchor %ld fork %d\n",
__func__,
anchorCreationHeight,
Params().GetConsensus().DakotaHeight);
Params().GetConsensus().DF6DakotaHeight);
return false;
}
}
Expand Down Expand Up @@ -875,7 +875,7 @@ bool ContextualValidateAnchor(const CAnchorData &anchor, CBlockIndex &anchorBloc
}

// Recreate deeper anchor depth
if (anchorCreationHeight >= static_cast<uint64_t>(Params().GetConsensus().FortCanningHeight)) {
if (anchorCreationHeight >= static_cast<uint64_t>(Params().GetConsensus().DF11FortCanningHeight)) {
timeDepth += Params().GetConsensus().mn.anchoringAdditionalTimeDepth;
while (anchorHeight > 0 && ::ChainActive()[anchorHeight]->nTime + timeDepth > anchorCreationBlock->nTime) {
--anchorHeight;
Expand Down Expand Up @@ -1147,7 +1147,7 @@ const PendingOrderType PendingOrder =
PendingOrderType([](const CAnchorIndex::AnchorRec &a, const CAnchorIndex::AnchorRec &b) {
if (a.btcHeight == b.btcHeight) {
if (a.anchor.height == b.anchor.height) {
if (a.anchor.height >= static_cast<THeight>(Params().GetConsensus().EunosHeight)) {
if (a.anchor.height >= static_cast<THeight>(Params().GetConsensus().DF8EunosHeight)) {
const auto blockHash = panchors->ReadBlockHash(a.btcHeight);
auto aHash = Hash(a.txHash.begin(), a.txHash.end(), blockHash.begin(), blockHash.end());
auto bHash = Hash(b.txHash.begin(), b.txHash.end(), blockHash.begin(), blockHash.end());
Expand Down
2 changes: 1 addition & 1 deletion src/masternodes/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class DeFiErrors {
}

static Res GovVarValidateFortCanningSpring() {
return Res::Err("Cannot be set before FortCanningSpringHeight");
return Res::Err("Cannot be set before DF17FortCanningSpringHeight");
}

static Res GovVarValidateToken(const uint32_t token) {
Expand Down
60 changes: 30 additions & 30 deletions src/masternodes/govvariables/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ UniValue ATTRIBUTES::Export() const {
}

Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
if (view.GetLastHeight() < Params().GetConsensus().FortCanningHillHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF14FortCanningHillHeight) {
return DeFiErrors::GovVarValidateFortCanningHill();
}

Expand All @@ -1650,7 +1650,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
case AttributeTypes::Token:
switch (attrV0->key) {
case TokenKeys::LoanPaybackCollateral:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningEpilogueHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF19FortCanningEpilogueHeight) {
return DeFiErrors::GovVarValidateFortCanningEpilogue();
}

Expand All @@ -1663,7 +1663,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
break;
case TokenKeys::LoanPayback:
case TokenKeys::LoanPaybackFeePCT:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningRoadHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF15FortCanningRoadHeight) {
return DeFiErrors::GovVarValidateFortCanningRoad();
}
if (!view.GetLoanTokenByID({attrV0->typeId})) {
Expand All @@ -1675,15 +1675,15 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
break;
case TokenKeys::DexInFeePct:
case TokenKeys::DexOutFeePct:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningRoadHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF15FortCanningRoadHeight) {
return DeFiErrors::GovVarValidateFortCanningRoad();
}
if (!view.GetToken(DCT_ID{attrV0->typeId})) {
return DeFiErrors::GovVarValidateToken(attrV0->typeId);
}
break;
case TokenKeys::LoanCollateralFactor:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningEpilogueHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF19FortCanningEpilogueHeight) {
const auto amount = std::get_if<CAmount>(&value);
if (amount) {
if (*amount > COIN) {
Expand All @@ -1693,7 +1693,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
}
[[fallthrough]];
case TokenKeys::LoanMintingInterest:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningGreatWorldHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF18FortCanningGreatWorldHeight) {
const auto amount = std::get_if<CAmount>(&value);
if (amount) {
if (*amount < 0) {
Expand All @@ -1704,7 +1704,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
[[fallthrough]];
case TokenKeys::LoanCollateralEnabled:
case TokenKeys::LoanMintingEnabled: {
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF16FortCanningCrunchHeight) {
return DeFiErrors::GovVarValidateFortCanningCrunch();
}
if (!VerifyToken(view, attrV0->typeId)) {
Expand All @@ -1718,15 +1718,15 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
break;
}
case TokenKeys::FixedIntervalPriceId:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF16FortCanningCrunchHeight) {
return DeFiErrors::GovVarValidateFortCanningCrunch();
}
if (!VerifyToken(view, attrV0->typeId)) {
return DeFiErrors::GovVarValidateToken(attrV0->typeId);
}
break;
case TokenKeys::DFIP2203Enabled:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningRoadHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF15FortCanningRoadHeight) {
return DeFiErrors::GovVarValidateFortCanningRoad();
}
if (!view.GetLoanTokenByID({attrV0->typeId})) {
Expand All @@ -1745,7 +1745,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
case AttributeTypes::Consortium:
switch (attrV0->key) {
case ConsortiumKeys::MemberValues: {
if (view.GetLastHeight() < Params().GetConsensus().GrandCentralHeight)
if (view.GetLastHeight() < Params().GetConsensus().DF20GrandCentralHeight)
return Res::Err("Cannot be set before GrandCentral");

if (!view.GetToken(DCT_ID{attrV0->typeId}))
Expand Down Expand Up @@ -1777,7 +1777,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
}
case ConsortiumKeys::MintLimit:
case ConsortiumKeys::DailyMintLimit:
if (view.GetLastHeight() < Params().GetConsensus().GrandCentralHeight)
if (view.GetLastHeight() < Params().GetConsensus().DF20GrandCentralHeight)
return Res::Err("Cannot be set before GrandCentral");

if (!view.GetToken(DCT_ID{attrV0->typeId}))
Expand All @@ -1789,7 +1789,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
break;

case AttributeTypes::Oracles:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF16FortCanningCrunchHeight) {
return DeFiErrors::GovVarValidateFortCanningCrunch();
}
if (attrV0->typeId == OracleIDs::Splits) {
Expand Down Expand Up @@ -1831,7 +1831,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
break;
case PoolKeys::TokenAFeeDir:
case PoolKeys::TokenBFeeDir:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpringHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF17FortCanningSpringHeight) {
return DeFiErrors::GovVarValidateFortCanningSpring();
}
if (!view.GetPoolPair({attrV0->typeId})) {
Expand All @@ -1845,25 +1845,25 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {

case AttributeTypes::Param:
if (attrV0->typeId == ParamIDs::Feature && attrV0->key == DFIPKeys::MintTokens) {
if (view.GetLastHeight() < Params().GetConsensus().GrandCentralEpilogueHeight) {
return Res::Err("Cannot be set before GrandCentralEpilogueHeight");
if (view.GetLastHeight() < Params().GetConsensus().DF21GrandCentralEpilogueHeight) {
return Res::Err("Cannot be set before DF21GrandCentralEpilogueHeight");
}
} else if (attrV0->typeId == ParamIDs::Feature || attrV0->typeId == ParamIDs::Foundation ||
attrV0->key == DFIPKeys::Members) {
if (view.GetLastHeight() < Params().GetConsensus().GrandCentralHeight) {
return Res::Err("Cannot be set before GrandCentralHeight");
if (view.GetLastHeight() < Params().GetConsensus().DF20GrandCentralHeight) {
return Res::Err("Cannot be set before DF20GrandCentralHeight");
}
} else if (attrV0->typeId == ParamIDs::Foundation || attrV0->key == DFIPKeys::Members) {
if (view.GetLastHeight() < Params().GetConsensus().GrandCentralHeight) {
return Res::Err("Cannot be set before GrandCentralHeight");
if (view.GetLastHeight() < Params().GetConsensus().DF20GrandCentralHeight) {
return Res::Err("Cannot be set before DF20GrandCentralHeight");
}
} 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");
if (view.GetLastHeight() < Params().GetConsensus().DF17FortCanningSpringHeight) {
return Res::Err("Cannot be set before DF17FortCanningSpringHeight");
}
} else if (attrV0->typeId == ParamIDs::DFIP2203) {
if (view.GetLastHeight() < Params().GetConsensus().FortCanningRoadHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF15FortCanningRoadHeight) {
return DeFiErrors::GovVarValidateFortCanningRoad();
}
} else if (attrV0->typeId != ParamIDs::DFIP2201) {
Expand All @@ -1876,7 +1876,7 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
break;

case AttributeTypes::Locks:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningCrunchHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF16FortCanningCrunchHeight) {
return Res::Err("Cannot be set before FortCanningCrunch");
}
if (attrV0->typeId != ParamIDs::TokenID) {
Expand All @@ -1888,19 +1888,19 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {
break;

case AttributeTypes::Governance:
if (view.GetLastHeight() < Params().GetConsensus().GrandCentralHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF20GrandCentralHeight) {
return Res::Err("Cannot be set before GrandCentral");
}
break;

case AttributeTypes::EVMType:
if (view.GetLastHeight() < Params().GetConsensus().NextNetworkUpgradeHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF22NextHeight) {
return Res::Err("Cannot be set before NextNetworkUpgrade");
}
break;

case AttributeTypes::Transfer:
if (view.GetLastHeight() < Params().GetConsensus().NextNetworkUpgradeHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF22NextHeight) {
return Res::Err("Cannot be set before NextNetworkUpgrade");
}
if ((attrV0->typeId == TransferIDs::DVMToEVM || attrV0->typeId == TransferIDs::EVMToDVM) &&
Expand All @@ -1917,14 +1917,14 @@ Res ATTRIBUTES::Validate(const CCustomCSView &view) const {

case AttributeTypes::Vaults:
if (attrV0->typeId == VaultIDs::DUSDVault && attrV0->key == VaultKeys::DUSDVaultEnabled) {
if (view.GetLastHeight() < Params().GetConsensus().NextNetworkUpgradeHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF22NextHeight) {
return Res::Err("Cannot be set before NextNetworkUpgrade");
}
}
break;

case AttributeTypes::Rules:
if (view.GetLastHeight() < Params().GetConsensus().NextNetworkUpgradeHeight) {
if (view.GetLastHeight() < Params().GetConsensus().DF22NextHeight) {
return Res::Err("Cannot be set before NextNetworkUpgrade");
}
break;
Expand Down Expand Up @@ -2024,7 +2024,7 @@ Res ATTRIBUTES::Apply(CCustomCSView &mnview, const uint32_t height) {
return res;
}
} else if (attrV0->key == TokenKeys::LoanMintingInterest) {
if (height >= static_cast<uint32_t>(Params().GetConsensus().FortCanningGreatWorldHeight) &&
if (height >= static_cast<uint32_t>(Params().GetConsensus().DF18FortCanningGreatWorldHeight) &&
interestTokens.count(attrV0->typeId)) {
const auto tokenInterest = std::get_if<CAmount>(&attribute.second);
if (!tokenInterest) {
Expand All @@ -2050,7 +2050,7 @@ Res ATTRIBUTES::Apply(CCustomCSView &mnview, const uint32_t height) {
}
}
} else if (attrV0->key == TokenKeys::LoanCollateralFactor) {
if (height >= static_cast<uint32_t>(Params().GetConsensus().FortCanningEpilogueHeight)) {
if (height >= static_cast<uint32_t>(Params().GetConsensus().DF19FortCanningEpilogueHeight)) {
// Skip on if skip collateral check is passed
if (Params().NetworkIDString() == CBaseChainParams::REGTEST &&
gArgs.GetBoolArg("-regtest-skip-loan-collateral-validation", false)) {
Expand Down
2 changes: 1 addition & 1 deletion src/masternodes/govvariables/loan_daily_reward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ UniValue LP_DAILY_LOAN_TOKEN_REWARD::Export() const {
}

Res LP_DAILY_LOAN_TOKEN_REWARD::Validate(const CCustomCSView &view) const {
Require(view.GetLastHeight() >= Params().GetConsensus().FortCanningHeight, []{ return "Cannot be set before FortCanning"; });
Require(view.GetLastHeight() >= Params().GetConsensus().DF11FortCanningHeight, []{ return "Cannot be set before FortCanning"; });
return Res::Err("Cannot be set manually.");
}

Expand Down
Loading