Skip to content

Commit

Permalink
Merge pull request KomodoPlatform#530 from Asherda/release-v1.0.12
Browse files Browse the repository at this point in the history
Release v1.0.12
  • Loading branch information
Asherda authored Jun 28, 2023
2 parents 8f1700f + e8371ac commit c73aa08
Show file tree
Hide file tree
Showing 21 changed files with 569 additions and 273 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ stages:
########################################################################################################################
variables:

VERSION: 1.0.11
VERSION: 1.0.12

VERUS_CLI_ARM64_LINUX: Verus-CLI-Linux-v${VERSION}-arm64.tar.gz
VERUS_CLI_LINUX_X86_64: Verus-CLI-Linux-v${VERSION}-x86_64.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## VerusCoin version 1.0.11
## VerusCoin version 1.0.12

Arguably the world's most advanced technology, zero knowledge privacy enabled, multi-chain blockchain protocol, Verus Public Blockchains as a Service (PBaaS) combines Sapling zero knowledge technology with an intelligent, multi-chain, provable protocol, using interchain smart transactions. Verus PBaaS also enables merge mining and cross-chain staking with a completely original, combined proof of stake/proof of work consensus algorithm, Proof of Power, that can be mined on CPUs and mobile phones, and also solves the nothing at stake problem. With this and its approach towards CPU mining and ASICs, Verus Coin strives to be one of the most naturally decentralizing and attack resistant blockchain networks in existence.

Expand Down
2 changes: 1 addition & 1 deletion doc/man/verus-cli/linux/README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

VerusCoin Command Line Tools v1.0.11
VerusCoin Command Line Tools v1.0.12

Contents:
verusd - VerusCoin daemon
Expand Down
2 changes: 1 addition & 1 deletion doc/man/verus-cli/mac/README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

VerusCoin Command Line Tools v1.0.11
VerusCoin Command Line Tools v1.0.12

Contents:
verusd - VerusCoin daemon.
Expand Down
2 changes: 1 addition & 1 deletion doc/man/verus-cli/windows/README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

VerusCoin Command Line Tools v1.0.11
VerusCoin Command Line Tools v1.0.12

Contents:
verusd.exe - VerusCoin daemon
Expand Down
4 changes: 3 additions & 1 deletion src/cryptoconditions/src/asn/INTEGER.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,12 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
}
break;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
/* Copy the integer body */
for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add)
*bp++ = *p;

#pragma GCC diagnostic pop
if(st->buf) FREEMEM(st->buf);
st->buf = buf;
st->size = bp - buf;
Expand Down
2 changes: 1 addition & 1 deletion src/deprecation.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// * Shut down 52 weeks' worth of blocks after the estimated release block height.
// * A warning is shown during the 2 months' worth of blocks prior to shut down.

static const int APPROX_RELEASE_HEIGHT = 2588000;
static const int APPROX_RELEASE_HEIGHT = 2598000;

static const int WEEKS_UNTIL_DEPRECATION = 52;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 60 * 24);
Expand Down
64 changes: 53 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4510,15 +4510,22 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
liquidityFees,
cbFees);

std::map<uint160, int32_t> currencyIndexMap = newNotarization.currencyState.GetReserveMap();
bool newGatewayConverter = (cbCurDef.IsGatewayConverter() &&
cbCurDef.gatewayID == ASSETCHAINS_CHAINID &&
(!PBAAS_TESTMODE ||
tempLastNotarization.currencyState.reserves[currencyIndexMap[ASSETCHAINS_CHAINID]] ==
cbCurDef.gatewayConverterIssuance));

if (!feesConverted)
{
cbFees = (originalFees - liquidityFees);
}

printf("originalFees: %s\ncbFees: %s\nliquidityFees: %s\n",
originalFees.ToUniValue().write(1,2).c_str(),
cbFees.ToUniValue().write(1,2).c_str(),
liquidityFees.ToUniValue().write(1,2).c_str()); //*/
LogPrint("notarization", "originalFees: %s\ncbFees: %s\nliquidityFees: %s\n",
originalFees.ToUniValue().write(1,2).c_str(),
cbFees.ToUniValue().write(1,2).c_str(),
liquidityFees.ToUniValue().write(1,2).c_str()); //*/

