fixed switch values in validation; bumped version
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Salvium Zero v0.7.1
|
# Salvium Zero v0.7.2
|
||||||
|
|
||||||
Copyright (c) 2023-2024, Salvium
|
Copyright (c) 2023-2024, Salvium
|
||||||
Portions Copyright (c) 2014-2023, The Monero Project
|
Portions Copyright (c) 2014-2023, The Monero Project
|
||||||
|
|||||||
@@ -1498,6 +1498,7 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl
|
|||||||
case HF_VERSION_BULLETPROOF_PLUS:
|
case HF_VERSION_BULLETPROOF_PLUS:
|
||||||
case HF_VERSION_ENABLE_N_OUTS:
|
case HF_VERSION_ENABLE_N_OUTS:
|
||||||
case HF_VERSION_FULL_PROOFS:
|
case HF_VERSION_FULL_PROOFS:
|
||||||
|
case HF_VERSION_ENFORCE_FULL_PROOFS:
|
||||||
if (b.miner_tx.amount_burnt > 0) {
|
if (b.miner_tx.amount_burnt > 0) {
|
||||||
CHECK_AND_ASSERT_MES(money_in_use + b.miner_tx.amount_burnt > money_in_use, false, "miner transaction is overflowed by amount_burnt");
|
CHECK_AND_ASSERT_MES(money_in_use + b.miner_tx.amount_burnt > money_in_use, false, "miner transaction is overflowed by amount_burnt");
|
||||||
money_in_use += b.miner_tx.amount_burnt;
|
money_in_use += b.miner_tx.amount_burnt;
|
||||||
@@ -3492,9 +3493,9 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// from v4, forbid invalid pubkeys
|
// from v4, forbid invalid pubkeys
|
||||||
if (hf_version >= 4) {
|
if (hf_version >= 1) {
|
||||||
for (const auto &o: tx.vout) {
|
for (const auto &o: tx.vout) {
|
||||||
crypto::public_key output_public_key;
|
crypto::public_key output_public_key;
|
||||||
if (!get_output_public_key(o, output_public_key)) {
|
if (!get_output_public_key(o, output_public_key)) {
|
||||||
@@ -3507,7 +3508,7 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// from v8, allow bulletproofs
|
// from v8, allow bulletproofs
|
||||||
if (hf_version < 8) {
|
if (hf_version < 8) {
|
||||||
if (tx.version >= 2) {
|
if (tx.version >= 2) {
|
||||||
@@ -3606,10 +3607,9 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// from v16, forbid bulletproofs
|
// from v1, forbid bulletproofs
|
||||||
if (hf_version > HF_VERSION_BULLETPROOF_PLUS) {
|
if (hf_version >= HF_VERSION_BULLETPROOF_PLUS) {
|
||||||
if (tx.version >= 2) {
|
if (tx.version >= 2) {
|
||||||
const bool bulletproof = rct::is_rct_bulletproof(tx.rct_signatures.type);
|
const bool bulletproof = rct::is_rct_bulletproof(tx.rct_signatures.type);
|
||||||
if (bulletproof)
|
if (bulletproof)
|
||||||
@@ -3620,11 +3620,19 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (hf_version >= HF_VERSION_FULL_PROOFS) {
|
// from v4, only allow bulletproofs plus _with_ full proofs on RCT transactions
|
||||||
if (tx.type == cryptonote::transaction_type::TRANSFER) {
|
if (hf_version >= HF_VERSION_ENFORCE_FULL_PROOFS) {
|
||||||
|
if (tx.type == cryptonote::transaction_type::TRANSFER || tx.type == cryptonote::transaction_type::STAKE || tx.type == cryptonote::transaction_type::BURN || tx.type == cryptonote::transaction_type::CONVERT) {
|
||||||
if (tx.rct_signatures.type != rct::RCTTypeFullProofs) {
|
if (tx.rct_signatures.type != rct::RCTTypeFullProofs) {
|
||||||
MERROR_VER("FullProofs required for TRANSFER TXs after v" + std::to_string(HF_VERSION_FULL_PROOFS));
|
MERROR_VER("FullProofs required after v" + std::to_string(HF_VERSION_FULL_PROOFS));
|
||||||
|
tvc.m_invalid_output = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tx.rct_signatures.type != rct::RCTTypeNull) {
|
||||||
|
MERROR_VER("NULL RCT required for coinbase TXs after v" + std::to_string(HF_VERSION_FULL_PROOFS));
|
||||||
tvc.m_invalid_output = true;
|
tvc.m_invalid_output = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -4043,6 +4051,17 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
|
|||||||
// obviously, the original and simple rct APIs use a mixRing that's indexes
|
// obviously, the original and simple rct APIs use a mixRing that's indexes
|
||||||
// in opposite orders, because it'd be too simple otherwise...
|
// in opposite orders, because it'd be too simple otherwise...
|
||||||
const rct::rctSig &rv = tx.rct_signatures;
|
const rct::rctSig &rv = tx.rct_signatures;
|
||||||
|
|
||||||
|
// Check that after full proofs are enabled, the RCT version is set to enforce full proofs
|
||||||
|
if (hf_version >= HF_VERSION_ENFORCE_FULL_PROOFS)
|
||||||
|
{
|
||||||
|
if (rv.type != rct::RCTTypeNull && rv.type != rct::RCTTypeFullProofs)
|
||||||
|
{
|
||||||
|
MERROR_VER("Unsupported rct type (full proofs are required): " << rv.type);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (rv.type)
|
switch (rv.type)
|
||||||
{
|
{
|
||||||
case rct::RCTTypeNull: {
|
case rct::RCTTypeNull: {
|
||||||
@@ -4133,22 +4152,6 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
|
|||||||
MERROR_VER("Unsupported rct type: " << rv.type);
|
MERROR_VER("Unsupported rct type: " << rv.type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for bulletproofs, check they're only multi-output after v8
|
|
||||||
if (rct::is_rct_bulletproof(rv.type))
|
|
||||||
{
|
|
||||||
if (hf_version < 8)
|
|
||||||
{
|
|
||||||
for (const rct::Bulletproof &proof: rv.p.bulletproofs)
|
|
||||||
{
|
|
||||||
if (proof.V.size() > 1)
|
|
||||||
{
|
|
||||||
MERROR_VER("Multi output bulletproofs are invalid before v8");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -590,6 +590,7 @@ namespace cryptonote
|
|||||||
case HF_VERSION_BULLETPROOF_PLUS:
|
case HF_VERSION_BULLETPROOF_PLUS:
|
||||||
case HF_VERSION_ENABLE_N_OUTS:
|
case HF_VERSION_ENABLE_N_OUTS:
|
||||||
case HF_VERSION_FULL_PROOFS:
|
case HF_VERSION_FULL_PROOFS:
|
||||||
|
case HF_VERSION_ENFORCE_FULL_PROOFS:
|
||||||
// SRCG: subtract 20% that will be rewarded to staking users
|
// SRCG: subtract 20% that will be rewarded to staking users
|
||||||
CHECK_AND_ASSERT_MES(tx.amount_burnt == 0, false, "while creating outs: amount_burnt is nonzero");
|
CHECK_AND_ASSERT_MES(tx.amount_burnt == 0, false, "while creating outs: amount_burnt is nonzero");
|
||||||
tx.amount_burnt = amount / 5;
|
tx.amount_burnt = amount / 5;
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
|
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
|
||||||
#define DEF_SALVIUM_VERSION "0.7.1"
|
#define DEF_SALVIUM_VERSION "0.7.2"
|
||||||
#define DEF_MONERO_VERSION_TAG "release"
|
#define DEF_MONERO_VERSION_TAG "release"
|
||||||
#define DEF_MONERO_VERSION "0.18.3.3"
|
#define DEF_MONERO_VERSION "0.18.3.3"
|
||||||
#define DEF_MONERO_RELEASE_NAME "Zero"
|
#define DEF_MONERO_RELEASE_NAME "Zero"
|
||||||
|
|||||||
Reference in New Issue
Block a user