Skip to content

Commit

Permalink
Merge pull request jl777#409 from VerusCoin/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Asherda authored May 4, 2022
2 parents 5c91a86 + e85af0f commit d8b79a2
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 47 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: 0.9.2
VERSION: 0.9.2-1

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 0.9.2
## VerusCoin version 0.9.2-1

Arguably the world's most advanced technology, zero knowledge privacy-centric blockchain, Verus Coin brings Sapling performance and zero knowledge features to an intelligent system with interchain smart contracts and a completely original, combined proof of stake/proof of work consensus algorithm that 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 blockchains 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 v0.9.2
VerusCoin Command Line Tools v0.9.2-1

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 v0.9.2
VerusCoin Command Line Tools v0.9.2-1

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 v0.9.2
VerusCoin Command Line Tools v0.9.2-1

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 20 weeks' worth of blocks after the estimated release block height.
// * A warning is shown during the 2 weeks' worth of blocks prior to shut down.

static const int APPROX_RELEASE_HEIGHT = 2009000;
static const int APPROX_RELEASE_HEIGHT = 2014000;

static const int WEEKS_UNTIL_DEPRECATION = 20;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 60 * 24);
Expand Down
82 changes: 45 additions & 37 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3825,6 +3825,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
prevCurrencyState.UpdateWithEmission(GetBlockSubsidy(nHeight, consensus));
CCoinbaseCurrencyState currencyState = prevCurrencyState;

std::map<uint160, int32_t> exportTransferCount;
std::map<uint160, int32_t> currencyExportTransferCount;
std::map<uint160, int32_t> identityExportTransferCount;

std::vector<PrecomputedTransactionData> txdata;
txdata.reserve(block.vtx.size()); // Required so that pointers to individual PrecomputedTransactionData don't get invalidated
for (unsigned int i = 0; i < block.vtx.size(); i++)
Expand All @@ -3842,6 +3846,47 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
return false; // Failure reason has been set in validation state object
}

