Commit Graph

41 Commits

Author SHA1 Message Date
Kris Nuttycombe 3cec519ce4 scripted-diff: Update Zcash copyrights to 2023
-BEGIN VERIFY SCRIPT-
for party in "The Zcash developers" "The Bitcoin Core developers" "Bitcoin Developers"; do
  sed -i"" -e "s#Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? $party#Copyright (c) \1-2023 $party#" COPYING
  sed -i"" -e "s#\(.*\)\([0-9]\{4\}\)\(-[0-9]\{4\}\)\, $party#\1\2-2023, $party#" contrib/debian/copyright
done

sed -i"" -e "s/define(_COPYRIGHT_YEAR, [0-9]\{4\})/define(_COPYRIGHT_YEAR, 2023)/" configure.ac
sed -i"" -e "s/#define COPYRIGHT_YEAR [0-9]\{4\}/#define COPYRIGHT_YEAR 2023/" src/clientversion.h

git grep "^// Copyright (c) .* The Zcash developers" \
  | awk -F ':' '{print $1}' \
  | xargs -I {} sed -i"" -e "s#// Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? The Zcash developers#// Copyright (c) \1-2023 The Zcash developers#" {}
-END VERIFY SCRIPT-
2023-01-23 11:31:54 -07:00
Jim Posen 9a7e2c153d scripted-diff: Move util files to separate directory.
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp

sed -i -e 's/"util\.h"/"util\/system\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
git checkout HEAD -- src/secp256k1 # exclude secp256k1, which has its own "util.h"
sed -i -e 's/"utilmoneystr\.h"/"util\/moneystr\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utilstrencodings\.h"/"util\/strencodings\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utiltime\.h"/"util\/time\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i -e 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i -e 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i -e 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i -e 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i -e 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i -e 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i -e 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i -e 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i -e 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
-END VERIFY SCRIPT-
2022-07-01 17:50:09 -06:00
Jack Grigg df08281f25 Migrate BLAKE2b Rust FFI to `cxx` 2022-05-27 20:15:05 +00:00
Kris Nuttycombe 5ae1772d2b scripted-diff: Update Zcash copyrights to 2022
-BEGIN VERIFY SCRIPT-
git grep "// Copyright (c) .* The Zcash developers" \
  | awk -F ':' '{print $1}' \
  | xargs -I {} sed -i"" -e "s#// Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? The Zcash developers#// Copyright (c) \1-2022 The Zcash developers#" {}
