Skip to content

Commit

Permalink
Merge pull request #164 from ZencashOfficial/development
Browse files Browse the repository at this point in the history
* Update zeromq dependency fixing [CVE-2019-6250](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-6250)
* Fix libsodium fall-back dl-path
* `-blockmaxcomplexity` switch, limit transactions to be included into blocks based on block complexity. Block complexity is the sum of transaction complexity per block. Transaction complexity is the number of inputs of a transaction squared. Like -mempooltxinputlimit this switch is intended as a last resort when unable to build blocks fast enough because of poor GBT performance. 0  or negative values means no limit is applied. (default: 0)
* `-deprecatedgetblocktemplate` switch, disable block complexity calculation and use the previous GetBlockTemplate implementation.
* `getblockfinalityindex` RPC method, display contextual confidence value of needed confirmations for block to be considered final, taking into account possible parallel penalized chains
* `getglobaltips` utility RPC method, display known chaintips including possible parallel penalized chains
* Additions to the 51% attack prevention implementation adjusting block propagation of penalized chains
* Multiple test cases added for all new features
* Backport of zcash/zcash#3897, fixes security issue https://z.cash/support/security/announcements/security-announcement-2019-03-19/ reported to Zcash by Alexis Enston, thanks to the original reporter and the Zcash team for notifying us about the issue!
* Updates to documentation addressing DNS rebinding attacks with ZMQ/AMQP, Zcash PR zcash/zcash#3890, credit to @zebambam.
* New mainnet and testnet checkpoint blocks
* Aria2 added to fetch-params.sh DL methods, wget resume support more robust
  • Loading branch information
cronicc committed Apr 8, 2019
2 parents 4ba3514 + 8c400a9 commit 9f8b010
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
Zen 2.0.17-rc1
Zen 2.0.17
==============

What is Horizen?
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 2)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 17)
define(_CLIENT_VERSION_BUILD, 25)
define(_CLIENT_VERSION_BUILD, 51)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
define(_CLIENT_VERSION_IS_RELEASE, true)
Expand Down
18 changes: 10 additions & 8 deletions src/chainparams.cpp
Expand Up @@ -141,11 +141,12 @@ class CMainParams : public CChainParams {
( 110000, uint256S("0x000000003f5d6ba1385c6cd2d4f836dfc5adf7f98834309ad67e26faef462454"))
( 139200, uint256S("0x00000001ea53c09a45e3f097ba8f48a4c117b5b368031c4eb2fa02cb5a84c99e"))
( 294072, uint256S("0x000000005f9ceecc87d9e5eaab2cf548c787231829ad6f609975fadd10fff5be"))
( 429014, uint256S("0x000000000dc4f58375d9fa6dc4cb1bfc4b0afefbf4f7e1ee2cc755d6ca3b40b0")),
1544750778, // * UNIX timestamp of last checkpoint block
5295731, // * total number of transactions between genesis and last checkpoint
( 429014, uint256S("0x000000000dc4f58375d9fa6dc4cb1bfc4b0afefbf4f7e1ee2cc755d6ca3b40b0"))
( 491000, uint256S("0x0000000018d0b189de58bcd8ff5048d2e4d1c652b98912ff002c8f07c6f81b8c")),
1554121784, // * UNIX timestamp of last checkpoint block
7527208, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
7110 // * estimated number of transactions per day after checkpoint
8834 // * estimated number of transactions per day after checkpoint
// total number of tx / (checkpoint block height / (24 * 24))
};

