Skip to content

Commit

Permalink
Merge pull request KomodoPlatform#492 from VerusCoin/dev
Browse files Browse the repository at this point in the history
v0.9.9-5
  • Loading branch information
Asherda authored Mar 30, 2023
2 parents 91c0e75 + 82ef67d commit 1c9491b
Show file tree
Hide file tree
Showing 18 changed files with 245 additions and 88 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.9-4
VERSION: 0.9.9-5

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.9-4
## VerusCoin version 0.9.9-5

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.9-4
VerusCoin Command Line Tools v0.9.9-5

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.9-4
VerusCoin Command Line Tools v0.9.9-5

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.9-4
VerusCoin Command Line Tools v0.9.9-5

Contents:
verusd.exe - VerusCoin daemon
Expand Down
2 changes: 1 addition & 1 deletion src/cc/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool Eval::Dispatch(const CC *cond, const CTransaction &txTo, unsigned int nIn,
return(ProcessCC(cp,this, vparams, txTo, nIn, fulfilled));
break;
}
return Invalid("invalid-code, dont forget to add EVAL_NEWCC to Eval::Dispatch");
return Invalid("invalid smart transaction code");
}


Expand Down
6 changes: 4 additions & 2 deletions src/cryptoconditions/src/cryptoconditions.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,11 @@ int cc_visit(CC *cond, CCVisitor visitor) {
int cc_verify(const struct CC *cond, const unsigned char *msg, size_t msgLength, int doHashMsg,
const unsigned char *condBin, size_t condBinLength,
VerifyEval verifyEval, void *evalContext, int checkSig) {
unsigned char targetBinary[2000];

unsigned char targetBinary[MAX_BINARY_CC_SIZE];

//fprintf(stderr,"in cc_verify cond.%p msg.%p[%d] dohash.%d condbin.%p[%d]\n",cond,msg,(int32_t)msgLength,doHashMsg,condBin,(int32_t)condBinLength);
const size_t binLength = cc_conditionBinary(cond, targetBinary, 2000);
const size_t binLength = cc_conditionBinary(cond, targetBinary, MAX_BINARY_CC_SIZE);

if (0 != memcmp(condBin, targetBinary, binLength)) {
fprintf(stderr,"cc_verify error A\n");
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 = 2468000;
static const int APPROX_RELEASE_HEIGHT = 2474000;

static const int WEEKS_UNTIL_DEPRECATION = 20;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 60 * 24);
Expand Down
9 changes: 4 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,15 +1402,14 @@ bool ContextualCheckTransaction(
}

// precheck all crypto conditions
bool invalid = false;
for (int i = 0; i < tx.vout.size(); i++)
{
COptCCParams p;
if (tx.vout[i].scriptPubKey.IsPayToCryptoCondition(p))
{
if (!p.IsValid())
if (!p.IsValid(isPBaaS, nHeight) && isPBaaS)
{
invalid = true;
return state.DoS(10, error(state.GetRejectReason().c_str()), REJECT_INVALID, "bad-txns-failed-params-precheck");
}
if (p.evalCode == EVAL_NONE)
{
Expand All @@ -1424,7 +1423,7 @@ bool ContextualCheckTransaction(
CCcontract_info CC;
CCcontract_info *cp;
if (!((p.evalCode <= EVAL_LAST) &&
(cp = CCinit(&CC, p.evalCode))))
(cp = CCinit(&CC, p.evalCode))))
{
return state.DoS(100, error("ContextualCheckTransaction(): Invalid smart transaction eval code"), REJECT_INVALID, "bad-txns-evalcode-invalid");
}
Expand Down Expand Up @@ -8056,8 +8055,8 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
if (!isExpiringSoon) {
// Send stream from relay memory
MapRelay::iterator mi;
LOCK(cs_mapRelay);
{
LOCK(cs_mapRelay);
mi = mapRelay.find(inv.hash);
if (mi != mapRelay.end()) {
pfrom->PushMessage(inv.GetCommand(), *(*mi).second);
Expand Down
19 changes: 11 additions & 8 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2389,13 +2389,18 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const std::vecto
? nMedianTimePast
: pblock->GetBlockTime();

if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff) || IsExpiredTx(tx, nHeight))
CValidationState state;

if (!IsFinalTx(tx, nHeight, nLockTimeCutoff))
{
//fprintf(stderr,"coinbase.%d finaltx.%d expired.%d\n",tx.IsCoinBase(),IsFinalTx(tx, nHeight, nLockTimeCutoff),IsExpiredTx(tx, nHeight));
if (tx.IsCoinBase() || IsExpiredTx(tx, nHeight))
{
txesToRemove.push_back(tx);
}
continue;
}
if (tx.IsCoinBase() ||
IsExpiredTx(tx, nHeight) ||
(mi->GetHeight() != nHeight &&
!ContextualCheckTransaction(tx, state, Params(), nHeight, 0)))
{
txesToRemove.push_back(tx);
continue;
}

Expand All @@ -2409,8 +2414,6 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const std::vecto

CAmount delayedFee = 0;

CValidationState state;

// first, eliminate conflicts at the output level, then we can verify inputs
if (isReserve)
{
Expand Down
11 changes: 8 additions & 3 deletions src/pbaas/identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2341,9 +2341,10 @@ bool PrecheckIdentityPrimary(const CTransaction &tx, int32_t outNum, CValidation
{
CIdentity checkIdentity;
auto &output = tx.vout[i];
if (output.scriptPubKey.IsPayToCryptoCondition(p) &&
bool isSmartOutput = output.scriptPubKey.IsPayToCryptoCondition(p);
if (isSmartOutput &&
(!advancedIdentity || p.AsVector().size() < CScript::MAX_SCRIPT_ELEMENT_SIZE) &&
p.IsValid() &&
p.IsValid(isPBaaS, height) &&
p.version >= COptCCParams::VERSION_V3 &&
p.vData.size() > 1)
{
Expand Down Expand Up @@ -2443,9 +2444,13 @@ bool PrecheckIdentityPrimary(const CTransaction &tx, int32_t outNum, CValidation
break;
}
}
else if (advancedIdentity && isSmartOutput && !p.IsValid(isPBaaS, height))
{
return state.Error("Invalid smart transaction output");
}
}

if (!validIdentity)
if (!validIdentity && identity.IsValid())
{
return state.Error("Invalid identity definition");
}
Expand Down
4 changes: 2 additions & 2 deletions src/script/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const int CCSigningNodes = 1 << CC_Ed25519 | 1 << CC_Secp256k1;

const int CCEvalNode = 1 << CC_Eval;

const int CCFirstEvalOnly = 2;
const int CCLastEvalOnly = 0x0d;
const int CCFirstEvalOnly = 1;
const int CCLastEvalOnly = 0x14;

/*
* Check if the server can accept the condition based on it's structure / types
Expand Down
48 changes: 0 additions & 48 deletions src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1714,15 +1714,6 @@ int TransactionSignatureChecker::CheckCryptoCondition(
}
if (!success || !condBinary.size())
{
/*
char *jsonCondStr = cc_conditionToJSONString(outputCC);
if (jsonCondStr)
{
printf("Signed condition: %s\n", jsonCondStr);
cJSON_free(jsonCondStr);
}
*/

cc_free(outputCC);
condBinary.clear();
}
Expand Down Expand Up @@ -1766,45 +1757,6 @@ int TransactionSignatureChecker::CheckCryptoCondition(
return -1;
}

/*
char *jsonCondStr = cc_conditionToJSONString(cond);
if (jsonCondStr)
{
printf("Fulfillment condition: %s\n", jsonCondStr);
cJSON_free(jsonCondStr);
uint8_t buf[2000];
int ccLen = cc_conditionBinary(cond, buf, 2000);
if (ccLen)
{
CC *transformedCC = cc_readConditionBinary(buf, ccLen);
if (transformedCC)
{
jsonCondStr = cc_conditionToJSONString(transformedCC);
if (jsonCondStr)
{
printf("Converted fulfillment condition: %s\n", jsonCondStr);
cJSON_free(jsonCondStr);
}
cc_free(transformedCC);
}
}
}
if (condBinary.size())
{
CC *transformedCC = cc_readConditionBinary(condBinary.data(), condBinary.size());
if (transformedCC)
{
jsonCondStr = cc_conditionToJSONString(transformedCC);
if (jsonCondStr)
{
printf("Binary condition reconstructed: %s\n", jsonCondStr);
cJSON_free(jsonCondStr);
}
cc_free(transformedCC);
}
}
*/

if (!IsSupportedCryptoCondition(cond, p.IsValid() ? p.evalCode : 0) || !IsSignedCryptoCondition(cond))
{
cc_free(cond);
Expand Down
Loading

0 comments on commit 1c9491b

Please sign in to comment.