Skip to content

Commit

Permalink
Merge pull request KomodoPlatform#561 from Asherda/release-v1.1.2-2
Browse files Browse the repository at this point in the history
Release v1.1.2-2
  • Loading branch information
Asherda authored Nov 27, 2023
2 parents e5156f8 + 761b94e commit f2d6190
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 28 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.1.2-1
VERSION: 1.1.2-2

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.1.2-1
## VerusCoin version 1.1.2-2

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.1.2-1
VerusCoin Command Line Tools v1.1.2-2

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.1.2-1
VerusCoin Command Line Tools v1.1.2-2

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.1.2-1
VerusCoin Command Line Tools v1.1.2-2

Contents:
verusd.exe - VerusCoin daemon
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 = 2803000;
static const int APPROX_RELEASE_HEIGHT = 2811000;

static const int WEEKS_UNTIL_DEPRECATION = 52;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 60 * 24);
Expand Down
12 changes: 12 additions & 0 deletions src/key_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,18 @@ CReserveTransfer::CReserveTransfer(const UniValue &uni) : CTokenOutput(uni), nFe
destination = CTransferDestination(find_value(uni, "destination"));
}

CReserveTransfer::CReserveTransfer(const CScript &script) : flags(0)
{
COptCCParams p;
if (script.IsPayToCryptoCondition(p) && p.IsValid())
{
if (p.evalCode == EVAL_RESERVE_TRANSFER && p.vData.size())
{
FromVector(p.vData[0], *this);
}
}
}