Expand Down Expand Up @@ -229,11 +230,12 @@ class CTestNetParams : public CMainParams {
boost::assign::map_list_of
(0, consensus.hashGenesisBlock)
(38000, uint256S("0x001e9a2d2e2892b88e9998cf7b079b41d59dd085423a921fe8386cecc42287b8"))
(362210, uint256S("0x00023d5c074a7c2ccf130dac34b2b6f77e3c4466cfed0b72c3f3715157c92949")),
1544778326, // * UNIX timestamp of last checkpoint block
742245, // * total number of transactions between genesis and last checkpoint
(362210, uint256S("0x00023d5c074a7c2ccf130dac34b2b6f77e3c4466cfed0b72c3f3715157c92949"))
(423000, uint256S("0x000d04b28067fe99445961f795ee7436f1dbbffc3a045f6890868e605209d170")),
1554139343, // * UNIX timestamp of last checkpoint block
879571, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
1180 // total number of tx / (checkpoint block height / (24 * 24))
1198 // total number of tx / (checkpoint block height / (24 * 24))
};

// commented out - seems to make no sense but kept around for reference just in case
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Expand Up @@ -35,7 +35,7 @@
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 17
#define CLIENT_VERSION_BUILD 25
#define CLIENT_VERSION_BUILD 51

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
4 changes: 2 additions & 2 deletions src/deprecation.h
Expand Up @@ -5,8 +5,8 @@
#ifndef ZCASH_DEPRECATION_H
#define ZCASH_DEPRECATION_H

static const int APPROX_RELEASE_HEIGHT = 440700;
static const int WEEKS_UNTIL_DEPRECATION = 16;
static const int APPROX_RELEASE_HEIGHT = 495075;
static const int WEEKS_UNTIL_DEPRECATION = 15;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 24 * 24);

