-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
contrib: add test for bucketing with asmap #28869
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
cc: @fjahr |
f81eac9
to
e14b33c
Compare
I would like it more if you keep the And if this is not being run as part of the functional test suite (which I only understood just now), then I am not sure it belongs there. Maybe there is precedent for something similar but to me it feels more like this is something comparable to I think it could be running as part of suite as well though, invoked with the asmap file fixture that we have there? I guess that also depends on how long the test takes to run. So I am currently unsure if this is more valuable as a devtool or as a functional test. I slightly tend towards devtool at the moment. @virtu do you have some feedback on whether this would be/would have been helpful for you as a tool for your simulations? |
I agree. I'm inclined to move it to |
Can you clarify what this meant to do? What is it stressing, where do the magic numbers "2000, 1/3, 2/3" come from, what is expected to fail under this "stress"? |
Sure! "Stressing" is basically test bucketing logic in a situation that we try to add in the new table:
|
e14b33c
to
c84eb94
Compare
c84eb94
to
6d6f461
Compare
Force-pushed changing the approach - PR description has been updated:
|
6d6f461
to
3738b20
Compare
Concept ACK I think this could use some documentation on top of the file on how the script is intended to be used, see the text in |
3738b20
to
5cf2d15
Compare
@fjahr, nice idea. Force-pushed adding it. |
5cf2d15
to
931b677
Compare
Force-pushed addressing ASMap health check. cc: @fjahr |
931b677
to
649bbcf
Compare
Rebased |
Code looks good. I have been testing this with the |
Just checked it, @fjahr. I think diff --git a/contrib/asmap/test_bucketing.py b/contrib/asmap/test_bucketing.py
index 575ce72ad3..f1033d66bc 100755
--- a/contrib/asmap/test_bucketing.py
+++ b/contrib/asmap/test_bucketing.py
@@ -78,11 +78,10 @@ class AsmapBucketingTest(BitcoinTestFramework):
addr_port = f"{addr}:8333" if type(ipaddress.ip_address(addr)) is ipaddress.IPv4Address else f"[{addr}]:8333"
log_msg = f"Added {addr_port} mapped to AS{asn} to new"
try:
- with node.assert_debug_log([log_msg]):
- if node.addpeeraddress(address=str(addr), tried=False, port=8333)["success"]:
- added = True
- self.log.info(f"added {addr} (ASN {asn}) to the new table")
- asns.append(asn)
+ if node.addpeeraddress(address=str(addr), tried=False, port=8333)["success"]:
+ added = True
+ self.log.info(f"added {addr} (ASN {asn}) to the new table")
+ asns.append(asn)
except AssertionError as e:
if added:
assert f"{log_msg}[" in str(e)
@@ -91,12 +90,6 @@ class AsmapBucketingTest(BitcoinTestFramework):
addrman_info = node.getaddrmaninfo()
assert_equal(len_entries, addrman_info["all_networks"]["new"])
- raw_addrman = node.getrawaddrman()
- self.log.info("Check addrman is successfully loaded after restarting")
- with node.assert_debug_log([f"ASMap Health Check: {len_entries} clearnet peers are mapped to {NUM_ASNS} ASNs with 0 peers being unmapped"]):
- self.restart_node(0, extra_args=self.args)
- assert_equal(raw_addrman, node.getrawaddrman())
-
if __name__ == '__main__':
AsmapBucketingTest().main() |
Yeah, with that change it doesn't slow down anymore! |
649bbcf
to
facfc26
Compare
Force-pushed changing the code to make it faster. Removed the Thanks, @fjahr. |
tACK facfc26 CI failure seems unrelated... |
facfc26
to
7e4562e
Compare
Rebased and since |
This PR adds a Python script to test the addrman bucketing logic using asmap. You should run this test using your own asmap file (
./contrib/asmap/test_bucketing.py --asmap=path/to/asmap --num_asns=1000
).How it works?
--num_asns=N
: GetN
unique ASNs and their respective ranges.1000 addresses
from each ASN into the "new" table.I'm first opening it as a draft to seek concept acks and perhaps more ideas to include here.