1
0
Fork 0
forked from lthn/blockchain

Merge branch 'master' into release

This commit is contained in:
sowle 2023-08-01 15:50:21 +02:00
commit 9d51307574
14 changed files with 150 additions and 43 deletions

View file

@ -13,11 +13,11 @@ Be sure to clone the repository properly:\
### Dependencies
| component / version | minimum <br>(not recommended but may work) | recommended | most recent of what we have ever tested |
|--|--|--|--|
| gcc (Linux) | 5.4.0 | 7.4.0 | 8.3.0 |
| gcc (Linux) | 5.4.0 | 7.5.0 | 8.3.0 |
| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 |
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2015 (14.0 update 1) | 2017 (15.9.0) | 2019 |
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2015 (14.0 update 1) | 2017 (15.9.0) | 2022 (17.4.2) |
| [XCode](https://developer.apple.com/downloads/) (macOS) | 9.2 | 12.3 | 12.3 |
| [CMake](https://cmake.org/download/) | 2.8.6 | 3.15.5 | 3.20 |
| [CMake](https://cmake.org/download/) | 2.8.6 | 3.15.5 | 3.26.3 |
| [Boost](https://www.boost.org/users/download/) | 1.70 | 1.70 | 1.76 |
| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | - | 1.1.1n | 1.1.1n |
| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 5.8.0 | 5.11.2 | 5.15.2 |
@ -45,7 +45,7 @@ Recommended OS version: Ubuntu 18.04 LTS.
2. Download and build Boost
curl -OL https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2
tar -xjf boost_1_70_0.tar.bz2
echo "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 boost_1_70_0.tar.bz2" | shasum -c && tar -xjf boost_1_70_0.tar.bz2
cd boost_1_70_0
./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log
./b2
@ -63,10 +63,10 @@ Recommended OS version: Ubuntu 18.04 LTS.
4. Install OpenSSL
We recommend installing OpenSSL v1.1.1n locally unless you would like to use the same version system-wide.
We recommend installing OpenSSL v1.1.1n locally unless you would like to use the same version system-wide. Adjust the local path `/home/user/openssl` in the commands below according to your needs.
curl -OL https://www.openssl.org/source/openssl-1.1.1n.tar.gz
tar xaf openssl-1.1.1n.tar.gz
echo "40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a openssl-1.1.1n.tar.gz" | shasum -c && tar xaf openssl-1.1.1n.tar.gz
cd openssl-1.1.1n/
./config --prefix=/home/user/openssl --openssldir=/home/user/openssl shared zlib
make

View file

@ -21,8 +21,8 @@ namespace tools
};
#ifndef TESTNET
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.42.247/pre-download/zano_mdbx_95_1569000.pak", "c2aff6fb65c2d7a40492738c75d1d04f2f35388d3c1a664aeb77420f2d90d644", 1740147926, 3221176320 };
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.42.247/pre-download/zano_lmdb_95_1569000.pak", "f673636638b666b36c976168a3c64b2fd1fcf071c41b5d9cf01ed58a5924f80a", 2244905636, 3216977920 };
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.42.247/pre-download/zano_mdbx_95_2200000.pak", "c3bd64c62495c3f266759750952519f13f32fc161b59547beaa8202b6e26d516", 2628767033, 5100195840 };
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.42.247/pre-download/zano_lmdb_95_2200000.pak", "fcbf0ab3b23836e1a51fa675e719900fb94110cfb74790b3323cebce7fb9f5bd", 3426025872, 4954472448 };
#else
static constexpr pre_download_entry c_pre_download_mdbx = { "", "", 0, 0 };
static constexpr pre_download_entry c_pre_download_lmdb = { "", "", 0, 0 };

View file

@ -3919,9 +3919,6 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
if (need_to_profile && mixins_count > 0)
{
m_performance_data.tx_mixin_count.push(mixins_count);
#ifdef _DEBUG
LOG_PRINT_L0("[TX_MIXINS]: " << mixins_count);
#endif
}
//check if there is already transaction with this hash

View file

@ -26,6 +26,7 @@ namespace currency
ADD_CHECKPOINT(900000, "2205b73cd79d4937b087b02a8b001171b73c34464bc4a952834eaf7c2bd63e86");
ADD_CHECKPOINT(1161000, "96990d851b484e30190678756ba2a4d3a2f92b987e2470728ac1e38b2bf35908");
ADD_CHECKPOINT(1480000, "5dd3381eec35e8b4eba4518bfd8eec682a4292761d92218fd59b9f0ffedad3fe");
ADD_CHECKPOINT(2000000, "7b6698a8cc279aa78d6263f01fef186bd16f5b1ea263a7f4714abc1d506b9cb3");
#endif
return true;

View file

@ -499,23 +499,24 @@ namespace currency
//-----------------------------------------------------------------------------------------------
bool core::add_new_block(const block& b, block_verification_context& bvc)
{
uint64_t h = m_blockchain_storage.get_top_block_height();
if (m_stop_after_height != 0 && h >= m_stop_after_height)
{
LOG_PRINT_YELLOW("Blockchain top block height is " << h << ", the daemon will now stop as requested", LOG_LEVEL_0);
if (m_critical_error_handler)
return m_critical_error_handler->on_immediate_stop_requested();
return false;
}
bool r = m_blockchain_storage.add_new_block(b, bvc);
if (r && bvc.m_added_to_main_chain)
{
uint64_t h = get_block_height(b);
h = get_block_height(b);
auto& crc = m_blockchain_storage.get_core_runtime_config();
if (h == crc.hard_fork_01_starts_after_height + 1)
{ LOG_PRINT_GREEN("Hardfork 1 activated at height " << h, LOG_LEVEL_0); }
else if (h == crc.hard_fork_02_starts_after_height + 1)
{ LOG_PRINT_GREEN("Hardfork 2 activated at height " << h, LOG_LEVEL_0); }
if (h == m_stop_after_height)
{
LOG_PRINT_YELLOW("Reached block " << h << ", the daemon will now stop as requested", LOG_LEVEL_0);
if (m_critical_error_handler)
return m_critical_error_handler->on_immediate_stop_requested();
return false;
}
}
return r;
}

@ -1 +1 @@
Subproject commit fe224894ddab077d94741a0062500b7306834959
Subproject commit 047a4602748e0d3e40456f9d2fc2eeef1bc89b06

View file

@ -5,9 +5,9 @@
#define PROJECT_MAJOR_VERSION "1"
#define PROJECT_MINOR_VERSION "5"
#define PROJECT_REVISION "0"
#define PROJECT_REVISION "2"
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
#define PROJECT_VERSION_BUILD_NO 144
#define PROJECT_VERSION_BUILD_NO 150
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"

View file

@ -3521,6 +3521,7 @@ bool wallet2::try_mint_pos()
//------------------------------------------------------------------
bool wallet2::try_mint_pos(const currency::account_public_address& miner_address)
{
TIME_MEASURE_START_MS(mining_duration_ms);
mining_context ctx = AUTO_VAL_INIT(ctx);
WLT_LOG_L1("Starting PoS mining iteration");
fill_mining_context(ctx);
@ -3550,8 +3551,9 @@ bool wallet2::try_mint_pos(const currency::account_public_address& miner_address
{
build_minted_block(ctx.sp, ctx.rsp, miner_address);
}
TIME_MEASURE_FINISH_MS(mining_duration_ms);
WLT_LOG_L0("PoS mining: " << ctx.rsp.iterations_processed << " iterations finished, status: " << ctx.rsp.status << ", used " << ctx.sp.pos_entries.size() << " entries with total amount: " << print_money_brief(pos_entries_amount));
WLT_LOG_L0("PoS mining: " << ctx.rsp.iterations_processed << " iterations finished (" << std::fixed << std::setprecision(2) << (mining_duration_ms / 1000.0f) << "s), status: " << ctx.rsp.status << ", used " << ctx.sp.pos_entries.size() << " entries with total amount: " << print_money_brief(pos_entries_amount));
return true;
}
@ -3594,6 +3596,16 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
tmpl_req.pos_index = req.pos_entries[rsp.index].index;
tmpl_req.extra_text = m_miner_text_info;
tmpl_req.stake_unlock_time = req.pos_entries[rsp.index].stake_unlock_time;
// mark stake source as spent and make sure it will be restored in case of error
const std::vector<uint64_t> stake_transfer_idx_vec{ req.pos_entries[rsp.index].wallet_index };
mark_transfers_as_spent(stake_transfer_idx_vec, "stake source");
bool gracefull_leaving = false;
auto stake_transfer_spent_flag_restorer = epee::misc_utils::create_scope_leave_handler([&](){
if (!gracefull_leaving)
clear_transfers_from_flag(stake_transfer_idx_vec, WALLET_TRANSFER_DETAIL_FLAG_SPENT, "stake source");
});
//generate packing tx
transaction pack_tx = AUTO_VAL_INIT(pack_tx);
if (generate_packing_transaction_if_needed(pack_tx, 0))
@ -3641,7 +3653,7 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
keys_ptrs);
WLT_CHECK_AND_ASSERT_MES(res, false, "Failed to prepare_and_sign_pos_block");
WLT_LOG_GREEN("Block constructed <" << get_block_hash(b) << ">, sending to core...", LOG_LEVEL_0);
WLT_LOG_GREEN("Block " << get_block_hash(b) << " @ " << get_block_height(b) << " has been constructed, sending to core...", LOG_LEVEL_0);
currency::COMMAND_RPC_SUBMITBLOCK2::request subm_req = AUTO_VAL_INIT(subm_req);
currency::COMMAND_RPC_SUBMITBLOCK2::response subm_rsp = AUTO_VAL_INIT(subm_rsp);
@ -3658,6 +3670,7 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
WLT_LOG_GREEN("POS block generated and accepted, congrats!", LOG_LEVEL_0);
m_wcallback->on_pos_block_found(b);
gracefull_leaving = true; // to prevent source transfer flags be cleared in scope leave handler
return true;
}
//----------------------------------------------------------------------------------------------------

View file

@ -1029,6 +1029,12 @@ bool pos_minting_tx_packing::configure_core(currency::core& c, size_t ev_index,
bool pos_minting_tx_packing::pos_minting_tx_packing::generate(std::vector<test_event_entry>& events) const
{
//
// THIS TEST IS ONLY FOR PRE-ZARCANUM WALLET
// PLEASE, reject all changes made in master/release2/develop branches and use the version from cryptoassets/multiassets
// -- sowle
//
bool r = false;
m_accounts.resize(TOTAL_ACCS_COUNT);
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate();
@ -1039,12 +1045,12 @@ bool pos_minting_tx_packing::pos_minting_tx_packing::generate(std::vector<test_e
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 5);
m_alice_start_amount = 10 * CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size;// +TESTS_DEFAULT_FEE;
m_alice_start_amount = CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size;
// 10 outputs each of (CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size) coins
// m_pos_mint_packing_size outputs each of CURRENCY_BLOCK_REWARD coins
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_start_amount, m_pos_mint_packing_size, TESTS_DEFAULT_FEE, tx_1);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_1);
@ -1085,7 +1091,7 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v
m_alice_start_amount + CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size // unlocked
), false, "");
alice_wlt->set_pos_mint_packing_size(m_pos_mint_packing_size);
alice_wlt->set_pos_mint_packing_size(100);
// no coinbase tx outputs should be packed
r = alice_wlt->try_mint_pos();
@ -1096,7 +1102,7 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v
m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1), // total
true,
UINT64_MAX,
m_alice_start_amount // unlocked (one output with amount == CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size was spent as stake)
UINT64_MAX //m_alice_start_amount // unlocked (one output with amount == CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size was spent as stake)
), false, "");
r = mine_next_pow_blocks_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c, WALLET_DEFAULT_TX_SPENDABLE_AGE);
@ -1109,7 +1115,8 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v
m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) // unlocked
), false, "");
// coinbase tx outputs should be packed now, there's enough coinbase outputs (> m_pos_mint_packing_size)
// coinbase tx outputs still should NOT be packed now (it's only possible with the stake)
alice_wlt->set_pos_mint_packing_size(10);
r = alice_wlt->try_mint_pos();
CHECK_AND_ASSERT_MES(r, false, "try_mint_pos failed");
@ -1117,11 +1124,10 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v
m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 2), // total (+1 one block reward)
true,
UINT64_MAX,
// CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size locked for stake
// CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) locked for packing tx
m_alice_start_amount + CURRENCY_BLOCK_REWARD - CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) // unlocked
m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 0) // unlocked
), false, "");
alice_wlt->set_pos_mint_packing_size(8);
r = alice_wlt->try_mint_pos();
CHECK_AND_ASSERT_MES(r, false, "try_mint_pos failed");
@ -1129,8 +1135,7 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v
m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 3), // total (+1 one block reward)
true,
UINT64_MAX,
// CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size locked for stake
m_alice_start_amount + CURRENCY_BLOCK_REWARD - CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) - CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size // unlocked
0 // unlocked
), false, "");
return true;

