Compare commits

...
Sign in to create a new pull request.

5 commits

Author SHA1 Message Date
sowle
5dd0c13fbc
stagenet hf4 height bump 2024-03-18 21:06:02 +01:00
zano build machine
7ba7db8ea1 === build number: 700 -> 701 === 2024-03-18 22:44:29 +03:00
sowle
2fcb663b61
difficulty scaling fixed 2024-03-18 20:43:30 +01:00
sowle
ecf0d119e6
stagenet build version set 2024-03-17 00:52:57 +01:00
sowle
60a827b3cd
stagenet set up (testing HF4 @ 2550700) 2024-03-17 00:50:21 +01:00
6 changed files with 65 additions and 24 deletions

View file

@ -7,6 +7,7 @@
#include "epee/include/misc_log_ex.h"
#include "zarcanum.h"
#include "range_proofs.h"
#include "../currency_core/currency_config.h"
#include "../currency_core/crypto_config.h" // TODO: move it to the crypto
#include "../common/crypto_stream_operators.h" // TODO: move it to the crypto
@ -34,13 +35,13 @@ namespace crypto
mp::uint256_t zarcanum_precalculate_l_div_z_D(const mp::uint128_t& pos_difficulty)
{
//LOG_PRINT_GREEN_L0(ENDL << "floor( l / (z * D) ) = " << c_scalar_L.as_boost_mp_type<mp::uint256_t>() / (c_zarcanum_z_coeff_mp * pos_difficulty));
return c_scalar_L.as_boost_mp_type<mp::uint256_t>() / (c_zarcanum_z_coeff_mp * pos_difficulty); // == floor( l / (z * D) )
return c_scalar_L.as_boost_mp_type<mp::uint256_t>() / (c_zarcanum_z_coeff_mp * pos_difficulty / STAGENET_POS_DIFF_DIVISOR); // == floor( l / (z * D) )
}
mp::uint256_t zarcanum_precalculate_z_l_div_z_D(const mp::uint128_t& pos_difficulty)
{
//LOG_PRINT_GREEN_L0(ENDL << "z * floor( l / (z * D) ) = " << c_zarcanum_z_coeff_mp * (c_scalar_L.as_boost_mp_type<mp::uint256_t>() / (c_zarcanum_z_coeff_mp * pos_difficulty)));
return c_zarcanum_z_coeff_mp * (c_scalar_L.as_boost_mp_type<mp::uint256_t>() / (c_zarcanum_z_coeff_mp * pos_difficulty)); // == z * floor( l / (z * D) )
return c_zarcanum_z_coeff_mp * (c_scalar_L.as_boost_mp_type<mp::uint256_t>() / (c_zarcanum_z_coeff_mp * pos_difficulty / STAGENET_POS_DIFF_DIVISOR)); // == z * floor( l / (z * D) )
}
bool zarcanum_check_main_pos_inequality(const hash& kernel_hash, const scalar_t& blinding_mask, const scalar_t& secret_q,
@ -50,11 +51,31 @@ namespace crypto
lhs = lhs_s.as_boost_mp_type<mp::uint256_t>();
rhs = static_cast<mp::uint512_t>(z_l_div_z_D) * stake_amount; // == floor( l / (z * D) ) * z * a
//LOG_PRINT_GREEN_L0(ENDL <<
// "z_l_div_z_D = " << z_l_div_z_D << ENDL <<
// "stake_amount = " << stake_amount << ENDL <<
// "lhs = " << lhs << ENDL <<
// "rhs = " << rhs);
// estimate the stake to satisfy the equation
mp::uint256_t estimated_amount = lhs / z_l_div_z_D;
mp::uint256_t ratio = estimated_amount / stake_amount;
static mp::uint256_t min_ratio = std::numeric_limits<mp::uint256_t>::max();
static uint64_t stake_amount_for_min = 0;
static size_t count = 0;
if (min_ratio > ratio)
{
min_ratio = ratio;
stake_amount_for_min = stake_amount;
}
if (++count > 100000)
{
LOG_PRINT_GREEN("min amount satisfying staking (in coins): " << min_ratio * stake_amount_for_min / ((uint64_t)1000000000000) << ", corresp. stake: " <<
stake_amount_for_min / 1000000000000ull << ", ratio is: " << min_ratio, LOG_LEVEL_0);
count = 0;
min_ratio = std::numeric_limits<mp::uint256_t>::max();
}
//LOG_PRINT_GREEN_L0("Zarcanum check main ineq:" << ENDL <<
// " z_l_div_z_D = " << z_l_div_z_D << ENDL <<
// " stake_amount = " << stake_amount << ENDL <<
// " lhs = " << lhs << ENDL <<
// " rhs = " << rhs);
return lhs < rhs; // h * (f + q + f') mod l < floor( l / (z * D) ) * z * a
}
@ -226,6 +247,13 @@ namespace crypto
// make sure 0 < d <= l / floor(z * D)
const mp::uint256_t l_div_z_D_mp = zarcanum_precalculate_l_div_z_D(pos_difficulty);
const scalar_t l_div_z_D(l_div_z_D_mp);
if (!(sig.d < l_div_z_D))
{
LOG_PRINT_RED(ENDL <<
"D = 0x" << std::hex << pos_difficulty << ENDL <<
"sig.d = 0x" << std::hex << sig.d.as_boost_mp_type<mp::uint256_t>() << ENDL <<
"l_div_z_D = 0x" << std::hex << l_div_z_D_mp, LOG_LEVEL_0);
}
CHECK_AND_FAIL_WITH_ERROR_IF_FALSE(!sig.d.is_zero() && sig.d < l_div_z_D, 2);
const scalar_t dz = sig.d * c_zarcanum_z_coeff_s;

