If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#31250 (wallet: Disable creating and loading legacy wallets by achow101)
#30893 (test: Introduce ensure_for helper by fjahr)
#29415 (Broadcast own transactions only via short-lived Tor or I2P connections by vasild)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
DrahtBot added the label
Tests
on Feb 28, 2024
axizqayum686 changes_requested
axizqayum686
commented at 6:47 am on February 28, 2024:
none
.
Empact
commented at 7:03 am on February 28, 2024:
contributor
Would be nice to structure this as a scripted diff: one commit where you add the function and requires, another where you convert the assert !=s.
That would ensure programmatically that you hit all of the cases.
maflcko requested review from theStack
on Feb 28, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
DrahtBot added the label
CI failed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal
commented at 4:15 pm on March 2, 2024:
contributor
added scripted diff in dc087f1 with the following script
git grep -l "assert.*!=" ./test/functional
I will have to amend the commit as I see more spots I need to modify with the assert_not_equal util
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
theStack
commented at 8:35 pm on March 2, 2024:
contributor
Concept ACK, thanks for picking this up.
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
kevkevinpal force-pushed
on Mar 2, 2024
brunoerg
commented at 2:48 pm on March 4, 2024:
contributor
There are some places you are using assert_not_equal but not importing it and other ones you’re importing it twice. Check CI.
0Running Unit Tests for Test Framework Modules
1Traceback (most recent call last):
2File"/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_runner.py", line 906, in<module> 3 main()
4File"/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_runner.py", line 539, in main
5 run_tests(
6File"/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_runner.py", line 580, in run_tests
7 test_framework_tests.addTest(unittest.TestLoader().loadTestsFromName("test_framework.{}".format(module)))
8^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9File"/usr/lib/python3.12/unittest/loader.py", line 137, in loadTestsFromName
10 module = __import__(module_name)
11^^^^^^^^^^^^^^^^^^^^^^^12File"/ci_container_base/test/functional/test_framework/address.py", line 14, in<module>13 from .script import (
14File"/ci_container_base/test/functional/test_framework/script.py", line 14, in<module>15 from .key import TaggedHash, tweak_add_pubkey, compute_xonly_pubkey
16File"/ci_container_base/test/functional/test_framework/key.py", line 16, in<module>17 from test_framework.crypto import secp256k1
18File"/ci_container_base/test/functional/test_framework/crypto/secp256k1.py", line 316, in<module>19 G = GE.lift_x(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798)
20^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^21File"/ci_container_base/test/functional/test_framework/crypto/secp256k1.py", line 257, in lift_x
22 y = (FE(x)**3+7).sqrt()
23^^^^^24File"/ci_container_base/test/functional/test_framework/crypto/secp256k1.py", line 41, in __init__
25 assert_not_equal(den, 0)
26^^^^^^^^^^^^^^^^27NameError: name 'assert_not_equal' is not defined
in
test/functional/p2p_blockfilters.py:24
in
ad1e879351outdated
21@@ -21,6 +22,7 @@
22 from test_framework.p2p import P2PInterface
23 from test_framework.test_framework import BitcoinTestFramework
24 from test_framework.util import (
25+ assert_not_equal,
"node 0 chain did not reorganize"
This seems to be the 3rd argument to the assert_not_equal() call, i.e. *args. Will this piece be kicked in then? any(thing1 == arg for arg in args)
I don’t get why would we need to search for main_block_hash in the above error string.
I’m unable to run make successfully because of the following error on my system. I’ve noticed this in another PR as well and it is due to lack of a commit that was merged in later.
Asked couple questions.
assert_equal is helpful because when a == 3 fails, it can be helpful to know what the value of a actually is without having to add debug code and rerun. If a != 3 fails, though, you already know that a == 3, so this doesn’t seem very helpful.
There are cases where you’re comparing a != b and may not be sure which ones getting the wrong value where this could perhaps be helpful, but those seem pretty rare.
Concept -0 for me.
in
test/functional/test_framework/util.py:78
in
f9ba6fd46doutdated
55@@ -56,6 +56,10 @@ def assert_equal(thing1, thing2, *args):
56 if thing1 != thing2 or any(thing1 != arg for arg in args):
57 raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
5859+def assert_not_equal(thing1, thing2, *args):
60+ if thing1 == thing2 or any(thing1 == arg for arg in args):
61+ raise AssertionError("%s" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
This error message doesn’t make sense when *args is non-empty: if you say assert_not_equal(a, 1, 2) and a is 1 or 2, it will report 1 == 1 == 2 or 2 == 1 == 2.
I’ve updated this to instead only take three arguments and the last one being an optional message since I did not see anywhere we were already asserting != in a chain.
This should clear up the message and allow the one location we do use a message to be used
kevkevinpal
commented at 0:29 am on May 22, 2024:
contributor
@kevkevinpal Did you use a tool to generate the verification script?
No I did not I just manually used git grep and sed to create the script
kevkevinpal force-pushed
on May 22, 2024
DrahtBot added the label
CI failed
on May 22, 2024
DrahtBot
commented at 0:38 am on May 22, 2024:
contributor
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.
Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
Leave a comment here, if you need help tracking down a confusing failure.
DrahtBot removed the label
Needs rebase
on May 22, 2024
kevkevinpal force-pushed
on May 22, 2024
DrahtBot removed the label
CI failed
on May 22, 2024
DrahtBot added the label
Needs rebase
on Jul 2, 2024
glozow
commented at 11:59 am on August 7, 2024:
member
Are you still working on this?
kevkevinpal force-pushed
on Aug 7, 2024
kevkevinpal
commented at 2:42 pm on August 7, 2024:
contributor
Are you still working on this?
Yup just haven’t had much activity on it but rebased to 1d72266
DrahtBot removed the label
Needs rebase
on Aug 7, 2024
kevkevinpal requested review from axizqayum686
on Aug 7, 2024
kevkevinpal requested review from rkrux
on Aug 7, 2024
kevkevinpal requested review from brunoerg
on Aug 7, 2024
kevkevinpal requested review from ajtowns
on Aug 7, 2024
achow101 removed review request from rkrux
on Oct 15, 2024
achow101 removed review request from BrandonOdiwuor
on Oct 15, 2024
achow101 removed review request from axizqayum686
on Oct 15, 2024
achow101 requested review from vasild
on Oct 15, 2024
DrahtBot added the label
CI failed
on Oct 24, 2024
DrahtBot removed the label
CI failed
on Oct 25, 2024
vasild approved
vasild
commented at 10:43 am on November 5, 2024:
contributor
Almost ACK1d722660a6, modulo squash of the two commits.
This is a nice addition.
It is better to squash the two commits into one because IMO it does not make sense to first add the import in one commit and in another commit to use it. That way it becomes difficult to review whether an unnecessary import was added to some file. Also some python linter that tests each commit could be upset about the unused imports in the first commit.
I found it easier to read the diff itself instead of the “scripted diff” code (the line is 700+ chars long!). Further, I tweaked the diff to get the left and right sides align, so instead of:
Nit: The 3rd argument can be called error_message.
rkrux
commented at 7:47 am on November 11, 2024:
none
Concept ACK1d722660a65522539872c09ae8a3ba8c9ca55b77
The util function looks quite different from the last time I reviewed, simpler and more readable now!
Couple points:
The PR needs a rebase so that it works with the new build system, unable to build and test it in local atm with the latest build commands. Though the PR doesn’t have any conflicts with master, it would be nice to have this PR rebased if not much overhead for the author.
I agree with @vasild’s comment that the first commit should not be importing the helper function only to be used in the next commit. While reviewing the first commit, it immediately struck to me it is being imported but not used, which looked odd. However, I now wonder would squashing the 2 commits still work with the scripted diff as per the comment in the script checker?
DrahtBot added the label
CI failed
on Nov 12, 2024
kevkevinpal force-pushed
on Nov 12, 2024
kevkevinpal force-pushed
on Nov 12, 2024
kevkevinpal force-pushed
on Nov 12, 2024
test: create assert_not_equal util and add to where imports are needed
In the functional tests there are lots of cases where we assert != which
this new util will replace, we also are adding the imports and the
following commit will add the new assertion
48b67ba538
kevkevinpal force-pushed
on Nov 13, 2024
scripted-diff: tests replaced where != is used in functional tests to assert_not_equal
kevkevinpal
commented at 2:43 am on November 13, 2024:
contributor
yes @rkrux you are right if I want to use a scripted diff then all the changes must be done using the script
I can remove the scripted diff and just squash them into a single diff since right now the script is getting very large already if that is preferred by others
DrahtBot removed the label
CI failed
on Nov 13, 2024
DrahtBot added the label
Needs rebase
on Nov 19, 2024
DrahtBot
commented at 7:59 pm on November 19, 2024:
contributor
🐙 This pull request conflicts with the target branch and needs rebase.
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2025-01-06 21:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me