-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: Merge bitcoin/bitcoin#(partial) 30291, 30397, 22729, 29633, 29459 #7300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
0146658
f5b4561
443e2cc
737bd9d
086d42e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,12 @@ def run_test(self): | |
| txid_in_block = self.wallet.sendrawtransaction(from_node=node, tx_hex=raw_tx_in_block) | ||
| self.generate(node, 1) | ||
| self.mempool_size = 0 | ||
| # Check negative feerate | ||
| assert_raises_rpc_error(-3, "Amount out of range", lambda: self.check_mempool_result( | ||
| result_expected=None, | ||
| rawtxs=[raw_tx_in_block], | ||
| maxfeerate=-0.01, | ||
| )) | ||
|
Comment on lines
+80
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Missing prerequisite: bitcoin#29434 bitcoin#29459 was added upstream immediately after the maxfeerate coverage introduced by bitcoin#29434. In upstream, bitcoin#29434 added the 1 BTC/kvB rejection test, the 0.99 BTC/kvB passing test, and the src/rpc/mempool.cpp ParseFeeRate path that rejects fee rates >= 1 BTC/kvB. Dash's current backport of bitcoin#29459 only adds the negative maxfeerate assertion and adapts around the missing bitcoin#29434 context: the following already-known check still has no maxfeerate=0.99, and src/rpc/mempool.cpp still parses maxfeerate with CFeeRate(AmountFromValue(...)) instead of ParseFeeRate. This is a soft prerequisite gap because the new negative-feerate test is cleanly adapted and should pass, but the upstream dependency chain around this test is incomplete. Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g. source: ['codex-backport-reviewer'] |
||
| self.check_mempool_result( | ||
| result_expected=[{'txid': txid_in_block, 'allowed': False, 'reject-reason': 'txn-already-known'}], | ||
| rawtxs=[raw_tx_in_block], | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |||||||||||||||||||||||
| wait_until_helper, | ||||||||||||||||||||||||
| p2p_port, | ||||||||||||||||||||||||
| get_chain_folder, | ||||||||||||||||||||||||
| tor_port, | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| BITCOIND_PROC_WAIT_TIMEOUT = 60 | ||||||||||||||||||||||||
|
|
@@ -90,8 +91,11 @@ def __init__(self, i, datadir, extra_args_from_options, *, chain, rpchost, timew | |||||||||||||||||||||||
| self.cwd = cwd | ||||||||||||||||||||||||
| self.mocktime = mocktime | ||||||||||||||||||||||||
| self.descriptors = descriptors | ||||||||||||||||||||||||
| self.has_explicit_bind = False | ||||||||||||||||||||||||
| if extra_conf is not None: | ||||||||||||||||||||||||
| append_config(datadir, extra_conf) | ||||||||||||||||||||||||
| # Remember if there is bind=... in the config file. | ||||||||||||||||||||||||
| self.has_explicit_bind = any(e.startswith("bind=") for e in extra_conf) | ||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||
| # Most callers will just need to add extra args to the standard list below. | ||||||||||||||||||||||||
| # For those callers that need more flexibity, they can just set the args property directly. | ||||||||||||||||||||||||
| # Note that common args are set in the config file (see initialize_datadir) | ||||||||||||||||||||||||
|
|
@@ -227,6 +231,17 @@ def start(self, extra_args=None, *, cwd=None, stdout=None, stderr=None, **kwargs | |||||||||||||||||||||||
| if extra_args is None: | ||||||||||||||||||||||||
| extra_args = self.extra_args | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
231
to
233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||||||||||||||||||||||||
| # If listening and no -bind is given, then bitcoind would bind P2P ports on | ||||||||||||||||||||||||
| # 0.0.0.0:P and 127.0.0.1:18445 (for incoming Tor connections), where P is | ||||||||||||||||||||||||
| # a unique port chosen by the test framework and configured as port=P in | ||||||||||||||||||||||||
| # bitcoin.conf. To avoid collisions on 127.0.0.1:18445, change it to | ||||||||||||||||||||||||
| # 127.0.0.1:tor_port(). | ||||||||||||||||||||||||
|
knst marked this conversation as resolved.
Comment on lines
+234
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 Nitpick: Carry-over comment references Bitcoin regtest port 18445 and bitcoind The block comment cherry-picked from bitcoin#22729 still mentions
Suggested change
source: ['claude', 'codex']
Comment on lines
+234
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Superseded duplicate This inline comment was a duplicate created by an over-broad policy-gate promotion. Please ignore this thread and use the corrected nitpick comment on the same block instead.
Comment on lines
+234
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Superseded duplicate This inline comment duplicated the stale-comment nitpick and incorrectly labeled it as a blocking backport-prerequisite issue. Please ignore this thread and use the corrected nitpick comment instead. |
||||||||||||||||||||||||
| will_listen = all(e != "-nolisten" and e != "-listen=0" for e in extra_args) | ||||||||||||||||||||||||
| has_explicit_bind = self.has_explicit_bind or any(e.startswith("-bind=") for e in extra_args) | ||||||||||||||||||||||||
| if will_listen and not has_explicit_bind: | ||||||||||||||||||||||||
| extra_args.append(f"-bind=0.0.0.0:{p2p_port(self.index)}") | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a test opts out with Useful? React with 👍 / 👎. |
||||||||||||||||||||||||
| extra_args.append(f"-bind=127.0.0.1:{tor_port(self.index)}=onion") | ||||||||||||||||||||||||
|
knst marked this conversation as resolved.
Comment on lines
+239
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: Implicit -bind injection ignores --dashd-extra-args (extra_args_from_options)
Suggested change
source: ['codex']
Comment on lines
231
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: start() mutates caller's extra_args list — shared-reference footgun Carried forward from the prior review at 314e0a3 and still valid at 086d42e. When Correction note: this is a suggestion, not a backport-prerequisite blocker; the earlier policy-gate text on this comment was incorrect.
Comment on lines
231
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Superseded duplicate This inline comment duplicated the carried-forward |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| self.use_v2transport = "-v2transport=1" in extra_args or (self.default_to_v2 and "-v2transport=0" not in extra_args) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Add a new stdout and stderr file each time dashd is started | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,8 +15,10 @@ | |||||||||
| import argparse | ||||||||||
| from collections import deque | ||||||||||
| import configparser | ||||||||||
| import csv | ||||||||||
| import datetime | ||||||||||
| import os | ||||||||||
| import pathlib | ||||||||||
| import time | ||||||||||
| import shutil | ||||||||||
| import signal | ||||||||||
|
|
@@ -451,6 +453,7 @@ def main(): | |||||||||
| parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure') | ||||||||||
| parser.add_argument('--filter', help='filter scripts to run by regular expression') | ||||||||||
| parser.add_argument('--skipunit', '-u', action='store_true', help='skip unit tests for the test framework') | ||||||||||
| parser.add_argument('--resultsfile', '-r', help='store test results (as CSV) to the provided file') | ||||||||||
|
|
||||||||||
|
|
||||||||||
| args, unknown_args = parser.parse_known_args() | ||||||||||
|
|
@@ -483,6 +486,13 @@ def main(): | |||||||||
|
|
||||||||||
| logging.debug("Temporary test directory at %s" % tmpdir) | ||||||||||
|
|
||||||||||
| results_filepath = None | ||||||||||
| if args.resultsfile: | ||||||||||
| results_filepath = pathlib.Path(args.resultsfile) | ||||||||||
| # Stop early if the parent directory doesn't exist | ||||||||||
| assert results_filepath.parent.exists(), "Results file parent directory does not exist" | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace assertion with explicit error handling for consistency. Using Suggested fix- assert results_filepath.parent.exists(), "Results file parent directory does not exist"
+ if not results_filepath.parent.exists():
+ print("ERROR: Results file parent directory does not exist")
+ sys.exit(1)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| logging.debug("Test results will be written to " + str(results_filepath)) | ||||||||||
|
|
||||||||||
| enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND") | ||||||||||
|
|
||||||||||
| if not enable_bitcoind: | ||||||||||
|
|
@@ -564,9 +574,10 @@ def main(): | |||||||||
| failfast=args.failfast, | ||||||||||
| use_term_control=args.ansi, | ||||||||||
| skipunit=args.skipunit, | ||||||||||
| results_filepath=results_filepath, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control, skipunit=False): | ||||||||||
| def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control, skipunit=False, results_filepath=None): | ||||||||||
| args = args or [] | ||||||||||
|
|
||||||||||
| # Warn if dashd is already running | ||||||||||
|
|
@@ -662,7 +673,10 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enab | |||||||||
| logging.debug("Early exiting after test failure") | ||||||||||
| break | ||||||||||
|
|
||||||||||
| print_results(test_results, max_len_name, (int(time.time() - start_time))) | ||||||||||
| runtime = int(time.time() - start_time) | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: mark 30291 as partial due to missing fix of typo on this line: |
||||||||||
| print_results(test_results, max_len_name, runtime) | ||||||||||
| if results_filepath: | ||||||||||
| write_results(test_results, results_filepath, runtime) | ||||||||||
|
|
||||||||||
| if coverage: | ||||||||||
| coverage_passed = coverage.report_rpc_coverage() | ||||||||||
|
|
@@ -709,6 +723,17 @@ def print_results(test_results, max_len_name, runtime): | |||||||||
| results += "Runtime: %s s\n" % (runtime) | ||||||||||
| print(results) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def write_results(test_results, filepath, total_runtime): | ||||||||||
| with open(filepath, mode="w", encoding="utf8") as results_file: | ||||||||||
| results_writer = csv.writer(results_file) | ||||||||||
| results_writer.writerow(['test', 'status', 'duration(seconds)']) | ||||||||||
| all_passed = True | ||||||||||
| for test_result in test_results: | ||||||||||
| all_passed = all_passed and test_result.was_successful | ||||||||||
| results_writer.writerow([test_result.name, test_result.status, str(test_result.time)]) | ||||||||||
| results_writer.writerow(['ALL', ("Passed" if all_passed else "Failed"), str(total_runtime)]) | ||||||||||
|
|
||||||||||
| class TestHandler: | ||||||||||
| """ | ||||||||||
| Trigger the test scripts passed in via the list. | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppInitMain()still insertsDefaultOnionServiceTarget()intooptions.onion_bindswhen no-bind/-whitebindis supplied, even if the user sets-listenonion=0; making every onion bind failure fatal here means a conflict on the implicit 127.0.0.1 onion target port aborts startup before the later 0.0.0.0 bind can succeed. This regresses running another node with a different-portand onion listening disabled, where the implicit Tor target is occupied but normal P2P listening would otherwise work; only explicit onion binds should be fatal, or the default should be skipped when onion listening is off.Useful? React with 👍 / 👎.