Skip to content

Conversation

brunoerg
Copy link
Contributor

@brunoerg brunoerg commented Feb 6, 2024

For I2P, we do not try to connect if port is != 0. However, we do not have anything that indicates it or any error when trying to connect with port != 0. This PR adds a log for it. Also, it improves the functional test. With this log we can ensure the reason we won't connect is the port, in the current test, we cannot ensure it.

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 6, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK jonatack, kristapsk, epiccurious, vasild, achow101

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@epiccurious
Copy link
Contributor

Concept ACK 950f360.

Copy link
Contributor

@kristapsk kristapsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cr utACK 950f360

@DrahtBot DrahtBot requested a review from epiccurious February 6, 2024 22:21
@DrahtBot DrahtBot requested a review from epiccurious February 7, 2024 02:02
@epiccurious
Copy link
Contributor

Tested ACK 950f360.

@DrahtBot DrahtBot removed the request for review from epiccurious February 7, 2024 02:02
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK

@brunoerg brunoerg force-pushed the 2024-02-i2p-log-connect branch from 950f360 to 5b358cd Compare February 8, 2024 21:36
@brunoerg
Copy link
Contributor Author

brunoerg commented Feb 8, 2024

Force-pushed addressing #29393 (comment)

@jonatack
Copy link
Member

jonatack commented Feb 8, 2024

ACK 5b358cd

Copy link
Contributor

@kristapsk kristapsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 5b358cd

@DrahtBot DrahtBot requested review from epiccurious and removed request for epiccurious February 8, 2024 23:01
@DrahtBot DrahtBot requested a review from epiccurious February 9, 2024 14:57
@epiccurious
Copy link
Contributor

re-ACK 5b358cd.

@DrahtBot DrahtBot removed the request for review from epiccurious February 9, 2024 14:58
Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5b358cd

How did you come to this? Did you encounter some !=0 I2P ports in the wild? I don't have any in my addrman:

$ bitcoin-cli getnodeaddresses 0 |jq 'map(select(.address |test("\\.i2p$"; "i"))) |map(select(.port != 0)) |length'
0

$ bitcoin-cli getnodeaddresses 0 |jq 'map(select(.address |test("\\.i2p$"; "i"))) |map(select(.port == 0)) |length'
1605

@brunoerg
Copy link
Contributor Author

brunoerg commented Mar 1, 2024

How did you come to this? Did you encounter some !=0 I2P ports in the wild?

I didn't encounter in practice, in fact, I was testing some nuances of i2p and tried to add it using addnode to check the behaviour, then I noticed that. Reading the functional test I realized that the way we were checking it was weird and did not really ensure the problem is the port.

@achow101
Copy link
Member

achow101 commented Mar 9, 2024

ACK 5b358cd

@achow101 achow101 merged commit a78ca70 into bitcoin:master Mar 9, 2024

self.log.info("Ensure we try to connect if port=0 and get an error due to missing I2P proxy")
addr = "h3r6bkn46qxftwja53pxiykntegfyfjqtnzbm6iv6r5mungmqgmq.b32.i2p:0"
with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}"]):
with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}: Cannot connect to {PROXY}"]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reverted in https://github.com/bitcoin/bitcoin/pull/30345/files (as of now)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a comment there

PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 24, 2024
… port

5b358cd i2p: log connection was refused due to arbitrary port (brunoerg)

Pull request description:

  For I2P, we do not try to connect if port is != 0. However, we do not have anything that indicates it or any error when trying to connect with port != 0. This PR adds a log for it. Also, it improves the functional test. With this log we can ensure the reason we won't connect is the port, in the current test, we cannot ensure it.

ACKs for top commit:
  jonatack:
    ACK 5b358cd
  epiccurious:
    re-ACK 5b358cd.
  achow101:
    ACK 5b358cd
  kristapsk:
    re-ACK 5b358cd
  vasild:
    ACK 5b358cd

Tree-SHA512: 027245afa771c9295fff0bfd17c251dca4a9f4c739e5773922de3c030a65ef05d96291edcbdeeaa50ba3add61f75f28d8c00be503e03fc33d3491d1956fc549f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 24, 2024
… port

5b358cd i2p: log connection was refused due to arbitrary port (brunoerg)

