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

Bundle activations of NFT adjustments and send-to-many #1258

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions src/omnicore/nftdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,13 @@ void CMPNonFungibleTokensDB::SanityCheck()

for (std::map<uint32_t,int64_t>::iterator it = totals.begin(); it != totals.end(); ++it) {
if (mastercore::getTotalTokens(it->first) != it->second) {
std::string abortMsg = strprintf("Failed sanity check on property %d (%d != %d)\n", it->first, mastercore::getTotalTokens(it->first), it->second);
AbortNode(abortMsg);
PrintToLog("Failed sanity check on property %d (%d != %d)\n", it->first, mastercore::getTotalTokens(it->first), it->second);
} else {
result = result + strprintf("%d:%d=%d,", it->first, mastercore::getTotalTokens(it->first), it->second);
}
}

if (msc_debug_nftdb) PrintToLog("UTDB sanity check OK (%s)\n", result);
if (msc_debug_nftdb) PrintToLog("UTDB sanity check (%s)\n", result);
}

void CMPNonFungibleTokensDB::printStats()
Expand Down
35 changes: 11 additions & 24 deletions src/omnicore/rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std::vector<TransactionRestriction> CConsensusParams::GetRestrictions() const
{ MSC_TYPE_SEND_NONFUNGIBLE, MP_TX_PKT_V0, false, MSC_NONFUNGIBLE_BLOCK },
{ MSC_TYPE_NONFUNGIBLE_DATA, MP_TX_PKT_V0, false, MSC_NONFUNGIBLE_BLOCK },

{ MSC_TYPE_SEND_TO_MANY, MP_TX_PKT_V0, false, MSC_SEND_TO_MANY_BLOCK },
{ MSC_TYPE_SEND_TO_MANY, MP_TX_PKT_V0, false, MSC_SEND_TO_MANY_NFT_FIX_BLOCK },
};

const size_t nSize = sizeof(vTxRestrictions) / sizeof(vTxRestrictions[0]);
Expand Down Expand Up @@ -257,7 +257,7 @@ CMainConsensusParams::CMainConsensusParams()
MSC_ANYDATA_BLOCK = 0;
MSC_NONFUNGIBLE_BLOCK = 999999;
MSC_DELEGATED_ISSUANCE_BLOCK = 999999;
MSC_SEND_TO_MANY_BLOCK = 999999;
MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 999999;
// Other feature activations:
GRANTEFFECTS_FEATURE_BLOCK = 394500;
DEXMATH_FEATURE_BLOCK = 395000;
Expand All @@ -266,7 +266,6 @@ CMainConsensusParams::CMainConsensusParams()
FEES_FEATURE_BLOCK = 999999;
FREEZENOTICE_FEATURE_BLOCK = 999999;
FREEDEX_FEATURE_BLOCK = 999999;
NONFUNGIBLETOKEN_ISSUER_DATA = 999999;
}

