Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dashpay/dash into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta committed Sep 27, 2024
2 parents a0e056f + bd27f65 commit db3c62b
Show file tree
Hide file tree
Showing 114 changed files with 1,543 additions and 961 deletions.
6 changes: 4 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ task:
<< : *GLOBAL_TASK_TEMPLATE
container:
image: ubuntu:focal
cpu: 4
memory: 16G # The default memory is sometimes just a bit too small, so double everything
env:
MAKEJOBS: "-j8"
FILE_ENV: "./ci/test/00_setup_env_native_multiprocess.sh"

task:
Expand All @@ -161,12 +164,11 @@ task:
task:
name: 'macOS 11 native [gui] [no depends]'
brew_install_script:
- brew update
- brew install boost libevent berkeley-db4 qt@5 miniupnpc ccache zeromq qrencode sqlite libtool automake pkg-config gnu-getopt
<< : *GLOBAL_TASK_TEMPLATE
macos_instance:
# Use latest image, but hardcode version to avoid silent upgrades (and breaks)
image: big-sur-xcode-12.4 # https://cirrus-ci.org/guide/macOS
image: big-sur-xcode-12.5 # https://cirrus-ci.org/guide/macOS
env:
DANGER_RUN_CI_ON_HOST: "true"
CI_USE_APT_INSTALL: "no"
Expand Down
6 changes: 6 additions & 0 deletions doc/fuzzing.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,9 @@ $ honggfuzz/honggfuzz --exit_upon_crash --quiet --timeout 4 -n 1 -Q \
-nodebuglogfile -bind=127.0.0.1:18444 -logthreadnames \
-debug
```
# OSS-Fuzz
Bitcoin Core participates in Google's [OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/bitcoin-core)
program, which includes a dashboard of [publicly disclosed vulnerabilities](https://bugs.chromium.org/p/oss-fuzz/issues/list).
For more details, see [Bitcoin's OSS-fuzz](https://github.com/bitcoin/bitcoin/tree/master/doc/fuzzing.md)
3 changes: 3 additions & 0 deletions doc/release-notes-6209.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Command-line options

- `-platform-user` is deprecated in favor of the whitelist feature. In releases 22.x of Dash Core it has been renamed to `-deprecated-platform-user` and will be removed in version 23.x
3 changes: 3 additions & 0 deletions doc/release-notes-6247.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### RPC changes

- Deprecated `protx *_hpmn` RPC entry points have been droppepd in favor of `protx *_evo`. The following have been removed: `protx register_fund_hpmn`, `protx register_hpmn`, `protx register_prepare_hpmn`, `protx update_service_hpmn`
8 changes: 8 additions & 0 deletions doc/tor.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ may not. In particular, the Tor Browser Bundle defaults to listening on port 915
See [Tor Project FAQ:TBBSocksPort](https://www.torproject.org/docs/faq.html.en#TBBSocksPort)
for how to properly configure Tor.

## Compatibility

- Starting with version 20.0, Dash Core only supports Tor version 3 hidden
services (Tor v3). Tor v2 addresses are ignored by Dash Core and neither
relayed nor stored.

- Tor removed v2 support beginning with version 0.4.6.

## How to see information about your Tor configuration via Dash Core

There are several ways to see your local onion address in Dash Core:
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ RES_ANIMATION = $(wildcard $(srcdir)/qt/res/animation/spinner-*.png)

BITCOIN_RC = qt/res/dash-qt-res.rc

BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS
BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER

qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS)
Expand Down
15 changes: 13 additions & 2 deletions src/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@

#include <bench/bench.h>

#include <chainparams.h>
#include <fs.h>
#include <test/util/setup_common.h>
#include <validation.h>

#include <algorithm>
#include <chrono>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <regex>
#include <string>
#include <vector>

using namespace std::chrono_literals;

const std::function<void(const std::string&)> G_TEST_LOG_FUN{};

Expand Down Expand Up @@ -66,6 +71,12 @@ void benchmark::BenchRunner::RunAll(const Args& args)

Bench bench;
bench.name(p.first);
if (args.min_time > 0ms) {
// convert to nanos before dividing to reduce rounding errors
std::chrono::nanoseconds min_time_ns = args.min_time;
bench.minEpochTime(min_time_ns / bench.epochs());
}

if (args.asymptote.empty()) {
p.second(bench);
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/bench/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ using ankerl::nanobench::Bench;
typedef std::function<void(Bench&)> BenchFunction;

struct Args {
std::string regex_filter;
bool is_list_only;
std::chrono::milliseconds min_time;
std::vector<double> asymptote;
fs::path output_csv;
fs::path output_json;
std::string regex_filter;
};

class BenchRunner
Expand Down
64 changes: 59 additions & 5 deletions src/bench/bench_bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@

#include <bench/bench.h>

#include <clientversion.h>
#include <crypto/sha256.h>
#include <fs.h>
#include <stacktraces.h>
#include <util/strencodings.h>
#include <util/system.h>

#include <bls/bls.h>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <sstream>
#include <vector>

static const char* DEFAULT_BENCH_FILTER = ".*";
static constexpr int64_t DEFAULT_MIN_TIME_MS{10};

static void SetupBenchArgs(ArgsManager& argsman)
{
SetupHelpOptions(argsman);

argsman.AddArg("-asymptote=n1,n2,n3,...", "Test asymptotic growth of the runtime of an algorithm, if supported by the benchmark", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-asymptote=<n1,n2,n3,...>", "Test asymptotic growth of the runtime of an algorithm, if supported by the benchmark", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-filter=<regex>", strprintf("Regular expression filter to select benchmark by name (default: %s)", DEFAULT_BENCH_FILTER), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-list", "List benchmarks without executing them", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-list", "List benchmarks without executing them", ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS);
argsman.AddArg("-min_time=<milliseconds>", strprintf("Minimum runtime per benchmark, in milliseconds (default: %d)", DEFAULT_MIN_TIME_MS), ArgsManager::ALLOW_INT, OptionsCategory::OPTIONS);
argsman.AddArg("-output_csv=<output.csv>", "Generate CSV file with the most important benchmark results", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-output_json=<output.json>", "Generate JSON file with all benchmark results", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
}
Expand Down Expand Up @@ -50,16 +58,62 @@ int main(int argc, char** argv)
}

if (HelpRequested(argsman)) {
std::cout << argsman.GetHelpMessage();
std::cout << "Usage: bench_dash [options]\n"
"\n"
<< argsman.GetHelpMessage()
<< "Description:\n"
"\n"
" bench_dash executes microbenchmarks. The quality of the benchmark results\n"
" highly depend on the stability of the machine. It can sometimes be difficult\n"
" to get stable, repeatable results, so here are a few tips:\n"
"\n"
" * Use pyperf [1] to disable frequency scaling, turbo boost etc. For best\n"
" results, use CPU pinning and CPU isolation (see [2]).\n"
"\n"
" * Each call of run() should do exactly the same work. E.g. inserting into\n"
" a std::vector doesn't do that as it will reallocate on certain calls. Make\n"
" sure each run has exactly the same preconditions.\n"
"\n"
" * If results are still not reliable, increase runtime with e.g.\n"
" -min_time=5000 to let a benchmark run for at least 5 seconds.\n"
"\n"
" * bench_dash uses nanobench [3] for which there is extensive\n"
" documentation available online.\n"
"\n"
"Environment Variables:\n"
"\n"
" To attach a profiler you can run a benchmark in endless mode. This can be\n"
" done with the environment variable NANOBENCH_ENDLESS. E.g. like so:\n"
"\n"
" NANOBENCH_ENDLESS=MuHash ./bench_dash -filter=MuHash\n"
"\n"
" In rare cases it can be useful to suppress stability warnings. This can be\n"
" done with the environment variable NANOBENCH_SUPPRESS_WARNINGS, e.g:\n"
"\n"
" NANOBENCH_SUPPRESS_WARNINGS=1 ./bench_dash\n"
"\n"
"Notes:\n"
"\n"
" 1. pyperf\n"
" https://github.com/psf/pyperf\n"
"\n"
" 2. CPU pinning & isolation\n"
" https://pyperf.readthedocs.io/en/latest/system.html\n"
"\n"
" 3. nanobench\n"
" https://github.com/martinus/nanobench\n"
"\n";

return EXIT_SUCCESS;
}

benchmark::Args args;
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);
args.is_list_only = argsman.GetBoolArg("-list", false);
args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", ""));
args.is_list_only = argsman.GetBoolArg("-list", false);
args.min_time = std::chrono::milliseconds(argsman.GetArg("-min_time", DEFAULT_MIN_TIME_MS));
args.output_csv = fs::PathFromString(argsman.GetArg("-output_csv", ""));
args.output_json = fs::PathFromString(argsman.GetArg("-output_json", ""));
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);

benchmark::BenchRunner::RunAll(args);

Expand Down
5 changes: 4 additions & 1 deletion src/bench/coin_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ static void CoinSelection(benchmark::Bench& bench)
coins.emplace_back(wtx.get(), 0 /* iIn */, 6 * 24 /* nDepthIn */, true /* spendable */, true /* solvable */, true /* safe */);
}
const CoinEligibilityFilter filter_standard(1, 6, 0);
const CoinSelectionParams coin_selection_params(true, 34, 148, CFeeRate(0), 0, false);
const CoinSelectionParams coin_selection_params(/* use_bnb= */ true, /* change_output_size= */ 34,
/* change_spend_size= */ 148, /* effective_feerate= */ CFeeRate(0),
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
bench.run([&] {
std::set<CInputCoin> setCoinsRet;
CAmount nValueRet;
Expand Down
8 changes: 2 additions & 6 deletions src/bench/crypto_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ static void MuHash(benchmark::Bench& bench)
{
MuHash3072 acc;
unsigned char key[32] = {0};
int i = 0;
uint32_t i = 0;
bench.run([&] {
key[0] = ++i;
key[0] = ++i & 0xFF;
acc *= MuHash3072(key);
});
}
Expand All @@ -273,10 +273,6 @@ static void MuHashDiv(benchmark::Bench& bench)
FastRandomContext rng(true);
MuHash3072 muhash{rng.randbytes(32)};

for (size_t i = 0; i < bench.epochIterations(); ++i) {
acc *= muhash;
}

bench.run([&] {
acc /= muhash;
});
Expand Down
10 changes: 4 additions & 6 deletions src/bench/peer_eviction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ static void EvictionProtectionCommon(
{
using Candidates = std::vector<NodeEvictionCandidate>;
FastRandomContext random_context{true};
bench.warmup(100).epochIterations(1100);

Candidates candidates{GetRandomNodeEvictionCandidates(num_candidates, random_context)};
for (auto& c : candidates) {
candidate_setup_fn(c);
}

std::vector<Candidates> copies{
static_cast<size_t>(bench.epochs() * bench.epochIterations()), candidates};
size_t i{0};

bench.run([&] {
ProtectEvictionCandidatesByRatio(copies.at(i));
++i;
// creating a copy has an overhead of about 3%, so it does not influence the benchmark results much.
auto copy = candidates;
ProtectEvictionCandidatesByRatio(copy);
});
}

Expand Down
16 changes: 8 additions & 8 deletions src/bench/rollingbloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ static void RollingBloom(benchmark::Bench& bench)
uint32_t count = 0;
bench.run([&] {
count++;
data[0] = count;
data[1] = count >> 8;
data[2] = count >> 16;
data[3] = count >> 24;
data[0] = count & 0xFF;
data[1] = (count >> 8) & 0xFF;
data[2] = (count >> 16) & 0xFF;
data[3] = (count >> 24) & 0xFF;
filter.insert(data);

data[0] = count >> 24;
data[1] = count >> 16;
data[2] = count >> 8;
data[3] = count;
data[0] = (count >> 24) & 0xFF;
data[1] = (count >> 16) & 0xFF;
data[2] = (count >> 8) & 0xFF;
data[3] = count & 0xFF;
filter.contains(data);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ class CRegTestParams : public CChainParams {
consensus.DIP0024Height = 900;
consensus.DIP0024QuorumsHeight = 900;
consensus.V19Height = 900;
consensus.V20Height = 1200;
consensus.V20Height = 900;
consensus.MinBIP9WarningHeight = 0;
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
Expand Down
2 changes: 1 addition & 1 deletion src/coinjoin/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ CTransactionBuilder::CTransactionBuilder(std::shared_ptr<CWallet> pwalletIn, con
// Generate a feerate which will be used to consider if the remainder is dust and will go into fees or not
coinControl.m_discard_feerate = ::GetDiscardRate(*pwallet);
// Generate a feerate which will be used by calculations of this class and also by CWallet::CreateTransaction
coinControl.m_feerate = std::max(pwallet->chain().estimateSmartFee(int(pwallet->m_confirm_target), true, nullptr), pwallet->m_pay_tx_fee);
coinControl.m_feerate = std::max(GetRequiredFeeRate(*pwallet), pwallet->m_pay_tx_fee);
// Change always goes back to origin
coinControl.destChange = tallyItemIn.txdest;
// Only allow tallyItems inputs for tx creation
Expand Down
13 changes: 0 additions & 13 deletions src/evo/specialtxman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,10 @@ static bool CheckSpecialTxInner(CDeterministicMNManager& dmnman, const Chainstat
case TRANSACTION_QUORUM_COMMITMENT:
return llmq::CheckLLMQCommitment(dmnman, chainman, tx, pindexPrev, state);
case TRANSACTION_MNHF_SIGNAL:
if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "mnhf-before-v20");
}
return CheckMNHFTx(chainman, qman, tx, pindexPrev, state);
case TRANSACTION_ASSET_LOCK:
if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetlocks-before-v20");
}
return CheckAssetLockUnlockTx(chainman.m_blockman, qman, tx, pindexPrev, indexes, state);
case TRANSACTION_ASSET_UNLOCK:
if (Params().NetworkIDString() == CBaseChainParams::REGTEST && !DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
// TODO: adjust functional tests to make it activated by MN_RR on regtest too
return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetunlocks-before-v20");
}
if (Params().NetworkIDString() != CBaseChainParams::REGTEST && !DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_MN_RR)) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetunlocks-before-mn_rr");
}
return CheckAssetLockUnlockTx(chainman.m_blockman, qman, tx, pindexPrev, indexes, state);
}
} catch (const std::exception& e) {
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddArg("-llmq-data-recovery=<n>", strprintf("Enable automated quorum data recovery (default: %u)", llmq::DEFAULT_ENABLE_QUORUM_DATA_RECOVERY), ArgsManager::ALLOW_ANY, OptionsCategory::MASTERNODE);
argsman.AddArg("-llmq-qvvec-sync=<quorum_name>:<mode>", strprintf("Defines from which LLMQ type the masternode should sync quorum verification vectors. Can be used multiple times with different LLMQ types. <mode>: %d (sync always from all quorums of the type defined by <quorum_name>), %d (sync from all quorums of the type defined by <quorum_name> if a member of any of the quorums)", (int32_t)llmq::QvvecSyncMode::Always, (int32_t)llmq::QvvecSyncMode::OnlyIfTypeMember), ArgsManager::ALLOW_ANY, OptionsCategory::MASTERNODE);
argsman.AddArg("-masternodeblsprivkey=<hex>", "Set the masternode BLS private key and enable the client to act as a masternode", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::MASTERNODE);
argsman.AddArg("-platform-user=<user>", "Set the username for the \"platform user\", a restricted user intended to be used by Dash Platform, to the specified username.", ArgsManager::ALLOW_ANY, OptionsCategory::MASTERNODE);
argsman.AddArg("-deprecated-platform-user=<user>", "Set the username for the \"platform user\", a restricted user intended to be used by Dash Platform, to the specified username.", ArgsManager::ALLOW_ANY, OptionsCategory::MASTERNODE);

argsman.AddArg("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !testnetChainParams->RequireStandard()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
argsman.AddArg("-dustrelayfee=<amt>", strprintf("Fee rate (in %s/kB) used to define dust, the value of an output such that it will cost more than its value in fees at this fee rate to spend it. (default: %s)", CURRENCY_UNIT, FormatMoney(DUST_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
Expand Down
11 changes: 9 additions & 2 deletions src/interfaces/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,18 @@ class Chain
//! Run function after given number of seconds. Cancel any previous calls with same name.
virtual void rpcRunLater(const std::string& name, std::function<void()> fn, int64_t seconds) = 0;

//! Get settings value.
virtual util::SettingsValue getSetting(const std::string& arg) = 0;

//! Get list of settings values.
virtual std::vector<util::SettingsValue> getSettingsList(const std::string& arg) = 0;

//! Return <datadir>/settings.json setting value.
virtual util::SettingsValue getRwSetting(const std::string& name) = 0;

//! Write a setting to <datadir>/settings.json.
virtual bool updateRwSetting(const std::string& name, const util::SettingsValue& value) = 0;
//! Write a setting to <datadir>/settings.json. Optionally just update the
//! setting in memory and do not write the file.
virtual bool updateRwSetting(const std::string& name, const util::SettingsValue& value, bool write=true) = 0;

//! Synchronously send transactionAddedToMempool notifications about all
//! current mempool transactions to the specified handler and return after
Expand Down
3 changes: 1 addition & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3486,8 +3486,7 @@ void CConnman::ThreadOpenMasternodeConnections(CDeterministicMNManager& dmnman,

didConnect = false;

if (!fNetworkActive || !mn_sync.IsBlockchainSynced())
continue;
if (!fNetworkActive || !m_masternode_thread_active || !mn_sync.IsBlockchainSynced()) continue;

std::set<CService> connectedNodes;
std::map<uint256 /*proTxHash*/, bool /*fInbound*/> connectedProRegTxHashes;
Expand Down
3 changes: 3 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,8 @@ friend class CNode;
bool GetNetworkActive() const { return fNetworkActive; };
bool GetUseAddrmanOutgoing() const { return m_use_addrman_outgoing; };
void SetNetworkActive(bool active, CMasternodeSync* const mn_sync);
bool GetMasternodeThreadActive() const { return m_masternode_thread_active; };
void SetMasternodeThreadActive(bool active) { m_masternode_thread_active = active; };
SocketEventsMode GetSocketEventsMode() const { return socketEventsMode; }

enum class MasternodeConn {
Expand Down Expand Up @@ -1721,6 +1723,7 @@ friend class CNode;

std::vector<ListenSocket> vhListenSocket;
std::atomic<bool> fNetworkActive{true};
std::atomic<bool> m_masternode_thread_active{true};
bool fAddressesInitialized{false};
AddrMan& addrman;
const NetGroupManager& m_netgroupman;
Expand Down
Loading

0 comments on commit db3c62b

Please sign in to comment.