From 9d968518a3774f884b7722eabdfd131e91f679cd Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Mon, 17 Jun 2019 19:38:45 -0700 Subject: [PATCH 1/3] Do not fetch sprout params, which saves every new Hush node from needing to download over 1.5GB of stuff it will never use --- zcutil/fetch-params.bat | 16 ++------------ zcutil/fetch-params.sh | 46 ++++++++++++++++++----------------------- 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/zcutil/fetch-params.bat b/zcutil/fetch-params.bat index 8b14b1845..e2327d7e3 100644 --- a/zcutil/fetch-params.bat +++ b/zcutil/fetch-params.bat @@ -4,26 +4,14 @@ cd %THIS_DIR% IF NOT EXIST %APPDATA%\ZcashParams ( MKDIR %APPDATA%\ZcashParams ) -IF NOT EXIST %APPDATA%\ZcashParams\sprout-proving.key ( - ECHO Downloading Zcash trusted setup sprout-proving.key, this may take a while ... - .\wget64.exe --progress=dot:giga --continue --retry-connrefused --waitretry=3 --timeout=30 https://z.cash/downloads/sprout-proving.key -O %APPDATA%\ZcashParams\sprout-proving.key -) -IF NOT EXIST %APPDATA%\ZcashParams\sprout-verifying.key ( - ECHO Downloading Zcash trusted setup sprout-verifying.key, this may take a while ... - .\wget64.exe --progress=dot:giga --continue --retry-connrefused --waitretry=3 --timeout=30 https://z.cash/downloads/sprout-verifying.key -O %APPDATA%\ZcashParams\sprout-verifying.key -) IF NOT EXIST %APPDATA%\ZcashParams\sapling-spend.params ( - ECHO Downloading Zcash trusted setup sprout-proving.key, this may take a while ... + ECHO Downloading Zcash trusted setup sapling-spend.key, this may take a while ... .\wget64.exe --progress=dot:giga --continue --retry-connrefused --waitretry=3 --timeout=30 https://z.cash/downloads/sapling-spend.params -O %APPDATA%\ZcashParams\sapling-spend.params ) IF NOT EXIST %APPDATA%\ZcashParams\sapling-output.params ( - ECHO Downloading Zcash trusted setup sprout-verifying.key, this may take a while ... + ECHO Downloading Zcash trusted setup sapling-output.key, this may take a while ... .\wget64.exe --progress=dot:giga --continue --retry-connrefused --waitretry=3 --timeout=30 https://z.cash/downloads/sapling-output.params -O %APPDATA%\ZcashParams\sapling-output.params ) -IF NOT EXIST %APPDATA%\ZcashParams\sprout-groth16.params ( - ECHO Downloading Zcash trusted setup sprout-verifying.key, this may take a while ... - .\wget64.exe --progress=dot:giga --continue --retry-connrefused --waitretry=3 --timeout=30 https://z.cash/downloads/sprout-groth16.params -O %APPDATA%\ZcashParams\sprout-groth16.params -) goto :EOF :GET_CURRENT_DIR pushd %~dp0 diff --git a/zcutil/fetch-params.sh b/zcutil/fetch-params.sh index 522de8099..c9ffff278 100755 --- a/zcutil/fetch-params.sh +++ b/zcutil/fetch-params.sh @@ -1,20 +1,20 @@ #!/bin/bash +# Copyright 2019 The Hush developers set -eu +# We do not declare our own location because we can use the params +# from any other installed coins if [[ "$OSTYPE" == "darwin"* ]]; then PARAMS_DIR="$HOME/Library/Application Support/ZcashParams" else PARAMS_DIR="$HOME/.zcash-params" fi -SPROUT_PKEY_NAME='sprout-proving.key' -SPROUT_VKEY_NAME='sprout-verifying.key' SAPLING_SPEND_NAME='sapling-spend.params' SAPLING_OUTPUT_NAME='sapling-output.params' -SAPLING_SPROUT_GROTH16_NAME='sprout-groth16.params' -SPROUT_URL="https://z.cash/downloads" -SPROUT_IPFS="/ipfs/QmZKKx7Xup7LiAtFRhYsE1M7waXcv9ir9eCECyXAFGxhEo" +URL="https://z.cash/downloads" +IPFS="/ipfs/QmZKKx7Xup7LiAtFRhYsE1M7waXcv9ir9eCECyXAFGxhEo" SHA256CMD="$(command -v sha256sum || echo shasum)" SHA256ARGS="$(command -v sha256sum >/dev/null || echo '-a 256')" @@ -38,7 +38,7 @@ function fetch_wget { cat <> "$README_PATH" < Date: Tue, 18 Jun 2019 01:59:57 -0700 Subject: [PATCH 2/3] Try to lift requirement for sprout params --- src/init.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 837679009..4ba38749a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,5 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin Core developers +// Copyright (c) 2019 The Hush developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -752,15 +753,11 @@ static void ZC_LoadParams( struct timeval tv_start, tv_end; float elapsed; - boost::filesystem::path pk_path = ZC_GetParamsDir() / "sprout-proving.key"; - boost::filesystem::path vk_path = ZC_GetParamsDir() / "sprout-verifying.key"; boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params"; boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params"; boost::filesystem::path sprout_groth16 = ZC_GetParamsDir() / "sprout-groth16.params"; if (!( - boost::filesystem::exists(pk_path) && - boost::filesystem::exists(vk_path) && boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output) && boost::filesystem::exists(sprout_groth16) @@ -775,18 +772,17 @@ static void ZC_LoadParams( return; } - LogPrintf("Loading verifying key from %s\n", vk_path.string().c_str()); + //LogPrintf("Loading verifying key from %s\n", vk_path.string().c_str()); gettimeofday(&tv_start, 0); - pzcashParams = ZCJoinSplit::Prepared(vk_path.string(), pk_path.string()); + //pzcashParams = ZCJoinSplit::Prepared(vk_path.string(), pk_path.string()); gettimeofday(&tv_end, 0); elapsed = float(tv_end.tv_sec-tv_start.tv_sec) + (tv_end.tv_usec-tv_start.tv_usec)/float(1000000); LogPrintf("Loaded verifying key in %fs seconds.\n", elapsed); - static_assert( - sizeof(boost::filesystem::path::value_type) == sizeof(codeunit), - "librustzcash not configured correctly"); + static_assert( sizeof(boost::filesystem::path::value_type) == sizeof(codeunit), "librustzcash not configured correctly"); + auto sapling_spend_str = sapling_spend.native(); auto sapling_output_str = sapling_output.native(); auto sprout_groth16_str = sprout_groth16.native(); @@ -796,6 +792,7 @@ static void ZC_LoadParams( LogPrintf("Loading Sapling (Sprout Groth16) parameters from %s\n", sprout_groth16.string().c_str()); gettimeofday(&tv_start, 0); + // TODO: Unfortunately there is no way to initialize things without groth16, unless Rust code is modified. librustzcash_init_zksnark_params( reinterpret_cast(sapling_spend_str.c_str()), sapling_spend_str.length(), From 471eeaa3ff7c7a7a7519ff8da23a86e13725f191 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Tue, 18 Jun 2019 06:11:22 -0700 Subject: [PATCH 3/3] ccacctivateht fix by blackjoker --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index ecf5237e6..8fb86ef22 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1692,7 +1692,7 @@ int8_t equihash_params_possible(uint64_t n, uint64_t k) void komodo_args(char *argv0) { - std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512]; + std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512] = {0}; IS_KOMODO_NOTARY = GetBoolArg("-notary", false); IS_STAKED_NOTARY = GetArg("-stakednotary", -1); memset(ccenables,0,sizeof(ccenables)); @@ -1767,7 +1767,7 @@ void komodo_args(char *argv0) { int32_t ecode = ccEnablesHeight[i]; int32_t ht = ccEnablesHeight[i+1]; - if ( ecode > 256 ) + if ( ecode > 256 || ecode < 0 ) fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode); else if ( ht > 0 ) {