-END VERIFY SCRIPT-
2022-05-11 16:47:12 -06:00
Jack Grigg 6b63fdd657 lint: s/trim/lenTrim in src/crypto/equihash.[cpp,h]
Fixes a false positive match to the locale-dependent trim function.
2020-11-09 23:06:21 +00:00
Jack Grigg d0a5343da9 lint: Fix missing or inconsistent include guards 2020-11-09 23:06:21 +00:00
Jack Grigg d476537d86 scripted-diff: Remove BOOST_STATIC_ASSERT
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_STATIC_ASSERT(/static_assert(/' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include <boost\/static_assert.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2020-10-27 10:44:58 +00:00
Jack Grigg 2d172e121f Replace libsodium's crypto_generichash_blake2b with blake2b_simd 2020-09-24 15:58:14 +01:00
Daira Hopwood 40b9cbf0b1 Allow Equihash validation tests to be compiled with --disable-mining.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-07-25 16:33:02 +01:00
Daira Hopwood c99a00596f Fix --disable-mining build regression. closes #4634
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-07-25 15:41:39 +01:00
Jack Grigg 96920e952d Remove C++ Equihash validator 2020-07-15 14:03:45 +12:00
Taylor Hornby 08662fa09a Add missing <stdexcept> header for std::invalid_argument 2020-05-24 16:49:13 -06:00
Homu 599ebb9686 Auto merge of #3742 - defuse:pow-security-improvements, r=str4d
Equihash Macro and Testing Improvements
2020-01-24 20:52:30 +00:00
Daira Hopwood bc909a7a7f Replace http with https: in links to the MIT license.
Also change MIT/X11 to just MIT, since no distinction was intended.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-18 15:26:01 +01:00
Taylor Hornby 288e72d643 Add test for unused bits in the Equihash solution encoding. 2019-01-23 10:01:54 -07:00
Taylor Hornby fd50cbd089 Make the equihash validator macro set its output to false when throwing an exception. 2019-01-23 10:01:54 -07:00
Jack Grigg 2cc0a252ad
Add compile flag to disable compilation of mining code 2017-01-30 21:14:46 +01:00
Daira Hopwood c6a7e897bc Add mostly-static checks on consistency of Equihash parameters, MAX_HEADERS_RESULTS, and MAX_PROTOCOL_MESSAGE_LENGTH.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-08-24 06:13:06 +01:00
Jack Grigg 5be6abbf84 Store the Equihash solution in minimal representation in the block header
The genesis blocks and miner tests have been regenerated, because changing the
block header serialisation format changes the block hash, and thus validity.

The Equihash solutions have been removed from the bloom test inputs for
simplicity (block validity is not checked there; only a valid serialisation is
necessary).
2016-08-16 16:02:39 +12:00
Jack Grigg 20abe2083c Extend byte array expansion and compression methods with optional padding 2016-08-16 11:02:04 +12:00
Jack Grigg caa0348f04 Update Equihash hash generation to match the Zcash spec
Changes:

- floor(512/n)*n/8 bytes of BLAKE2b output is split between floor(512/n)
  adjacent indices, instead of using one hash call per index.

- Parameters with n/(k+1) mod 8 != 0 will expand the BLAKE2b output to byte
  boundaries for colliding, instead of using a longer output and clearing bits.

- The genesis blocks have been regenerated.

- The test vectors have been regenerated.

- The Equihash inputs for the cancellation tests were modified to ensure that
  valid solutions were available to exercise the full solver.
2016-08-16 11:02:04 +12:00
Jack Grigg 881ffbfc87 Add methods for byte array expansion and compression
These methods convert between:

- A byte array of length NL/8, and
- An array of N blocks of ceil(L/8) bytes.
2016-08-16 11:02:00 +12:00
Jack Grigg eeb4177843 Add Equihash support for n = 200, k = 9
Closes #1177
2016-08-06 10:33:14 +12:00
Jack Grigg 036dcbd94a Remove the assumption that n/(k+1) is a multiple of 8.
This version works, but generates the initial rows in a way that is not what we
want to specify. See #1175 for resolving this.

Co-author: Daira Hopwood <daira@jacaranda.org>
2016-08-06 02:40:07 +12:00
Jack Grigg 51eb5273f5 Equihash: Pass each obtained solution to a callback for immediate checking
Closes #1143
2016-07-27 19:15:49 +12:00
Jack Grigg 215b9e139d Use std::shared_ptr to deallocate partialSolns automatically 2016-07-23 00:31:47 +12:00
Jack Grigg 1655db285d Move initialisations to simplify cancelled checks 2016-07-22 23:54:14 +12:00
Jack Grigg 5b4ebcd5e2 Add tests that exercise the cancellation code branches 2016-07-21 16:39:32 +12:00
Jack Grigg 2dbabb1159 Make Equihash solvers cancellable
The miner only cancels the solver when chainActive.Tip() changes.

Closes #1055
2016-07-20 19:17:02 +12:00
Jack Grigg d07cf62991 Speed up FullStepRow index comparison by leveraging big-endian byte layout 2016-06-11 16:28:57 +12:00
Jack Grigg ae37d2a4cd Increase Equihash parameters to n = 96, k = 3 (about 430 MiB)
Includes a tweak to set the fixed-width of the rows based on whether the first
or last round is widest. This is necessary for some parameters, these ones
included.
2016-06-11 12:15:25 +12:00
Jack Grigg 447444ae7a Fix nits after review 2016-06-01 23:15:04 +12:00
Jack Grigg d4d76536a5 Use fixed-width array for storing hash and indices 2016-05-24 23:16:53 +12:00
Jack Grigg 29d9986c83 Store full indices in the same char* as the hash 2016-05-24 23:16:52 +12:00
Jack Grigg 639c40047f Use comparator object for sorting StepRows 2016-05-24 23:16:52 +12:00
Jack Grigg a683cc85d9 Merge *StepRow XOR and trimming operations 2016-05-24 23:16:52 +12:00
Jack Grigg e95747288a Use template parameters to statically initialise Equihash 2016-05-24 23:16:50 +12:00
Jack Grigg 39f5cb35f9 Store truncated indices in the same char* as the hash (H/T tromp for the idea!) 2016-05-24 12:02:46 +12:00
Jack Grigg c92c1f6050 Implement index-truncation Equihash optimisation 2016-05-24 12:02:46 +12:00
Jack Grigg a3361e778b Refactor StepRow to make optimisation easier 2016-05-24 12:02:08 +12:00
Jack Grigg 6d25662f25 Implement validator and basic solver for Equihash 2016-04-08 13:56:00 +12:00