Fixes include:

- setting DEFAULT_STACK_TRACE=OFF for all release builds (prevents boost weak_ptr crash on some Linux systems)
- setting RPC-SSL to disabled by default (fixes "no connection to daemon" error)
- updated BlockchainLMDB::get_circulating_supply() to report staked coins as something other than BURNT
- bumped to v0.4.5
This commit is contained in:
Some Random Crypto Guy
2024-08-16 14:01:11 +01:00
parent beffdd7ed9
commit addd26cd47
8 changed files with 39 additions and 23 deletions

View File

@@ -538,7 +538,7 @@ elseif (DEPENDS AND NOT LINUX)
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
set(DEFAULT_STACK_TRACE ON)
set(DEFAULT_STACK_TRACE OFF)
set(STACK_TRACE_LIB "easylogging++") # for diag output only
set(LIBUNWIND_LIBRARIES "")
elseif (ARM)
@@ -547,7 +547,7 @@ elseif (ARM)
else()
find_package(Libunwind)
if(LIBUNWIND_FOUND)
set(DEFAULT_STACK_TRACE ON)
set(DEFAULT_STACK_TRACE OFF)
set(STACK_TRACE_LIB "libunwind") # for diag output only
else()
set(DEFAULT_STACK_TRACE OFF)

View File