Pull request description:

  For I2P, we do not try to connect if port is != 0. However, we do not have anything that indicates it or any error when trying to connect with port != 0. This PR adds a log for it. Also, it improves the functional test. With this log we can ensure the reason we won't connect is the port, in the current test, we cannot ensure it.

ACKs for top commit:
  jonatack:
    ACK 5b358cd
  epiccurious:
    re-ACK 5b358cd.
  achow101:
    ACK 5b358cd
  kristapsk:
    re-ACK 5b358cd
  vasild:
    ACK 5b358cd

Tree-SHA512: 027245afa771c9295fff0bfd17c251dca4a9f4c739e5773922de3c030a65ef05d96291edcbdeeaa50ba3add61f75f28d8c00be503e03fc33d3491d1956fc549f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 24, 2024
… port

5b358cd i2p: log connection was refused due to arbitrary port (brunoerg)

Pull request description:

  For I2P, we do not try to connect if port is != 0. However, we do not have anything that indicates it or any error when trying to connect with port != 0. This PR adds a log for it. Also, it improves the functional test. With this log we can ensure the reason we won't connect is the port, in the current test, we cannot ensure it.

ACKs for top commit:
  jonatack:
    ACK 5b358cd
  epiccurious:
    re-ACK 5b358cd.
  achow101:
    ACK 5b358cd
  kristapsk:
    re-ACK 5b358cd
  vasild:
    ACK 5b358cd

Tree-SHA512: 027245afa771c9295fff0bfd17c251dca4a9f4c739e5773922de3c030a65ef05d96291edcbdeeaa50ba3add61f75f28d8c00be503e03fc33d3491d1956fc549f
PastaPastaPasta added a commit to dashpay/dash that referenced this pull request Oct 24, 2024
b70e091 Merge bitcoin#29667: fuzz: actually test garbage >64b in p2p transport test (fanquake)
6d7aa3d Merge bitcoin#29497: test: simplify test_runner.py (fanquake)
d0e15d5 Merge bitcoin#29606: refactor: Reserve memory for ToLower/ToUpper conversions (Ava Chow)
045fa5f Merge bitcoin#29514: tests: Provide more helpful assert_equal errors (Ava Chow)
bd607f0 Merge bitcoin#29393: i2p: log connection was refused due to arbitrary port (Ava Chow)
c961755 Merge bitcoin#29595: doc: Wrap flags with code in developer-notes.md (fanquake)
8d6e5e7 Merge bitcoin#29583: fuzz: Apply fuzz env (suppressions, etc.) when fetching harness list (fanquake)
4dce690 Merge bitcoin#29576: Update functional test runner to return error code when no tests are found to run (fanquake)
910a7d6 Merge bitcoin#29529: fuzz: restrict fopencookie usage to Linux & FreeBSD (fanquake)
fdac2b3 Merge bitcoin#29493: subtree: update crc32c subtree (fanquake)
a23b342 Merge bitcoin#29475: doc: Fix Broken Links (fanquake)
92bad90 Merge bitcoin#28178: fuzz: Generate with random libFuzzer settings (fanquake)
9b6a05d Merge bitcoin#29443: depends: fix BDB compilation on OpenBSD (fanquake)
9963e6b Merge bitcoin#29413: fuzz: increase length of string used for `NetWhitelist{bind}Permissions::TryParse` (fanquake)
3914745 Merge bitcoin#29425: test: fix intermittent failure in wallet_reorgrestore.py (fanquake)
b719883 Merge bitcoin#29399: test: Fix utxo set hash serialisation signedness (fanquake)
f096880 Merge bitcoin#29377: test: Add makefile target for running unit tests (Ava Chow)
03e0bd3 Merge bitcoin#27319: addrman, refactor: improve stochastic test in `AddSingle` (Ava Chow)

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 b70e091
  knst:
    utACK b70e091

Tree-SHA512: 659a931f812c8a92cf3854abb873d92885219a392d6aa8e49ac4b27fe41e8e163ef9a135050e7c2e1bd33cecd2f7dae215e05a9c29f62e837e0057d3c16746d6
@bitcoin bitcoin locked and limited conversation to collaborators Jul 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants