Merge #6354: backport: trivial 2024 10 23 pr6

d573e4ff86 Merge bitcoin/bitcoin#28084: doc: update windows `-fstack-clash-protection` doc (fanquake)
e3bbd1a46e Merge bitcoin-core/gui#740: Show own outputs on PSBT signing window (Hennadii Stepanov)
70cbd3f8a2 Merge bitcoin/bitcoin#28044: test: indexes, fix on error infinite loop (Ryan Ofsky)
551109105a Merge bitcoin/bitcoin#28036: test: Restore unlimited timeout in IndexWaitSynced (fanquake)
2767a13268 Merge bitcoin/bitcoin#28021: docs: fixup honggfuzz fuzz patch (fanquake)
af944b7c8d Merge bitcoin/bitcoin#28013: doc: Fix verify-binaries link in contrib README (fanquake)
79a20f96a5 Merge bitcoin/bitcoin#27929: Added static_assert to check that base_blob is using whole bytes. (fanquake)
ece625c754 Merge bitcoin/bitcoin#27914: feerate: For GetFeePerK() return nSatoshisPerK instead of round trip through GetFee (fanquake)
ba5f4c0332 Merge bitcoin/bitcoin#27906: doc: test: update TestShell instructions (fanquake)
fbc6c6e644 Merge bitcoin/bitcoin#27875: build: make sure we can overwrite config.{guess,sub} before doing so (fanquake)
e2fcd1d947 Merge bitcoin/bitcoin#27225: doc: document json rpc endpoints (fanquake)
324db8bb31 Merge bitcoin/bitcoin#27603: test: added coverage to mining_basic.py (glozow)
a21b4b16f7 Merge bitcoin/bitcoin#27802: Update .style.yapf (fanquake)
ee6b7d66f1 Merge bitcoin/bitcoin#27721: depends: remove redundant stdlib option (fanquake)
f27778abe7 Merge bitcoin/bitcoin#27561: test: Explicitly specify directory where to search tests for (fanquake)
105442f8cb Merge bitcoin/bitcoin#26422: build: Use newest `config.{guess,sub}` available (fanquake)
bef9631e99 Merge bitcoin/bitcoin#27661: doc, test: Document steps to reproduce TSan warning for `libdb` (fanquake)
277766fcef Merge bitcoin/bitcoin#27493: depends: no-longer nuke libc++abi.so* in native_clang package (fanquake)

Pull request description:

  ## Issue being fixed or feature implemented
  Batch of trivial backports

  ## What was done?
  See commits

  ## How Has This Been Tested?
  built locally; large combined merge passed tests locally

  ## Breaking Changes
  Should be none

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK d573e4ff86
  knst:
    utACK d573e4ff86

Tree-SHA512: c94f55888de1758457a617253ddd13013141398438a32343ee10ee170d76b7e091ef4479e96f7983cb7661ceb99984a60a668ee142a9aea52b8c5305738398cc
This commit is contained in:
pasta 2024-10-25 09:55:00 -05:00
commit 7997ad5a08
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
17 changed files with 103 additions and 45 deletions

View File

@ -107,7 +107,7 @@ each_dict_entry_on_separate_line=True
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
# reformatting on that line, because the string it has cannot be moved
# away from the i18n comment.
i18n_function_call=

View File

@ -14,3 +14,16 @@ fi
command -v autoreconf >/dev/null || \
(echo "configuration failed, please install autoconf first" && exit 1)
autoreconf --install --force --warnings=all
if expr "'$(build-aux/config.guess --timestamp)" \< "'$(depends/config.guess --timestamp)" > /dev/null; then
chmod ug+w build-aux/config.guess
chmod ug+w src/secp256k1/build-aux/config.guess
cp depends/config.guess build-aux
cp depends/config.guess src/secp256k1/build-aux
fi
if expr "'$(build-aux/config.sub --timestamp)" \< "'$(depends/config.sub --timestamp)" > /dev/null; then
chmod ug+w build-aux/config.sub
chmod ug+w src/secp256k1/build-aux/config.sub
cp depends/config.sub build-aux
cp depends/config.sub src/secp256k1/build-aux
fi

View File

@ -973,7 +973,8 @@ if test x$use_hardening != xno; then
case $host in
*mingw*)
dnl stack-clash-protection doesn't currently work, and likely should just be skipped for Windows.
dnl stack-clash-protection doesn't compile with GCC 10 and earlier.
dnl In any case, it is a no-op for Windows.
dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 for more details.
;;
*)