CPrincipal::CPrincipal(const UniValue &uni)
{
nVersion = uni_get_int(find_value(uni, "version"), VERSION_VAULT);
Expand Down
1 change: 1 addition & 0 deletions src/pbaas/crosschainrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ uint32_t PBAAS_TESTFORK5_TIME = 1687042800;
uint32_t PBAAS_TESTFORK6_TIME = 1687994100;
uint32_t PBAAS_TESTFORK7_TIME = 1688799600;
uint32_t PBAAS_TESTFORK8_TIME = 1690304400;
uint32_t PBAAS_TESTFORK9_TIME = 1701240000;

uint32_t PBAAS_MAINDEFI3_HEIGHT = 2553500;
uint32_t PBAAS_CLEARCONVERT_HEIGHT = 2588590;
Expand Down
12 changes: 5 additions & 7 deletions src/pbaas/pbaas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3658,7 +3658,7 @@ CCurrencyDefinition::CCurrencyDefinition(const CScript &scriptPubKey)
COptCCParams p;
if (scriptPubKey.IsPayToCryptoCondition(p) && p.IsValid())
{
if (p.evalCode == EVAL_CURRENCY_DEFINITION)
if (p.evalCode == EVAL_CURRENCY_DEFINITION && p.vData.size())
{
FromVector(p.vData[0], *this);
}
Expand Down Expand Up @@ -4579,7 +4579,8 @@ bool IsValidExportCurrency(const CCurrencyDefinition &systemDest, const uint160
return true;
}

uint160 converterID = (!IsVerusActive && ConnectedChains.FirstNotaryChain().GetID() == sysID) ? ConnectedChains.ThisChain().GatewayConverterID() : systemDest.GatewayConverterID();
int64_t thresholdTime = (height > 1 && chainActive.Height() >= height) ? chainActive[height]->nTime : chainActive.LastTip()->nTime;
uint160 converterID = ((!IsVerusActive() && thresholdTime > PBAAS_TESTFORK9_TIME) && ConnectedChains.FirstNotaryChain().GetID() == sysID) ? ConnectedChains.ThisChain().GatewayConverterID() : systemDest.GatewayConverterID();
if (!converterID.IsNull())
{
CCurrencyDefinition converter = ConnectedChains.GetCachedCurrency(converterID);
Expand Down Expand Up @@ -6692,7 +6693,7 @@ CCoinbaseCurrencyState CConnectedChains::AddPendingConversions(CCurrencyDefiniti
// get chain transfers that should apply before the start block
// until there is a post-start block notarization, we always consider the
// currency state to be up to just before the start block
std::multimap<uint160, ChainTransferData> unspentTransfers;
std::vector<ChainTransferData> unspentTransfers;
std::map<uint160, int32_t> currencyIndexes = currencyState.GetReserveMap();

if (GetUnspentChainTransfers(unspentTransfers, curDef.GetID()) &&
Expand All @@ -6701,10 +6702,7 @@ CCoinbaseCurrencyState CConnectedChains::AddPendingConversions(CCurrencyDefiniti
std::vector<CReserveTransfer> transfers = extraConversions;
for (auto &oneTransfer : unspentTransfers)
{
if (std::get<0>(oneTransfer.second) < curDef.startBlock)
{
transfers.push_back(std::get<2>(oneTransfer.second));
}
transfers.push_back(std::get<2>(oneTransfer));
}
uint256 transferHash;
CPBaaSNotarization newNotarization;
Expand Down
2 changes: 2 additions & 0 deletions src/pbaas/reserves.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern uint32_t PBAAS_TESTFORK5_TIME;
extern uint32_t PBAAS_TESTFORK6_TIME;
extern uint32_t PBAAS_TESTFORK7_TIME;
extern uint32_t PBAAS_TESTFORK8_TIME;
extern uint32_t PBAAS_TESTFORK9_TIME;
extern uint32_t PBAAS_MAINDEFI3_HEIGHT;
extern uint32_t PBAAS_CLEARCONVERT_HEIGHT;
extern uint32_t PBAAS_LASTKNOWNCLEARORACLE_HEIGHT;
Expand Down Expand Up @@ -204,6 +205,7 @@ class CReserveTransfer : public CTokenOutput
CReserveTransfer() : CTokenOutput(), flags(0), nFees(0) { }

CReserveTransfer(const UniValue &uni);
CReserveTransfer(const CScript &script);

CReserveTransfer(const std::vector<unsigned char> &asVector)
{
Expand Down
88 changes: 74 additions & 14 deletions src/rpc/pbaasrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2214,26 +2214,25 @@ UniValue getpendingtransfers(const UniValue& params, bool fHelp)

if (GetCurrencyDefinition(chainID, chainDef, &defHeight))
{
// look for new exports
multimap<uint160, ChainTransferData> inputDescriptors;
std::vector<ChainTransferData> unspentOutputs;

if (GetUnspentChainTransfers(inputDescriptors, chainID))
if (GetUnspentChainTransfers(unspentOutputs, chainID))
{
UniValue ret(UniValue::VARR);

for (auto &desc : inputDescriptors)
for (auto &desc : unspentOutputs)
{
UniValue oneExport(UniValue::VOBJ);
uint32_t inpHeight = std::get<0>(desc.second);
CInputDescriptor inpDesc = std::get<1>(desc.second);

oneExport.push_back(Pair("currencyid", EncodeDestination(CIdentityID(desc.first))));
oneExport.push_back(Pair("height", (int64_t)inpHeight));
oneExport.push_back(Pair("txid", inpDesc.txIn.prevout.hash.GetHex()));
oneExport.push_back(Pair("n", (int32_t)inpDesc.txIn.prevout.n));
oneExport.push_back(Pair("valueout", inpDesc.nValue));
oneExport.push_back(Pair("reservetransfer", std::get<2>(desc.second).ToUniValue()));
ret.push_back(oneExport);
if (std::get<2>(desc).IsValid())
{
oneExport.push_back(Pair("currencyid", EncodeDestination(CIdentityID(chainID))));
oneExport.push_back(Pair("height", (int64_t)std::get<0>(desc)));
oneExport.push_back(Pair("txid", std::get<1>(desc).txIn.prevout.hash.GetHex()));
oneExport.push_back(Pair("n", (int32_t)std::get<1>(desc).txIn.prevout.n));
oneExport.push_back(Pair("valueout", std::get<1>(desc).nValue));
oneExport.push_back(Pair("reservetransfer", std::get<2>(desc).ToUniValue()));
ret.push_back(oneExport);
}
}
if (ret.size())
{
Expand Down Expand Up @@ -3378,6 +3377,67 @@ bool GetUnspentChainTransfers(std::multimap<uint160, ChainTransferData> &inputDe
}
}

// returns all unspent chain transfer outputs, * including from the mempool *
bool GetUnspentChainTransfers(std::vector<ChainTransferData> &inputDescriptors, uint160 chainID)
{
std::vector<std::pair<CInputDescriptor, uint32_t>> unspentOutputs;

LOCK(cs_main);
LOCK2(smartTransactionCS, mempool.cs);

if (!ConnectedChains.GetUnspentByIndex(CReserveTransfer::ReserveTransferKey(), unspentOutputs))
{
return false;
}
else
{
CCoins coins;
CCoinsView dummy;
CCoinsViewCache view(&dummy);

CCoinsViewMemPool viewMemPool(pcoinsTip, mempool);
view.SetBackend(viewMemPool);

for (auto it = unspentOutputs.begin(); it != unspentOutputs.end(); it++)
{
CCoins coins;

if (view.GetCoins(it->first.txIn.prevout.hash, coins))
{
if (coins.IsAvailable(it->first.txIn.prevout.n))
{
// if this is a transfer output, optionally to this chain, add it to the input vector
// chain filter was applied in index search
COptCCParams p;
COptCCParams m;
CReserveTransfer rt;
uint160 destCID;
if (coins.vout[it->first.txIn.prevout.n].scriptPubKey.IsPayToCryptoCondition(p) &&
p.evalCode == EVAL_RESERVE_TRANSFER &&
p.vData.size() &&
p.version >= p.VERSION_V3 &&
(m = COptCCParams(p.vData.back())).IsValid() &&
(rt = CReserveTransfer(p.vData[0])).IsValid() &&
!(destCID = rt.GetImportCurrency()).IsNull() &&
destCID == chainID)
{
inputDescriptors.push_back(ChainTransferData(it->second,
CInputDescriptor(coins.vout[it->first.txIn.prevout.n].scriptPubKey,
coins.vout[it->first.txIn.prevout.n].nValue,
CTxIn(COutPoint(it->first.txIn.prevout.hash, it->first.txIn.prevout.n))),
rt));
}
}
}
else
{
LogPrint("crosschainexports", "%s: cannot retrieve transaction %s from height %u\n", __func__, it->first.txIn.prevout.hash.GetHex().c_str(), coins.nHeight);
}
}
return true;
}
}

void CChainNotarizationData::SetBestChain(const CCurrencyDefinition &fromChainDef,
const std::vector<std::pair<CTransaction, uint256>> &txesAndBlocks)
{
Expand Down
1 change: 1 addition & 0 deletions src/rpc/pbaasrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ bool GetChainTransfersUnspentBy(std::multimap<std::pair<uint32_t, uint160>, std:
bool GetChainTransfersBetween(std::multimap<std::pair<uint32_t, uint160>, std::pair<CInputDescriptor, CReserveTransfer>> &inputDescriptors,
uint160 chainFilter, uint32_t start, uint32_t end, uint32_t flags=CReserveTransfer::VALID);
bool GetUnspentChainTransfers(std::multimap<uint160, ChainTransferData> &inputDescriptors, uint160 chainFilter = uint160());
bool GetUnspentChainTransfers(std::vector<ChainTransferData> &inputDescriptors, uint160 chainID);

std::multimap<std::tuple<int, uint160, uint160, int64_t, int64_t>, std::pair<std::pair<int, CCurrencyValueMap>, std::pair<CInputDescriptor, CTransaction>>>
GetOfferMap(const uint160 &currencyOrId, bool isCurrency, bool acceptOnlyCurrency, bool acceptOnlyId, const std::set<uint160> &currencyOrIdFilter);
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ static const int MEMPOOL_GD_VERSION = 60002;
static const int NO_BLOOM_VERSION = 170004;

#define KOMODO_VERSION "0.2.1"
#define VERUS_VERSION "1.1.2-1"
#define VERUS_VERSION "1.1.2-2"

#endif // BITCOIN_VERSION_H

0 comments on commit f2d6190

Please sign in to comment.