View file

@ -110,13 +110,14 @@
#ifndef TESTNET
#define P2P_DEFAULT_PORT 11121
#define RPC_DEFAULT_PORT 11211
#define P2P_DEFAULT_PORT 11171
#define RPC_DEFAULT_PORT 11711
#define STRATUM_DEFAULT_PORT 11777
#define P2P_NETWORK_ID_TESTNET_FLAG 0
#define P2P_NETWORK_ID_TESTNET_FLAG 7
#define P2P_MAINTAINERS_PUB_KEY "8f138bb73f6d663a3746a542770781a09579a7b84cb4125249e95530824ee607"
#define DIFFICULTY_POS_STARTER 1
#else
#else
static_assert(false, "testnet is not supported");
#define P2P_DEFAULT_PORT (11112 + CURRENCY_FORMATION_VERSION)
#define RPC_DEFAULT_PORT 12111
#define STRATUM_DEFAULT_PORT 11888
@ -190,12 +191,16 @@
#define CURRENCY_NAME_ABR "ZANO"
#define CURRENCY_NAME_BASE "Zano"
#define CURRENCY_NAME_SHORT_BASE "Zano"
#define CURRENCY_NAME_ABR "ZANO_STAGE"
#define CURRENCY_NAME_BASE "Zano_SN"
#define CURRENCY_NAME_SHORT_BASE "Zano_SN"
#define STAGENET_POW_DIFF_DIVISOR 10000000
#define STAGENET_POS_DIFF_DIVISOR 80000
#ifndef TESTNET
#define CURRENCY_NAME CURRENCY_NAME_BASE
#define CURRENCY_NAME_SHORT CURRENCY_NAME_SHORT_BASE
#define CURRENCY_NAME CURRENCY_NAME_BASE"_stagenet"
#define CURRENCY_NAME_SHORT CURRENCY_NAME_SHORT_BASE"_stagenet"
#else
#define CURRENCY_NAME CURRENCY_NAME_BASE"_testnet"
#define CURRENCY_NAME_SHORT CURRENCY_NAME_SHORT_BASE"_testnet"
@ -267,7 +272,7 @@
#define ZANO_HARDFORK_01_AFTER_HEIGHT 194624 // 2019-09-21 20:25:16
#define ZANO_HARDFORK_02_AFTER_HEIGHT 999999 // 2021-04-05 09:11:45
#define ZANO_HARDFORK_03_AFTER_HEIGHT 1082577 // 2021-06-01 23:28:10
#define ZANO_HARDFORK_04_AFTER_HEIGHT 2555000 // 2024-03-21 10:16:46 (expected)
#define ZANO_HARDFORK_04_AFTER_HEIGHT 2551400
#else
/////// Zarcanum Testnet //////////////////////////////
#define ZANO_HARDFORK_01_AFTER_HEIGHT 0

View file

@ -68,6 +68,8 @@ namespace currency {
bool check_hash(const crypto::hash &hash_, wide_difficulty_type difficulty)
{
difficulty = difficulty / STAGENET_POW_DIFF_DIVISOR;
//revert byte order
crypto::hash h = {};
for (size_t i = 0; i != sizeof(h); i++)

View file

@ -314,12 +314,12 @@ namespace nodetool
//ADD_HARDCODED_SEED_NODE(std::string("0.0.0.0:") + std::to_string(P2P_DEFAULT_PORT));
ADD_HARDCODED_SEED_NODE("95.217.43.225", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("94.130.137.230", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("94.130.160.115", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("195.201.107.230", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("95.217.46.49", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("159.69.76.144", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("144.76.183.143", P2P_DEFAULT_PORT);
//ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT);
//ADD_HARDCODED_SEED_NODE("94.130.160.115", P2P_DEFAULT_PORT);
//ADD_HARDCODED_SEED_NODE("195.201.107.230", P2P_DEFAULT_PORT);
//ADD_HARDCODED_SEED_NODE("95.217.46.49", P2P_DEFAULT_PORT);
//ADD_HARDCODED_SEED_NODE("159.69.76.144", P2P_DEFAULT_PORT);
//ADD_HARDCODED_SEED_NODE("144.76.183.143", P2P_DEFAULT_PORT);
#else
// TESTNET
ADD_HARDCODED_SEED_NODE("95.217.43.225", P2P_DEFAULT_PORT);

View file

@ -8,6 +8,6 @@
#define PROJECT_REVISION "0"
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
#define PROJECT_VERSION_BUILD_NO 272
#define PROJECT_VERSION_BUILD_NO 701
#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

@ -4450,6 +4450,12 @@ bool wallet2::prepare_and_sign_pos_block(const mining_context& cxt, uint64_t ful
static_cast<crypto::zarcanum_proof&>(sig), &err);
WLT_CHECK_AND_ASSERT_MES(r, false, "zarcanum_generate_proof failed, err: " << (int)err);
LOG_PRINT_GREEN("WLT: Zarcanum proof generated: " << ENDL <<
" D = 0x" << std::hex << cxt.basic_diff << ENDL <<
" sig.d = 0x" << sig.d.to_string_as_hex_number() << ENDL <<
" floor(l / (z * D)) = 0x" << std::hex << cxt.z_l_div_z_D / crypto::c_zarcanum_z_coeff_mp << ENDL
, LOG_LEVEL_0);
//
// The miner tx prefix should be sealed by now, and the tx hash should be defined.
// Any changes made below should only affect the signatures/proofs and should not impact the prefix hash calculation.