Compare commits

..

3 Commits

Author SHA1 Message Date
Some Random Crypto Guy
945bdc72e7 Merge branch 'hotfix-0.6.4' 2024-11-16 00:49:08 +00:00
Some Random Crypto Guy
c6d843b6f5 hotfix to address the 'difficulty overhead' chain issues; added more fasta-sync checkpoints; bumped version number 2024-11-16 00:48:31 +00:00
Some Random Crypto Guy
b285ec550d fixed edge case where returning pre-HF2 transfer using HF2 CLI wallet _before_ HF2; bumped version 2024-10-31 18:37:41 +00:00
6 changed files with 52 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
# Salvium Zero v0.6.2
# Salvium Zero v0.6.4
Copyright (c) 2023-2024, Salvium
Portions Copyright (c) 2014-2023, The Monero Project
@@ -172,7 +172,7 @@ invokes cmake commands as needed.
```bash
cd salvium
git checkout v0.6.2
git checkout v0.6.4
make
```
@@ -251,7 +251,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
```bash
git clone https://github.com/salvium/salvium
cd salvium
git checkout v0.6.2
git checkout v0.6.4
```
* Build:
@@ -370,10 +370,10 @@ application.
cd salvium
```
* If you would like a specific [version/tag](https://github.com/salvium/salvium/tags), do a git checkout for that version. eg. 'v0.6.2'. If you don't care about the version and just want binaries from master, skip this step:
* If you would like a specific [version/tag](https://github.com/salvium/salvium/tags), do a git checkout for that version. eg. 'v0.6.4'. If you don't care about the version and just want binaries from master, skip this step:
```bash
git checkout v0.6.2
git checkout v0.6.4
```
* If you are on a 64-bit system, run:

Binary file not shown.

View File

@@ -204,6 +204,7 @@ namespace cryptonote
ADD_CHECKPOINT2(180, "e20bc8ac6aabb6b0792f23a29ce42a577c6a57d177a8ac1a51b68fb6de508045", "0x262b40");
ADD_CHECKPOINT2(190, "f69fdad7a15471b63a82668b618ee5b2a384291269d944b11974a723c1604124", "0x2856a3");
ADD_CHECKPOINT2(200, "eba53fa7006dfcdc837a56c0bc8f0e1883cf34861c26934d680252a6878a3f5d", "0x2aa022");
ADD_CHECKPOINT2(90000, "e125b5c1b26521f98e29df6ec88f041c176a2c0a3fcacd5bd0ad2278e9b02fd2", "0xc99801f937888"); // 3546475285149832
}
return true;
}

View File

@@ -1034,13 +1034,27 @@ size_t Blockchain::recalculate_difficulties(boost::optional<uint64_t> start_heig
LOG_PRINT_L3("Blockchain::" << __func__);
CRITICAL_REGION_LOCAL(m_blockchain_lock);
const uint64_t start_height = start_height_opt ? *start_height_opt : check_difficulty_checkpoints().second;
//uint64_t start_height = start_height_opt ? *start_height_opt : check_difficulty_checkpoints().second;
uint8_t version = get_current_hard_fork_version();
uint64_t start_height = 0;
if (start_height_opt) {
start_height = *start_height_opt;
} else {
bool found = false;
for (size_t i=0; i<num_mainnet_hard_forks; ++i) {
if (version == mainnet_hard_forks[i].version) {
start_height = mainnet_hard_forks[i].height;
found = true;
break;
}
}
start_height = std::max(start_height, check_difficulty_checkpoints().second);
}
const uint64_t top_height = m_db->height() - 1;
MGINFO("Recalculating difficulties from height " << start_height << " to height " << top_height);
std::vector<uint64_t> timestamps;
std::vector<difficulty_type> difficulties;
uint8_t version = get_current_hard_fork_version();
size_t difficulty_blocks_count;
if (version == 1) {
difficulty_blocks_count = DIFFICULTY_BLOCKS_COUNT;
@@ -6128,7 +6142,7 @@ void Blockchain::cancel()
}
#if defined(PER_BLOCK_CHECKPOINT)
static const char expected_block_hashes_hash[] = "3cb6d33c311e54f2b8439a3e4cc047f6b9b74db9fd92955f1db131a5dfce1edf";
static const char expected_block_hashes_hash[] = "5065d5361119a526b7a45e9e5bdf1d5be86f80e9eb43b0398bf0e47489c81c6d";
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
{
if (get_checkpoints == nullptr || !m_fast_sync)

View File

@@ -1,5 +1,5 @@
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
#define DEF_SALVIUM_VERSION "0.6.2"
#define DEF_SALVIUM_VERSION "0.6.4"
#define DEF_MONERO_VERSION_TAG "release"
#define DEF_MONERO_VERSION "0.18.3.3"
#define DEF_MONERO_RELEASE_NAME "Zero"

View File

@@ -11363,8 +11363,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_return(std::vector
crypto::public_key P_change = crypto::null_pkey;
uint8_t change_index;
uint32_t hf_version = get_current_hard_fork();
if (hf_version >= HF_VERSION_ENABLE_N_OUTS && td_origin.m_tx.version >= TRANSACTION_VERSION_N_OUTS) {
if (td_origin.m_tx.version >= TRANSACTION_VERSION_N_OUTS) {
// Calculate z_i (the shared secret between sender and ourselves for the original TX)
crypto::public_key txkey_pub = null_pkey; // R
const std::vector<crypto::public_key> in_additional_tx_pub_keys = get_additional_tx_pub_keys_from_extra(td_origin.m_tx);
@@ -11392,21 +11392,43 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_return(std::vector
std::strncpy(buf.domain_separator, "RETURN", 7);
buf.amount_key = rct::sk2rct(z_i);
crypto::hash_to_scalar(&buf, sizeof(buf), y);
// The change_index needs decoding too
uint8_t eci_data = td_origin.m_tx.return_address_change_mask[td_origin.m_internal_output_index];
// Calculate the encrypted_change_index data for this output
std::memset(buf.domain_separator, 0x0, sizeof(buf.domain_separator));
std::strncpy(buf.domain_separator, "CHG_IDX", 8);
crypto::secret_key eci_out;
keccak((uint8_t *)&buf, sizeof(buf), (uint8_t*)&eci_out, sizeof(eci_out));
change_index = eci_data ^ eci_out.data[0];
return_address = td_origin.m_tx.return_address_list[td_origin.m_internal_output_index];
} else {
// Sanity check that we aren't attempting to return our own TX change output to ourselves
THROW_WALLET_EXCEPTION_IF(change_index == td_origin.m_internal_output_index, error::wallet_internal_error, tr("Attempting to return change to ourself"));
// Sanity check that we can obtain the change output from the origin TX
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_public_key(td_origin.m_tx.vout[change_index], P_change),
error::wallet_internal_error,
tr("Failed to identify change output"));
} else {
// Change index is the one we didn't receive
change_index = (td_origin.m_internal_output_index == 0) ? 1 : 0;
// Return address was provided
return_address = td_origin.m_tx.return_address;
// Sanity check that we aren't attempting to return our own TX change output to ourselves
THROW_WALLET_EXCEPTION_IF(change_index == td_origin.m_internal_output_index, error::wallet_internal_error, tr("Attempting to return change to ourself"));
// Sanity check that we can obtain the change output from the origin TX
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_public_key(td_origin.m_tx.vout[change_index], P_change),
error::wallet_internal_error,
tr("Failed to identify change output"));
// Calculate y
struct {
char domain_separator[8];
@@ -11416,21 +11438,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_return(std::vector
std::strncpy(buf.domain_separator, "RETURN", 6);
buf.pubkey = P_change;
crypto::hash_to_scalar(&buf, sizeof(buf), y);
// Change index is the one we didn't receive
change_index = (td_origin.m_internal_output_index == 0) ? 1 : 0;
return_address = td_origin.m_tx.return_address;
}
// Sanity check that we aren't attempting to return our own TX change output to ourselves
THROW_WALLET_EXCEPTION_IF(change_index == td_origin.m_internal_output_index, error::wallet_internal_error, tr("Attempting to return change to ourself"));
// Sanity check that we can obtain the change output from the origin TX
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_public_key(td_origin.m_tx.vout[change_index], P_change),
error::wallet_internal_error,
tr("Failed to identify change output"));
// Calculate yF
rct::key key_y = (rct::key&)(y);
rct::key key_F = (rct::key&)(return_address);