Skip to content
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
2 changes: 1 addition & 1 deletion contrib/devtools/mocknet.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ index 1ad8d066d..01b13b8aa 100644
+ }
+
int nHeight{pindexLast->nHeight + 1};
bool newDifficultyAdjust{nHeight > params.EunosHeight};
bool newDifficultyAdjust{nHeight > params.DF8EunosHeight};

diff --git a/src/version.h b/src/version.h
index 3ab303d56..fb84cea92 100644
Expand Down
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
252 changes: 126 additions & 126 deletions src/chainparams.cpp

Large diffs are not rendered by default.

42 changes: 21 additions & 21 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 DF2BayfrontHeight;
int DF3DF4BayfrontGardensHeight;
int BayfrontGardensHeight;
/** 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 (IsBelowDakotaMintTokenOrAccountToUtxos(txType, nSpendHeight) || (nSpendHeight >= chainparams.GetConsensus().GrandCentralHeight && txType == CustomTxType::UpdateMasternode)) {
if (IsBelowDakotaMintTokenOrAccountToUtxos(txType, nSpendHeight) || (nSpendHeight >= chainparams.GetConsensus().DF20GrandCentralHeight && txType == CustomTxType::UpdateMasternode)) {
CCustomCSView discardCache(mnview, nullptr, nullptr, nullptr);
// Note: TXs are already filtered. So we pass isEVMEnabled to false, but for future proof, refactor this enough,
// that it's propagated.
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
4 changes: 2 additions & 2 deletions src/masternodes/consensus/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Res CGovernanceConsensus::operator()(const CGovernanceHeightMessage &obj) const
}

// Validate GovVariables before storing
if (height >= static_cast<uint32_t>(consensus.FortCanningCrunchHeight) &&
if (height >= static_cast<uint32_t>(consensus.DF16FortCanningCrunchHeight) &&
obj.govVar->GetName() == "ATTRIBUTES") {
auto govVar = mnview.GetAttributes();
if (!govVar) {
Expand All @@ -173,7 +173,7 @@ Res CGovernanceConsensus::operator()(const CGovernanceHeightMessage &obj) const
}

// After GW exclude TokenSplit if split will have already been performed by startHeight
if (height >= static_cast<uint32_t>(consensus.GrandCentralHeight)) {
if (height >= static_cast<uint32_t>(consensus.DF20GrandCentralHeight)) {
if (const auto attrVar = std::dynamic_pointer_cast<ATTRIBUTES>(govVar); attrVar) {
const auto attrMap = attrVar->GetAttributesMap();
std::vector<CDataStructureV0> keysToErase;
Expand Down
26 changes: 13 additions & 13 deletions src/masternodes/consensus/icxorders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#include <masternodes/mn_checks.h>

bool IsICXEnabled(const int height, const CCustomCSView &view, const Consensus::Params &consensus) {
if (height >= consensus.NextNetworkUpgradeHeight) {
if (height >= consensus.DF22NextHeight) {
const CDataStructureV0 enabledKey{AttributeTypes::Param, ParamIDs::Feature, DFIPKeys::ICXEnabled};
auto attributes = view.GetAttributes();
assert(attributes);
return attributes->GetValue(enabledKey, false);
}
// ICX transactions allowed before NextNetwrokUpgrade and some of these conditions
else if (height < consensus.FortCanningParkHeight || IsRegtestNetwork() || (IsTestNetwork() && static_cast<int>(height) >= 1250000))
else if (height < consensus.DF13FortCanningParkHeight || IsRegtestNetwork() || (IsTestNetwork() && static_cast<int>(height) >= 1250000))
return true;

// ICX transactions disabled in all other cases
Expand Down Expand Up @@ -99,7 +99,7 @@ Res CICXOrdersConsensus::operator()(const CICXMakeOfferMessage &obj) const {
auto order = mnview.GetICXOrderByCreationTx(makeoffer.orderTx);
Require(order, "order with creation tx " + makeoffer.orderTx.GetHex() + " does not exists!");

auto expiry = static_cast<int>(height) < consensus.EunosPayaHeight ? CICXMakeOffer::DEFAULT_EXPIRY
auto expiry = static_cast<int>(height) < consensus.DF10EunosPayaHeight ? CICXMakeOffer::DEFAULT_EXPIRY
: CICXMakeOffer::EUNOSPAYA_DEFAULT_EXPIRY;

Require(makeoffer.expiry >= expiry, "offer expiry must be greater than %d!", expiry - 1);
Expand Down Expand Up @@ -156,7 +156,7 @@ Res CICXOrdersConsensus::operator()(const CICXSubmitDFCHTLCMessage &obj) const {
submitdfchtlc.offerTx.GetHex());

uint32_t timeout;
if (static_cast<int>(height) < consensus.EunosPayaHeight)
if (static_cast<int>(height) < consensus.DF10EunosPayaHeight)
timeout = CICXSubmitDFCHTLC::MINIMUM_TIMEOUT;
else
timeout = CICXSubmitDFCHTLC::EUNOSPAYA_MINIMUM_TIMEOUT;
Expand All @@ -172,7 +172,7 @@ Res CICXOrdersConsensus::operator()(const CICXSubmitDFCHTLCMessage &obj) const {

CAmount takerFee = offer->takerFee;
// EunosPaya: calculating adjusted takerFee only if amount in htlc different than in offer
if (static_cast<int>(height) >= consensus.EunosPayaHeight) {
if (static_cast<int>(height) >= consensus.DF10EunosPayaHeight) {
if (calcAmount < offer->amount) {
auto BTCAmount = MultiplyAmounts(submitdfchtlc.amount, order->orderPrice);
takerFee = (arith_uint256(BTCAmount) * offer->takerFee / offer->amount).GetLow64();
Expand Down Expand Up @@ -221,7 +221,7 @@ Res CICXOrdersConsensus::operator()(const CICXSubmitDFCHTLCMessage &obj) const {
exthtlc->hash.GetHex());

uint32_t timeout, btcBlocksInDfi;
if (static_cast<int>(height) < consensus.EunosPayaHeight) {
if (static_cast<int>(height) < consensus.DF10EunosPayaHeight) {
timeout = CICXSubmitDFCHTLC::MINIMUM_2ND_TIMEOUT;
btcBlocksInDfi = CICXSubmitEXTHTLC::BTC_BLOCKS_IN_DFI_BLOCKS;
} else {
Expand Down Expand Up @@ -279,7 +279,7 @@ Res CICXOrdersConsensus::operator()(const CICXSubmitEXTHTLCMessage &obj) const {
"Invalid hash, external htlc hash is different than dfc htlc hash");

uint32_t timeout, btcBlocksInDfi;
if (static_cast<int>(height) < consensus.EunosPayaHeight) {
if (static_cast<int>(height) < consensus.DF10EunosPayaHeight) {
timeout = CICXSubmitEXTHTLC::MINIMUM_2ND_TIMEOUT;
btcBlocksInDfi = CICXSubmitEXTHTLC::BTC_BLOCKS_IN_DFI_BLOCKS;
} else {
Expand All @@ -298,7 +298,7 @@ Res CICXOrdersConsensus::operator()(const CICXSubmitEXTHTLCMessage &obj) const {
submitexthtlc.offerTx.GetHex());

uint32_t timeout;
if (static_cast<int>(height) < consensus.EunosPayaHeight)
if (static_cast<int>(height) < consensus.DF10EunosPayaHeight)
timeout = CICXSubmitEXTHTLC::MINIMUM_TIMEOUT;
else
timeout = CICXSubmitEXTHTLC::EUNOSPAYA_MINIMUM_TIMEOUT;
Expand All @@ -312,7 +312,7 @@ Res CICXOrdersConsensus::operator()(const CICXSubmitEXTHTLCMessage &obj) const {

CAmount takerFee = offer->takerFee;
// EunosPaya: calculating adjusted takerFee only if amount in htlc different than in offer
if (static_cast<int>(height) >= consensus.EunosPayaHeight) {
if (static_cast<int>(height) >= consensus.DF10EunosPayaHeight) {
if (calcAmount < offer->amount) {
auto BTCAmount = DivideAmounts(offer->amount, order->orderPrice);
takerFee = (arith_uint256(submitexthtlc.amount) * offer->takerFee / BTCAmount).GetLow64();
Expand Down Expand Up @@ -376,7 +376,7 @@ Res CICXOrdersConsensus::operator()(const CICXClaimDFCHTLCMessage &obj) const {
Require(order, "order with creation tx %s does not exists!", offer->orderTx.GetHex());

auto exthtlc = mnview.HasICXSubmitEXTHTLCOpen(dfchtlc->offerTx);
if (static_cast<int>(height) < consensus.EunosPayaHeight)
if (static_cast<int>(height) < consensus.DF10EunosPayaHeight)
Require(exthtlc, "cannot claim, external htlc for this offer does not exists or expired!");

// claim DFC HTLC to receiveAddress
Expand All @@ -402,7 +402,7 @@ Res CICXOrdersConsensus::operator()(const CICXClaimDFCHTLCMessage &obj) const {
auto ICXBugPath = [&](uint32_t height) {
if ((IsTestNetwork() && height >= 1250000) ||
IsRegtestNetwork() ||
(IsMainNetwork() && height >= static_cast<uint32_t>(consensus.NextNetworkUpgradeHeight)))
(IsMainNetwork() && height >= static_cast<uint32_t>(consensus.DF22NextHeight)))
return false;
return true;
};
Expand Down Expand Up @@ -435,7 +435,7 @@ Res CICXOrdersConsensus::operator()(const CICXClaimDFCHTLCMessage &obj) const {

Require(mnview.ICXCloseDFCHTLC(*dfchtlc, CICXSubmitDFCHTLC::STATUS_CLAIMED));

if (static_cast<int>(height) >= consensus.EunosPayaHeight) {
if (static_cast<int>(height) >= consensus.DF10EunosPayaHeight) {
if (exthtlc)
return mnview.ICXCloseEXTHTLC(*exthtlc, CICXSubmitEXTHTLC::STATUS_CLOSED);
else
Expand Down Expand Up @@ -504,7 +504,7 @@ Res CICXOrdersConsensus::operator()(const CICXCloseOfferMessage &obj) const {
offer->closeTx = closeoffer.creationTx;
offer->closeHeight = closeoffer.creationHeight;

bool isPreEunosPaya = static_cast<int>(height) < consensus.EunosPayaHeight;
bool isPreEunosPaya = static_cast<int>(height) < consensus.DF10EunosPayaHeight;

if (order->orderType == CICXOrder::TYPE_INTERNAL &&
!mnview.ExistedICXSubmitDFCHTLC(offer->creationTx, isPreEunosPaya)) {
Expand Down
30 changes: 15 additions & 15 deletions src/masternodes/consensus/loans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ static Res PaybackWithCollateral(CCustomCSView &view,
}

bool CLoansConsensus::IsTokensMigratedToGovVar() const {
return static_cast<int>(height) > consensus.FortCanningCrunchHeight + 1;
return static_cast<int>(height) > consensus.DF16FortCanningCrunchHeight + 1;
}

Res CLoansConsensus::operator()(const CLoanSetCollateralTokenMessage &obj) const {
Require(CheckCustomTx());

Require(HasFoundationAuth(), "tx not from foundation member!");

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

auto attributes = mnview.GetAttributes();
Expand Down Expand Up @@ -214,7 +214,7 @@ Res CLoansConsensus::operator()(const CLoanSetLoanTokenMessage &obj) const {

Require(HasFoundationAuth(), "tx not from foundation member!");

if (height < static_cast<uint32_t>(consensus.FortCanningGreatWorldHeight)) {
if (height < static_cast<uint32_t>(consensus.DF18FortCanningGreatWorldHeight)) {
Require(obj.interest >= 0, "interest rate cannot be less than 0!");
}

Expand All @@ -234,7 +234,7 @@ Res CLoansConsensus::operator()(const CLoanSetLoanTokenMessage &obj) const {
auto tokenId = mnview.CreateToken(token, false, isEvmEnabledForBlock, evmQueueId);
Require(tokenId);

if (height >= static_cast<uint32_t>(consensus.FortCanningCrunchHeight) && IsTokensMigratedToGovVar()) {
if (height >= static_cast<uint32_t>(consensus.DF16FortCanningCrunchHeight) && IsTokensMigratedToGovVar()) {
const auto &id = tokenId.val->v;

auto attributes = mnview.GetAttributes();
Expand Down Expand Up @@ -292,15 +292,15 @@ Res CLoansConsensus::operator()(const CLoanUpdateLoanTokenMessage &obj) const {

Require(HasFoundationAuth(), "tx not from foundation member!");

if (height < static_cast<uint32_t>(consensus.FortCanningGreatWorldHeight)) {
if (height < static_cast<uint32_t>(consensus.DF18FortCanningGreatWorldHeight)) {
Require(obj.interest >= 0, "interest rate cannot be less than 0!");
}

auto pair = mnview.GetTokenByCreationTx(obj.tokenTx);
Require(pair, "Loan token (%s) does not exist!", obj.tokenTx.GetHex());

auto loanToken =
(height >= static_cast<uint32_t>(consensus.FortCanningCrunchHeight) && IsTokensMigratedToGovVar())
(height >= static_cast<uint32_t>(consensus.DF16FortCanningCrunchHeight) && IsTokensMigratedToGovVar())
? mnview.GetLoanTokenByID(pair->first)
: mnview.GetLoanToken(obj.tokenTx);

Expand All @@ -323,7 +323,7 @@ Res CLoansConsensus::operator()(const CLoanUpdateLoanTokenMessage &obj) const {

Require(mnview.UpdateToken(pair->second));

if (height >= static_cast<uint32_t>(consensus.FortCanningCrunchHeight) && IsTokensMigratedToGovVar()) {
if (height >= static_cast<uint32_t>(consensus.DF16FortCanningCrunchHeight) && IsTokensMigratedToGovVar()) {
const auto &id = pair->first.v;

auto attributes = mnview.GetAttributes();
Expand Down Expand Up @@ -495,13 +495,13 @@ Res CLoansConsensus::operator()(const CLoanTakeLoanMessage &obj) const {
auto hasDUSDLoans = false;

std::optional<std::pair<DCT_ID, std::optional<CTokensView::CTokenImpl> > > tokenDUSD;
if (static_cast<int>(height) >= consensus.FortCanningRoadHeight) {
if (static_cast<int>(height) >= consensus.DF15FortCanningRoadHeight) {
tokenDUSD = mnview.GetToken("DUSD");
}

uint64_t totalLoansActivePrice = 0, totalLoansNextPrice = 0;
for (const auto &[tokenId, tokenAmount] : obj.amounts.balances) {
if (height >= static_cast<uint32_t>(consensus.FortCanningGreatWorldHeight)) {
if (height >= static_cast<uint32_t>(consensus.DF18FortCanningGreatWorldHeight)) {
Require(tokenAmount > 0, "Valid loan amount required (input: %d@%d)", tokenAmount, tokenId.v);
}

Expand Down Expand Up @@ -654,12 +654,12 @@ Res CLoansConsensus::operator()(const CLoanPaybackLoanV2Message &obj) const {

if (!HasAuth(obj.from)) return DeFiErrors::TXMissingInput();

if (static_cast<int>(height) < consensus.FortCanningRoadHeight) {
if (static_cast<int>(height) < consensus.DF15FortCanningRoadHeight) {
if (!IsVaultPriceValid(mnview, obj.vaultId, height)) return DeFiErrors::LoanAssetPriceInvalid();
}

// Handle payback with collateral special case
if (static_cast<int>(height) >= consensus.FortCanningEpilogueHeight &&
if (static_cast<int>(height) >= consensus.DF19FortCanningEpilogueHeight &&
IsPaybackWithCollateral(mnview, obj.loans)) {
return PaybackWithCollateral(mnview, *vault, obj.vaultId, height, time);
}
Expand All @@ -676,7 +676,7 @@ Res CLoansConsensus::operator()(const CLoanPaybackLoanV2Message &obj) const {
const auto &paybackTokenId = kv.first;
auto paybackAmount = kv.second;

if (height >= static_cast<uint32_t>(consensus.FortCanningGreatWorldHeight)) {
if (height >= static_cast<uint32_t>(consensus.DF18FortCanningGreatWorldHeight)) {
if (paybackAmount <= 0) return DeFiErrors::LoanPaymentAmountInvalid(paybackAmount, paybackTokenId.v);
}

Expand Down Expand Up @@ -793,8 +793,8 @@ Res CLoansConsensus::operator()(const CLoanPaybackLoanV2Message &obj) const {
if (!res)
return res;

if (height >= static_cast<uint32_t>(consensus.FortCanningMuseumHeight) && subLoan < currentLoanAmount &&
height < static_cast<uint32_t>(consensus.FortCanningGreatWorldHeight)) {
if (height >= static_cast<uint32_t>(consensus.DF12FortCanningMuseumHeight) && subLoan < currentLoanAmount &&
height < static_cast<uint32_t>(consensus.DF18FortCanningGreatWorldHeight)) {
auto newRate = mnview.GetInterestRate(obj.vaultId, loanTokenId, height);
if (!newRate) return DeFiErrors::TokenInterestRateInvalid(loanToken->symbol);

Expand All @@ -812,7 +812,7 @@ Res CLoansConsensus::operator()(const CLoanPaybackLoanV2Message &obj) const {
return res;

// If interest was negative remove it from sub amount
if (height >= static_cast<uint32_t>(consensus.FortCanningEpilogueHeight) && subInterest < 0)
if (height >= static_cast<uint32_t>(consensus.DF19FortCanningEpilogueHeight) && subInterest < 0)
subLoan += subInterest;

// Do not sub balance if negative interest fully negates the current loan amount
Expand Down
Loading