@@ -1915,8 +1915,8 @@ public:
*/
virtual uint64_t get_database_size() const = 0;
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi) = 0;
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) = 0;
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi) const = 0;
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) const = 0;
/**

View File

@@ -800,7 +800,7 @@ estim:
return threshold_size;
}
int BlockchainLMDB::get_yield_block_info(const uint64_t height, yield_block_info& ybi)
int BlockchainLMDB::get_yield_block_info(const uint64_t height, yield_block_info& ybi) const
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
@@ -825,11 +825,13 @@ int BlockchainLMDB::get_yield_block_info(const uint64_t height, yield_block_info
yield_block_info *p = (yield_block_info*)v.mv_data;
ybi = *p;
TXN_POSTFIX_RDONLY();
// Return success to caller
return ret;
}
int BlockchainLMDB::get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container)
int BlockchainLMDB::get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) const
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
@@ -858,6 +860,8 @@ int BlockchainLMDB::get_yield_tx_info(const uint64_t height, std::vector<yield_t
yti_container.emplace_back(*p);
}
TXN_POSTFIX_RDONLY();
// Return success to caller
return 0;
}
@@ -3469,9 +3473,12 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
uint64_t m_coinbase = get_block_already_generated_coins(m_height-1);
LOG_PRINT_L3("BlockchainLMDB::" << __func__ << " - mined supply for SAL = " << m_coinbase);
// SRCG: For V1, we can simply return this number, because there is no other source of coins
//circulating_supply["SAL"] = m_coinbase;
//return circulating_supply;
uint64_t staked_coins = 0;
yield_block_info ybi;
int result = get_yield_block_info(m_height-1, ybi);
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get YBI when querying supply: ", result).c_str()));
staked_coins = ybi.locked_coins_tally;
check_open();
@@ -3480,8 +3487,6 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
MDB_val k;
MDB_val v;
int result = 0;
MDB_cursor_op op = MDB_FIRST;
while (1)
{
@@ -3513,7 +3518,11 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
if (circulating_supply.empty()) {
circulating_supply["SAL"] = m_coinbase;
}
circulating_supply["BURN"] = m_coinbase - circulating_supply["SAL"];
// Adjust the supply to account for the staked coins
circulating_supply["STAKE"] = staked_coins;
circulating_supply["BURN"] = m_coinbase - circulating_supply["SAL"] - circulating_supply["STAKE"];
return circulating_supply;
}

View File

@@ -459,8 +459,8 @@ private:
//void migrate_0_1();
void cleanup_batch();
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi);
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container);
virtual int get_yield_block_info(const uint64_t height, yield_block_info& ybi) const;
virtual int get_yield_tx_info(const uint64_t height, std::vector<yield_tx_info>& yti_container) const;
private:
MDB_env* m_env;

View File

@@ -1478,7 +1478,7 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl
}
//------------------------------------------------------------------
// SRCG
bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, const std::map<std::string, uint64_t>& circ_supply, uint8_t hf_version)
bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, uint8_t hf_version)
{
LOG_PRINT_L3("Blockchain::" << __func__);
CHECK_AND_ASSERT_MES(b.tx_hashes.size() == txs.size(), false, "Invalid number of TXs / hashes supplied");
@@ -1488,6 +1488,17 @@ bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height,
CHECK_AND_ASSERT_MES(b.protocol_tx.vout.size() == 0, false, "void protocol transaction in the block has outputs");
return true;
}
if (!b.protocol_tx.vout.size()) {
// No money is minted, nothing to verify - bail out
return true;
}
// Get the circulating supply so we can verify
std::map<std::string, uint64_t> circ_supply;
if (hf_version >= HF_VERSION_ENABLE_CONVERT) {
circ_supply = get_db().get_circulating_supply();
}
// Build a map of outputs from the protocol_tx
std::map<crypto::public_key, std::tuple<std::string, uint64_t, uint64_t>> outputs;
@@ -4900,12 +4911,8 @@ leave:
}
TIME_MEASURE_FINISH(vmt);
TIME_MEASURE_START(gcs);
std::map<std::string, uint64_t> circ_supply = get_db().get_circulating_supply();
TIME_MEASURE_FINISH(gcs);
TIME_MEASURE_START(vpt);
if(!validate_protocol_transaction(bl, blockchain_height, txs, circ_supply, m_hardfork->get_current_version()))
if(!validate_protocol_transaction(bl, blockchain_height, txs, m_hardfork->get_current_version()))
{
MERROR_VER("Block with id: " << id << " has incorrect protocol transaction");
bvc.m_verifivation_failed = true;

View File

@@ -1521,7 +1521,7 @@ namespace cryptonote
*
* @return false if anything is found wrong with the protocol transaction, otherwise true
*/
bool validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, const std::map<std::string, uint64_t>& circ_supply, uint8_t hf_version);
bool validate_protocol_transaction(const block& b, uint64_t height, std::vector<std::pair<transaction, blobdata>>& txs, uint8_t hf_version);
/**
* @brief reverts the blockchain to its previous state following a failed switch

View File

@@ -98,7 +98,7 @@ namespace cryptonote
, rpc_login({"rpc-login", rpc_args::tr("Specify username[:password] required for RPC server"), "", true})
, confirm_external_bind({"confirm-external-bind", rpc_args::tr("Confirm rpc-bind-ip value is NOT a loopback (local) IP")})
, rpc_access_control_origins({"rpc-access-control-origins", rpc_args::tr("Specify a comma separated list of origins to allow cross origin resource sharing"), ""})
, rpc_ssl({"rpc-ssl", rpc_args::tr("Enable SSL on RPC connections: enabled|disabled|autodetect"), "autodetect"})
, rpc_ssl({"rpc-ssl", rpc_args::tr("Enable SSL on RPC connections: enabled|disabled|autodetect"), "disabled"})
, rpc_ssl_private_key({"rpc-ssl-private-key", rpc_args::tr("Path to a PEM format private key"), ""})
, rpc_ssl_certificate({"rpc-ssl-certificate", rpc_args::tr("Path to a PEM format certificate"), ""})
, rpc_ssl_ca_certificates({"rpc-ssl-ca-certificates", rpc_args::tr("Path to file containing concatenated PEM format certificate(s) to replace system CA(s)."), ""})

View File

@@ -1,5 +1,5 @@
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
#define DEF_SALVIUM_VERSION "0.4.4-beta2"
#define DEF_SALVIUM_VERSION "0.4.5"
#define DEF_MONERO_VERSION_TAG "release"
#define DEF_MONERO_VERSION "0.18.3.3"
#define DEF_MONERO_RELEASE_NAME "Zero"