// display import outputs
/*CMutableTransaction debugTxOut;
Expand Down Expand Up @@ -4551,13 +4558,13 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
tempLastNotarization.currencyState.reserveIn);
}

if (!cbCurDef.IsFractional())
if (!cbCurDef.IsFractional() || newGatewayConverter)
{
gatewayDeposits += originalFees;
}
gatewayDeposits.valueMap[cbCurID] += gatewayDepositsUsed.valueMap[cbCurID] + newNotarization.currencyState.primaryCurrencyOut;

printf("importedcurrency %s\nspentcurrencyout %s\nnewgatewaydeposits %s\n",
LogPrint("notarization", "importedcurrency %s\nspentcurrencyout %s\nnewgatewaydeposits %s\n",
importedCurrency.ToUniValue().write(1,2).c_str(),
spentCurrencyOut.ToUniValue().write(1,2).c_str(),
gatewayDeposits.ToUniValue().write(1,2).c_str()); //*/
Expand Down Expand Up @@ -4652,9 +4659,9 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin

UniValue jsonTx(UniValue::VOBJ);
TxToUniv(tx, uint256(), jsonTx);
printf("%s: coinbase tx: %s\n", __func__, jsonTx.write(1,2).c_str());
printf("%s: coinbase rtxd: %s\n", __func__, rtxd.ToUniValue().write(1,2).c_str());
printf("%s: nativeFees: %ld, reserve fees: %s\nextra coinbase outputs: %s\n", __func__, nFees, totalReserveTxFees.ToUniValue().write(1,2).c_str(), validExtraCoinbaseOutputs.ToUniValue().write(1,2).c_str());
LogPrint("notarization", "%s: coinbase tx: %s\n", __func__, jsonTx.write(1,2).c_str());
LogPrint("notarization", "%s: coinbase rtxd: %s\n", __func__, rtxd.ToUniValue().write(1,2).c_str());
LogPrint("notarization", "%s: nativeFees: %ld, reserve fees: %s\nextra coinbase outputs: %s\n", __func__, nFees, totalReserveTxFees.ToUniValue().write(1,2).c_str(), validExtraCoinbaseOutputs.ToUniValue().write(1,2).c_str());
//*/
}
else if (!isVerusActive)
Expand Down Expand Up @@ -8439,6 +8446,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
unsigned char ccode;
string strReason;
bool isRejectNewTx = false;
uint256 hash;
try {
vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, MAX_REJECT_MESSAGE_LENGTH);

Expand All @@ -8447,7 +8455,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,

if (strMsg == "block" || strMsg == "tx")
{
uint256 hash;
isRejectNewTx = strMsg == "tx";
vRecv >> hash;
ss << ": hash " << hash.ToString();
}
Expand All @@ -8458,7 +8466,18 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pfrom->fDisconnect = true;
return false;
}
Misbehaving(pfrom->GetId(), SanitizeString(strReason) == "tx-overwinter-not-active" ? 0 : 1);
int misbehavingLevel = (SanitizeString(strReason) == "tx-overwinter-not-active") ? 0 : 1;
if (isRejectNewTx &&
SanitizeString(strReason) == "bad-txns-inputs-spent")
{
CTransaction mTx;
LOCK(mempool.cs);
if (mempool.lookup(hash, mTx))
{
misbehavingLevel = 0;
}
}
Misbehaving(pfrom->GetId(), misbehavingLevel);
return false;
}

Expand Down Expand Up @@ -8925,6 +8944,29 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
LogPrint("mempool", "%s from peer=%d %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(),
pfrom->id, pfrom->cleanSubVer,
state.GetRejectReason());