36
utils/build_mail.py Normal file
View file

@ -0,0 +1,36 @@
import sys
import os
import smtplib
from email.message import EmailMessage
def getenv(e):
t = os.getenv(e)
if t == None:
print("Error: environment variable " + e + " was not set")
exit(1)
return t
zs_from = getenv("ZANO_SMTP_FROM")
zs_addr = getenv("ZANO_SMTP_ADDR")
zs_port = getenv("ZANO_SMTP_PORT")
zs_user = getenv("ZANO_SMTP_USER")
zs_pass = getenv("ZANO_SMTP_PASS")
if len(sys.argv) != 4:
print("Usage: " + sys.argv[0] + " <subject> <recipient(s)> <body>")
exit(1)
msg = EmailMessage()
msg['Subject'] = sys.argv[1]
msg['From'] = zs_from
msg['To'] = sys.argv[2]
msg.add_header('Content-Type','text/html')
msg.set_payload(sys.argv[3])
s = smtplib.SMTP(zs_addr, zs_port)
s.starttls()
s.login(zs_user, zs_pass)
s.send_message(msg)
s.quit()
print("e-mail sent.")

View file

@ -142,6 +142,6 @@ sha256: $checksum"
echo "$mail_msg"
echo "$mail_msg" | mail -s "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" ${emails}
python3 ../../utils/build_mail.py "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" "${emails}" "$mail_msg"
exit 0