/**
Expand Down Expand Up @@ -304,7 +303,7 @@ CTestNetConsensusParams::CTestNetConsensusParams()
MSC_ANYDATA_BLOCK = 0;
MSC_NONFUNGIBLE_BLOCK = 0;
MSC_DELEGATED_ISSUANCE_BLOCK = 0;
MSC_SEND_TO_MANY_BLOCK = 0;
MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 0;
// Other feature activations:
GRANTEFFECTS_FEATURE_BLOCK = 0;
DEXMATH_FEATURE_BLOCK = 0;
Expand All @@ -313,7 +312,6 @@ CTestNetConsensusParams::CTestNetConsensusParams()
FEES_FEATURE_BLOCK = 0;
FREEZENOTICE_FEATURE_BLOCK = 0;
FREEDEX_FEATURE_BLOCK = 0;
NONFUNGIBLETOKEN_ISSUER_DATA = 0;
}

/**
Expand Down Expand Up @@ -351,7 +349,7 @@ CRegTestConsensusParams::CRegTestConsensusParams()
MSC_ANYDATA_BLOCK = 0;
MSC_NONFUNGIBLE_BLOCK = 0;
MSC_DELEGATED_ISSUANCE_BLOCK = 0;
MSC_SEND_TO_MANY_BLOCK = 0;
MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 0;
// Other feature activations:
GRANTEFFECTS_FEATURE_BLOCK = 999999;
DEXMATH_FEATURE_BLOCK = 999999;
Expand All @@ -360,7 +358,6 @@ CRegTestConsensusParams::CRegTestConsensusParams()
FEES_FEATURE_BLOCK = 999999;
FREEZENOTICE_FEATURE_BLOCK = 999999;
FREEDEX_FEATURE_BLOCK = 999999;
NONFUNGIBLETOKEN_ISSUER_DATA = 999999;
}

//! Consensus parameters for mainnet
Expand Down Expand Up @@ -532,14 +529,11 @@ bool ActivateFeature(uint16_t featureId, int activationBlock, uint32_t minClient
case FEATURE_NONFUNGIBLE:
MutableConsensusParams().MSC_NONFUNGIBLE_BLOCK = activationBlock;
break;
case FEATURE_NONFUNGIBLE_ISSUER:
MutableConsensusParams().NONFUNGIBLETOKEN_ISSUER_DATA = activationBlock;
break;
case FEATURE_DELEGATEDISSUANCE:
MutableConsensusParams().MSC_DELEGATED_ISSUANCE_BLOCK = activationBlock;
break;
case FEATURE_SEND_TO_MANY:
MutableConsensusParams().MSC_SEND_TO_MANY_BLOCK = activationBlock;
case FEATURE_SEND_TO_MANY_NFT_FIX:
MutableConsensusParams().MSC_SEND_TO_MANY_NFT_FIX_BLOCK = activationBlock;
break;
default:
supported = false;
Expand Down Expand Up @@ -618,14 +612,11 @@ bool DeactivateFeature(uint16_t featureId, int transactionBlock)
case FEATURE_NONFUNGIBLE:
MutableConsensusParams().MSC_NONFUNGIBLE_BLOCK = 999999;
break;
case FEATURE_NONFUNGIBLE_ISSUER:
MutableConsensusParams().NONFUNGIBLETOKEN_ISSUER_DATA = 999999;
break;
case FEATURE_DELEGATEDISSUANCE:
MutableConsensusParams().MSC_DELEGATED_ISSUANCE_BLOCK = 999999;
break;
case FEATURE_SEND_TO_MANY:
MutableConsensusParams().MSC_SEND_TO_MANY_BLOCK = 999999;
case FEATURE_SEND_TO_MANY_NFT_FIX:
MutableConsensusParams().MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 999999;
break;
default:
return false;
Expand Down Expand Up @@ -660,9 +651,8 @@ std::string GetFeatureName(uint16_t featureId)
case FEATURE_FREEZENOTICE: return "Activate the waiting period for enabling freezing";
case FEATURE_FREEDEX: return "Activate trading of any token on the distributed exchange";
case FEATURE_NONFUNGIBLE: return "Uniquely identifiable tokens";
case FEATURE_NONFUNGIBLE_ISSUER: return "NFT issuer data update by issuers only";
case FEATURE_DELEGATEDISSUANCE: return "Activate delegated issuance of tokens";
case FEATURE_SEND_TO_MANY: return "Activate send-to-many transactions";
case FEATURE_SEND_TO_MANY_NFT_FIX: return "Activate send-to-many transactions";

default: return "Unknown feature";
}
Expand Down Expand Up @@ -716,14 +706,11 @@ bool IsFeatureActivated(uint16_t featureId, int transactionBlock)
case FEATURE_NONFUNGIBLE:
activationBlock = params.MSC_NONFUNGIBLE_BLOCK;
break;
case FEATURE_NONFUNGIBLE_ISSUER:
activationBlock = params.NONFUNGIBLETOKEN_ISSUER_DATA;
break;
case FEATURE_DELEGATEDISSUANCE:
activationBlock = params.MSC_DELEGATED_ISSUANCE_BLOCK;
break;
case FEATURE_SEND_TO_MANY:
activationBlock = params.MSC_SEND_TO_MANY_BLOCK;
case FEATURE_SEND_TO_MANY_NFT_FIX:
activationBlock = params.MSC_SEND_TO_MANY_NFT_FIX_BLOCK;
break;
default:
return false;
Expand Down
12 changes: 4 additions & 8 deletions src/omnicore/rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ const uint16_t FEATURE_FREEDEX = 15;
const uint16_t FEATURE_NONFUNGIBLE = 16;
//! Feature identifier to enable delegated issuance support
const uint16_t FEATURE_DELEGATEDISSUANCE = 17;
//! Feature identifier to enable NFT issuer data update by issuers only
const uint16_t FEATURE_NONFUNGIBLE_ISSUER = 18;
//! Feature identifier to enable send-to-many support
const uint16_t FEATURE_SEND_TO_MANY = 19;
//! Feature identifier to enable send-to-many support and to enable NFT issuer data update by issuers only
const uint16_t FEATURE_SEND_TO_MANY_NFT_FIX = 18;

//! When (propertyTotalTokens / OMNI_FEE_THRESHOLD) is reached fee distribution will occur
const int64_t OMNI_FEE_THRESHOLD = 100000; // 0.001%
Expand Down Expand Up @@ -144,8 +142,8 @@ class CConsensusParams
int MSC_NONFUNGIBLE_BLOCK;
//! Block to enable delegation of token issuance
int MSC_DELEGATED_ISSUANCE_BLOCK;
//! Block to enable send-to-many
int MSC_SEND_TO_MANY_BLOCK;
//! Block to enable send-to-many and the ability for only issuers to update issuer data on NFTs
int MSC_SEND_TO_MANY_NFT_FIX_BLOCK;

//! Block to deactivate crowdsale participations when "granting tokens"
int GRANTEFFECTS_FEATURE_BLOCK;
Expand All @@ -161,8 +159,6 @@ class CConsensusParams
int FREEZENOTICE_FEATURE_BLOCK;
//! Block to activate the waiting period to activate trading of any token on the distributed exchange
int FREEDEX_FEATURE_BLOCK;
//! Block to activate the ability for only issuers to update issuer data on NFTs
int NONFUNGIBLETOKEN_ISSUER_DATA;

/** Returns a mapping of transaction types, and the blocks at which they are enabled. */
virtual std::vector<TransactionRestriction> GetRestrictions() const;
Expand Down
6 changes: 3 additions & 3 deletions src/omnicore/tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ int CMPTransaction::logicMath_SendAll()
return (PKT_ERROR_SEND_ALL -22);
}

if (!IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) {
if (!IsFeatureActivated(FEATURE_SEND_TO_MANY_NFT_FIX, block)) {
if (isPropertyNonFungible(property)) {
PrintToLog("%s(): rejected: property %d is of type non-fungible\n", __func__, property);
return (PKT_ERROR_NFT -21);
Expand Down Expand Up @@ -1491,7 +1491,7 @@ int CMPTransaction::logicMath_SendAll()
continue;
}

if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) {
if (IsFeatureActivated(FEATURE_SEND_TO_MANY_NFT_FIX, block)) {
// do not transfer non-fungible tokens
if (isPropertyNonFungible(propertyId)) {
PrintToConsole("%s: property %d is non-fungible and will not be included in processing.\n", __func__, propertyId);
Expand Down Expand Up @@ -3000,7 +3000,7 @@ int CMPTransaction::logicMath_NonFungibleData()
sender,
property);

if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) {
if (IsFeatureActivated(FEATURE_SEND_TO_MANY_NFT_FIX, block)) {
return (PKT_ERROR_NFT -31);
}
}
Expand Down