View File

@ -36,5 +36,5 @@ Test and Verify Tools
### [TestGen](/contrib/testgen) ###
Utilities to generate test vectors for the data-driven Dash tests.
### [Verify Binaries](/contrib/verifybinaries) ###
### [Verify-Binaries](/contrib/verify-binaries) ###
This script attempts to download and verify the signature file SHA256SUMS.asc from bitcoin.org.

View File

@ -63,7 +63,7 @@ $(foreach TOOL,$(cctools_TOOLS),$(eval darwin_$(TOOL) = $$(build_prefix)/bin/$$(
# Explicitly point to our binaries (e.g. cctools) so that they are
# ensured to be found and preferred over other possibilities.
#
# -stdlib=libc++ -stdlib++-isystem$(OSX_SDK)/usr/include/c++/v1
# -stdlib++-isystem$(OSX_SDK)/usr/include/c++/v1
#
# Forces clang to use the libc++ headers from our SDK and completely
# forget about the libc++ headers from the standard directories
@ -107,7 +107,6 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
$(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
-isysroot$(OSX_SDK) \
-stdlib=libc++ \
-stdlib++-isystem$(OSX_SDK)/usr/include/c++/v1 \
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
-Xclang -internal-externc-isystem$(OSX_SDK)/usr/include

View File

@ -9,10 +9,6 @@ $(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16
$(package)_sha256_hash=48b83ef827ac2c213d5b64f5ad7ed082c8bcb712b46644e0dc5045c6f462c231
endif
define $(package)_preprocess_cmds
rm -f $($(package)_extract_dir)/lib/libc++abi.so*
endef
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_version)/include && \
mkdir -p $($(package)_staging_prefix_dir)/bin && \

View File

@ -5,6 +5,41 @@ The headless daemon `dashd` has the JSON-RPC API enabled by default, the GUI
option. In the GUI it is possible to execute RPC methods in the Debug Console
Dialog.
## Endpoints
There are two JSON-RPC endpoints on the server:
1. `/`
2. `/wallet/<walletname>/`
### `/` endpoint
This endpoint is always active.
It can always service non-wallet requests and can service wallet requests when
exactly one wallet is loaded.
### `/wallet/<walletname>/` endpoint
This endpoint is only activated when the wallet component has been compiled in.
It can service both wallet and non-wallet requests.
It MUST be used for wallet requests when two or more wallets are loaded.
This is the endpoint used by bitcoin-cli when a `-rpcwallet=` parameter is passed in.
Best practice would dictate using the `/wallet/<walletname>/` endpoint for ALL
requests when multiple wallets are in use.
### Examples
```sh
# Get block count from the / endpoint when rpcuser=alice and rpcport=38332
$ curl --user alice --data-binary '{"jsonrpc": "1.0", "id": "0", "method": "getblockcount", "params": []}' -H 'content-type: text/plain;' localhost:38332/
# Get balance from the /wallet/walletname endpoint when rpcuser=alice, rpcport=38332 and rpcwallet=desc-wallet
$ curl --user alice --data-binary '{"jsonrpc": "1.0", "id": "0", "method": "getbalance", "params": []}' -H 'content-type: text/plain;' localhost:38332/wallet/desc-wallet
```
## Parameter passing
The JSON-RPC server supports both _by-position_ and _by-name_ [parameter

View File

@ -212,44 +212,45 @@ $ CC=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang \
./configure --disable-wallet --with-gui=no \
--with-sanitizers=address,undefined
$ git apply << "EOF"
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index 455a82e39..2faa3f80f 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -158,7 +158,11 @@ static bool AppInit(int argc, char* argv[])
return fRet;
}
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 8195bceaec..cce2b31ff0 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -90,8 +90,12 @@ typedef char* sockopt_arg_type;
// building with a binutils < 2.36 is subject to this ld bug.
#define MAIN_FUNCTION __declspec(dllexport) int main(int argc, char* argv[])
#else
+#ifdef HFND_FUZZING_ENTRY_FUNCTION_CXX
+HFND_FUZZING_ENTRY_FUNCTION_CXX(int argc, char* argv[])
+#define MAIN_FUNCTION HFND_FUZZING_ENTRY_FUNCTION_CXX(int argc, char* argv[])
+#else
int main(int argc, char* argv[])
#define MAIN_FUNCTION int main(int argc, char* argv[])
#endif
+#endif
{
#ifdef WIN32
util::WinCmdLineArgs winArgs;
// Note these both should work with the current usage of poll, but best to be safe
// WIN32 poll is broken https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
diff --git a/src/net.cpp b/src/net.cpp
index cf987b699..636a4176a 100644
index 7601a6ea84..702d0f56ce 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -709,7 +709,7 @@ int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes)
@@ -727,7 +727,7 @@ int V1TransportDeserializer::readHeader(Span<const uint8_t> msg_bytes)
}
// Check start string, network magic
- if (memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
+ if (false && memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) { // skip network magic checking
LogPrint(BCLog::NET, "HEADER ERROR - MESSAGESTART (%s, %u bytes), received %s, peer=%d\n", hdr.GetCommand(), hdr.nMessageSize, HexStr(hdr.pchMessageStart), m_node_id);
LogPrint(BCLog::NET, "Header error: Wrong MessageStart %s received, peer=%d\n", HexStr(hdr.pchMessageStart), m_node_id);
return -1;
}
@@ -768,7 +768,7 @@ Optional<CNetMessage> V1TransportDeserializer::GetMessage(const std::chrono::mic
@@ -788,7 +788,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
RandAddEvent(ReadLE32(hash.begin()));
// Check checksum and header command string
// Check checksum and header message type string
- if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
+ if (false && memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) { // skip checksum checking
LogPrint(BCLog::NET, "CHECKSUM ERROR (%s, %u bytes), expected %s was %s, peer=%d\n",
SanitizeString(msg->m_command), msg->m_message_size,
HexStr(Span<uint8_t>(hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE)),
LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
SanitizeString(msg.m_type), msg.m_message_size,
HexStr(Span{hash}.first(CMessageHeader::CHECKSUM_SIZE)),
EOF
$ make -C src/ dashd
$ mkdir -p inputs/

View File

@ -53,7 +53,7 @@ public:
/**
* Return the fee in satoshis for a size of 1000 bytes
*/
CAmount GetFeePerK() const { return GetFee(1000); }
CAmount GetFeePerK() const { return nSatoshisPerK; }
friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; }
friend bool operator>(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK > b.nSatoshisPerK; }
friend bool operator==(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK == b.nSatoshisPerK; }

View File

@ -175,6 +175,8 @@ std::string PSBTOperationsDialog::renderTransaction(const PartiallySignedTransac
tx_description.append(tr(" * Sends %1 to %2")
.arg(BitcoinUnits::formatWithUnit(BitcoinUnits::DASH, out.nValue))
.arg(QString::fromStdString(EncodeDestination(address))));
// Check if the address is one of ours
if (m_wallet_model != nullptr && m_wallet_model->wallet().txoutIsMine(out)) tx_description.append(" (" + tr("own address") + ")");
tx_description.append("<br>");
}

View File

@ -5,14 +5,18 @@
#include <test/util/index.h>
#include <index/base.h>
#include <shutdown.h>
#include <util/check.h>
#include <util/time.h>
void IndexWaitSynced(BaseIndex& index)
void IndexWaitSynced(const BaseIndex& index)
{
const auto timeout{SteadyClock::now() + 120s};
while (!index.BlockUntilSyncedToCurrentChain()) {
Assert(timeout > SteadyClock::now());
// Assert shutdown was not requested to abort the test, instead of looping forever, in case
// there was an unexpected error in the index that caused it to stop syncing and request a shutdown.
Assert(!ShutdownRequested());
UninterruptibleSleep(100ms);
}
assert(index.GetSummary().synced);
}

View File

@ -8,6 +8,6 @@
class BaseIndex;
/** Block until the index is synced to the current chain */
void IndexWaitSynced(BaseIndex& index);
void IndexWaitSynced(const BaseIndex& index);
#endif // BITCOIN_TEST_UTIL_INDEX_H

View File

@ -23,6 +23,7 @@ class base_blob
{
protected:
static constexpr int WIDTH = BITS / 8;
static_assert(BITS % 8 == 0, "base_blob currently only supports whole bytes.");
std::array<uint8_t, WIDTH> m_data;
static_assert(WIDTH == sizeof(m_data), "Sanity check");

View File

@ -123,6 +123,7 @@ class MiningTest(BitcoinTestFramework):
assert_template(node, bad_block, 'bad-cb-missing')
self.log.info("submitblock: Test invalid coinbase transaction")
assert_raises_rpc_error(-22, "Block does not start with a coinbase", node.submitblock, CBlock().serialize().hex())
assert_raises_rpc_error(-22, "Block does not start with a coinbase", node.submitblock, bad_block.serialize().hex())
self.log.info("getblocktemplate: Test truncated final transaction")

View File

@ -37,13 +37,13 @@ importing the `TestShell` class from the `test_shell` sub-package.
The following `TestShell` methods manage the lifetime of the underlying bitcoind
processes and logging utilities.
* `TestShell.setup()`
* `TestShell.shutdown()`
* `TestShell().setup()`
* `TestShell().shutdown()`
The `TestShell` inherits all `BitcoinTestFramework` members and methods, such
as:
* `TestShell.nodes[index].rpc_method()`
* `TestShell.log.info("Custom log message")`
* `TestShell().nodes[index].rpc_method()`
* `TestShell().log.info("Custom log message")`
The following sections demonstrate how to initialize, run, and shut down a
`TestShell` object.
@ -141,7 +141,7 @@ instances and remove all temporary data and logging directories.
20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Tests successful
```
To prevent the logs from being removed after a shutdown, simply set the
`TestShell.options.nocleanup` member to `True`.
`TestShell().options.nocleanup` member to `True`.
```
>>> test.options.nocleanup = True
>>> test.shutdown()
@ -160,9 +160,9 @@ underlying `BitcoinTestFramework`:
The `TestShell` object initializes with the default settings inherited from the
`BitcoinTestFramework` class. The user can override these in
`TestShell.setup(key=value)`.
`TestShell().setup(key=value)`.
**Note:** `TestShell.reset()` will reset test parameters to default values and
**Note:** `TestShell().reset()` will reset test parameters to default values and
can be called after the TestShell is shut down.
| Test parameter key | Default Value | Description |
@ -179,7 +179,7 @@ can be called after the TestShell is shut down.
| `perf` | False | Profiles running nodes with `perf` for the duration of the test if set to `True`. |
| `rpc_timeout` | `60` | Sets the RPC server timeout for the underlying bitcoind processes. |
| `setup_clean_chain` | `False` | A 200-block-long chain is initialized from cache by default. Instead, `setup_clean_chain` initializes an empty blockchain if set to `True`. |
| `randomseed` | Random Integer | `TestShell.options.randomseed` is a member of `TestShell` which can be accessed during a test to seed a random generator. User can override default with a constant value for reproducible test runs. |
| `randomseed` | Random Integer | `TestShell().options.randomseed` is a member of `TestShell` which can be accessed during a test to seed a random generator. User can override default with a constant value for reproducible test runs. |
| `supports_cli` | `False` | Whether the bitcoin-cli utility is compiled and available for the test. |
| `tmpdir` | `"/var/folders/.../"` | Sets directory for test logs. Will be deleted upon a successful test run unless `nocleanup` is set to `True` |
| `trace_rpc` | `False` | Logs all RPC calls if set to `True`. |

View File

@ -549,6 +549,12 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enab
# Test Framework Tests
print("Running Unit Tests for Test Framework Modules")
tests_dir = src_dir + '/test/functional/'
# This allows `test_runner.py` to work from an out-of-source build directory using a symlink,
# a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561.
sys.path.append(tests_dir)
test_framework_tests = unittest.TestSuite()
for module in TEST_FRAMEWORK_MODULES:
test_framework_tests.addTest(unittest.TestLoader().loadTestsFromName("test_framework.{}".format(module)))
@ -556,8 +562,6 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enab
if not result.wasSuccessful():
sys.exit("Early exiting after failure in TestFramework unit tests")
tests_dir = src_dir + '/test/functional/'
flags = ['--cachedir={}'.format(cache_dir)] + args
if enable_coverage:

View File

@ -32,6 +32,7 @@ race:src/qt/test/*
deadlock:src/qt/test/*
# External libraries
# https://github.com/bitcoin/bitcoin/pull/27658#issuecomment-1547639621
deadlock:libdb
race:libzmq