View file

@ -154,6 +154,6 @@ sha256: $checksum"
echo "$mail_msg"
echo "$mail_msg" | mail -s "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" ${emails}
python3 ../../utils/build_mail.py "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" "${emails}" "$mail_msg"
exit 0
exit 0

View file

@ -148,13 +148,17 @@ echo "Build success"
echo "############### Uploading... ################"
package_filepath=$package_filename
package_filepath="$(pwd)/$package_filename"
scp $package_filepath zano_build_server:/var/www/html/builds/
#scp $package_filepath zano_build_server:/var/www/html/builds/
source ../../../utils/macosx_build_uploader.sh
pushd .
upload_build $package_filepath
if [ $? -ne 0 ]; then
echo "Failed to upload to remote server"
exit 1
fi
popd
read checksum <<< $( shasum -a 256 $package_filepath | awk '/^/ { print $1 }' )
@ -165,8 +169,7 @@ sha256: $checksum"
echo "$mail_msg"
echo "$mail_msg" | mail -s "Zano macOS-x64 ${build_prefix_label}${testnet_label}build $version_str" ${emails}
python3 ../../../utils/build_mail.py "Zano macOS-x64 ${build_prefix_label}${testnet_label}build $version_str" "${emails}" "$mail_msg"
######################
# notarization

View file

@ -0,0 +1,51 @@
set +e
curr_path=${BASH_SOURCE%/*}
function upload_build() # $1 - path to the file to be uploaded
{
if [ -z "$1" ]
then
echo "ERROR: upload_build is called with no or invalid parameters"
return 1
fi
# check if the directory contains files
#if [ -n "$(ls -A "$ZANO_BLD_UPL_DIR" 2>/dev/null)" ]
#then
# echo "ERROR: uploading folder contains files"
# return 1
#fi
cd "$ZANO_BLD_UPL_DIR" || return 2
rm -rf ./* || return 3
#popd || return 4
touch WAIT || return 5
cp $1 . || return 6
rm WAIT || return 7
counter=0
while [ ! -f DONE ]
do
if [ "$counter" -ge 150 ]
then
echo "ERROR: uploading is taking longer than expected"
touch STOP
return 8
fi
sleep 2
echo "waiting..."
counter=$((counter + 1))
done
rc=$(<DONE)
if [ "$rc" -eq 0 ]
then
echo "Upload successful."
return 0
fi
echo "Upload unsuccessfull, exit code = $rc."
return $rc
}