mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
Merge pull request #4235 from PastaPastaPasta/backport-triv-pr7
backport: 'trivial' pr7
This commit is contained in:
commit
08558d67ee
26
.cirrus.yml
Normal file
26
.cirrus.yml
Normal file
@ -0,0 +1,26 @@
|
||||
task:
|
||||
name: "FreeBsd 12.0 amd64 [GOAL: install] [no depends, only system libs]"
|
||||
freebsd_instance:
|
||||
image: freebsd-12-0-release-amd64
|
||||
ccache_cache:
|
||||
folder: "/tmp/ccache_dir"
|
||||
env:
|
||||
MAKEJOBS: "-j3"
|
||||
CONFIGURE_OPTS: "--disable-dependency-tracking"
|
||||
GOAL: "install"
|
||||
CCACHE_SIZE: "200M"
|
||||
CCACHE_COMPRESS: 1
|
||||
CCACHE_DIR: "/tmp/ccache_dir"
|
||||
install_script:
|
||||
- pkg install -y autoconf automake boost-libs git gmake libevent libtool openssl pkgconf python3 ccache
|
||||
- ./contrib/install_db4.sh $(pwd)
|
||||
- ccache --max-size=${CCACHE_SIZE}
|
||||
configure_script:
|
||||
- ./autogen.sh
|
||||
- ./configure ${CONFIGURE_OPTS} BDB_LIBS="-L$(pwd)/db4/lib -ldb_cxx-4.8" BDB_CFLAGS="-I$(pwd)/db4/include" || ( cat config.log && false)
|
||||
make_script:
|
||||
- gmake ${MAKEJOBS} ${GOAL} || ( echo "Build failure. Verbose build follows." && gmake ${GOAL} V=1 ; false )
|
||||
check_script:
|
||||
- gmake check ${MAKEJOBS} VERBOSE=1
|
||||
functional_test_script:
|
||||
- ./test/functional/test_runner.py --ci --combinedlogslen=1000 --quiet --failfast
|
261
.style.yapf
Normal file
261
.style.yapf
Normal file
@ -0,0 +1,261 @@
|
||||
[style]
|
||||
# Align closing bracket with visual indentation.
|
||||
align_closing_bracket_with_visual_indent=True
|
||||
|
||||
# Allow dictionary keys to exist on multiple lines. For example:
|
||||
#
|
||||
# x = {
|
||||
# ('this is the first element of a tuple',
|
||||
# 'this is the second element of a tuple'):
|
||||
# value,
|
||||
# }
|
||||
allow_multiline_dictionary_keys=False
|
||||
|
||||
# Allow lambdas to be formatted on more than one line.
|
||||
allow_multiline_lambdas=False
|
||||
|
||||
# Allow splits before the dictionary value.
|
||||
allow_split_before_dict_value=True
|
||||
|
||||
# Number of blank lines surrounding top-level function and class
|
||||
# definitions.
|
||||
blank_lines_around_top_level_definition=2
|
||||
|
||||
# Insert a blank line before a class-level docstring.
|
||||
blank_line_before_class_docstring=False
|
||||
|
||||
# Insert a blank line before a module docstring.
|
||||
blank_line_before_module_docstring=False
|
||||
|
||||
# Insert a blank line before a 'def' or 'class' immediately nested
|
||||
# within another 'def' or 'class'. For example:
|
||||
#
|
||||
# class Foo:
|
||||
# # <------ this blank line
|
||||
# def method():
|
||||
# ...
|
||||
blank_line_before_nested_class_or_def=False
|
||||
|
||||
# Do not split consecutive brackets. Only relevant when
|
||||
# dedent_closing_brackets is set. For example:
|
||||
#
|
||||
# call_func_that_takes_a_dict(
|
||||
# {
|
||||
# 'key1': 'value1',
|
||||
# 'key2': 'value2',
|
||||
# }
|
||||
# )
|
||||
#
|
||||
# would reformat to:
|
||||
#
|
||||
# call_func_that_takes_a_dict({
|
||||
# 'key1': 'value1',
|
||||
# 'key2': 'value2',
|
||||
# })
|
||||
coalesce_brackets=False
|
||||
|
||||
# The column limit.
|
||||
column_limit=160
|
||||
|
||||
# The style for continuation alignment. Possible values are:
|
||||
#
|
||||
# - SPACE: Use spaces for continuation alignment. This is default behavior.
|
||||
# - FIXED: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns
|
||||
# (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs) for continuation
|
||||
# alignment.
|
||||
# - LESS: Slightly left if cannot vertically align continuation lines with
|
||||
# indent characters.
|
||||
# - VALIGN-RIGHT: Vertically align continuation lines with indent
|
||||
# characters. Slightly right (one more indent character) if cannot
|
||||
# vertically align continuation lines with indent characters.
|
||||
#
|
||||
# For options FIXED, and VALIGN-RIGHT are only available when USE_TABS is
|
||||
# enabled.
|
||||
continuation_align_style=SPACE
|
||||
|
||||
# Indent width used for line continuations.
|
||||
continuation_indent_width=4
|
||||
|
||||
# Put closing brackets on a separate line, dedented, if the bracketed
|
||||
# expression can't fit in a single line. Applies to all kinds of brackets,
|
||||
# including function definitions and calls. For example:
|
||||
#
|
||||
# config = {
|
||||
# 'key1': 'value1',
|
||||
# 'key2': 'value2',
|
||||
# } # <--- this bracket is dedented and on a separate line
|
||||
#
|
||||
# time_series = self.remote_client.query_entity_counters(
|
||||
# entity='dev3246.region1',
|
||||
# key='dns.query_latency_tcp',
|
||||
# transform=Transformation.AVERAGE(window=timedelta(seconds=60)),
|
||||
# start_ts=now()-timedelta(days=3),
|
||||
# end_ts=now(),
|
||||
# ) # <--- this bracket is dedented and on a separate line
|
||||
dedent_closing_brackets=False
|
||||
|
||||
# Disable the heuristic which places each list element on a separate line
|
||||
# if the list is comma-terminated.
|
||||
disable_ending_comma_heuristic=False
|
||||
|
||||
# Place each dictionary entry onto its own line.
|
||||
each_dict_entry_on_separate_line=True
|
||||
|
||||
# The regex for an i18n comment. The presence of this comment stops
|
||||
# reformatting of that line, because the comments are required to be
|
||||
# next to the string they translate.
|
||||
i18n_comment=
|
||||
|
||||
# The i18n function call names. The presence of this function stops
|
||||
# reformattting on that line, because the string it has cannot be moved
|
||||
# away from the i18n comment.
|
||||
i18n_function_call=
|
||||
|
||||
# Indent the dictionary value if it cannot fit on the same line as the
|
||||
# dictionary key. For example:
|
||||
#
|
||||
# config = {
|
||||
# 'key1':
|
||||
# 'value1',
|
||||
# 'key2': value1 +
|
||||
# value2,
|
||||
# }
|
||||
indent_dictionary_value=False
|
||||
|
||||
# The number of columns to use for indentation.
|
||||
indent_width=4
|
||||
|
||||
# Join short lines into one line. E.g., single line 'if' statements.
|
||||
join_multiple_lines=True
|
||||
|
||||
# Do not include spaces around selected binary operators. For example:
|
||||
#
|
||||
# 1 + 2 * 3 - 4 / 5
|
||||
#
|
||||
# will be formatted as follows when configured with "*,/":
|
||||
#
|
||||
# 1 + 2*3 - 4/5
|
||||
#
|
||||
no_spaces_around_selected_binary_operators=
|
||||
|
||||
# Use spaces around default or named assigns.
|
||||
spaces_around_default_or_named_assign=False
|
||||
|
||||
# Use spaces around the power operator.
|
||||
spaces_around_power_operator=False
|
||||
|
||||
# The number of spaces required before a trailing comment.
|
||||
spaces_before_comment=2
|
||||
|
||||
# Insert a space between the ending comma and closing bracket of a list,
|
||||
# etc.
|
||||
space_between_ending_comma_and_closing_bracket=True
|
||||
|
||||
# Split before arguments
|
||||
split_all_comma_separated_values=False
|
||||
|
||||
# Split before arguments if the argument list is terminated by a
|
||||
# comma.
|
||||
split_arguments_when_comma_terminated=False
|
||||
|
||||
# Set to True to prefer splitting before '&', '|' or '^' rather than
|
||||
# after.
|
||||
split_before_bitwise_operator=True
|
||||
|
||||
# Split before the closing bracket if a list or dict literal doesn't fit on
|
||||
# a single line.
|
||||
split_before_closing_bracket=True
|
||||
|
||||
# Split before a dictionary or set generator (comp_for). For example, note
|
||||
# the split before the 'for':
|
||||
#
|
||||
# foo = {
|
||||
# variable: 'Hello world, have a nice day!'
|
||||
# for variable in bar if variable != 42
|
||||
# }
|
||||
split_before_dict_set_generator=True
|
||||
|
||||
# Split before the '.' if we need to split a longer expression:
|
||||
#
|
||||
# foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d))
|
||||
#
|
||||
# would reformat to something like:
|
||||
#
|
||||
# foo = ('This is a really long string: {}, {}, {}, {}'
|
||||
# .format(a, b, c, d))
|
||||
split_before_dot=False
|
||||
|
||||
# Split after the opening paren which surrounds an expression if it doesn't
|
||||
# fit on a single line.
|
||||
split_before_expression_after_opening_paren=False
|
||||
|
||||
# If an argument / parameter list is going to be split, then split before
|
||||
# the first argument.
|
||||
split_before_first_argument=False
|
||||
|
||||
# Set to True to prefer splitting before 'and' or 'or' rather than
|
||||
# after.
|
||||
split_before_logical_operator=True
|
||||
|
||||
# Split named assignments onto individual lines.
|
||||
split_before_named_assigns=True
|
||||
|
||||
# Set to True to split list comprehensions and generators that have
|
||||
# non-trivial expressions and multiple clauses before each of these
|
||||
# clauses. For example:
|
||||
#
|
||||
# result = [
|
||||
# a_long_var + 100 for a_long_var in xrange(1000)
|
||||
# if a_long_var % 10]
|
||||
#
|
||||
# would reformat to something like:
|
||||
#
|
||||
# result = [
|
||||
# a_long_var + 100
|
||||
# for a_long_var in xrange(1000)
|
||||
# if a_long_var % 10]
|
||||
split_complex_comprehension=False
|
||||
|
||||
# The penalty for splitting right after the opening bracket.
|
||||
split_penalty_after_opening_bracket=30
|
||||
|
||||
# The penalty for splitting the line after a unary operator.
|
||||
split_penalty_after_unary_operator=10000
|
||||
|
||||
# The penalty for splitting right before an if expression.
|
||||
split_penalty_before_if_expr=0
|
||||
|
||||
# The penalty of splitting the line around the '&', '|', and '^'
|
||||
# operators.
|
||||
split_penalty_bitwise_operator=300
|
||||
|
||||
# The penalty for splitting a list comprehension or generator
|
||||
# expression.
|
||||
split_penalty_comprehension=80
|
||||
|
||||
# The penalty for characters over the column limit.
|
||||
split_penalty_excess_character=7000
|
||||
|
||||
# The penalty incurred by adding a line split to the unwrapped line. The
|
||||
# more line splits added the higher the penalty.
|
||||
split_penalty_for_added_line_split=30
|
||||
|
||||
# The penalty of splitting a list of "import as" names. For example:
|
||||
#
|
||||
# from a_very_long_or_indented_module_name_yada_yad import (long_argument_1,
|
||||
# long_argument_2,
|
||||
# long_argument_3)
|
||||
#
|
||||
# would reformat to something like:
|
||||
#
|
||||
# from a_very_long_or_indented_module_name_yada_yad import (
|
||||
# long_argument_1, long_argument_2, long_argument_3)
|
||||
split_penalty_import_names=0
|
||||
|
||||
# The penalty of splitting the line around the 'and' and 'or'
|
||||
# operators.
|
||||
split_penalty_logical_operator=300
|
||||
|
||||
# Use the Tab character for indentation.
|
||||
use_tabs=False
|
||||
|
@ -43,7 +43,7 @@ Commit messages should be verbose by default consisting of a short subject line
|
||||
paragraph(s), unless the title alone is self-explanatory (like "Corrected typo
|
||||
in init.cpp") in which case a single title line is sufficient. Commit messages should be
|
||||
helpful to people reading your code in the future, so explain the reasoning for
|
||||
your decisions. Further explanation [here](http://chris.beams.io/posts/git-commit/).
|
||||
your decisions. Further explanation [here](https://chris.beams.io/posts/git-commit/).
|
||||
|
||||
If a particular commit references another issue, please add the reference. For
|
||||
example: `refs #1234` or `fixes #4321`. Using the `fixes` or `closes` keywords
|
||||
@ -193,6 +193,7 @@ In general, all pull requests must:
|
||||
- Not break the existing test suite;
|
||||
- Where bugs are fixed, where possible, there should be unit tests
|
||||
demonstrating the bug and also proving the fix. This helps prevent regression.
|
||||
- Change relevant comments and documentation when behaviour of code changes.
|
||||
|
||||
Patches that change Dash consensus rules are considerably more involved than
|
||||
normal because they affect the entire ecosystem and so must be preceded by
|
||||
@ -212,7 +213,10 @@ consensus to merge a pull request (remember that discussions may have been
|
||||
spread out over GitHub, mailing list and IRC discussions). The following
|
||||
language is used within pull-request comments:
|
||||
|
||||
- ACK means "I have tested the code and I agree it should be merged";
|
||||
- (t)ACK means "I have tested the code and I agree it should be merged", involving
|
||||
change-specific manual testing in addition to running the unit and functional
|
||||
tests, and in case it is not obvious how the manual testing was done, it should
|
||||
be described;
|
||||
- NACK means "I disagree this should be merged", and must be accompanied by
|
||||
sound technical justification (or in certain cases of copyright/patent/licensing
|
||||
issues, legal justification). NACKs without accompanying reasoning may be
|
||||
|
@ -786,6 +786,10 @@ if test x$TARGET_OS != xwindows; then
|
||||
AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"])
|
||||
fi
|
||||
|
||||
# All versions of gcc that we commonly use for building are subject to bug
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set
|
||||
# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
|
||||
AX_CHECK_COMPILE_FLAG([-fstack-reuse=none],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"])
|
||||
if test x$use_hardening != xno; then
|
||||
use_hardening=yes
|
||||
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
|
||||
|
@ -7,6 +7,8 @@ clang-format-diff.py
|
||||
|
||||
A script to format unified git diffs according to [.clang-format](../../src/.clang-format).
|
||||
|
||||
Requires `clang-format`, installed e.g. via `brew install clang-format` on macOS.
|
||||
|
||||
For instance, to format the last commit with 0 lines of context,
|
||||
the script should be called from the git root folder as follows.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
if [ $# -ne 3 ];
|
||||
then echo "usage: $0 <input> <stripped-binary> <debug-binary>"
|
||||
fi
|
||||
|
152
contrib/devtools/test_deterministic_coverage.sh
Executable file
152
contrib/devtools/test_deterministic_coverage.sh
Executable file
@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
# Test for deterministic coverage across unit test runs.
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
# Use GCOV_EXECUTABLE="gcov" if compiling with gcc.
|
||||
# Use GCOV_EXECUTABLE="llvm-cov gcov" if compiling with clang.
|
||||
GCOV_EXECUTABLE="gcov"
|
||||
|
||||
# TODO this list is likely incomplete / incorrect for Dash
|
||||
# Disable tests known to cause non-deterministic behaviour and document the source or point of non-determinism.
|
||||
NON_DETERMINISTIC_TESTS=(
|
||||
"coinselector_tests/knapsack_solver_test" # coinselector_tests.cpp: if (equal_sets(setCoinsRet, setCoinsRet2))
|
||||
"denialofservice_tests/DoS_mapOrphans" # denialofservice_tests.cpp: it = mapOrphanTransactions.lower_bound(InsecureRand256());
|
||||
"fs_tests/fsbridge_fstream" # deterministic test failure?
|
||||
"miner_tests/CreateNewBlock_validity" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"scheduler_tests/manythreads" # scheduler.cpp: CScheduler::serviceQueue()
|
||||
"scheduler_tests/singlethreadedscheduler_ordered" # scheduler.cpp: CScheduler::serviceQueue()
|
||||
"tx_validationcache_tests/checkinputs_test" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"tx_validationcache_tests/tx_mempool_block_doublespend" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"txindex_tests/txindex_initial_sync" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"txvalidation_tests/tx_mempool_reject_coinbase" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"validation_block_tests/processnewblock_signals_ordering" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"wallet_tests/coin_mark_dirty_immature_credit" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"wallet_tests/dummy_input_size_test" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"wallet_tests/importmulti_rescan" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"wallet_tests/importwallet_rescan" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"wallet_tests/ListCoins" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"wallet_tests/scan_for_wallet_transactions" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
"wallet_tests/wallet_disableprivkeys" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10)
|
||||
)
|
||||
|
||||
TEST_BITCOIN_BINARY="src/test/test_dash"
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $0 [custom test filter (default: all but known non-deterministic tests)] [number of test runs (default: 2)]"
|
||||
}
|
||||
|
||||
N_TEST_RUNS=2
|
||||
BOOST_TEST_RUN_FILTERS=""
|
||||
if [[ $# != 0 ]]; then
|
||||
if [[ $1 == "--help" ]]; then
|
||||
print_usage
|
||||
exit
|
||||
fi
|
||||
PARSED_ARGUMENTS=0
|
||||
if [[ $1 =~ [a-z] ]]; then
|
||||
BOOST_TEST_RUN_FILTERS=$1
|
||||
PARSED_ARGUMENTS=$((PARSED_ARGUMENTS + 1))
|
||||
shift
|
||||
fi
|
||||
if [[ $1 =~ ^[0-9]+$ ]]; then
|
||||
N_TEST_RUNS=$1
|
||||
PARSED_ARGUMENTS=$((PARSED_ARGUMENTS + 1))
|
||||
shift
|
||||
fi
|
||||
if [[ ${PARSED_ARGUMENTS} == 0 || $# -gt 2 || ${N_TEST_RUNS} -lt 2 ]]; then
|
||||
print_usage
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
if [[ ${BOOST_TEST_RUN_FILTERS} == "" ]]; then
|
||||
BOOST_TEST_RUN_FILTERS="$(IFS=":"; echo "!${NON_DETERMINISTIC_TESTS[*]}" | sed 's/:/:!/g')"
|
||||
else
|
||||
echo "Using Boost test filter: ${BOOST_TEST_RUN_FILTERS}"
|
||||
echo
|
||||
fi
|
||||
|
||||
if ! command -v gcov > /dev/null; then
|
||||
echo "Error: gcov not installed. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v gcovr > /dev/null; then
|
||||
echo "Error: gcovr not installed. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -e ${TEST_BITCOIN_BINARY} ]]; then
|
||||
echo "Error: Executable ${TEST_BITCOIN_BINARY} not found. Run \"./configure --enable-lcov\" and compile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_file_suffix_count() {
|
||||
find src/ -type f -name "*.$1" | wc -l
|
||||
}
|
||||
|
||||
if [[ $(get_file_suffix_count gcno) == 0 ]]; then
|
||||
echo "Error: Could not find any *.gcno files. The *.gcno files are generated by the compiler. Run \"./configure --enable-lcov\" and re-compile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_covr_filename() {
|
||||
echo "gcovr.run-$1.txt"
|
||||
}
|
||||
|
||||
TEST_RUN_ID=0
|
||||
while [[ ${TEST_RUN_ID} -lt ${N_TEST_RUNS} ]]; do
|
||||
TEST_RUN_ID=$((TEST_RUN_ID + 1))
|
||||
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Measuring coverage, run #${TEST_RUN_ID} of ${N_TEST_RUNS}"
|
||||
find src/ -type f -name "*.gcda" -exec rm {} \;
|
||||
if [[ $(get_file_suffix_count gcda) != 0 ]]; then
|
||||
echo "Error: Stale *.gcda files found. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
TEST_OUTPUT_TEMPFILE=$(mktemp)
|
||||
if ! BOOST_TEST_RUN_FILTERS="${BOOST_TEST_RUN_FILTERS}" ${TEST_BITCOIN_BINARY} > "${TEST_OUTPUT_TEMPFILE}" 2>&1; then
|
||||
cat "${TEST_OUTPUT_TEMPFILE}"
|
||||
rm "${TEST_OUTPUT_TEMPFILE}"
|
||||
exit 1
|
||||
fi
|
||||
rm "${TEST_OUTPUT_TEMPFILE}"
|
||||
if [[ $(get_file_suffix_count gcda) == 0 ]]; then
|
||||
echo "Error: Running the test suite did not create any *.gcda files. The gcda files are generated when the instrumented test programs are executed. Run \"./configure --enable-lcov\" and re-compile."
|
||||
exit 1
|
||||
fi
|
||||
GCOVR_TEMPFILE=$(mktemp)
|
||||
if ! gcovr --gcov-executable "${GCOV_EXECUTABLE}" -r src/ > "${GCOVR_TEMPFILE}"; then
|
||||
echo "Error: gcovr failed. Output written to ${GCOVR_TEMPFILE}. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
GCOVR_FILENAME=$(get_covr_filename ${TEST_RUN_ID})
|
||||
mv "${GCOVR_TEMPFILE}" "${GCOVR_FILENAME}"
|
||||
if grep -E "^TOTAL *0 *0 " "${GCOVR_FILENAME}"; then
|
||||
echo "Error: Spurious gcovr output. Make sure the correct GCOV_EXECUTABLE variable is set in $0 (\"gcov\" for gcc, \"llvm-cov gcov\" for clang)."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ${TEST_RUN_ID} != 1 ]]; then
|
||||
COVERAGE_DIFF=$(diff -u "$(get_covr_filename 1)" "${GCOVR_FILENAME}")
|
||||
if [[ ${COVERAGE_DIFF} != "" ]]; then
|
||||
echo
|
||||
echo "The line coverage is non-deterministic between runs. Exiting."
|
||||
echo
|
||||
echo "The test suite must be deterministic in the sense that the set of lines executed at least"
|
||||
echo "once must be identical between runs. This is a necessary condition for meaningful"
|
||||
echo "coverage measuring."
|
||||
echo
|
||||
echo "${COVERAGE_DIFF}"
|
||||
exit 1
|
||||
fi
|
||||
rm "${GCOVR_FILENAME}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Coverage test passed: Deterministic coverage across ${N_TEST_RUNS} runs."
|
||||
exit
|
@ -35,6 +35,7 @@ remotes:
|
||||
"dir": "dash"
|
||||
files: []
|
||||
script: |
|
||||
set -e -o pipefail
|
||||
|
||||
WRAP_DIR=$HOME/wrapped
|
||||
HOSTS="i686-pc-linux-gnu x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu"
|
||||
@ -201,8 +202,8 @@ script: |
|
||||
find . -name "lib*.la" -delete
|
||||
find . -name "lib*.a" -delete
|
||||
rm -rf ${DISTNAME}/lib/pkgconfig
|
||||
find ${DISTNAME}/bin -type f -executable -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \;
|
||||
find ${DISTNAME}/lib -type f -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \;
|
||||
find ${DISTNAME}/bin -type f -executable -print0 | xargs -0 -n1 -I{} ../contrib/devtools/split-debug.sh {} {} {}.dbg
|
||||
find ${DISTNAME}/lib -type f -print0 | xargs -0 -n1 -I{} ../contrib/devtools/split-debug.sh {} {} {}.dbg
|
||||
cp ../doc/README.md ${DISTNAME}/
|
||||
find ${DISTNAME} -not -name "*.dbg" | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz
|
||||
find ${DISTNAME} -name "*.dbg" | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}-debug.tar.gz
|
||||
|
@ -12,6 +12,8 @@ remotes:
|
||||
files:
|
||||
- "dashcore-osx-unsigned.tar.gz"
|
||||
script: |
|
||||
set -e -o pipefail
|
||||
|
||||
WRAP_DIR=$HOME/wrapped
|
||||
mkdir -p ${WRAP_DIR}
|
||||
export PATH=`pwd`:$PATH
|
||||
|
@ -35,6 +35,8 @@ remotes:
|
||||
files:
|
||||
- "MacOSX10.11.sdk.tar.gz"
|
||||
script: |
|
||||
set -e -o pipefail
|
||||
|
||||
WRAP_DIR=$HOME/wrapped
|
||||
HOSTS="x86_64-apple-darwin14"
|
||||
CONFIGFLAGS="--enable-reduce-exports --disable-miner --disable-bench --disable-gui-tests GENISOIMAGE=$WRAP_DIR/genisoimage --enable-crash-hooks"
|
||||
|
@ -17,6 +17,8 @@ files:
|
||||
- "osslsigncode-2.0.tar.gz"
|
||||
- "dashcore-win-unsigned.tar.gz"
|
||||
script: |
|
||||
set -e -o pipefail
|
||||
|
||||
BUILD_DIR=`pwd`
|
||||
SIGDIR=${BUILD_DIR}/signature/win
|
||||
UNSIGNED_DIR=${BUILD_DIR}/unsigned
|
||||
|
@ -29,6 +29,8 @@ remotes:
|
||||
"dir": "dash"
|
||||
files: []
|
||||
script: |
|
||||
set -e -o pipefail
|
||||
|
||||
WRAP_DIR=$HOME/wrapped
|
||||
HOSTS="i686-w64-mingw32 x86_64-w64-mingw32"
|
||||
CONFIGFLAGS="--enable-reduce-exports --disable-miner --disable-bench --disable-gui-tests --enable-crash-hooks"
|
||||
|
@ -183,4 +183,6 @@ download-win:
|
||||
@$(MAKE) -s HOST=x86_64-w64-mingw32 download-one
|
||||
download: download-osx download-linux download-win
|
||||
|
||||
$(foreach package,$(all_packages),$(eval $(call ext_add_stages,$(package))))
|
||||
|
||||
.PHONY: install cached clean clean-all download-one download-osx download-linux download-win download check-packages check-sources
|
||||
|
@ -78,8 +78,9 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
|
||||
|
||||
|
||||
#default commands
|
||||
# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior
|
||||
$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
|
||||
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --strip-components=1 -xf $$($(1)_source)
|
||||
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --no-same-owner --strip-components=1 -xf $$($(1)_source)
|
||||
$(1)_preprocess_cmds ?=
|
||||
$(1)_build_cmds ?=
|
||||
$(1)_config_cmds ?=
|
||||
@ -172,15 +173,15 @@ $($(1)_extracted): | $($(1)_fetched)
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)cd $$(@D); $(call $(1)_extract_cmds,$(1))
|
||||
$(AT)touch $$@
|
||||
$($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted)
|
||||
$($(1)_preprocessed): | $($(1)_extracted)
|
||||
$(AT)echo Preprocessing $(1)...
|
||||
$(AT)mkdir -p $$(@D) $($(1)_patch_dir)
|
||||
$(AT)$(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;)
|
||||
$(AT)cd $$(@D); $(call $(1)_preprocess_cmds, $(1))
|
||||
$(AT)touch $$@
|
||||
$($(1)_configured): | $($(1)_preprocessed)
|
||||
$($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed)
|
||||
$(AT)echo Configuring $(1)...
|
||||
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar xf $($(package)_cached); )
|
||||
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); )
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
|
||||
$(AT)touch $$@
|
||||
@ -215,6 +216,14 @@ $(1): | $($(1)_cached_checksum)
|
||||
|
||||
endef
|
||||
|
||||
stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum
|
||||
|
||||
define ext_add_stages
|
||||
$(foreach stage,$(stages),
|
||||
$(1)_$(stage): $($(1)_$(stage))
|
||||
.PHONY: $(1)_$(stage))
|
||||
endef
|
||||
|
||||
# These functions create the build targets for each package. They must be
|
||||
# broken down into small steps so that each part is done for all packages
|
||||
# before moving on to the next step. Otherwise, a package's info
|
||||
|
@ -22,12 +22,12 @@ define $(package)_extract_cmds
|
||||
echo "$($(package)_clang_sha256_hash) $($(package)_source_dir)/$($(package)_clang_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
mkdir -p toolchain/bin toolchain/lib/clang/3.5/include && \
|
||||
tar --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \
|
||||
tar --no-same-owner --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \
|
||||
rm -f toolchain/lib/libc++abi.so* && \
|
||||
echo "#!/bin/sh" > toolchain/bin/$(host)-dsymutil && \
|
||||
echo "exit 0" >> toolchain/bin/$(host)-dsymutil && \
|
||||
chmod +x toolchain/bin/$(host)-dsymutil && \
|
||||
tar --strip-components=1 -xf $($(package)_source)
|
||||
tar --no-same-owner --strip-components=1 -xf $($(package)_source)
|
||||
endef
|
||||
|
||||
define $(package)_set_vars
|
||||
|
@ -5,7 +5,7 @@ $(package)_file_name=protobuf-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=ee445612d544d885ae240ffbcbf9267faa9f593b7b101f21d58beceb92661910
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared
|
||||
$(package)_config_opts=--disable-shared --without-zlib
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
|
@ -114,11 +114,11 @@ define $(package)_extract_cmds
|
||||
echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
mkdir qtbase && \
|
||||
tar --strip-components=1 -xf $($(package)_source) -C qtbase && \
|
||||
tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
|
||||
mkdir qttranslations && \
|
||||
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
|
||||
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
|
||||
mkdir qttools && \
|
||||
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
|
||||
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
@ -127,7 +127,7 @@ define $(package)_preprocess_cmds
|
||||
sed -i.old "/updateqm.depends =/d" qttranslations/translations/translations.pro && \
|
||||
sed -i.old "s/src_plugins.depends = src_sql src_network/src_plugins.depends = src_network/" qtbase/src/src.pro && \
|
||||
sed -i.old "s|X11/extensions/XIproto.h|X11/X.h|" qtbase/src/plugins/platforms/xcb/qxcbxsettings.cpp && \
|
||||
sed -i.old 's/if \[ "$$$$XPLATFORM_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/if \[ "$$$$BUILD_ON_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/' qtbase/configure && \
|
||||
sed -i.old -e 's/if \[ "$$$$XPLATFORM_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/if \[ "$$$$BUILD_ON_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/' -e 's|/bin/pwd|pwd|' qtbase/configure && \
|
||||
sed -i.old 's/CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0)/CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, kCGMouseButtonLeft)/' qtbase/src/plugins/platforms/cocoa/qcocoacursor.mm && \
|
||||
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
|
||||
cp -f qtbase/mkspecs/macx-clang/Info.plist.lib qtbase/mkspecs/macx-clang-linux/ &&\
|
||||
|
@ -593,8 +593,8 @@ class AddressBookPage
|
||||
Mode m_mode;
|
||||
}
|
||||
|
||||
AddressBookPage::AddressBookPage(Mode _mode) :
|
||||
m_mode(_mode)
|
||||
AddressBookPage::AddressBookPage(Mode _mode)
|
||||
: m_mode(_mode)
|
||||
...
|
||||
```
|
||||
|
||||
|
@ -8,7 +8,9 @@ Table of Contents
|
||||
* [Cache compilations with `ccache`](#cache-compilations-with-ccache)
|
||||
* [Disable features with `./configure`](#disable-features-with-configure)
|
||||
* [Make use of your threads with `make -j`](#make-use-of-your-threads-with-make--j)
|
||||
* [Only build what you need](#only-build-what-you-need)
|
||||
* [Multiple working directories with `git worktrees`](#multiple-working-directories-with-git-worktrees)
|
||||
* [Interactive "dummy rebases" for fixups and execs with `git merge-base`](#interactive-dummy-rebases-for-fixups-and-execs-with-git-merge-base)
|
||||
* [Writing code](#writing-code)
|
||||
* [Format C/C++/Protobuf diffs with `clang-format-diff.py`](#format-ccprotobuf-diffs-with-clang-format-diffpy)
|
||||
* [Format Python diffs with `yapf-diff.py`](#format-python-diffs-with-yapf-diffpy)
|
||||
@ -32,6 +34,17 @@ Install `ccache` through your distribution's package manager, and run `./configu
|
||||
|
||||
To use ccache for all your C/C++ projects, follow the symlinks method [here](https://ccache.samba.org/manual/latest.html#_run_modes) to set it up.
|
||||
|
||||
To get the most out of ccache, put something like this in `~/.ccache/ccache.conf`:
|
||||
|
||||
```
|
||||
max_size = 50.0G # or whatever cache size you prefer; default is 5G; 0 means unlimited
|
||||
base_dir = /home/yourname # or wherever you keep your source files
|
||||
```
|
||||
|
||||
Note: base_dir is required for ccache to share cached compiles of the same file across different repositories / paths; it will only do this for paths under base_dir. So this option is required for effective use of ccache with git worktrees (described below).
|
||||
|
||||
You _must not_ set base_dir to "/", or anywhere that contains system headers (according to the ccache docs).
|
||||
|
||||
### Disable features with `./configure`
|
||||
|
||||
After running `./autogen.sh`, which generates the `./configure` file, use `./configure --help` to identify features that you can disable to save on compilation time. A few common flags:
|
||||
@ -43,6 +56,8 @@ After running `./autogen.sh`, which generates the `./configure` file, use `./con
|
||||
--without-gui
|
||||
```
|
||||
|
||||
If you do need the wallet enabled, it is common for devs to add `--with-incompatible-bdb`. This uses your system bdb version for the wallet, so you don't have to find a copy of bdb 4.8. Wallets from such a build will be incompatible with any release binary (and vice versa), so use with caution on mainnet.
|
||||
|
||||
### Make use of your threads with `make -j`
|
||||
|
||||
If you have multiple threads on your machine, you can tell `make` to utilize all of them with:
|
||||
@ -51,6 +66,20 @@ If you have multiple threads on your machine, you can tell `make` to utilize all
|
||||
make -j"$(($(nproc)+1))"
|
||||
```
|
||||
|
||||
### Only build what you need
|
||||
|
||||
When rebuilding during development, note that running `make`, without giving a target, will do a lot of work you probably don't need. It will build the GUI (unless you've disabled it) and all the tests (which take much longer to build than the app does).
|
||||
|
||||
Obviously, it is important to build and run the tests at appropriate times -- but when you just want a quick compile to check your work, consider picking one or a set of build targets relevant to what you're working on, e.g.:
|
||||
|
||||
```sh
|
||||
make src/dashd src/dash-cli
|
||||
make src/qt/dash-qt
|
||||
make -C src dash_bench
|
||||
```
|
||||
|
||||
(You can and should combine this with `-j`, as above, for a parallel build.)
|
||||
|
||||
### Multiple working directories with `git worktrees`
|
||||
|
||||
If you work with multiple branches or multiple copies of the repository, you should try `git worktrees`.
|
||||
@ -65,6 +94,21 @@ To simply check out a commit-ish under a new working directory without disruptin
|
||||
git worktree add --checkout ../where-my-checkout-commit-ish-will-live my-checkout-commit-ish
|
||||
```
|
||||
|
||||
### Interactive "dummy rebases" for fixups and execs with `git merge-base`
|
||||
|
||||
When rebasing, we often want to do a "dummy rebase," whereby we are not rebasing over an updated master but rather over the last common commit with master. This might be useful for rearranging commits, `rebase --autosquash`ing, or `rebase --exec`ing without introducing conflicts that arise from an updated master. In these situations, we can use `git merge-base` to identify the last common commit with master, and rebase off of that.
|
||||
|
||||
To squash in `git commit --fixup` commits without rebasing over an updated master, we can do the following:
|
||||
|
||||
```sh
|
||||
git rebase -i --autosquash "$(git merge-base master HEAD)"
|
||||
```
|
||||
|
||||
To execute `make check` on every commit since last diverged from master, but without rebasing over an updated master, we can do the following:
|
||||
```sh
|
||||
git rebase -i --exec "make check" "$(git merge-base master HEAD)"
|
||||
```
|
||||
|
||||
-----
|
||||
|
||||
This synergizes well with [`ccache`](#cache-compilations-with-ccache) as objects resulting from unchanged code will most likely hit the cache and won't need to be recompiled.
|
||||
@ -76,7 +120,7 @@ Writing code
|
||||
|
||||
### Format C/C++/Protobuf diffs with `clang-format-diff.py`
|
||||
|
||||
See [contrib/devtools/README.md](contrib/devtools/README.md#clang-format-diff.py).
|
||||
See [contrib/devtools/README.md](/contrib/devtools/README.md#clang-format-diff.py).
|
||||
|
||||
### Format Python diffs with `yapf-diff.py`
|
||||
|
||||
@ -129,14 +173,14 @@ When looking at other's pull requests, it may make sense to add the following se
|
||||
```
|
||||
[remote "upstream-pull"]
|
||||
fetch = +refs/pull/*:refs/remotes/upstream-pull/*
|
||||
url = git@github.com:bitcoin/bitcoin.git
|
||||
url = git@github.com:dashpay/dash.git
|
||||
```
|
||||
|
||||
This will add an `upstream-pull` remote to your git repository, which can be fetched using `git fetch --all` or `git fetch upstream-pull`. Afterwards, you can use `upstream-pull/NUMBER/head` in arguments to `git show`, `git checkout` and anywhere a commit id would be acceptable to see the changes from pull request NUMBER.
|
||||
|
||||
### Diff the diffs with `git range-diff`
|
||||
|
||||
It is very common for contributors to rebase their pull requests, or make changes to commits (perhaps in response to review) that are not at the head of their branch. This poses a problem for reviewers as when the contributor force pushes, the reviewer is no longer sure that his previous reviews of commits are still valid (as the commit hashes can now be different even though the diff is semantically the same). `git range-diff` can help solve this problem by diffing the diffs.
|
||||
It is very common for contributors to rebase their pull requests, or make changes to commits (perhaps in response to review) that are not at the head of their branch. This poses a problem for reviewers as when the contributor force pushes, the reviewer is no longer sure that his previous reviews of commits are still valid (as the commit hashes can now be different even though the diff is semantically the same). [git range-diff](https://git-scm.com/docs/git-range-diff) (Git >= 2.19) can help solve this problem by diffing the diffs.
|
||||
|
||||
For example, to identify the differences between your previously reviewed diffs P1-5, and the new diffs P1-2,N3-4 as illustrated below:
|
||||
```
|
||||
@ -152,7 +196,19 @@ You can do:
|
||||
git range-diff master previously-reviewed-head new-head
|
||||
```
|
||||
|
||||
Note that `git range-diff` also work for rebases.
|
||||
Note that `git range-diff` also work for rebases:
|
||||
|
||||
```
|
||||
P1--P2--P3--P4--P5 <-- previously-reviewed-head
|
||||
/
|
||||
...--m--m1--m2--m3 <-- master
|
||||
\
|
||||
P1--P2--N3--N4 <-- new-head (with P3 modified, P4 & P5 squashed)
|
||||
|
||||
PREV=P5 N=4 && git range-diff `git merge-base --all HEAD $PREV`...$PREV HEAD~$N...HEAD
|
||||
```
|
||||
|
||||
Where `P5` is the commit you last reviewed and `4` is the number of commits in the new version.
|
||||
|
||||
-----
|
||||
|
||||
|
@ -5,7 +5,6 @@ SetCompressor /SOLID lzma
|
||||
|
||||
# General Symbol Definitions
|
||||
!define REGKEY "SOFTWARE\$(^Name)"
|
||||
!define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@
|
||||
!define COMPANY "@PACKAGE_NAME@ project"
|
||||
!define URL @PACKAGE_URL@
|
||||
|
||||
@ -49,7 +48,7 @@ Var StartMenuGroup
|
||||
!insertmacro MUI_LANGUAGE English
|
||||
|
||||
# Installer attributes
|
||||
OutFile @abs_top_srcdir@/@PACKAGE_TARNAME@-${VERSION}-win@WINDOWS_BITS@-setup.exe
|
||||
OutFile @abs_top_srcdir@/@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win@WINDOWS_BITS@-setup.exe
|
||||
!if "@WINDOWS_BITS@" == "64"
|
||||
InstallDir $PROGRAMFILES64\DashCore
|
||||
!else
|
||||
@ -59,12 +58,12 @@ CRCCheck on
|
||||
XPStyle on
|
||||
BrandingText " "
|
||||
ShowInstDetails show
|
||||
VIProductVersion ${VERSION}.@CLIENT_VERSION_BUILD@
|
||||
VIProductVersion @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@.@CLIENT_VERSION_BUILD@
|
||||
VIAddVersionKey ProductName "@PACKAGE_NAME@"
|
||||
VIAddVersionKey ProductVersion "${VERSION}"
|
||||
VIAddVersionKey ProductVersion "@PACKAGE_VERSION@"
|
||||
VIAddVersionKey CompanyName "${COMPANY}"
|
||||
VIAddVersionKey CompanyWebsite "${URL}"
|
||||
VIAddVersionKey FileVersion "${VERSION}"
|
||||
VIAddVersionKey FileVersion "@PACKAGE_VERSION@"
|
||||
VIAddVersionKey FileDescription ""
|
||||
VIAddVersionKey LegalCopyright ""
|
||||
InstallDirRegKey HKCU "${REGKEY}" Path
|
||||
@ -98,7 +97,7 @@ Section -post SEC0001
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "@PACKAGE_VERSION@"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
|
||||
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
|
||||
|
@ -767,13 +767,13 @@ clean-local:
|
||||
check-symbols: $(bin_PROGRAMS)
|
||||
if GLIBC_BACK_COMPAT
|
||||
@echo "Checking glibc back compat..."
|
||||
$(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
|
||||
$(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(PYTHON) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
|
||||
endif
|
||||
|
||||
check-security: $(bin_PROGRAMS)
|
||||
if HARDEN
|
||||
@echo "Checking binary security..."
|
||||
$(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
|
||||
$(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(PYTHON) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS)
|
||||
endif
|
||||
|
||||
|
||||
|
@ -17,6 +17,17 @@
|
||||
# error "Dash Core cannot be compiled without assertions."
|
||||
#endif
|
||||
|
||||
// Assumption: We assume a C++11 (ISO/IEC 14882:2011) compiler (minimum requirement).
|
||||
// Example(s): We assume the presence of C++11 features everywhere :-)
|
||||
// Note: MSVC does not report the expected __cplusplus value due to legacy
|
||||
// reasons.
|
||||
#if !defined(_MSC_VER)
|
||||
// ISO Standard C++11 [cpp.predefined]p1:
|
||||
// "The name __cplusplus is defined to the value 201103L when compiling a C++
|
||||
// translation unit."
|
||||
static_assert(__cplusplus >= 201103L, "C++11 standard assumed");
|
||||
#endif
|
||||
|
||||
// Assumption: We assume the floating-point types to fulfill the requirements of
|
||||
// IEC 559 (IEEE 754) standard.
|
||||
// Example(s): Floating-point division by zero in ConnectBlock, CreateTransaction
|
||||
@ -40,8 +51,13 @@ static_assert(sizeof(double) == 8, "64-bit double assumed");
|
||||
static_assert(sizeof(short) == 2, "16-bit short assumed");
|
||||
static_assert(sizeof(int) == 4, "32-bit int assumed");
|
||||
|
||||
// Assumption: We assume size_t to be 32-bit or 64-bit.
|
||||
// Example(s): size_t assumed to be at least 32-bit in ecdsa_signature_parse_der_lax(...).
|
||||
// size_t assumed to be 32-bit or 64-bit in MallocUsage(...).
|
||||
static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "size_t assumed to be 32-bit or 64-bit");
|
||||
static_assert(sizeof(size_t) == sizeof(void*), "Sizes of size_t and void* assumed to be equal");
|
||||
|
||||
// Some important things we are NOT assuming (non-exhaustive list):
|
||||
// * We are NOT assuming a specific value for sizeof(std::size_t).
|
||||
// * We are NOT assuming a specific value for std::endian::native.
|
||||
// * We are NOT assuming a specific value for std::locale("").name().
|
||||
// * We are NOT assuming a specific value for std::numeric_limits<char>::is_signed.
|
||||
|
@ -12,36 +12,6 @@ extern "C" {
|
||||
#include <crypto/ctaes/ctaes.c>
|
||||
}
|
||||
|
||||
AES128Encrypt::AES128Encrypt(const unsigned char key[16])
|
||||
{
|
||||
AES128_init(&ctx, key);
|
||||
}
|
||||
|
||||
AES128Encrypt::~AES128Encrypt()
|
||||
{
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
}
|
||||
|
||||
void AES128Encrypt::Encrypt(unsigned char ciphertext[16], const unsigned char plaintext[16]) const
|
||||
{
|
||||
AES128_encrypt(&ctx, 1, ciphertext, plaintext);
|
||||
}
|
||||
|
||||
AES128Decrypt::AES128Decrypt(const unsigned char key[16])
|
||||
{
|
||||
AES128_init(&ctx, key);
|
||||
}
|
||||
|
||||
AES128Decrypt::~AES128Decrypt()
|
||||
{
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
}
|
||||
|
||||
void AES128Decrypt::Decrypt(unsigned char plaintext[16], const unsigned char ciphertext[16]) const
|
||||
{
|
||||
AES128_decrypt(&ctx, 1, plaintext, ciphertext);
|
||||
}
|
||||
|
||||
AES256Encrypt::AES256Encrypt(const unsigned char key[32])
|
||||
{
|
||||
AES256_init(&ctx, key);
|
||||
@ -182,35 +152,3 @@ AES256CBCDecrypt::~AES256CBCDecrypt()
|
||||
{
|
||||
memset(iv, 0, sizeof(iv));
|
||||
}
|
||||
|
||||
AES128CBCEncrypt::AES128CBCEncrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn)
|
||||
: enc(key), pad(padIn)
|
||||
{
|
||||
memcpy(iv, ivIn, AES_BLOCKSIZE);
|
||||
}
|
||||
|
||||
AES128CBCEncrypt::~AES128CBCEncrypt()
|
||||
{
|
||||
memset(iv, 0, AES_BLOCKSIZE);
|
||||
}
|
||||
|
||||
int AES128CBCEncrypt::Encrypt(const unsigned char* data, int size, unsigned char* out) const
|
||||
{
|
||||
return CBCEncrypt(enc, iv, data, size, pad, out);
|
||||
}
|
||||
|
||||
AES128CBCDecrypt::AES128CBCDecrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn)
|
||||
: dec(key), pad(padIn)
|
||||
{
|
||||
memcpy(iv, ivIn, AES_BLOCKSIZE);
|
||||
}
|
||||
|
||||
AES128CBCDecrypt::~AES128CBCDecrypt()
|
||||
{
|
||||
memset(iv, 0, AES_BLOCKSIZE);
|
||||
}
|
||||
|
||||
int AES128CBCDecrypt::Decrypt(const unsigned char* data, int size, unsigned char* out) const
|
||||
{
|
||||
return CBCDecrypt(dec, iv, data, size, pad, out);
|
||||
}
|
||||
|
@ -12,33 +12,8 @@ extern "C" {
|
||||
}
|
||||
|
||||
static const int AES_BLOCKSIZE = 16;
|
||||
static const int AES128_KEYSIZE = 16;
|
||||
static const int AES256_KEYSIZE = 32;
|
||||
|
||||
/** An encryption class for AES-128. */
|
||||
class AES128Encrypt
|
||||
{
|
||||
private:
|
||||
AES128_ctx ctx;
|
||||
|
||||
public:
|
||||
explicit AES128Encrypt(const unsigned char key[16]);
|
||||
~AES128Encrypt();
|
||||
void Encrypt(unsigned char ciphertext[16], const unsigned char plaintext[16]) const;
|
||||
};
|
||||
|
||||
/** A decryption class for AES-128. */
|
||||
class AES128Decrypt
|
||||
{
|
||||
private:
|
||||
AES128_ctx ctx;
|
||||
|
||||
public:
|
||||
explicit AES128Decrypt(const unsigned char key[16]);
|
||||
~AES128Decrypt();
|
||||
void Decrypt(unsigned char plaintext[16], const unsigned char ciphertext[16]) const;
|
||||
};
|
||||
|
||||
/** An encryption class for AES-256. */
|
||||
class AES256Encrypt
|
||||
{
|
||||
@ -89,30 +64,4 @@ private:
|
||||
unsigned char iv[AES_BLOCKSIZE];
|
||||
};
|
||||
|
||||
class AES128CBCEncrypt
|
||||
{
|
||||
public:
|
||||
AES128CBCEncrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn);
|
||||
~AES128CBCEncrypt();
|
||||
int Encrypt(const unsigned char* data, int size, unsigned char* out) const;
|
||||
|
||||
private:
|
||||
const AES128Encrypt enc;
|
||||
const bool pad;
|
||||
unsigned char iv[AES_BLOCKSIZE];
|
||||
};
|
||||
|
||||
class AES128CBCDecrypt
|
||||
{
|
||||
public:
|
||||
AES128CBCDecrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn);
|
||||
~AES128CBCDecrypt();
|
||||
int Decrypt(const unsigned char* data, int size, unsigned char* out) const;
|
||||
|
||||
private:
|
||||
const AES128Decrypt dec;
|
||||
const bool pad;
|
||||
unsigned char iv[AES_BLOCKSIZE];
|
||||
};
|
||||
|
||||
#endif // BITCOIN_CRYPTO_AES_H
|
||||
|
@ -256,7 +256,7 @@ CRIPEMD160& CRIPEMD160::Write(const unsigned char* data, size_t len)
|
||||
ripemd160::Transform(s, buf);
|
||||
bufsize = 0;
|
||||
}
|
||||
while (end >= data + 64) {
|
||||
while (end - data >= 64) {
|
||||
// Process full chunks directly from the source.
|
||||
ripemd160::Transform(s, data);
|
||||
bytes += 64;
|
||||
|
@ -163,7 +163,7 @@ CSHA1& CSHA1::Write(const unsigned char* data, size_t len)
|
||||
sha1::Transform(s, buf);
|
||||
bufsize = 0;
|
||||
}
|
||||
while (end >= data + 64) {
|
||||
while (end - data >= 64) {
|
||||
// Process full chunks directly from the source.
|
||||
sha1::Transform(s, data);
|
||||
bytes += 64;
|
||||
|
@ -168,7 +168,7 @@ CSHA512& CSHA512::Write(const unsigned char* data, size_t len)
|
||||
sha512::Transform(s, buf);
|
||||
bufsize = 0;
|
||||
}
|
||||
while (end >= data + 128) {
|
||||
while (end - data >= 128) {
|
||||
// Process full chunks directly from the source.
|
||||
sha512::Transform(s, data);
|
||||
data += 128;
|
||||
|
@ -115,7 +115,7 @@ static leveldb::Options GetOptions(size_t nCacheSize)
|
||||
}
|
||||
|
||||
CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate)
|
||||
: m_name(fs::basename(path))
|
||||
: m_name{path.stem().string()}
|
||||
{
|
||||
penv = nullptr;
|
||||
readoptions.verify_checksums = true;
|
||||
|
1
src/fs.h
1
src/fs.h
@ -11,6 +11,7 @@
|
||||
#include <ext/stdio_filebuf.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
|
||||
|
@ -488,7 +488,7 @@ void SetupServerArgs()
|
||||
gArgs.AddArg("-?", "Print this help message and exit", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-alertnotify=<cmd>", "Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-assumevalid=<hex>", strprintf("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)", defaultChainParams->GetConsensus().defaultAssumeValid.GetHex(), testnetChainParams->GetConsensus().defaultAssumeValid.GetHex()), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-blocksdir=<dir>", "Specify blocks directory (default: <datadir>/blocks)", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-blocksdir=<dir>", "Specify directory to hold blocks subdirectory for *.dat files (default: <datadir>)", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-blocknotify=<cmd>", "Execute command when the best block changes (%s in cmd is replaced by block hash)", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-blockreconstructionextratxn=<n>", strprintf("Extra transactions to keep in memory for compact block reconstructions (default: %u)", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-blocksonly", strprintf("Whether to operate in a blocks only mode (default: %u)", DEFAULT_BLOCKSONLY), true, OptionsCategory::OPTIONS);
|
||||
|
@ -149,14 +149,14 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
size_type _size;
|
||||
size_type _size = 0;
|
||||
union direct_or_indirect {
|
||||
char direct[sizeof(T) * N];
|
||||
struct {
|
||||
size_type capacity;
|
||||
char* indirect;
|
||||
};
|
||||
} _union;
|
||||
} _union = {};
|
||||
|
||||
T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
|
||||
const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
|
||||
@ -253,34 +253,34 @@ public:
|
||||
fill(item_ptr(0), first, last);
|
||||
}
|
||||
|
||||
prevector() : _size(0), _union{{}} {}
|
||||
prevector() {}
|
||||
|
||||
explicit prevector(size_type n) : prevector() {
|
||||
explicit prevector(size_type n) {
|
||||
resize(n);
|
||||
}
|
||||
|
||||
explicit prevector(size_type n, const T& val) : prevector() {
|
||||
explicit prevector(size_type n, const T& val) {
|
||||
change_capacity(n);
|
||||
_size += n;
|
||||
fill(item_ptr(0), n, val);
|
||||
}
|
||||
|
||||
template<typename InputIterator>
|
||||
prevector(InputIterator first, InputIterator last) : prevector() {
|
||||
prevector(InputIterator first, InputIterator last) {
|
||||
size_type n = last - first;
|
||||
change_capacity(n);
|
||||
_size += n;
|
||||
fill(item_ptr(0), first, last);
|
||||
}
|
||||
|
||||
prevector(const prevector<N, T, Size, Diff>& other) : prevector() {
|
||||
prevector(const prevector<N, T, Size, Diff>& other) {
|
||||
size_type n = other.size();
|
||||
change_capacity(n);
|
||||
_size += n;
|
||||
fill(item_ptr(0), other.begin(), other.end());
|
||||
}
|
||||
|
||||
prevector(prevector<N, T, Size, Diff>&& other) : prevector() {
|
||||
prevector(prevector<N, T, Size, Diff>&& other) {
|
||||
swap(other);
|
||||
}
|
||||
|
||||
|
@ -69,26 +69,6 @@ static void TestHMACSHA512(const std::string &hexkey, const std::string &hexin,
|
||||
TestVector(CHMAC_SHA512(key.data(), key.size()), ParseHex(hexin), ParseHex(hexout));
|
||||
}
|
||||
|
||||
static void TestAES128(const std::string &hexkey, const std::string &hexin, const std::string &hexout)
|
||||
{
|
||||
std::vector<unsigned char> key = ParseHex(hexkey);
|
||||
std::vector<unsigned char> in = ParseHex(hexin);
|
||||
std::vector<unsigned char> correctout = ParseHex(hexout);
|
||||
std::vector<unsigned char> buf, buf2;
|
||||
|
||||
assert(key.size() == 16);
|
||||
assert(in.size() == 16);
|
||||
assert(correctout.size() == 16);
|
||||
AES128Encrypt enc(key.data());
|
||||
buf.resize(correctout.size());
|
||||
buf2.resize(correctout.size());
|
||||
enc.Encrypt(buf.data(), in.data());
|
||||
BOOST_CHECK_EQUAL(HexStr(buf), HexStr(correctout));
|
||||
AES128Decrypt dec(key.data());
|
||||
dec.Decrypt(buf2.data(), buf.data());
|
||||
BOOST_CHECK_EQUAL(HexStr(buf2), HexStr(in));
|
||||
}
|
||||
|
||||
static void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout)
|
||||
{
|
||||
std::vector<unsigned char> key = ParseHex(hexkey);
|
||||
@ -108,47 +88,6 @@ static void TestAES256(const std::string &hexkey, const std::string &hexin, cons
|
||||
BOOST_CHECK(buf == in);
|
||||
}
|
||||
|
||||
static void TestAES128CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout)
|
||||
{
|
||||
std::vector<unsigned char> key = ParseHex(hexkey);
|
||||
std::vector<unsigned char> iv = ParseHex(hexiv);
|
||||
std::vector<unsigned char> in = ParseHex(hexin);
|
||||
std::vector<unsigned char> correctout = ParseHex(hexout);
|
||||
std::vector<unsigned char> realout(in.size() + AES_BLOCKSIZE);
|
||||
|
||||
// Encrypt the plaintext and verify that it equals the cipher
|
||||
AES128CBCEncrypt enc(key.data(), iv.data(), pad);
|
||||
int size = enc.Encrypt(in.data(), in.size(), realout.data());
|
||||
realout.resize(size);
|
||||
BOOST_CHECK(realout.size() == correctout.size());
|
||||
BOOST_CHECK_MESSAGE(realout == correctout, HexStr(realout) + std::string(" != ") + hexout);
|
||||
|
||||
// Decrypt the cipher and verify that it equals the plaintext
|
||||
std::vector<unsigned char> decrypted(correctout.size());
|
||||
AES128CBCDecrypt dec(key.data(), iv.data(), pad);
|
||||
size = dec.Decrypt(correctout.data(), correctout.size(), decrypted.data());
|
||||
decrypted.resize(size);
|
||||
BOOST_CHECK(decrypted.size() == in.size());
|
||||
BOOST_CHECK_MESSAGE(decrypted == in, HexStr(decrypted) + std::string(" != ") + hexin);
|
||||
|
||||
// Encrypt and re-decrypt substrings of the plaintext and verify that they equal each-other
|
||||
for(std::vector<unsigned char>::iterator i(in.begin()); i != in.end(); ++i)
|
||||
{
|
||||
std::vector<unsigned char> sub(i, in.end());
|
||||
std::vector<unsigned char> subout(sub.size() + AES_BLOCKSIZE);
|
||||
int _size = enc.Encrypt(sub.data(), sub.size(), subout.data());
|
||||
if (_size != 0)
|
||||
{
|
||||
subout.resize(_size);
|
||||
std::vector<unsigned char> subdecrypted(subout.size());
|
||||
_size = dec.Decrypt(subout.data(), subout.size(), subdecrypted.data());
|
||||
subdecrypted.resize(_size);
|
||||
BOOST_CHECK(decrypted.size() == in.size());
|
||||
BOOST_CHECK_MESSAGE(subdecrypted == sub, HexStr(subdecrypted) + std::string(" != ") + HexStr(sub));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout)
|
||||
{
|
||||
std::vector<unsigned char> key = ParseHex(hexkey);
|
||||
@ -461,14 +400,9 @@ BOOST_AUTO_TEST_CASE(hmac_sha512_testvectors) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(aes_testvectors) {
|
||||
// AES test vectors from FIPS 197.
|
||||
TestAES128("000102030405060708090a0b0c0d0e0f", "00112233445566778899aabbccddeeff", "69c4e0d86a7b0430d8cdb78070b4c55a");
|
||||
TestAES256("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", "00112233445566778899aabbccddeeff", "8ea2b7ca516745bfeafc49904b496089");
|
||||
|
||||
// AES-ECB test vectors from NIST sp800-38a.
|
||||
TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "6bc1bee22e409f96e93d7e117393172a", "3ad77bb40d7a3660a89ecaf32466ef97");
|
||||
TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "ae2d8a571e03ac9c9eb76fac45af8e51", "f5d3d58503b9699de785895a96fdbaaf");
|
||||
TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "30c81c46a35ce411e5fbc1191a0a52ef", "43b1cd7f598ece23881b00e3ed030688");
|
||||
TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "f69f2445df4f9b17ad2b417be66c3710", "7b0c785e27e8ad3f8223207104725dd4");
|
||||
TestAES256("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", "6bc1bee22e409f96e93d7e117393172a", "f3eed1bdb5d2a03c064b5a7e3db181f8");
|
||||
TestAES256("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", "ae2d8a571e03ac9c9eb76fac45af8e51", "591ccb10d410ed26dc5ba74a31362870");
|
||||
TestAES256("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", "30c81c46a35ce411e5fbc1191a0a52ef", "b6ed21b99ca6f4f9f153e7b1beafed1d");
|
||||
@ -476,27 +410,6 @@ BOOST_AUTO_TEST_CASE(aes_testvectors) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(aes_cbc_testvectors) {
|
||||
|
||||
// NIST AES CBC 128-bit encryption test-vectors
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "000102030405060708090A0B0C0D0E0F", false, \
|
||||
"6bc1bee22e409f96e93d7e117393172a", "7649abac8119b246cee98e9b12e9197d");
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "7649ABAC8119B246CEE98E9B12E9197D", false, \
|
||||
"ae2d8a571e03ac9c9eb76fac45af8e51", "5086cb9b507219ee95db113a917678b2");
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "5086cb9b507219ee95db113a917678b2", false, \
|
||||
"30c81c46a35ce411e5fbc1191a0a52ef", "73bed6b8e3c1743b7116e69e22229516");
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "73bed6b8e3c1743b7116e69e22229516", false, \
|
||||
"f69f2445df4f9b17ad2b417be66c3710", "3ff1caa1681fac09120eca307586e1a7");
|
||||
|
||||
// The same vectors with padding enabled
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "000102030405060708090A0B0C0D0E0F", true, \
|
||||
"6bc1bee22e409f96e93d7e117393172a", "7649abac8119b246cee98e9b12e9197d8964e0b149c10b7b682e6e39aaeb731c");
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "7649ABAC8119B246CEE98E9B12E9197D", true, \
|
||||
"ae2d8a571e03ac9c9eb76fac45af8e51", "5086cb9b507219ee95db113a917678b255e21d7100b988ffec32feeafaf23538");
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "5086cb9b507219ee95db113a917678b2", true, \
|
||||
"30c81c46a35ce411e5fbc1191a0a52ef", "73bed6b8e3c1743b7116e69e22229516f6eccda327bf8e5ec43718b0039adceb");
|
||||
TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "73bed6b8e3c1743b7116e69e22229516", true, \
|
||||
"f69f2445df4f9b17ad2b417be66c3710", "3ff1caa1681fac09120eca307586e1a78cb82807230e1321d3fae00d18cc2012");
|
||||
|
||||
// NIST AES CBC 256-bit encryption test-vectors
|
||||
TestAES256CBC("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", \
|
||||
"000102030405060708090A0B0C0D0E0F", false, "6bc1bee22e409f96e93d7e117393172a", \
|
||||
|
@ -1164,11 +1164,12 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
|
||||
fcntl(fileno(file), F_PREALLOCATE, &fst);
|
||||
}
|
||||
ftruncate(fileno(file), fst.fst_length);
|
||||
#elif defined(__linux__)
|
||||
#else
|
||||
#if defined(__linux__)
|
||||
// Version using posix_fallocate
|
||||
off_t nEndPos = (off_t)offset + length;
|
||||
posix_fallocate(fileno(file), 0, nEndPos);
|
||||
#else
|
||||
if (0 == posix_fallocate(fileno(file), 0, nEndPos)) return;
|
||||
#endif
|
||||
// Fallback version
|
||||
// TODO: just write one byte per block
|
||||
static const char buf[65536] = {};
|
||||
|
@ -341,13 +341,6 @@ bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, std::string& er
|
||||
LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion());
|
||||
LogPrintf("Using wallet %s\n", walletFile);
|
||||
|
||||
// Wallet file must be a plain filename without a directory
|
||||
if (walletFile != fs::basename(walletFile) + fs::extension(walletFile))
|
||||
{
|
||||
errorStr = strprintf(_("Wallet %s resides outside wallet directory %s"), walletFile, walletDir.string());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!env->Open(true /* retry */)) {
|
||||
errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir);
|
||||
return false;
|
||||
|
@ -122,8 +122,11 @@ class AuthServiceProxy():
|
||||
def get_request(self, *args, **argsn):
|
||||
AuthServiceProxy.__id_count += 1
|
||||
|
||||
log.debug("-%s-> %s %s" % (AuthServiceProxy.__id_count, self._service_name,
|
||||
json.dumps(args, default=EncodeDecimal, ensure_ascii=self.ensure_ascii)))
|
||||
log.debug("-{}-> {} {}".format(
|
||||
AuthServiceProxy.__id_count,
|
||||
self._service_name,
|
||||
json.dumps(args or argsn, default=EncodeDecimal, ensure_ascii=self.ensure_ascii),
|
||||
))
|
||||
if args and argsn:
|
||||
raise ValueError('Cannot handle both named and positional arguments')
|
||||
return {'version': '1.1',
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2017 The Bitcoin Core developers
|
||||
# Copyright (c) 2017-2019 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
@ -16,11 +16,15 @@ set -u
|
||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
LINTALL=$(basename "${BASH_SOURCE[0]}")
|
||||
|
||||
EXIT_CODE=0
|
||||
|
||||
for f in "${SCRIPTDIR}"/lint-*.sh; do
|
||||
if [ "$(basename "$f")" != "$LINTALL" ]; then
|
||||
if ! "$f"; then
|
||||
echo "^---- failure generated from $f"
|
||||
exit 1
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit ${EXIT_CODE}
|
||||
|
Loading…
Reference in New Issue
Block a user