// Number of blocks before deprecation to warn users
Expand Down
22 changes: 11 additions & 11 deletions src/gtest/test_relayforks.cpp
Expand Up @@ -171,19 +171,19 @@ TEST(relayforks_test, relayforks) {

std::cout << "Building main chain..." << std::endl;
const CBlockIndex* fm = makeMain(TRUNK_01_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from main chain..." << std::endl;
const CBlockIndex* f1 = makeFork(FORK_01_POS, TRUNK_02_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from main chain again..." << std::endl;
const CBlockIndex* f2 = makeFork(FORK_02_POS, TRUNK_03_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from latest fork..." << std::endl;
const CBlockIndex* f3 = makeFork(FORK_03_POS, TRUNK_04_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from first fork..." << std::endl;
const CBlockIndex* f4 = makeFork(FORK_04_POS, TRUNK_05_SZ);
Expand Down Expand Up @@ -225,20 +225,20 @@ TEST(relayforks_test, relayforks) {
ASSERT_EQ ( vOutput[2], f2->GetBlockHash() );

// 3. update the time of the tip on f1 and check it is the most recent now
sleep(2);
MilliSleep(2000);
ASSERT_EQ( updateGlobalForkTips(f1, false), true);
vOutput.clear();
ASSERT_EQ ( getMostRecentGlobalForkTips(vOutput), 3);
ASSERT_EQ ( vOutput[0], f1->GetBlockHash() );

// 4. take a block on the main chain, updating the concerned tip should fail
sleep(2);
MilliSleep(2000);
const CBlockIndex* dum1 = vBlocks[FORK_01_POS + 1];
ASSERT_EQ( updateGlobalForkTips(dum1, true), false);

// 5. take a block on a fork placed behind a crossroads: updating of both its tips should
// be succesful and they would be on top of ordered vector
sleep(2);
MilliSleep(2000);
const CBlockIndex* dum2 = vBlocks[FORK_04_POS - 1];
ASSERT_EQ( updateGlobalForkTips(dum2, true), true);

Expand Down Expand Up @@ -267,19 +267,19 @@ TEST(relayforks_test, checkisonmain) {

std::cout << "Building main chain..." << std::endl;
const CBlockIndex* fm = makeMain(TRUNK_01_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from main chain..." << std::endl;
const CBlockIndex* f1 = makeFork(FORK_01_POS, TRUNK_02_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from main chain again..." << std::endl;
const CBlockIndex* f2 = makeFork(FORK_02_POS, TRUNK_03_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from latest fork..." << std::endl;
const CBlockIndex* f3 = makeFork(FORK_03_POS, TRUNK_04_SZ);
sleep(2);
MilliSleep(2000);

std::cout << "Forking from first fork..." << std::endl;
const CBlockIndex* f4 = makeFork(FORK_04_POS, TRUNK_05_SZ);
Expand Down
61 changes: 57 additions & 4 deletions zcutil/fetch-params.sh
Expand Up @@ -19,15 +19,59 @@ SPROUT_IPFS="/ipfs/QmZKKx7Xup7LiAtFRhYsE1M7waXcv9ir9eCECyXAFGxhEo"
SHA256CMD="$(command -v sha256sum || echo shasum)"
SHA256ARGS="$(command -v sha256sum >/dev/null || echo '-a 256')"

ARIA2CMD="$(command -v aria2c || echo '')"
WGETCMD="$(command -v wget || echo '')"
IPFSCMD="$(command -v ipfs || echo '')"
CURLCMD="$(command -v curl || echo '')"

# fetch methods can be disabled with ZC_DISABLE_SOMETHING=1
ZC_DISABLE_ARIA2="${ZC_DISABLE_ARIA2:-}"
ZC_DISABLE_WGET="${ZC_DISABLE_WGET:-}"
ZC_DISABLE_IPFS="${ZC_DISABLE_IPFS:-}"
ZC_DISABLE_CURL="${ZC_DISABLE_CURL:-}"

function fetch_aria2 {
if [ -z "$ARIA2CMD" ] || ! [ -z "$ZC_DISABLE_ARIA2" ]; then
return 1
fi

local filename="$1"
local dlname="$(basename $2)"

cat <<EOF
Retrieving (aria2): $SPROUT_URL/$filename
EOF

aria2c \
--out="$dlname" \
--continue=true \
--max-tries=3 \
--retry-wait=2 \
--split=16 \
--max-connection-per-server=16 \
--timeout=90 \
--auto-save-interval=5 \
--always-resume=false \
--allow-overwrite=true \
--download-result=full \
--summary-interval=10 \
"$SPROUT_URL/$filename" || \
{ echo -e "\n\nResume failed, downloading $filename from scratch.\n\n" \
&& aria2c \
--out="$dlname" \
--continue=false \
--remove-control-file=true \
--max-tries=3 \
--timeout=30 \
--always-resume=false \
--allow-overwrite=true \
--download-result=full \
--summary-interval=10 \
"$SPROUT_URL/$filename"
}
}

function fetch_wget {
if [ -z "$WGETCMD" ] || ! [ -z "$ZC_DISABLE_WGET" ]; then
return 1
Expand All @@ -44,9 +88,17 @@ EOF
wget \
--progress=dot:giga \
--output-document="$dlname" \
--continue \
--retry-connrefused --waitretry=3 --timeout=30 \
"$SPROUT_URL/$filename"
--continue --tries=3 \
--retry-connrefused --waitretry=3 --timeout=90 \
"$SPROUT_URL/$filename" || \
{ echo -e "\n\nResume failed, downloading $filename from scratch.\n\n" \
&& wget \
--progress=dot:giga \
--output-document="$dlname" \
--tries=3 \
--retry-connrefused --waitretry=3 --timeout=30 \
"$SPROUT_URL/$filename"
}
}

function fetch_ipfs {
Expand Down Expand Up @@ -91,6 +143,7 @@ function fetch_failure {
Failed to fetch the Zcash zkSNARK parameters!
Try installing one of the following programs and make sure you're online:
* aria2
* ipfs
* wget
* curl
Expand All @@ -107,7 +160,7 @@ function fetch_params {

if ! [ -f "$output" ]
then
for method in wget ipfs curl failure; do
for method in aria2 wget ipfs curl failure; do
if "fetch_$method" "$filename" "$dlname"; then
echo "Download successful!"
break
Expand Down

0 comments on commit 9f8b010

Please sign in to comment.