if (state.GetRejectReason() == "bad-txns-inputs-spent" && nDoS <= 1)
{
CObjectFinalization of;
// if it is an import or export, don't report to reduce network traffic. that will happen.
for (auto &oneOut : tx.vout)
{
COptCCParams chkP;
if (CCrossChainExport(oneOut.scriptPubKey).IsValid() ||
CCrossChainImport(oneOut.scriptPubKey).IsValid() ||
CPBaaSNotarization(oneOut.scriptPubKey).IsValid() ||
(oneOut.scriptPubKey.IsPayToCryptoCondition(chkP) &&
chkP.IsValid() &&
chkP.evalCode == EVAL_FINALIZE_NOTARIZATION &&
chkP.vData.size() &&
(of = CObjectFinalization(chkP.vData[0])).IsValid() &&
of.IsConfirmed()))
{
nDoS = 0;
break;
}
}
}
pfrom->PushMessage("reject", strCommand, state.GetRejectCode(),
state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash);
if (nDoS > 0)
Expand Down
30 changes: 25 additions & 5 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,9 @@ bool AddOneCurrencyImport(const CCurrencyDefinition &newCurrency,
std::vector<CReserveTransfer> exportTransfers(_exportTransfers);

bool updatedMinMax = newCurrency.IsPBaaSChain() &&
lastNotarization.proofRoots.count(VERUS_CHAINID) &&
lastNotarization.proofRoots.find(VERUS_CHAINID)->second.rootHeight >= ConnectedChains.GetZeroViaHeight(PBAAS_TESTMODE);
(!PBAAS_TESTMODE ||
(lastNotarization.proofRoots.count(VERUS_CHAINID) &&
lastNotarization.proofRoots.find(VERUS_CHAINID)->second.rootHeight >= ConnectedChains.GetZeroViaHeight(PBAAS_TESTMODE)));

if (updatedMinMax)
{
Expand Down Expand Up @@ -1019,6 +1020,12 @@ bool AddOneCurrencyImport(const CCurrencyDefinition &newCurrency,
liquidityFees,
additionalFees);

std::map<uint160, int32_t> currencyIndexMap = newNotarization.currencyState.GetReserveMap();
bool newGatewayConverter = (newCurrency.IsGatewayConverter() &&
newCurrency.gatewayID == newChainID &&
(!PBAAS_TESTMODE ||
tempLastNotarization.currencyState.reserves[currencyIndexMap[newChainID]] == newCurrency.gatewayConverterIssuance));

if (!feesConverted)
{
additionalFees += (originalFees - liquidityFees);
Expand Down Expand Up @@ -1080,7 +1087,7 @@ bool AddOneCurrencyImport(const CCurrencyDefinition &newCurrency,
{
gatewayDeposits = CCurrencyValueMap(lastNotarization.currencyState.currencies, lastNotarization.currencyState.reserveIn);
}
if (!newCurrency.IsFractional())
if (!newCurrency.IsFractional() || newGatewayConverter)
{
gatewayDeposits += originalFees;
}
Expand Down Expand Up @@ -1113,7 +1120,7 @@ bool AddOneCurrencyImport(const CCurrencyDefinition &newCurrency,
outputs.push_back(CTxOut(nativeOut, MakeMofNCCScript(CConditionObj<CReserveDeposit>(EVAL_RESERVE_DEPOSIT, depositDests, 1, &rd))));
}

if (newCurrency.notaries.size())
if (newCurrency.notaries.size() && newCurrency.IsPBaaSChain())
{
// notaries all get an even share of 10% of the launch fee in the launch currency to use for notarizing
// they may also get pre-allocations
Expand Down Expand Up @@ -1194,7 +1201,7 @@ bool AddOneCurrencyImport(const CCurrencyDefinition &newCurrency,

CReserveTransactionDescriptor rtxd;
CCoinbaseCurrencyState importState = newNotarization.currencyState;
importState.RevertReservesAndSupply();
importState.RevertReservesAndSupply(_newChain);
CCurrencyValueMap importedCurrency;
CCurrencyValueMap gatewayDepositsIn;
CCurrencyValueMap spentCurrencyOut;
Expand Down Expand Up @@ -1652,6 +1659,9 @@ bool IsValidBlockOneCoinbase(const std::vector<CTxOut> &_outputs,
std::map<uint160, CCurrencyValueMap> fundsRecipients;
CCurrencyValueMap blockOneMinerFunds;

int64_t converterIssuance = 0;
bool updatedProtocol = !PBAAS_TESTMODE;

int firstPBaaSOut = 0;
bool doneMinerOuts = false;

Expand Down Expand Up @@ -1776,6 +1786,7 @@ bool IsValidBlockOneCoinbase(const std::vector<CTxOut> &_outputs,
blockOneCurrencies.insert(oneCurrencyID);
}
}
converterIssuance = oneCurrency.gatewayConverterIssuance;
}
blockOneCurrencies.erase(oneID);
removedCurrencies.insert(oneID);
Expand Down Expand Up @@ -1809,6 +1820,11 @@ bool IsValidBlockOneCoinbase(const std::vector<CTxOut> &_outputs,
return state.Error("Invalid currency import info");
}
currencyImports[oneID].second = notarization;
if (notarization.currencyID == converterCurrencyID &&
notarization.currencyState.reserves[notarization.currencyState.GetReserveMap()[newChainID]] == converterIssuance)
{
updatedProtocol = true;
}
}
else
{
Expand Down Expand Up @@ -1862,6 +1878,10 @@ bool IsValidBlockOneCoinbase(const std::vector<CTxOut> &_outputs,
uniScript1.write(1,2).c_str(),
uniScript2.write(1,2).c_str());
}
if (updatedProtocol)
{
return state.Error("Mismatched block one output at #" + std::to_string(i));
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/pbaas/crosschainrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ uint32_t PBAAS_TESTFORK2_TIME = 1684281600;
uint32_t PBAAS_TESTFORK3_TIME = 1685379600;
uint32_t PBAAS_TESTFORK4_TIME = 1686416400;
uint32_t PBAAS_TESTFORK5_TIME = 1687042800;
uint32_t PBAAS_TESTFORK6_TIME = 1687994100;
uint32_t PBAAS_MAINDEFI3_HEIGHT = 2553500;
uint32_t PBAAS_CLEARCONVERT_HEIGHT = 2588590;
uint32_t PBAAS_LASTKNOWNCLEARORACLE_HEIGHT = 2597525;
uint32_t PBAAS_ENFORCE_CORRECT_EVIDENCE_TIME = 1684359650;

//
Expand Down
19 changes: 15 additions & 4 deletions src/pbaas/identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,11 @@ bool ValidateSpendingIdentityReservation(const CTransaction &tx, int32_t outNum,
{
if (isPBaaS)
{
bool testModePreUpdate = PBAAS_TESTMODE && !ConnectedChains.IncludePostLaunchFees(height);
if (issuingCurrency.proofProtocol == issuingCurrency.PROOF_CHAINID &&
(issuingCurrency.endBlock == 0 ||
issuingCurrency.endBlock <= height))
((testModePreUpdate && issuingCurrency.endBlock <= height) ||
(!testModePreUpdate && height <= issuingCurrency.endBlock))))
{
// if this is a purchase from centralized/DAO-based currency, ensure we have a valid output
// of the correct amount to the issuer ID before any of the referrals
Expand Down Expand Up @@ -1980,9 +1982,11 @@ bool PrecheckIdentityReservation(const CTransaction &tx, int32_t outNum, CValida
{
if (isPBaaS)
{
bool testModePreUpdate = PBAAS_TESTMODE && !ConnectedChains.IncludePostLaunchFees(height);
if (issuingCurrency.proofProtocol == issuingCurrency.PROOF_CHAINID &&
(issuingCurrency.endBlock == 0 ||
issuingCurrency.endBlock <= height))
((testModePreUpdate && issuingCurrency.endBlock <= height) ||
(!testModePreUpdate && height <= issuingCurrency.endBlock))))
{
// if this is a purchase from centralized/DAO-based currency, ensure we have a valid output
// of the correct amount to the issuer ID before any of the referrals
Expand Down Expand Up @@ -2825,8 +2829,15 @@ bool PrecheckIdentityPrimary(const CTransaction &tx, int32_t outNum, CValidation
}
if (i == outNum)
{
return ConnectedChains.FirstNotaryChain().IsValid() &&
IsValidBlockOneCoinbase(tx.vout, ConnectedChains.FirstNotaryChain(), ConnectedChains.ThisChain(), state);
if (ConnectedChains.FirstNotaryChain().IsValid() &&
IsValidBlockOneCoinbase(tx.vout, ConnectedChains.FirstNotaryChain(), ConnectedChains.ThisChain(), state))
{
return true;
}
else
{
return state.Error("Invalid block 1 coinbase");
}
}
else
{
Expand Down
Loading

0 comments on commit c73aa08

Please sign in to comment.