for (auto &oneOut : tx.vout)
{
COptCCParams p;
CReserveTransfer rt;
if (oneOut.scriptPubKey.IsPayToCryptoCondition(p) &&
p.IsValid() &&
p.evalCode == EVAL_RESERVE_TRANSFER)
{
if (p.version >= p.VERSION_V3 &&
p.vData.size() &&
(rt = CReserveTransfer(p.vData[0])).IsValid())
{
uint160 destCurrencyID = rt.GetImportCurrency();
CCurrencyDefinition destCurrency = ConnectedChains.GetCachedCurrency(destCurrencyID);
// ETH protocol has limits on number of valid reserve transfers of each type in a block
CCurrencyDefinition destSystem = ConnectedChains.GetCachedCurrency(destCurrency.SystemOrGatewayID());

if (!destSystem.IsValid())
{
return state.DoS(10, error("%s: unable to retrieve system destination for export to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-invalid-system");
}
if (++exportTransferCount[destCurrencyID] > destSystem.MaxTransferExportCount())
{
return state.DoS(10, error("%s: attempt to submit block with too many transfers exporting to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-too-many-transfers");
}
if (rt.IsCurrencyExport() && ++currencyExportTransferCount[destCurrencyID] > destSystem.MaxCurrencyDefinitionExportCount())
{
return state.DoS(10, error("%s: attempt to submit block with too many currency definition transfers exporting to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-too-many-currency-transfers");
}
if (rt.IsIdentityExport() && ++identityExportTransferCount[destCurrencyID] > destSystem.MaxIdentityDefinitionExportCount())
{
return state.DoS(10, error("%s: attempt to submit block with too many identity definition transfers exporting to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-too-many-identity-transfers");
}
}
else
{
return state.DoS(10, error("%s: invalid reserve transfer", __func__), REJECT_INVALID, "bad-txns-reserve-transfer");
}
}
}

CReserveTransactionDescriptor rtxd(tx, view, nHeight);
if (rtxd.IsReject())
{
Expand Down Expand Up @@ -6028,9 +6073,6 @@ bool ContextualCheckBlock(
// Check that all transactions are finalized, reject stake transactions, and
// ensure no reservation ID duplicates
std::set<uint160> newIDRegistrations;
std::map<uint160, int32_t> exportTransferCount;
std::map<uint160, int32_t> currencyExportTransferCount;
std::map<uint160, int32_t> identityExportTransferCount;
std::set<std::string> newIDs;
for (uint32_t i = 0; i < block.vtx.size(); i++) {
const CTransaction& tx = block.vtx[i];
Expand Down Expand Up @@ -6078,40 +6120,6 @@ bool ContextualCheckBlock(
return state.DoS(10, error("%s: attempt to submit block with invalid or duplicate identity", __func__), REJECT_INVALID, "bad-txns-dup-id");
}
}
else if (p.evalCode == EVAL_RESERVE_TRANSFER)
{
CReserveTransfer rt;
if (p.version >= p.VERSION_V3 &&
p.vData.size() &&
(rt = CReserveTransfer(p.vData[0])).IsValid())
{
uint160 destCurrencyID = rt.GetImportCurrency();
CCurrencyDefinition destCurrency = ConnectedChains.GetCachedCurrency(destCurrencyID);
// ETH protocol has limits on number of valid reserve transfers of each type in a block
CCurrencyDefinition destSystem = ConnectedChains.GetCachedCurrency(destCurrency.SystemOrGatewayID());

if (!destSystem.IsValid())
{
return state.DoS(10, error("%s: unable to retrieve system destination for export to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-invalid-system");
}
if (++exportTransferCount[destCurrencyID] > destSystem.MaxTransferExportCount())
{
return state.DoS(10, error("%s: attempt to submit block with too many transfers exporting to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-too-many-transfers");
}
if (rt.IsCurrencyExport() && ++currencyExportTransferCount[destCurrencyID] > destSystem.MaxCurrencyDefinitionExportCount())
{
return state.DoS(10, error("%s: attempt to submit block with too many currency definition transfers exporting to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-too-many-currency-transfers");
}
if (rt.IsIdentityExport() && ++identityExportTransferCount[destCurrencyID] > destSystem.MaxIdentityDefinitionExportCount())
{
return state.DoS(10, error("%s: attempt to submit block with too many identity definition transfers exporting to %s", __func__, EncodeDestination(CIdentityID(destCurrencyID)).c_str()), REJECT_INVALID, "bad-txns-too-many-identity-transfers");
}
}
else
{
return state.DoS(10, error("%s: invalid reserve transfer", __func__), REJECT_INVALID, "bad-txns-reserve-transfer");
}
}
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/rpc/pbaasrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9902,9 +9902,10 @@ UniValue registeridentity(const UniValue& params, bool fHelp)
{
// make a burn output of this currency for the amount
CReserveTransfer rt(CReserveTransfer::VALID + CReserveTransfer::BURN_CHANGE_PRICE,
CCurrencyValueMap(std::vector<uint160>({issuerID}), std::vector<int64_t>({expectedFee})),
CCurrencyValueMap(std::vector<uint160>({issuerID}),
std::vector<int64_t>({expectedFee})),
ASSETCHAINS_CHAINID,
ConnectedChains.ThisChain().IDImportFee(),
ConnectedChains.ThisChain().GetTransactionTransferFee(),
issuerID,
DestinationToTransferDestination(CIdentityID(issuerID)));
registrationPaymentOut = outputs.size();
Expand All @@ -9916,7 +9917,7 @@ UniValue registeridentity(const UniValue& params, bool fHelp)

std::vector<CTxDestination> dests = std::vector<CTxDestination>({pk.GetID()});

outputs.push_back({MakeMofNCCScript(CConditionObj<CReserveTransfer>(EVAL_RESERVE_TRANSFER, dests, 1, &rt)), ConnectedChains.ThisChain().IDImportFee(), false});
outputs.push_back({MakeMofNCCScript(CConditionObj<CReserveTransfer>(EVAL_RESERVE_TRANSFER, dests, 1, &rt)), ConnectedChains.ThisChain().GetTransactionTransferFee(), false});
}

// add referrals, Verus supports referrals
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 "0.9.2"
#define VERUS_VERSION "0.9.2-1"

#endif // BITCOIN_VERSION_H

0 comments on commit d8b79a2

Please sign in to comment.