Compare commits

...

11 Commits

Author SHA1 Message Date
Some Random Crypto Guy c820967cba fixed issues with ROLLUP circulating supply changes; fixed BURN SAL for HF11+; bumped RC version 2026-03-17 13:34:27 +00:00
Some Random Crypto Guy eadaa21e83 added hashes file for v1.1.0-rc4 2026-03-13 13:18:26 +00:00
Some Random Crypto Guy 465b384195 fixed regression of TESTNET_VERSION var 2026-03-10 21:01:54 +00:00
Some Random Crypto Guy 768ca26a8d Merge branch 'develop' of https://github.com/salvium/salvium into develop 2026-03-10 20:58:15 +00:00
Some Random Crypto Guy 6fb131a52b bumped testnet version; bumped miner and protocol TX versions for HF11; added some verification 2026-03-10 20:57:54 +00:00
auruya 3f18c388f6 add tx type and version check to block verification 2026-03-10 18:06:16 +03:00
auruya 2f646cdc10 use tx version 5 for miner and protocol txs in ENABLE_TOKENS hardfork 2026-03-10 18:03:04 +03:00
Some Random Crypto Guy a5523be459 bumped testnet version to prevent collision with old remnants; bumped version number; fixed duplicate CREATE_TOKEN issues 2026-03-10 13:56:13 +00:00
Some Random Crypto Guy 81d322b2ce Merge branch 'main' into develop 2026-03-10 13:54:58 +00:00
Some Random Crypto Guy 35b1a03b3d Merge branch 'main' into develop 2025-12-10 12:00:13 +00:00
Some Random Crypto Guy a6f47a9f92 Merge branch 'carrot-tx-proof-support' into develop 2025-12-08 19:29:38 +00:00
10 changed files with 185 additions and 80 deletions
+5
View File
@@ -0,0 +1,5 @@
d0a8b0515ae2ee79849cbc17b0639bb7859e30efcd50e5b058540874cd0919ce salvium-v1.1.0-rc4-ubuntu22.04-linux-x86_64.zip
6528b8b23f09c574fc9383b48b88e87f99609ff5ce1b727872b5554505a69d77 salvium-v1.1.0-rc4-ubuntu22.04-linux-aarch64.zip
00ca183c47f852b8b30e4b87ce3b3536a0e97866e6027bf25d389b4a1bc9c471 salvium-v1.1.0-rc4-macos-x86_64.zip
50480b1043e9b5901576ab45f926b0b51a5d21237c6da549603ad1f13819e6ed salvium-v1.1.0-rc4-macos-aarch64.zip
adf96eee17e16f318fc047721acb5bfa8ae7ed1c0ff8d022da8ab5df64d8ce3f salvium-v1.1.0-rc4-win64.zip
+116 -60
View File
@@ -1501,38 +1501,55 @@ uint64_t BlockchainLMDB::add_transaction_data(const crypto::hash& blk_hash, cons
tx.type == cryptonote::transaction_type::STAKE ||
tx.type == cryptonote::transaction_type::AUDIT ||
tx.type == cryptonote::transaction_type::TRANSFER ||
tx.type == cryptonote::transaction_type::CREATE_TOKEN)
tx.type == cryptonote::transaction_type::CREATE_TOKEN ||
tx.type == cryptonote::transaction_type::ROLLUP)
{
// Get the current tally value for the source currency type
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type(tx.source_asset_type));
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
boost::multiprecision::int128_t final_source_tally = source_tally - tx.amount_burnt - tx.rct_signatures.txnFee;
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
// Sanity check - prevent underflow
if (source_tally < final_source_tally)
throw0(DB_ERROR("numeric underflow detected when processing C/B/S/A/T for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tx_id << "\n\tTally before burn = " << source_tally.str() << "\n\tTally after burn = " << final_source_tally.str());
bool is_token = cryptonote::is_asset_type_token(tx.source_asset_type);
if (!is_token) {
// Get the current tally value for the source currency type
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type(tx.source_asset_type));
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
boost::multiprecision::int128_t final_source_tally = source_tally - tx.amount_burnt - tx.rct_signatures.txnFee;
if (tx.version >= TRANSACTION_VERSION_ENABLE_TOKENS) {
if (tx.source_asset_type != "SAL1") {
// this must be a SAL BURN TX, so fee is paid for by ROLLUP
final_source_tally = final_source_tally + tx.rct_signatures.txnFee;
}
}
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
// Sanity check - prevent underflow
if (source_tally < final_source_tally)
throw0(DB_ERROR("numeric underflow detected when processing C/B/S/A/T for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tx_id << "\n\tTally before burn = " << source_tally.str() << "\n\tTally after burn = " << final_source_tally.str());
MDB_val_copy<uint64_t> burn_idx(cryptonote::asset_id_from_type("BURN"));
boost::multiprecision::int128_t burn_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, burn_tally);
if (result && /*(m_height>0 ||*/ result != MDB_NOTFOUND/*)*/)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
boost::multiprecision::int128_t final_burn_tally = burn_tally + tx.amount_burnt + tx.rct_signatures.txnFee;
// Sanity check - prevent underflow
if (burn_tally > final_burn_tally)
throw0(DB_ERROR("burn overflow detected when adding tx for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, final_burn_tally);
MDB_val_copy<uint64_t> burn_idx(cryptonote::asset_id_from_type("BURN"));
boost::multiprecision::int128_t burn_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, burn_tally);
if (result && /*(m_height>0 ||*/ result != MDB_NOTFOUND/*)*/)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
boost::multiprecision::int128_t final_burn_tally = burn_tally + tx.amount_burnt + tx.rct_signatures.txnFee;
if (tx.version >= TRANSACTION_VERSION_ENABLE_TOKENS) {
if (tx.source_asset_type != "SAL1") {
// this must be a SAL BURN TX, so fee is paid for by ROLLUP
final_burn_tally = final_burn_tally - tx.rct_signatures.txnFee;
}
}
// Sanity check - prevent underflow
if (burn_tally > final_burn_tally)
throw0(DB_ERROR("burn overflow detected when adding tx for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, final_burn_tally);
}
}
if (tx.type == cryptonote::transaction_type::PROTOCOL) {
// Iterate over all of the outputs for a PROTOCOL_TX since they're all MINTED
std::map<uint32_t, uint64_t> minted_amounts;
std::map<uint32_t, uint64_t> burned_amounts;
for (const auto& out: tx.vout) {
// Fetch the amount and output_asset_type for this output
@@ -1541,6 +1558,11 @@ uint64_t BlockchainLMDB::add_transaction_data(const crypto::hash& blk_hash, cons
if (!ok)
throw0(DB_ERROR("failed to get output asset type (needed to update the circulating supply data for the PROTOCOL_TX)"));
minted_amounts[cryptonote::asset_id_from_type(asset_type)] += out.amount;
if (asset_type == "SAL" || asset_type == "SAL1") {
uint32_t burned_asset_id = cryptonote::asset_id_from_type("BURN");
burned_amounts[burned_asset_id] += out.amount;
}
}
// Now update the overall tally entries
@@ -1567,23 +1589,23 @@ uint64_t BlockchainLMDB::add_transaction_data(const crypto::hash& blk_hash, cons
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
// Log can be changed - not burning here
LOG_PRINT_L1("tx ID " << tx_id << "\n\tAsset Type = " << cryptonote::asset_type_from_id(asset.first) << "\n\tTally before burn =" << source_tally.str() << "\n\tTally after burn =" << final_source_tally.str());
MDB_val_copy<uint64_t> burn_idx(cryptonote::asset_id_from_type("BURN"));
}
// Update burned asset tallies (subtract what was burned, BUT NOT for tokens which are being created!)
// HERE BE DRAGONS!!!
// SRCG: there should only ever be one entry in this vector!!!
for (const auto& asset: burned_amounts) {
MDB_val_copy<uint64_t> burn_idx(asset.first);
boost::multiprecision::int128_t burn_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, burn_tally);
if (result && result != MDB_NOTFOUND)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
uint64_t burn_amount = 0;
if (asset.first == 0x53414C00 || asset.first == 0x53414C31 || asset.first == 0x4255524E) { //BURN SAL and SAL1 // check
burn_amount = asset.second;
} else {
burn_amount = asset.second / 200;
}
if (burn_tally < burn_amount)
if (burn_tally < asset.second)
throw0(DB_ERROR("add_transaction_data() - burn underflow"));
boost::multiprecision::int128_t final_burn_tally = burn_tally - burn_amount;
boost::multiprecision::int128_t final_burn_tally = burn_tally - asset.second;
write_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, final_burn_tally);
}
// LAND AHOY!!!
}
// Is there a rollup_tx to add?
@@ -1898,37 +1920,60 @@ void BlockchainLMDB::remove_transaction_data(const crypto::hash& tx_hash, const
write_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, final_burn_tally);
}
if (tx.type == cryptonote::transaction_type::BURN || tx.type == cryptonote::transaction_type::CONVERT || tx.type == cryptonote::transaction_type::STAKE || tx.type == cryptonote::transaction_type::AUDIT || tx.type == cryptonote::transaction_type::TRANSFER) {
if (tx.type == cryptonote::transaction_type::BURN ||
tx.type == cryptonote::transaction_type::CONVERT ||
tx.type == cryptonote::transaction_type::STAKE ||
tx.type == cryptonote::transaction_type::AUDIT ||
tx.type == cryptonote::transaction_type::TRANSFER ||
tx.type == cryptonote::transaction_type::CREATE_TOKEN ||
tx.type == cryptonote::transaction_type::ROLLUP)
{
// Get the current tally value for the source currency type
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type(tx.source_asset_type));
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
boost::multiprecision::int128_t final_source_tally = source_tally + tx.amount_burnt + tx.rct_signatures.txnFee;
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when removing db transaction: ", result).c_str()));
// Sanity check - prevent overflow
if (source_tally > final_source_tally)
throw0(DB_ERROR("numeric overflow detected when processing C/B/S/A/T for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tip->data.tx_id << "\n\tTally before remint =" << source_tally.str() << "\n\tTally after remint =" << final_source_tally.str());
MDB_val_copy<uint64_t> burn_idx(cryptonote::asset_id_from_type("BURN"));
boost::multiprecision::int128_t burn_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, burn_tally);
if (result && /*(m_height>0 ||*/ result != MDB_NOTFOUND/*)*/)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
boost::multiprecision::int128_t final_burn_tally = burn_tally - tx.amount_burnt - tx.rct_signatures.txnFee;
// Sanity check - prevent underflow
if (burn_tally < (tx.amount_burnt + tx.rct_signatures.txnFee))
throw0(DB_ERROR("burn underflow detected when removing tx for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, final_burn_tally);
}
bool is_token = cryptonote::is_asset_type_token(tx.source_asset_type);
if (!is_token) {
// Get the current tally value for the source currency type
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type(tx.source_asset_type));
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
boost::multiprecision::int128_t final_source_tally = source_tally + tx.amount_burnt + tx.rct_signatures.txnFee;
if (tx.version >= TRANSACTION_VERSION_ENABLE_TOKENS) {
if (tx.source_asset_type != "SAL1") {
// this must be a SAL BURN TX, so fee is paid for by ROLLUP
final_source_tally = final_source_tally - tx.rct_signatures.txnFee;
}
}
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when removing db transaction: ", result).c_str()));
// Sanity check - prevent overflow
if (source_tally > final_source_tally)
throw0(DB_ERROR("numeric overflow detected when processing C/B/S/A/T for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tip->data.tx_id << "\n\tTally before remint =" << source_tally.str() << "\n\tTally after remint =" << final_source_tally.str());
MDB_val_copy<uint64_t> burn_idx(cryptonote::asset_id_from_type("BURN"));
boost::multiprecision::int128_t burn_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, burn_tally);
if (result && /*(m_height>0 ||*/ result != MDB_NOTFOUND/*)*/)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
boost::multiprecision::int128_t final_burn_tally = burn_tally - tx.amount_burnt - tx.rct_signatures.txnFee;
if (tx.version >= TRANSACTION_VERSION_ENABLE_TOKENS) {
if (tx.source_asset_type != "SAL1") {
// this must be a SAL BURN TX, so fee is paid for by ROLLUP
final_burn_tally = final_burn_tally + tx.rct_signatures.txnFee;
}
}
// Sanity check - prevent underflow
if (burn_tally < (tx.amount_burnt + tx.rct_signatures.txnFee))
throw0(DB_ERROR("burn underflow detected when removing tx for db transaction"));
write_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, final_burn_tally);
}
}
if (tx.type == cryptonote::transaction_type::PROTOCOL) {
// Iterate over all of the outputs for a PROTOCOL_TX since they're all MINTED
std::map<uint32_t, uint64_t> minted_amounts;
std::map<uint32_t, uint64_t> burned_amounts;
for (const auto& out: tx.vout) {
// Fetch the amount and output_asset_type for this output
@@ -1937,6 +1982,11 @@ void BlockchainLMDB::remove_transaction_data(const crypto::hash& tx_hash, const
if (!ok)
throw0(DB_ERROR("failed to get output asset type (needed to update the circulating supply data for the PROTOCOL_TX)"));
minted_amounts[cryptonote::asset_id_from_type(asset_type)] += out.amount;
if (asset_type == "SAL" || asset_type == "SAL1") {
uint32_t burned_asset_id = cryptonote::asset_id_from_type("BURN");
burned_amounts[burned_asset_id] += out.amount;
}
}
// Now update the overall tally entries
@@ -1955,8 +2005,13 @@ void BlockchainLMDB::remove_transaction_data(const crypto::hash& tx_hash, const
boost::multiprecision::int128_t final_source_tally = source_tally - asset.second;
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tip->data.tx_id << "\n\tAsset Type = " << cryptonote::asset_type_from_id(asset.first) << "\n\tTally before undoing mint =" << source_tally.str() << "\n\tTally after undoing mint =" << final_source_tally.str());
MDB_val_copy<uint64_t> burn_idx(cryptonote::asset_id_from_type("BURN"));
}
// Update burned asset tallies (add what was burned, BUT NOT for tokens which were being created!)
// HERE BE DRAGONS!!!
// SRCG: there should only ever be one entry in this vector!!!
for (const auto& asset: burned_amounts) {
MDB_val_copy<uint64_t> burn_idx(asset.first);
boost::multiprecision::int128_t burn_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, burn_tally);
if (result)
@@ -1966,6 +2021,7 @@ void BlockchainLMDB::remove_transaction_data(const crypto::hash& tx_hash, const
boost::multiprecision::int128_t final_burn_tally = burn_tally + asset.second;
write_circulating_supply_data(m_cur_circ_supply_tally, burn_idx, final_burn_tally);
}
// LAND AHOY!!!
}
remove_tx_outputs(tip->data.tx_id, tx);
+1
View File
@@ -217,6 +217,7 @@ void make_carrot_transaction_proposal_v1(const std::vector<CarrotPaymentProposal
}
uint64_t fee = tx_proposal_out.fee;
if (asset_type != "SAL1") {
// check here
if (tx_type != cryptonote::transaction_type::BURN || asset_type != "SAL") {
CARROT_CHECK_AND_THROW(cryptonote::is_valid_custom_asset_type(asset_type),
carrot_logic_error, "make_carrot_transaction_proposal_v1: invalid asset type in payment proposals: " << asset_type);
+1 -1
View File
@@ -254,7 +254,7 @@
#define HF_VERSION_ENABLE_ORACLE 255
#define HF_VERSION_SLIPPAGE_YIELD 255
#define TESTNET_VERSION 15
#define TESTNET_VERSION 16
#define STAGENET_VERSION 1
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8
+34 -11
View File
@@ -1351,7 +1351,10 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "coinbase transaction in the block has the wrong type");
CHECK_AND_ASSERT_MES(b.miner_tx.version > 1, false, "Invalid coinbase transaction version");
if (hf_version >= HF_VERSION_CARROT) {
if (hf_version >= HF_VERSION_ENABLE_TOKENS) {
CHECK_AND_ASSERT_MES(b.miner_tx.version == TRANSACTION_VERSION_ENABLE_TOKENS, false, "miner transaction has wrong version");
CHECK_AND_ASSERT_MES(b.miner_tx.type == cryptonote::transaction_type::MINER, false, "miner transaction has wrong type");
} else if (hf_version >= HF_VERSION_CARROT) {
CHECK_AND_ASSERT_MES(b.miner_tx.version == TRANSACTION_VERSION_CARROT, false, "miner transaction has wrong version");
CHECK_AND_ASSERT_MES(b.miner_tx.type == cryptonote::transaction_type::MINER, false, "miner transaction has wrong type");
}
@@ -1410,7 +1413,10 @@ bool Blockchain::prevalidate_protocol_transaction(const block& b, uint64_t heigh
uint64_t stake_lock_period = get_config(m_nettype).STAKE_LOCK_PERIOD;
uint8_t hf_version_submitted = get_ideal_hard_fork_version(height - stake_lock_period - 1);
if (hf_version == HF_VERSION_CARROT) {
if (hf_version >= HF_VERSION_ENABLE_TOKENS) {
CHECK_AND_ASSERT_MES(b.protocol_tx.version == TRANSACTION_VERSION_ENABLE_TOKENS, false, "protocol transaction has wrong version");
hf_version_submitted = hf_version;
} else if (hf_version == HF_VERSION_CARROT) {
if (hf_version_submitted >= HF_VERSION_CARROT || b.protocol_tx.vout.size() == 0) {
CHECK_AND_ASSERT_MES(b.protocol_tx.version == TRANSACTION_VERSION_CARROT, false, "protocol transaction has wrong version");
} else {
@@ -3914,8 +3920,8 @@ bool Blockchain::check_tx_asset_types(const transaction& tx, tx_verification_con
return false;
}
} else if (tx.type == cryptonote::transaction_type::BURN) {
if ((tx.source_asset_type != "SAL" && tx.source_asset_type != "SAL1") || tx.destination_asset_type != tx.source_asset_type) {
MERROR_VER("Invalid source/dest asset type for BURN - provided source asset: " << tx.source_asset_type << ", and destination asset: " << tx.destination_asset_type << ", expected (matching) SAL/SAL1");
if ((tx.source_asset_type != "SAL" && tx.source_asset_type != "SAL1") || (tx.source_asset_type != tx.destination_asset_type)) {
MERROR_VER("Invalid source/dest asset type for BURN - provided source asset: " << tx.source_asset_type << ", and destination asset: " << tx.destination_asset_type << ", expected SAL/SAL1 for both");
tvc.m_verifivation_failed = true;
return false;
}
@@ -3941,12 +3947,19 @@ bool Blockchain::check_tx_asset_types(const transaction& tx, tx_verification_con
return false;
}
} else if (hf_version >= HF_VERSION_CARROT) {
if (tx.source_asset_type != "SAL1" || tx.destination_asset_type != "SAL1") {
MERROR_VER("Invalid destination/source asset type - provided destination asset: " << tx.destination_asset_type << ", expected SAL1" << ", provided source asset: " << tx.source_asset_type << ", expected SAL1");
tvc.m_verifivation_failed = true;
return false;
if (tx.type == cryptonote::transaction_type::BURN) {
if (tx.source_asset_type != "SAL1" || tx.destination_asset_type != "BURN") {
MERROR_VER("Invalid source/dest asset type for BURN - provided destination asset: " << tx.destination_asset_type << ", expected BURN" << ", provided source asset: " << tx.source_asset_type << ", expected SAL1");
tvc.m_verifivation_failed = true;
return false;
}
} else {
if (tx.source_asset_type != "SAL1" || tx.destination_asset_type != "SAL1") {
MERROR_VER("Invalid destination/source asset type - provided destination asset: " << tx.destination_asset_type << ", expected SAL1" << ", provided source asset: " << tx.source_asset_type << ", expected SAL1");
tvc.m_verifivation_failed = true;
return false;
}
}
// }
} else if (hf_version >= HF_VERSION_SALVIUM_ONE_PROOFS) {
// protocol and miner txs don't have source and destination asset types
if (tx.type == cryptonote::transaction_type::PROTOCOL || tx.type == cryptonote::transaction_type::MINER) {
@@ -3954,8 +3967,8 @@ bool Blockchain::check_tx_asset_types(const transaction& tx, tx_verification_con
} else if (tx.type == cryptonote::transaction_type::AUDIT) {
CHECK_AND_ASSERT_MES(tx.source_asset_type == "SAL" && tx.destination_asset_type == "SAL", false, "wrong source/destination asset type: provided source asset " << tx.source_asset_type << " expected SAL and provided destination asset " << tx.destination_asset_type << " expected SAL");
} else if (tx.type == cryptonote::transaction_type::BURN) {
if (tx.source_asset_type != "SAL1" || tx.destination_asset_type != "BURN") {
MERROR_VER("Invalid source/dest asset type for BURN - provided source asset: " << tx.source_asset_type << ", and destination asset: " << tx.destination_asset_type << ", expected SAL1 and BURN respectively");
if ((tx.source_asset_type != "SAL" && tx.source_asset_type != "SAL1") || tx.destination_asset_type != "BURN") {
MERROR_VER("Invalid source/dest asset type for BURN - provided source asset: " << tx.source_asset_type << ", and destination asset: " << tx.destination_asset_type << ", expected SAL/SAL1 and BURN respectively");
tvc.m_verifivation_failed = true;
return false;
}
@@ -5583,6 +5596,16 @@ leave:
}
}
#endif
// Check the TX type
tx_verification_context tvc;
if (!check_tx_type_and_version(tx, tvc)) {
MERROR("Block with id: " << id << " failed to pass transaction type and version check for transaction id: " << tx_id);
bvc.m_verifivation_failed = true;
return_tx_to_pool(txs);
goto leave;
}
TIME_MEASURE_FINISH(cc);
t_checktx += cc;
fee_summary += fee;
+2 -1
View File
@@ -392,6 +392,7 @@ namespace cryptonote
}
tx = store_carrot_to_coinbase_transaction_v1(enotes, std::string{}, cryptonote::transaction_type::PROTOCOL, height);
tx.amount_burnt = 0;
tx.version = (hard_fork_version >= HF_VERSION_ENABLE_TOKENS) ? TRANSACTION_VERSION_ENABLE_TOKENS : TRANSACTION_VERSION_CARROT;
tx.invalidate_hashes();
}
catch (const std::exception &e)
@@ -540,7 +541,7 @@ namespace cryptonote
}
tx = carrot::store_carrot_to_coinbase_transaction_v1(enotes, extra_nonce, cryptonote::transaction_type::MINER, height);
tx.version = (hard_fork_version >= HF_VERSION_ENABLE_TOKENS) ? TRANSACTION_VERSION_ENABLE_TOKENS : TRANSACTION_VERSION_CARROT;
tx.amount_burnt = stake_reward;
tx.invalidate_hashes();
}
+15 -2
View File
@@ -275,6 +275,13 @@ namespace cryptonote
return false;
}
// HERE BE DRAGONS!!!
// Check that CREATE_TOKEN txs are unique in the pool
if (tx.type == cryptonote::transaction_type::CREATE_TOKEN) {
// TODO: ...scan the existing entries - requires either a registry of CREATE_TOKEN TXs, or to interatively process the pool
}
// LAND AHOY!!!
// assume failure during verification steps until success is certain
tvc.m_verifivation_failed = true;
@@ -1649,11 +1656,17 @@ namespace cryptonote
LOG_PRINT_L2("Filling block template, median weight " << median_weight << ", " << m_txs_by_fee_and_receive_time.size() << " txes in the pool");
LockedTXN lock(m_blockchain.get_db());
// Store list of tokens being created
std::set<std::string> tokens;
// Get the list of already-created tokens that are in the DB
std::map<std::string, cryptonote::token_metadata_t> mapTokens = m_blockchain.get_db().get_tokens();
for (const auto &entry: mapTokens) {
tokens.insert(entry.second.asset_type);
}
LockedTXN lock(m_blockchain.get_db());
auto sorted_it = m_txs_by_fee_and_receive_time.begin();
for (; sorted_it != m_txs_by_fee_and_receive_time.end(); ++sorted_it)
{
+8 -2
View File
@@ -8755,9 +8755,15 @@ bool simple_wallet::burn(const std::vector<std::string> &args_)
return true;
}
uint8_t hf_version = m_wallet->get_current_hard_fork();
if (hf_version >= HF_VERSION_CARROT && hf_version < HF_VERSION_ENABLE_TOKENS) {
fail_msg_writer() << tr("BURN command is disabled until hard fork ") << HF_VERSION_ENABLE_TOKENS;
return true;
}
std::vector<std::string> local_args;
carrot::AddressDeriveType derive_type;
if (m_wallet->use_fork_rules(HF_VERSION_CARROT, 0)) {
if (hf_version >= HF_VERSION_CARROT) {
derive_type = carrot::AddressDeriveType::Carrot;
} else {
derive_type = carrot::AddressDeriveType::PreCarrot;
@@ -8776,7 +8782,7 @@ bool simple_wallet::burn(const std::vector<std::string> &args_)
asset_type = strLastArg;
local_args.pop_back();
if (m_wallet->get_current_hard_fork() >= HF_VERSION_ENABLE_TOKENS) {
if (hf_version >= HF_VERSION_ENABLE_TOKENS) {
transfer_main(Burn, asset_type, asset_type, local_args, false);
} else {
transfer_main(Burn, asset_type, "BURN", local_args, false);
+1 -1
View File
@@ -1,5 +1,5 @@
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
#define DEF_SALVIUM_VERSION "1.1.0-rc3"
#define DEF_SALVIUM_VERSION "1.1.0-rc5"
#define DEF_MONERO_VERSION_TAG "release"
#define DEF_MONERO_VERSION "0.18.4.0"
#define DEF_MONERO_RELEASE_NAME "One"
+2 -2
View File
@@ -9574,7 +9574,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
// check we're clear enough of rct start, to avoid corner cases below
THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE,
error::get_output_distribution, "Not enough rct outputs");
THROW_WALLET_EXCEPTION_IF(rct_offsets.back() <= max_rct_index,
THROW_WALLET_EXCEPTION_IF(rct_offsets.back() < max_rct_index,
error::get_output_distribution, "Daemon reports suspicious number of rct outputs");
}
@@ -11089,7 +11089,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
// Is this a BURN TX?
if (hf_version >= HF_VERSION_ENABLE_TOKENS && tx_type == cryptonote::transaction_type::BURN) {
THROW_WALLET_EXCEPTION_IF(source_asset != "SAL" && source_asset != "SAL1", error::wallet_internal_error, "Only SAL and SAL1 may be burnt");
THROW_WALLET_EXCEPTION_IF(source_asset != "SAL" && source_asset != "SAL1", error::wallet_internal_error, "Only SAL/SAL1 may be burnt");
THROW_WALLET_EXCEPTION_IF(dsts.size() != 1, error::wallet_internal_error, "Only 1 destination permitted for BURN");
dsts[0].asset_type = source_asset;
}